summaryrefslogtreecommitdiff
path: root/libavformat/dv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-08-23 12:12:34 +0200
committerAnton Khirnov <anton@khirnov.net>2022-09-05 08:10:55 +0200
commit090f12b15750bc3eb81b2d892cd980e9285cfe48 (patch)
treea6a2dc49eb97e73c5642bb5961bb0952a7994793 /libavformat/dv.c
parentf7b3fc4afe6540506257c73a93a3f4272c250d44 (diff)
downloadffmpeg-090f12b15750bc3eb81b2d892cd980e9285cfe48.tar.gz
lavf/dv: make returning the video packet optional
The mov demuxer only returns DV audio, video packets are discarded. It first reads the data to be parsed into a packet. Then both this packet and the pointer to its data are passed together to avpriv_dv_produce_packet(), which parses the data and partially overwrites the packet. This is confusing and potentially dangerous, so just pass NULL and avoid pointless packet modification.
Diffstat (limited to 'libavformat/dv.c')
-rw-r--r--libavformat/dv.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 303cecf9bb..f88fe62349 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -430,14 +430,17 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
}
}
- /* Now it's time to return video packet */
- size = dv_extract_video_info(c, buf);
- pkt->data = buf;
- pkt->pos = pos;
- pkt->size = size;
- pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->stream_index = c->vst->index;
- pkt->pts = c->frames;
+ /* return the video packet, if the caller wants it */
+ if (pkt) {
+ size = dv_extract_video_info(c, buf);
+
+ pkt->data = buf;
+ pkt->pos = pos;
+ pkt->size = size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ pkt->stream_index = c->vst->index;
+ pkt->pts = c->frames;
+ }
c->frames++;