[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general
Ivan Schreter
schreter
Thu Feb 26 20:43:47 CET 2009
Baptiste Coudurier wrote:
> Hi Ivan,
>
> On 2/24/2009 11:57 AM, Ivan Schreter wrote:
>
>> [...]
>>
>> typedef struct MpegTSPESFilter {
>> PESCallback *pes_cb;
>> @@ -147,6 +147,7 @@
>> int total_size;
>> int pes_header_size;
>> int64_t pts, dts;
>> + int64_t stream_pos; /**< position of first TS packet of this PES packet */
>> uint8_t header[MAX_PES_HEADER_SIZE];
>> };
>>
>> @@ -810,7 +811,8 @@
>>
>> /* return non zero if a packet could be constructed */
>> static void mpegts_push_data(MpegTSFilter *filter,
>> - const uint8_t *buf, int buf_size, int is_start)
>> + const uint8_t *buf, int buf_size, int is_start,
>> + int64_t pos)
>> {
>> PESContext *pes = filter->u.pes_filter.opaque;
>> MpegTSContext *ts = pes->ts;
>> @@ -823,6 +825,8 @@
>> if (is_start) {
>> pes->state = MPEGTS_HEADER;
>> pes->data_index = 0;
>> + /* Note: file position points just after the TS packet, so subtract it */
>> + pes->stream_pos = pos - ts->raw_packet_size;
>>
>
> Is it possible to adjust pos before passing it to the callback, easier
> and can spare one comment.
>
>
Sure...
I was just thinking, we can save the subtraction, since only if is_start
is set, this subtraction will be done. But here updated patch.
Regards,
Ivan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seek_2_mpegts_pos.patch
Type: text/x-patch
Size: 2578 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090226/5795a416/attachment.bin>
More information about the ffmpeg-devel
mailing list