diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-11-21 21:14:42 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-11-23 21:58:10 +0100 |
commit | 5872c781222d5f61b69a511ea6b024d4cab0aaf6 (patch) | |
tree | a02d687e84241a8fd4cc42ebe221176f33b958e1 /libavformat/cdg.c | |
parent | 0844b57c11cc3a1d5320c34f81f66d30f6706d2c (diff) | |
download | ffmpeg-5872c781222d5f61b69a511ea6b024d4cab0aaf6.tar.gz |
cdg: skip packets that don't contain a cdg command.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/cdg.c')
-rw-r--r-- | libavformat/cdg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/cdg.c b/libavformat/cdg.c index b60ea3710a..b6caa5129d 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -22,6 +22,8 @@ #include "avformat.h" #define CDG_PACKET_SIZE 24 +#define CDG_COMMAND 0x09 +#define CDG_MASK 0x3F static int read_header(AVFormatContext *s, AVFormatParameters *ap) { @@ -49,7 +51,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret; - ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE); + while (1) { + ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE); + if (ret < 1 || (pkt->data[0] & CDG_MASK) == CDG_COMMAND) + break; + av_free_packet(pkt); + } pkt->stream_index = 0; return ret; |