cdg: skip packets that don't contain a cdg command.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
committed by
Anton Khirnov
parent
0844b57c11
commit
5872c78122
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user