[FFmpeg-devel] [PATCH] mxfdec: set audio packet pts

Tomas Härdin tomas.hardin at codemill.se
Thu Sep 13 11:25:40 CEST 2012


On Wed, 2012-09-12 at 13:06 +0200, Michael Niedermayer wrote:
> @@ -2045,12 +2046,14 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
>              pkt->stream_index = index;
>              pkt->pos = klv.offset;
>  
> -            if (s->streams[index]->codec->codec_type == AVMEDIA_TYPE_VIDEO && next_ofs >= 0) {
> +            codec_type = s->streams[index]->codec->codec_type;
> +            if ((codec_type == AVMEDIA_TYPE_AUDIO || codec_type == AVMEDIA_TYPE_VIDEO) && next_ofs >= 0) {
>                  /* mxf->current_edit_unit good - see if we have an index table to derive timestamps from */
>                  MXFIndexTable *t = &mxf->index_tables[0];
>  
>                  if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < t->nb_ptses) {
> -                    pkt->dts = mxf->current_edit_unit + t->first_dts;
> +                    if (codec_type == AVMEDIA_TYPE_VIDEO)
> +                        pkt->dts = mxf->current_edit_unit + t->first_dts;
>                      pkt->pts = t->ptses[mxf->current_edit_unit];

Setting audio PTSes to the reordered values is simply wrong. We had a
discussion about fixing NTSC stuff "properly" (within the limits of
MXF). The TL;DR of it is that st->time_base should be the samplerate and
that audio timestamps need to be extrapolated. I don't have time to work
on this at the moment though.

/Tomas



More information about the ffmpeg-devel mailing list