[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general
Ivan Schreter
schreter
Wed Feb 18 23:32:13 CET 2009
Baptiste Coudurier wrote:
> Ivan Schreter wrote:
>
>> [...]
>>
>> /* 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 ? (pos - ts->raw_packet_size) : -1;
>>
>
> Maybe ts->pos47 could be changed to store the offset of the last 0x47
> byte, get_pcr might will need change.
>
>
Sorry, I do not understand what you mean.
> Besides I think stream_pos cannot be -1, there should be 0x47 byte
> before in any case, no ?
>
In my tests, it was sometimes -1. To be honest, I didn't look into the
reasons why...
Regards,
Ivan
More information about the ffmpeg-devel
mailing list