Revision 9f2fc126

View differences:

libavformat/Makefile
33 33
OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)       += bethsoftvid.o
34 34
OBJS-$(CONFIG_BFI_DEMUXER)               += bfi.o
35 35
OBJS-$(CONFIG_C93_DEMUXER)               += c93.o vocdec.o voc.o
36
OBJS-$(CONFIG_CAVSVIDEO_DEMUXER)         += raw.o
36 37
OBJS-$(CONFIG_CRC_MUXER)                 += crcenc.o
37 38
OBJS-$(CONFIG_DAUD_DEMUXER)              += daud.o
38 39
OBJS-$(CONFIG_DAUD_MUXER)                += daud.o
libavformat/allformats.c
65 65
    REGISTER_DEMUXER  (BETHSOFTVID, bethsoftvid);
66 66
    REGISTER_DEMUXER  (BFI, bfi);
67 67
    REGISTER_DEMUXER  (C93, c93);
68
    REGISTER_DEMUXER  (CAVSVIDEO, cavsvideo);
68 69
    REGISTER_MUXER    (CRC, crc);
69 70
    REGISTER_MUXDEMUX (DAUD, daud);
70 71
    REGISTER_MUXDEMUX (DIRAC, dirac);
libavformat/raw.c
365 365
        return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
366 366
    return 0;
367 367
}
368

  
369
#define CAVS_SEQ_START_CODE       0x000001b0
370
#define CAVS_PIC_I_START_CODE     0x000001b3
371
#define CAVS_UNDEF_START_CODE     0x000001b4
372
#define CAVS_PIC_PB_START_CODE    0x000001b6
373
#define CAVS_VIDEO_EDIT_CODE      0x000001b7
374
#define CAVS_PROFILE_JIZHUN       0x20
375

  
376
static int cavsvideo_probe(AVProbeData *p)
377
{
378
    uint32_t code= -1;
379
    int pic=0, seq=0, slice_pos = 0;
380
    int i;
381

  
382
    for(i=0; i<p->buf_size; i++){
383
        code = (code<<8) + p->buf[i];
384
        if ((code & 0xffffff00) == 0x100) {
385
            if(code < CAVS_SEQ_START_CODE) {
386
                /* slices have to be consecutive */
387
                if(code < slice_pos)
388
                    return 0;
389
                slice_pos = code;
390
            } else {
391
                slice_pos = 0;
392
            }
393
            if (code == CAVS_SEQ_START_CODE) {
394
                seq++;
395
                /* check for the only currently supported profile */
396
                if(p->buf[i+1] != CAVS_PROFILE_JIZHUN)
397
                    return 0;
398
            } else if ((code == CAVS_PIC_I_START_CODE) ||
399
                       (code == CAVS_PIC_PB_START_CODE)) {
400
                pic++;
401
            } else if ((code == CAVS_UNDEF_START_CODE) ||
402
                       (code >  CAVS_VIDEO_EDIT_CODE)) {
403
                return 0;
404
            }
405
        }
406
    }
407
    if(seq && seq*9<=pic*10)
408
        return AVPROBE_SCORE_MAX/2;
409
    return 0;
410
}
368 411
#endif
369 412

  
370 413
#if CONFIG_M4V_DEMUXER
......
1054 1097
};
1055 1098
#endif
1056 1099

  
1100
#if CONFIG_CAVSVIDEO_DEMUXER
1101
AVInputFormat cavsvideo_demuxer = {
1102
    "cavsvideo",
1103
    NULL_IF_CONFIG_SMALL("Chinese AVS video"),
1104
    0,
1105
    cavsvideo_probe,
1106
    video_read_header,
1107
    raw_read_partial_packet,
1108
    .flags= AVFMT_GENERIC_INDEX,
1109
    .value = CODEC_ID_CAVS,
1110
};
1111
#endif
1112

  
1057 1113
#if CONFIG_NULL_MUXER
1058 1114
AVOutputFormat null_muxer = {
1059 1115
    "null",

Also available in: Unified diff