Revision 8cd4ac3d libavformat/mpeg.c

View differences:

libavformat/mpeg.c
107 107
typedef struct MpegDemuxContext {
108 108
    int32_t header_state;
109 109
    unsigned char psm_es_type[256];
110
    int sofdec;
110 111
} MpegDemuxContext;
111 112

  
112 113
static int mpegps_read_header(AVFormatContext *s,
113 114
                              AVFormatParameters *ap)
114 115
{
115 116
    MpegDemuxContext *m = s->priv_data;
117
    uint8_t buffer[8192];
118
    char *p;
119

  
116 120
    m->header_state = 0xff;
117 121
    s->ctx_flags |= AVFMTCTX_NOHEADER;
118 122

  
123
    get_buffer(&s->pb, buffer, sizeof(buffer));
124
    if ((p=memchr(buffer, 'S', sizeof(buffer))))
125
        if (!memcmp(p, "Sofdec", 6))
126
            m->sofdec = 1;
127
    url_fseek(&s->pb, -sizeof(buffer), SEEK_CUR);
128

  
119 129
    /* no need to do more */
120 130
    return 0;
121 131
}
......
449 459
        type = CODEC_TYPE_VIDEO;
450 460
    } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
451 461
        type = CODEC_TYPE_AUDIO;
452
        codec_id = CODEC_ID_MP2;
462
        codec_id = m->sofdec ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
453 463
    } else if (startcode >= 0x80 && startcode <= 0x87) {
454 464
        type = CODEC_TYPE_AUDIO;
455 465
        codec_id = CODEC_ID_AC3;

Also available in: Unified diff