Add version info to celtenc/celtdec output as suggested on the
mailing list by Rob Til Freedmen. Also add a bitstream version check to these applications.
This commit is contained in:
parent
f0d6e31903
commit
dd91338b0a
2 changed files with 21 additions and 10 deletions
|
@ -276,13 +276,13 @@ void usage(void)
|
||||||
|
|
||||||
void version(void)
|
void version(void)
|
||||||
{
|
{
|
||||||
printf ("celtenc (CELT encoder)\n");
|
printf ("celtenc (CELT %s encoder)\n",CELT_VERSION);
|
||||||
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void version_short(void)
|
void version_short(void)
|
||||||
{
|
{
|
||||||
printf ("celtenc (CELT encoder)\n");
|
printf ("celtenc (CELT %s encoder)\n",CELT_VERSION);
|
||||||
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +290,7 @@ static CELTDecoder *process_header(ogg_packet *op, celt_int32_t enh_enabled, cel
|
||||||
{
|
{
|
||||||
CELTDecoder *st;
|
CELTDecoder *st;
|
||||||
CELTHeader header;
|
CELTHeader header;
|
||||||
|
int bitstream;
|
||||||
|
|
||||||
celt_header_from_packet(op->packet, op->bytes, &header);
|
celt_header_from_packet(op->packet, op->bytes, &header);
|
||||||
|
|
||||||
|
@ -304,6 +305,12 @@ static CELTDecoder *process_header(ogg_packet *op, celt_int32_t enh_enabled, cel
|
||||||
fprintf (stderr, "Mode initialization failed.\n");
|
fprintf (stderr, "Mode initialization failed.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
celt_mode_info(*mode, CELT_GET_BITSTREAM_VERSION, &bitstream);
|
||||||
|
if (bitstream!=header.version_id)
|
||||||
|
fprintf(stderr, "WARNING: Input was encoded with a CELT bitstream version %d. This decoder uses %d. Output will probably be corrupted.\n",header.version_id,bitstream);
|
||||||
|
|
||||||
*channels = header.nb_channels;
|
*channels = header.nb_channels;
|
||||||
*overlap=header.overlap;
|
*overlap=header.overlap;
|
||||||
st = celt_decoder_create(*mode);
|
st = celt_decoder_create(*mode);
|
||||||
|
|
|
@ -185,13 +185,13 @@ void add_fisbone_packet (ogg_stream_state *os, celt_int32_t serialno, CELTHeader
|
||||||
|
|
||||||
void version(void)
|
void version(void)
|
||||||
{
|
{
|
||||||
printf ("celtenc (CELT encoder)\n");
|
printf ("celtenc (CELT %s encoder)\n",CELT_VERSION);
|
||||||
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void version_short(void)
|
void version_short(void)
|
||||||
{
|
{
|
||||||
printf ("celtenc (CELT encoder)\n");
|
printf ("celtenc (CELT %s encoder)\n",CELT_VERSION);
|
||||||
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
printf ("Copyright (C) 2008 Jean-Marc Valin\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +295,8 @@ int main(int argc, char **argv)
|
||||||
celt_int32_t lookahead = 0;
|
celt_int32_t lookahead = 0;
|
||||||
int bytes_per_packet=48;
|
int bytes_per_packet=48;
|
||||||
int complexity=-127;
|
int complexity=-127;
|
||||||
|
int bitstream;
|
||||||
snprintf(vendor_string, sizeof(vendor_string), "Encoded with CELT\n");
|
|
||||||
|
|
||||||
comment_init(&comments, &comments_length, vendor_string);
|
|
||||||
|
|
||||||
/*Process command-line options*/
|
/*Process command-line options*/
|
||||||
while(1)
|
while(1)
|
||||||
|
@ -469,6 +467,12 @@ int main(int argc, char **argv)
|
||||||
mode = celt_mode_create(rate, chan, frame_size, NULL);
|
mode = celt_mode_create(rate, chan, frame_size, NULL);
|
||||||
if (!mode)
|
if (!mode)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
celt_mode_info(mode,CELT_GET_BITSTREAM_VERSION,&bitstream);
|
||||||
|
|
||||||
|
snprintf(vendor_string, sizeof(vendor_string), "Encoded with CELT %s (bitstream: %d)\n",CELT_VERSION,bitstream);
|
||||||
|
comment_init(&comments, &comments_length, vendor_string);
|
||||||
|
|
||||||
celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);
|
celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);
|
||||||
|
|
||||||
celt_header_init(&header, mode);
|
celt_header_init(&header, mode);
|
||||||
|
@ -479,8 +483,8 @@ int main(int argc, char **argv)
|
||||||
if (chan==2)
|
if (chan==2)
|
||||||
st_string="stereo";
|
st_string="stereo";
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
fprintf (stderr, "Encoding %d Hz %s audio in %d sample packets at %0.3fkbit/sec (%d bytes per packet)\n",
|
fprintf (stderr, "Encoding %d Hz %s audio in %d sample packets at %0.3fkbit/sec (%d bytes per packet) with bitstream version %d\n",
|
||||||
header.sample_rate, st_string, frame_size, bitrate, bytes_per_packet);
|
header.sample_rate, st_string, frame_size, bitrate, bytes_per_packet,bitstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Initialize CELT encoder*/
|
/*Initialize CELT encoder*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue