aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/cdg.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-11-21 21:14:42 +0100
committerAnton Khirnov <anton@khirnov.net>2011-11-23 21:58:10 +0100
commit5872c781222d5f61b69a511ea6b024d4cab0aaf6 (patch)
treea02d687e84241a8fd4cc42ebe221176f33b958e1 /libavformat/cdg.c
parent0844b57c11cc3a1d5320c34f81f66d30f6706d2c (diff)
downloadffmpeg-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.c9
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;