summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-07-25 00:23:27 +0300
committerUoti Urpala <uau@mplayer2.org>2012-07-25 01:10:30 +0300
commit8079f4ff821aa811de449f08dfdba777e8dd0397 (patch)
tree4f18f58d5e0fafc317e7d5541f5f291db7532d06 /libmpcodecs
parent5f3c3f8c32d20405a2caf7de66aa1ea7f513d4d2 (diff)
downloadmpv-8079f4ff821aa811de449f08dfdba777e8dd0397.tar.bz2
mpv-8079f4ff821aa811de449f08dfdba777e8dd0397.tar.xz
demux, vd_ffmpeg: fix demux keyframe flag, set AV_PKT_FLAG_KEY
There was some confusion about the "flags" field in demuxer packets. Demuxers set it to either 1 or 0x10 to indicate a keyframe (and the field was not used to indicate anything else). This didn't cause visible problems because nothing read the value. Replace the "flags" field with a boolean "keyframe" field. Set AV_PKT_FLAG_KEY based on this field in packets fed to libavcodec video decoders (looks like PNG and ZeroCodec are the only ones which depend on values from demuxer; previously this was hardcoded to true for PNG). Make demux_mf set the keyframe field in every packet. This matters for PNG files now that the demuxer flag is forwarded to libavcodec. Fix logic setting the field in demux_mkv. It had probably not been updated when adding SimpleBlock support. This probably makes no difference for any current practical use.
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index b34b5b5593..b49b3c6975 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -642,8 +642,10 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
av_init_packet(&pkt);
pkt.data = data;
pkt.size = len;
- // HACK: make PNGs decode normally instead of as CorePNG delta frames
- pkt.flags = AV_PKT_FLAG_KEY;
+ /* Some codecs (ZeroCodec, some cases of PNG) may want keyframe info
+ * from demuxer. */
+ if (packet && packet->keyframe)
+ pkt.flags |= AV_PKT_FLAG_KEY;
if (packet && packet->avpacket) {
pkt.side_data = packet->avpacket->side_data;
pkt.side_data_elems = packet->avpacket->side_data_elems;