Browse code

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>

Justin Ruggles authored on 2011/11/22 05:14:42
Showing 2 changed files
... ...
@@ -22,6 +22,8 @@
22 22
 #include "avformat.h"
23 23
 
24 24
 #define CDG_PACKET_SIZE    24
25
+#define CDG_COMMAND        0x09
26
+#define CDG_MASK           0x3F
25 27
 
26 28
 static int read_header(AVFormatContext *s, AVFormatParameters *ap)
27 29
 {
... ...
@@ -49,7 +51,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
49 49
 {
50 50
     int ret;
51 51
 
52
-    ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
52
+    while (1) {
53
+        ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
54
+        if (ret < 1 || (pkt->data[0] & CDG_MASK) == CDG_COMMAND)
55
+            break;
56
+        av_free_packet(pkt);
57
+    }
53 58
 
54 59
     pkt->stream_index = 0;
55 60
     return ret;
... ...
@@ -210,3 +210,91 @@
210 210
 0, 62700, 194400, 0x1b75a275
211 211
 0, 63000, 194400, 0xedd1a572
212 212
 0, 63300, 194400, 0x55daad6a
213
+0, 63600, 194400, 0xcb93b067
214
+0, 63900, 194400, 0x5888ba5d
215
+0, 64200, 194400, 0x2c11c84f
216
+0, 64500, 194400, 0x0fbae334
217
+0, 64800, 194400, 0x773fed2a
218
+0, 65100, 194400, 0x2f87fc1b
219
+0, 65400, 194400, 0xe8120521
220
+0, 65700, 194400, 0x64ac0f17
221
+0, 66000, 194400, 0xba531c0a
222
+0, 66300, 194400, 0xf49433f2
223
+0, 66600, 194400, 0x79e234f1
224
+0, 66900, 194400, 0x043937ee
225
+0, 67200, 194400, 0x9e6141e4
226
+0, 67500, 194400, 0x34204fd6
227
+0, 67800, 194400, 0xa1dd60c5
228
+0, 68100, 194400, 0x12b36eb7
229
+0, 68400, 194400, 0x68987aab
230
+0, 68700, 194400, 0x3207889d
231
+0, 69000, 194400, 0x3bb59194
232
+0, 69300, 194400, 0x0a119f86
233
+0, 69600, 194400, 0x472bab7a
234
+0, 69900, 194400, 0x7364c85d
235
+0, 70200, 194400, 0xa812d84d
236
+0, 70500, 194400, 0xf384f530
237
+0, 70800, 194400, 0x1546052f
238
+0, 71100, 194400, 0xeb611a1a
239
+0, 71400, 194400, 0xc39d250f
240
+0, 71700, 194400, 0x7bd73301
241
+0, 72000, 194400, 0x10f73cf7
242
+0, 72300, 194400, 0x95dc55de
243
+0, 72600, 194400, 0x392e61d2
244
+0, 72900, 194400, 0x113c7bb8
245
+0, 73200, 194400, 0x17128fa4
246
+0, 73500, 194400, 0xf95e9b98
247
+0, 73800, 194400, 0xdc47aa89
248
+0, 74100, 194400, 0xea5dc073
249
+0, 74400, 194400, 0x8dfadc57
250
+0, 74700, 194400, 0xe5c3e84b
251
+0, 75000, 194400, 0x8952f43f
252
+0, 75300, 194400, 0xec9e0240
253
+0, 75600, 194400, 0x8f460c36
254
+0, 75900, 194400, 0xd43e182a
255
+0, 76200, 194400, 0xb00b2919
256
+0, 76500, 194400, 0xc9f6350d
257
+0, 76800, 194400, 0x87ca44fd
258
+0, 77100, 194400, 0xa6a250f1
259
+0, 77400, 194400, 0x34fa60e1
260
+0, 77700, 194400, 0xe1a372cf
261
+0, 78000, 194400, 0xc80785bc
262
+0, 78300, 194400, 0x43e297aa
263
+0, 78600, 194400, 0x7e8ea49d
264
+0, 78900, 194400, 0xd009b091
265
+0, 79200, 194400, 0x9126bc85
266
+0, 79500, 194400, 0x175ad36e
267
+0, 79800, 194400, 0xf9dae160
268
+0, 80100, 194400, 0x1b98f948
269
+0, 80400, 194400, 0xa6c5133d
270
+0, 80700, 194400, 0xf5d42729
271
+0, 81000, 194400, 0x8cfe311f
272
+0, 81300, 194400, 0x18733e12
273
+0, 81600, 194400, 0x24ac50ff
274
+0, 81900, 194400, 0x0d1c64eb
275
+0, 82200, 194400, 0xde947cd3
276
+0, 82500, 194400, 0x08268dc2
277
+0, 82800, 194400, 0xfec69fb0
278
+0, 83100, 194400, 0xba83aba4
279
+0, 83400, 194400, 0xfbe2bc93
280
+0, 83700, 194400, 0xe22fcc83
281
+0, 84000, 194400, 0x050fcf80
282
+0, 84300, 194400, 0xee1ed778
283
+0, 84600, 194400, 0xb44cda75
284
+0, 84900, 194400, 0xa29fe46b
285
+0, 85200, 194400, 0xa99bf55a
286
+0, 85500, 194400, 0x4f840d51
287
+0, 85800, 194400, 0x58941945
288
+0, 86100, 194400, 0x62cb2638
289
+0, 86400, 194400, 0x22ee312d
290
+0, 86700, 194400, 0xea8f3925
291
+0, 87000, 194400, 0xed294c12
292
+0, 87300, 194400, 0xafa75e00
293
+0, 87600, 194400, 0x19d45ffe
294
+0, 87900, 194400, 0x7fcf61fc
295
+0, 88200, 194400, 0x2c126df0
296
+0, 88500, 194400, 0x331379e4
297
+0, 88800, 194400, 0x99fe8cd1
298
+0, 89100, 194400, 0xa5ec98c5
299
+0, 89400, 194400, 0xac68a6b7
300
+0, 89700, 194400, 0x28e6b2ab