[FFmpeg-devel] [RFC] Seeking in PVA files
Michael Niedermayer
michaelni
Sat Jan 5 02:13:04 CET 2008
On Fri, Jan 04, 2008 at 12:52:19PM +0100, Ivo wrote:
> Hi,
>
> I started working on seeking for PVA files. The attached patch also contains
> some cosmetics, a bug fix and some refactoring of code, so it is not
> intended to be applied as-is. I will separate the changes after the
> comments/review-cycle(s).
>
> With the attached patch, seeking works for all samples files and it works
> just as well as MPlayer's native demuxer. I have one problem though. I
> cannot discern keyframes from non-keyframes, so it might seek to somewhere
> in the middle of a GOP (the old demuxer had the same problem). The only way
> I see to fix that would be for the demuxer to check the MPEG-ES packet
> before adding it to the index. Or is there a way I could instruct the
> decoder to drop all frames leading up to the next keyframe without decoding
> and/or printing warning/error messages? Or another solution I am
> overlooking?
ive just fixed the deoceder, i wonder why noone complained about this years
ago
[...]
> +static inline int64_t get_pes_pts(int pes_flags, uint8_t *pes_header_data) {
> + int64_t res = AV_NOPTS_VALUE;
> +
> + if (pes_flags & 0x80 && (pes_header_data[0] & 0xf0) == 0x20) {
> + res = ((long long) *pes_header_data & 0x0e) << 29;
> + res += (AV_RB16(pes_header_data+1) >> 1) << 15;
> + res += AV_RB16(pes_header_data+3) >> 1;
> + }
> +
> + return res;
> +}
duplicate of get_pts() from mpeg.c
and i suspect this is not the only one
[...]
> +static int pva_read_seek(struct AVFormatContext *s, int stream_index,
> + int64_t timestamp, int flags) {
> + AVStream *st = s->streams[stream_index];
> + PVAContext *pvactx = s->priv_data;
> + int index = av_index_search_timestamp(st, timestamp, flags);
> +
> + if (index < 0) return -1;
> +
> + url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
> + pvactx->continue_pes = 0;
> +
> + return 0;
> +}
i have some doubt that this works. av_index_search_timestamp() just looks in
the index
you should try av_seek_frame_binary() if the default (read_seek=NULL) doesnt
do
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20080105/e99adec4/attachment.pgp>
More information about the ffmpeg-devel
mailing list