remove useless initialization to 0 of adx context

Originally committed as revision 10899 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Aurelien Jacobs 17 years ago
parent ad8df79b1d
commit 6177c7efe1
  1. 18
      libavcodec/adx.c
  2. 12
      libavformat/mpeg.c

@ -176,7 +176,6 @@ static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t buf
return 0x20+4; return 0x20+4;
} }
static int adx_decode_init(AVCodecContext *avctx);
static int adx_encode_init(AVCodecContext *avctx) static int adx_encode_init(AVCodecContext *avctx)
{ {
if (avctx->channels > 2) if (avctx->channels > 2)
@ -189,7 +188,6 @@ static int adx_encode_init(AVCodecContext *avctx)
// avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32; // avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
av_log(avctx, AV_LOG_DEBUG, "adx encode init\n"); av_log(avctx, AV_LOG_DEBUG, "adx encode init\n");
adx_decode_init(avctx);
return 0; return 0;
} }
@ -284,20 +282,6 @@ static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size
return offset; return offset;
} }
static int adx_decode_init(AVCodecContext * avctx)
{
ADXContext *c = avctx->priv_data;
// printf("adx_decode_init\n"); fflush(stdout);
c->prev[0].s1 = 0;
c->prev[0].s2 = 0;
c->prev[1].s1 = 0;
c->prev[1].s2 = 0;
c->header_parsed = 0;
c->in_temp = 0;
return 0;
}
#if 0 #if 0
static void dump(unsigned char *buf,size_t len) static void dump(unsigned char *buf,size_t len)
{ {
@ -391,7 +375,7 @@ AVCodec adpcm_adx_decoder = {
CODEC_TYPE_AUDIO, CODEC_TYPE_AUDIO,
CODEC_ID_ADPCM_ADX, CODEC_ID_ADPCM_ADX,
sizeof(ADXContext), sizeof(ADXContext),
adx_decode_init, NULL,
NULL, NULL,
NULL, NULL,
adx_decode_frame, adx_decode_frame,

@ -85,15 +85,25 @@ static int mpegps_probe(AVProbeData *p)
typedef struct MpegDemuxContext { typedef struct MpegDemuxContext {
int32_t header_state; int32_t header_state;
unsigned char psm_es_type[256]; unsigned char psm_es_type[256];
int sofdec;
} MpegDemuxContext; } MpegDemuxContext;
static int mpegps_read_header(AVFormatContext *s, static int mpegps_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
MpegDemuxContext *m = s->priv_data; MpegDemuxContext *m = s->priv_data;
uint8_t buffer[8192];
char *p;
m->header_state = 0xff; m->header_state = 0xff;
s->ctx_flags |= AVFMTCTX_NOHEADER; s->ctx_flags |= AVFMTCTX_NOHEADER;
get_buffer(&s->pb, buffer, sizeof(buffer));
if ((p=memchr(buffer, 'S', sizeof(buffer))))
if (!memcmp(p, "Sofdec", 6))
m->sofdec = 1;
url_fseek(&s->pb, -sizeof(buffer), SEEK_CUR);
/* no need to do more */ /* no need to do more */
return 0; return 0;
} }
@ -427,7 +437,7 @@ static int mpegps_read_packet(AVFormatContext *s,
type = CODEC_TYPE_VIDEO; type = CODEC_TYPE_VIDEO;
} else if (startcode >= 0x1c0 && startcode <= 0x1df) { } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
type = CODEC_TYPE_AUDIO; type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_MP2; codec_id = m->sofdec ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
} else if (startcode >= 0x80 && startcode <= 0x87) { } else if (startcode >= 0x80 && startcode <= 0x87) {
type = CODEC_TYPE_AUDIO; type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AC3; codec_id = CODEC_ID_AC3;

Loading…
Cancel
Save