[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general
Michael Niedermayer
michaelni
Sun Mar 1 01:28:49 CET 2009
On Sat, Feb 28, 2009 at 10:08:46PM +0100, Ivan Schreter wrote:
> Michael Niedermayer wrote:
>> On Wed, Feb 11, 2009 at 11:10:52AM +0100, Ivan Schreter wrote:
>>
>>> [...]
>>> 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
>>
>>
> I've put together a series of patches adding exact frame position in the
> stream.
>
> avcodec_framepos adds av_parser_parse2(), which gets also the position,
> which is then passed to the actual parser. If the parser wants to, it can
> store it, do whatever with it and return correct position later.
> Alternatively, we could store it on the context directly in lavf and save
> extra function version.
>
> avformat_framepos passes current packet position to the parser and consumes
> the position from the parser, if any. As fallback, current packet position
> is used (it is OK for formats having one packet per frame).
>
> h264_framepos is the implementation for H.264 parser. It will store
> position of the first packet in the context and then return this position
> after the whole frame is parsed. Should more than one frame lie in the same
> packet, all of them will get the same packet position. I suppose something
> analoguous will be needed for MPEG video.
>
> regress_framepos updates seek regression test. Now even more seek results
> do have a frame position (which was missing before).
>
> What do you think?
your code looks broken
pos has to be handled like pts/dts in the parser so that it is assigned to
the correct packet you arent doing that so my assumtation is your code
does not work except for cases where you are lucky enough that frames are
not split over packets
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20090301/4bbba482/attachment.pgp>
More information about the ffmpeg-devel
mailing list