Revision e3507058 libavformat/raw.c

View differences:

libavformat/raw.c
241 241
}
242 242
#endif
243 243

  
244
#if CONFIG_M4V_DEMUXER
245
#define VISUAL_OBJECT_START_CODE       0x000001b5
246
#define VOP_START_CODE                 0x000001b6
247

  
248
static int mpeg4video_probe(AVProbeData *probe_packet)
249
{
250
    uint32_t temp_buffer= -1;
251
    int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
252
    int i;
253

  
254
    for(i=0; i<probe_packet->buf_size; i++){
255
        temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
256
        if ((temp_buffer & 0xffffff00) != 0x100)
257
            continue;
258

  
259
        if (temp_buffer == VOP_START_CODE)                         VOP++;
260
        else if (temp_buffer == VISUAL_OBJECT_START_CODE)          VISO++;
261
        else if (temp_buffer < 0x120)                              VO++;
262
        else if (temp_buffer < 0x130)                              VOL++;
263
        else if (   !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
264
                 && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
265
    }
266

  
267
    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
268
        return AVPROBE_SCORE_MAX/2;
269
    return 0;
270
}
271
#endif
272

  
273 244
#if CONFIG_H264_DEMUXER
274 245
static int h264_probe(AVProbeData *p)
275 246
{
......
735 706
};
736 707
#endif
737 708

  
738
#if CONFIG_M4V_DEMUXER
739
AVInputFormat m4v_demuxer = {
740
    "m4v",
741
    NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
742
    0,
743
    mpeg4video_probe, /** probing for MPEG-4 data */
744
    ff_raw_video_read_header,
745
    ff_raw_read_partial_packet,
746
    .flags= AVFMT_GENERIC_INDEX,
747
    .extensions = "m4v",
748
    .value = CODEC_ID_MPEG4,
749
};
750
#endif
751

  
752 709
#if CONFIG_M4V_MUXER
753 710
AVOutputFormat m4v_muxer = {
754 711
    "m4v",

Also available in: Unified diff