comparison mpeg.c @ 2694:bb2ba011f1e1 libavformat

remove useless initialization to 0 of adx context
author aurel
date Thu, 01 Nov 2007 17:50:05 +0000
parents a8122196ad95
children b89af3f21df6
comparison
equal deleted inserted replaced
2693:997fb1ac4783 2694:bb2ba011f1e1
83 83
84 84
85 typedef struct MpegDemuxContext { 85 typedef struct MpegDemuxContext {
86 int32_t header_state; 86 int32_t header_state;
87 unsigned char psm_es_type[256]; 87 unsigned char psm_es_type[256];
88 int sofdec;
88 } MpegDemuxContext; 89 } MpegDemuxContext;
89 90
90 static int mpegps_read_header(AVFormatContext *s, 91 static int mpegps_read_header(AVFormatContext *s,
91 AVFormatParameters *ap) 92 AVFormatParameters *ap)
92 { 93 {
93 MpegDemuxContext *m = s->priv_data; 94 MpegDemuxContext *m = s->priv_data;
95 uint8_t buffer[8192];
96 char *p;
97
94 m->header_state = 0xff; 98 m->header_state = 0xff;
95 s->ctx_flags |= AVFMTCTX_NOHEADER; 99 s->ctx_flags |= AVFMTCTX_NOHEADER;
100
101 get_buffer(&s->pb, buffer, sizeof(buffer));
102 if ((p=memchr(buffer, 'S', sizeof(buffer))))
103 if (!memcmp(p, "Sofdec", 6))
104 m->sofdec = 1;
105 url_fseek(&s->pb, -sizeof(buffer), SEEK_CUR);
96 106
97 /* no need to do more */ 107 /* no need to do more */
98 return 0; 108 return 0;
99 } 109 }
100 110
425 else 435 else
426 codec_id = CODEC_ID_MPEG2VIDEO; 436 codec_id = CODEC_ID_MPEG2VIDEO;
427 type = CODEC_TYPE_VIDEO; 437 type = CODEC_TYPE_VIDEO;
428 } else if (startcode >= 0x1c0 && startcode <= 0x1df) { 438 } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
429 type = CODEC_TYPE_AUDIO; 439 type = CODEC_TYPE_AUDIO;
430 codec_id = CODEC_ID_MP2; 440 codec_id = m->sofdec ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
431 } else if (startcode >= 0x80 && startcode <= 0x87) { 441 } else if (startcode >= 0x80 && startcode <= 0x87) {
432 type = CODEC_TYPE_AUDIO; 442 type = CODEC_TYPE_AUDIO;
433 codec_id = CODEC_ID_AC3; 443 codec_id = CODEC_ID_AC3;
434 } else if ((startcode >= 0x88 && startcode <= 0x8f) 444 } else if ((startcode >= 0x88 && startcode <= 0x8f)
435 ||( startcode >= 0x98 && startcode <= 0x9f)) { 445 ||( startcode >= 0x98 && startcode <= 0x9f)) {