Mercurial > libavcodec.hg
comparison flacdec.c @ 8728:329e332e829f libavcodec
flacdec: set default sample_fmt before parsing extradata
author | jbr |
---|---|
date | Mon, 02 Feb 2009 01:53:40 +0000 |
parents | e9d9d946f213 |
children | 49817775b44f |
comparison
equal
deleted
inserted
replaced
8727:0d2190f5ae78 | 8728:329e332e829f |
---|---|
101 static av_cold int flac_decode_init(AVCodecContext *avctx) | 101 static av_cold int flac_decode_init(AVCodecContext *avctx) |
102 { | 102 { |
103 FLACContext *s = avctx->priv_data; | 103 FLACContext *s = avctx->priv_data; |
104 s->avctx = avctx; | 104 s->avctx = avctx; |
105 | 105 |
106 avctx->sample_fmt = SAMPLE_FMT_S16; | |
107 | |
106 if (avctx->extradata_size > 4) { | 108 if (avctx->extradata_size > 4) { |
107 /* initialize based on the demuxer-supplied streamdata header */ | 109 /* initialize based on the demuxer-supplied streamdata header */ |
108 if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) { | 110 if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) { |
109 ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, | 111 ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, |
110 avctx->extradata); | 112 avctx->extradata); |
113 init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); | 115 init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); |
114 metadata_parse(s); | 116 metadata_parse(s); |
115 } | 117 } |
116 } | 118 } |
117 | 119 |
118 avctx->sample_fmt = SAMPLE_FMT_S16; | |
119 return 0; | 120 return 0; |
120 } | 121 } |
121 | 122 |
122 static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s) | 123 static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s) |
123 { | 124 { |