cdg: skip packets that don't contain a cdg command.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Justin Ruggles
2011-11-21 21:14:42 +01:00
committed by Anton Khirnov
parent 0844b57c11
commit 5872c78122
2 changed files with 96 additions and 1 deletions

View File

@@ -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;