On 07/14/2012 09:41 AM, Kostya Shishkov wrote:
> Decoder is _not_ bitexact but hopefully is good enough.
> Sent gzipped since the patch is rather large.
> +static int g723_1_init(AVFormatContext *s)
> +{
> + AVStream *st;
> +
> + st = avformat_new_stream(s, NULL);
> + if (!st)
> + return AVERROR(ENOMEM);
> +
> + st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
> + st->codec->codec_id = CODEC_ID_G723_1;
> + st->codec->channels = 1;
> + st->codec->sample_rate = 8000;
> + st->codec->bits_per_coded_sample = 16;
I don't think bits_per_coded_sample should be set here. We shouldn't set
it unless there really are 16 bits in each sample, which I don't think
is true in this case, or it's needed to differentiate something about
the audio stream that can only be found at the container level, which
also does not look to be the case here.
Oh, also please set channel_layout to AV_CH_LAYOUT_MONO.
> +
> + avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
> +
> + return 0;
> +}
You need to also set st->start_time to 0 since read_packet sets only
packet durations and not timestamps.
Cheers,
Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel