[Ffmpeg-devel] [PATCH] DVR-MS probe audio format - was DVR-MS bug (MP2 decoding)

Michael Niedermayer michaelni
Tue Apr 10 01:26:04 CEST 2007


Hi

On Mon, Apr 09, 2007 at 05:14:39PM -0500, John Donaghy wrote:
> >[...]
> >> @@ -1787,6 +1808,18 @@
> >>              }
> >>              if(last == AV_NOPTS_VALUE || duration_count[index]<=1)
> >>                  last_dts[pkt->stream_index]= pkt->dts;
> >> +
> >> +            if (st->codec->codec_type == CODEC_TYPE_AUDIO &&
> >> +                st->codec->codec_id == CODEC_ID_NONE) {
> >> +                int score;
> >> +                AVProbeData *pd = &(probe_data[st->index]);
> >> +                pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size);
> >> +                memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
> >> +                pd->buf_size = pd->buf_size+pkt->size;
> >> +
> >> +                score = pd->buf_size < PROBE_BUF_MAX ?
> >AVPROBE_SCORE_MAX/4 : 0;
> >> +                codec_identified[st->index] =
> >set_codec_from_probe_data(st, pd, score);
> >> +             }
> >>          }
> >>          if(st->parser && st->parser->parser->split &&
> >!st->codec->extradata){
> >>              int i= st->parser->parser->split(st->codec, pkt->data,
> >pkt->size);
> >> @@ -1866,12 +1899,28 @@
> >>                  }
> >>              }
> >
> >>          }else if(st->codec->codec_type == CODEC_TYPE_AUDIO) {
> >> +            if (!codec_identified[st->index])
> >> +                codec_identified[st->index] =
> >set_codec_from_probe_data(st, &(probe_data[st->index]), 0);
> >> +            if (codec_identified[st->index]) {
> >> +                st->need_parsing = 1;
> >> +            }
> >
> >why is the code run twice?
> 
> 
> This function is called the first time with a score value calculated from
> the size of the probe data (as done elsewhere in this file). If no matching
> codec is found using the higher score value, it is called the second time
> with a score of 0 to look for a probe match of > 0. The reason for this is
> that on some data the probe functions return higher definitive values (e.g.
> 25 or 50) but on other data they return values of 1. In some cases both the
> mp3 and ac3 probe functions return 1 but we know from testing that in these
> cases the data is always ac3 - i.e the mp3 probe function sometimes returns
> a value of 1 on an ac3 stream and the ac3 probe also returns a value of 1 on
> the same stream. Perhaps the probe functions need improving and then my code
> could be simplified but I dont currently know how to do that.

well what will break if you remove the first check and just check at the
end?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070410/32b3d3d7/attachment.pgp>



More information about the ffmpeg-devel mailing list