[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general

Michael Niedermayer michaelni
Thu Feb 12 03:13:49 CET 2009

On Wed, Feb 11, 2009 at 11:10:52AM +0100, Ivan Schreter wrote:
> Michael Niedermayer wrote:
> >>> the time when a frame end/start is detected can be several packets after
> >>> the point where the first byte of that frame was stored.
> >>> the obvious way to fix this is to pass pos into av_parser_parse()
> >>> and reorder it like the timestamps.
> >>>   
> >>>       
> >> The only objection could be (to see the problem you are mentioning), if 
> >> packets inside one AVStream (e.g., single video stream) would be 
> >> interleaved. I cannot really imagine why would someone do it, but the 
> >>     
> >
> > RTFS before guessing
> > there are things called startcodes they are 4 bytes long and they are
> > used to detect the end and start of a frame.
> >   
> I know.
> > As it is with these, they can (and are in reality as well) be split across
> > packets.
> > thats mpeg ...
> > EAC3 is more complex ...
> >   
> If I understand you correctly (including previous mails), you'd like to 
> see the following: The packet position is passed to parser function by 
> extending the parser context by two fields: one passing the position of 
> current packet to the parser (currently only buffer and size is passed) 
> and one returning the position of packet which contained the startcode. 
> The parser should take care of filling it (or not). If filled, it will 
> be used, if not, current (broken) last packet position can be used as 
> fallback, until all parsers do. Alternatively, one could extend parser 
> function by extra parameter with in/out position (in = current packet 
> pos, out = first frame packet pos). This would require change in all 
> parsers, though, making the patch large, OTOH making the aforementioned 
> fallback unnecessary (it will work so implicitly). Which one do you want?

av_parser_parse() takes dts & pts currently, it should also take pos and then
do pretty much the same with pos that it does with dts/pts

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090212/609ac9f0/attachment.pgp>

More information about the ffmpeg-devel mailing list