Skip to content

Commit

Permalink
cdg: skip packets that don't contain a cdg command.
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Khirnov <anton@khirnov.net>
  • Loading branch information
justinruggles authored and elenril committed Nov 23, 2011
1 parent 0844b57 commit 5872c78
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libavformat/cdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
88 changes: 88 additions & 0 deletions tests/ref/fate/cdgraphics
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,91 @@
0, 62700, 194400, 0x1b75a275
0, 63000, 194400, 0xedd1a572
0, 63300, 194400, 0x55daad6a
0, 63600, 194400, 0xcb93b067
0, 63900, 194400, 0x5888ba5d
0, 64200, 194400, 0x2c11c84f
0, 64500, 194400, 0x0fbae334
0, 64800, 194400, 0x773fed2a
0, 65100, 194400, 0x2f87fc1b
0, 65400, 194400, 0xe8120521
0, 65700, 194400, 0x64ac0f17
0, 66000, 194400, 0xba531c0a
0, 66300, 194400, 0xf49433f2
0, 66600, 194400, 0x79e234f1
0, 66900, 194400, 0x043937ee
0, 67200, 194400, 0x9e6141e4
0, 67500, 194400, 0x34204fd6
0, 67800, 194400, 0xa1dd60c5
0, 68100, 194400, 0x12b36eb7
0, 68400, 194400, 0x68987aab
0, 68700, 194400, 0x3207889d
0, 69000, 194400, 0x3bb59194
0, 69300, 194400, 0x0a119f86
0, 69600, 194400, 0x472bab7a
0, 69900, 194400, 0x7364c85d
0, 70200, 194400, 0xa812d84d
0, 70500, 194400, 0xf384f530
0, 70800, 194400, 0x1546052f
0, 71100, 194400, 0xeb611a1a
0, 71400, 194400, 0xc39d250f
0, 71700, 194400, 0x7bd73301
0, 72000, 194400, 0x10f73cf7
0, 72300, 194400, 0x95dc55de
0, 72600, 194400, 0x392e61d2
0, 72900, 194400, 0x113c7bb8
0, 73200, 194400, 0x17128fa4
0, 73500, 194400, 0xf95e9b98
0, 73800, 194400, 0xdc47aa89
0, 74100, 194400, 0xea5dc073
0, 74400, 194400, 0x8dfadc57
0, 74700, 194400, 0xe5c3e84b
0, 75000, 194400, 0x8952f43f
0, 75300, 194400, 0xec9e0240
0, 75600, 194400, 0x8f460c36
0, 75900, 194400, 0xd43e182a
0, 76200, 194400, 0xb00b2919
0, 76500, 194400, 0xc9f6350d
0, 76800, 194400, 0x87ca44fd
0, 77100, 194400, 0xa6a250f1
0, 77400, 194400, 0x34fa60e1
0, 77700, 194400, 0xe1a372cf
0, 78000, 194400, 0xc80785bc
0, 78300, 194400, 0x43e297aa
0, 78600, 194400, 0x7e8ea49d
0, 78900, 194400, 0xd009b091
0, 79200, 194400, 0x9126bc85
0, 79500, 194400, 0x175ad36e
0, 79800, 194400, 0xf9dae160
0, 80100, 194400, 0x1b98f948
0, 80400, 194400, 0xa6c5133d
0, 80700, 194400, 0xf5d42729
0, 81000, 194400, 0x8cfe311f
0, 81300, 194400, 0x18733e12
0, 81600, 194400, 0x24ac50ff
0, 81900, 194400, 0x0d1c64eb
0, 82200, 194400, 0xde947cd3
0, 82500, 194400, 0x08268dc2
0, 82800, 194400, 0xfec69fb0
0, 83100, 194400, 0xba83aba4
0, 83400, 194400, 0xfbe2bc93
0, 83700, 194400, 0xe22fcc83
0, 84000, 194400, 0x050fcf80
0, 84300, 194400, 0xee1ed778
0, 84600, 194400, 0xb44cda75
0, 84900, 194400, 0xa29fe46b
0, 85200, 194400, 0xa99bf55a
0, 85500, 194400, 0x4f840d51
0, 85800, 194400, 0x58941945
0, 86100, 194400, 0x62cb2638
0, 86400, 194400, 0x22ee312d
0, 86700, 194400, 0xea8f3925
0, 87000, 194400, 0xed294c12
0, 87300, 194400, 0xafa75e00
0, 87600, 194400, 0x19d45ffe
0, 87900, 194400, 0x7fcf61fc
0, 88200, 194400, 0x2c126df0
0, 88500, 194400, 0x331379e4
0, 88800, 194400, 0x99fe8cd1
0, 89100, 194400, 0xa5ec98c5
0, 89400, 194400, 0xac68a6b7
0, 89700, 194400, 0x28e6b2ab

0 comments on commit 5872c78

Please sign in to comment.