---
libavformat/asfdec.c | 2 +-
libavformat/avidec.c | 2 +-
libavformat/dxa.c | 2 +-
libavformat/matroskadec.c | 2 +-
libavformat/mov.c | 2 +-
libavformat/riff.h | 2 +-
libavformat/riffdec.c | 71 +++++++++++++++++++++++------------------------
libavformat/wavdec.c | 4 +--
libavformat/wtv.c | 2 +-
libavformat/xwma.c | 2 +-
10 files changed, 45 insertions(+), 46 deletions(-)
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index ca7712f..969775a 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -782,7 +782,7 @@ static int asf_read_stream_properties(AVFormatContext *s,
const GUIDParseTable *
switch (type) {
case AVMEDIA_TYPE_AUDIO:
asf_st->type = AVMEDIA_TYPE_AUDIO;
- if ((ret = ff_get_wav_header(s, pb, st->codec, ts_data_len)) < 0)
+ if ((ret = ff_get_wav_header(s, pb, st->codecpar, ts_data_len)) < 0)
return ret;
break;
case AVMEDIA_TYPE_VIDEO:
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 4cebd17..7f5b53a 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -709,7 +709,7 @@ static int avi_read_header(AVFormatContext *s)
// avio_skip(pb, size - 5 * 4);
break;
case AVMEDIA_TYPE_AUDIO:
- ret = ff_get_wav_header(s, pb, st->codec, size);
+ ret = ff_get_wav_header(s, pb, st->codecpar, size);
if (ret < 0)
return ret;
ast->dshow_block_align = st->codec->block_align;
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 7d04e7b..2b6e5f7 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -106,7 +106,7 @@ static int dxa_read_header(AVFormatContext *s)
ast = avformat_new_stream(s, NULL);
if (!ast)
return -1;
- ret = ff_get_wav_header(s, pb, ast->codec, fsize);
+ ret = ff_get_wav_header(s, pb, ast->codecpar, fsize);
if (ret < 0)
return ret;
if (ast->codec->sample_rate > 0)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 0757bf5..1dc36d7 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1653,7 +1653,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
ffio_init_context(&b, track->codec_priv.data,
track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
- ret = ff_get_wav_header(s, &b, st->codec, track->codec_priv.size);
+ ret = ff_get_wav_header(s, &b, st->codecpar,
track->codec_priv.size);
if (ret < 0)
return ret;
codec_id = st->codec->codec_id;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index aaf1c2d..9b7823e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -769,7 +769,7 @@ static int mov_read_wfex(MOVContext *c, AVIOContext *pb,
MOVAtom atom)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
- return ff_get_wav_header(c->fc, pb, st->codec, atom.size);
+ return ff_get_wav_header(c->fc, pb, st->codecpar, atom.size);
}
static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
diff --git a/libavformat/riff.h b/libavformat/riff.h
index 5bac95a..1332109 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -48,7 +48,7 @@ int ff_get_bmp_header(AVIOContext *pb, AVStream *st);
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag
*tags, int for_asf);
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc);
enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps);
-int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecContext
*codec, int size);
+int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters
*par, int size);
extern const AVCodecTag ff_codec_bmp_tags[];
extern const AVCodecTag ff_codec_wav_tags[];
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 41b7a9c..7b33a15 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -54,29 +54,29 @@ enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid
*guids, ff_asf_guid guid)
* an openended structure.
*/
-static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c)
+static void parse_waveformatex(AVIOContext *pb, AVCodecParameters *par)
{
ff_asf_guid subformat;
- c->bits_per_coded_sample = avio_rl16(pb);
- c->channel_layout = avio_rl32(pb); /* dwChannelMask */
+ par->bits_per_coded_sample = avio_rl16(pb);
+ par->channel_layout = avio_rl32(pb); /* dwChannelMask */
ff_get_guid(pb, &subformat);
if (!memcmp(subformat + 4,
(const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12)) {
- c->codec_tag = AV_RL32(subformat);
- c->codec_id = ff_wav_codec_get_id(c->codec_tag,
- c->bits_per_coded_sample);
+ par->codec_tag = AV_RL32(subformat);
+ par->codec_id = ff_wav_codec_get_id(par->codec_tag,
+ par->bits_per_coded_sample);
} else {
- c->codec_id = ff_codec_guid_get_id(ff_codec_wav_guids, subformat);
- if (!c->codec_id)
- av_log(c, AV_LOG_WARNING,
+ par->codec_id = ff_codec_guid_get_id(ff_codec_wav_guids, subformat);
+ if (!par->codec_id)
+ av_log(pb, AV_LOG_WARNING,
"unknown subformat:"FF_PRI_GUID"\n",
FF_ARG_GUID(subformat));
}
}
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
- AVCodecContext *codec, int size)
+ AVCodecParameters *par, int size)
{
int id;
uint64_t bitrate;
@@ -85,39 +85,38 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
return AVERROR_INVALIDDATA;
id = avio_rl16(pb);
- codec->codec_type = AVMEDIA_TYPE_AUDIO;
- codec->channels = avio_rl16(pb);
- codec->sample_rate = avio_rl32(pb);
+ par->codec_type = AVMEDIA_TYPE_AUDIO;
+ par->channels = avio_rl16(pb);
+ par->sample_rate = avio_rl32(pb);
bitrate = avio_rl32(pb) * 8;
- codec->block_align = avio_rl16(pb);
+ par->block_align = avio_rl16(pb);
if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */
- codec->bits_per_coded_sample = 8;
+ par->bits_per_coded_sample = 8;
} else
- codec->bits_per_coded_sample = avio_rl16(pb);
+ par->bits_per_coded_sample = avio_rl16(pb);
if (id == 0xFFFE) {
- codec->codec_tag = 0;
+ par->codec_tag = 0;
} else {
- codec->codec_tag = id;
- codec->codec_id = ff_wav_codec_get_id(id,
- codec->bits_per_coded_sample);
+ par->codec_tag = id;
+ par->codec_id = ff_wav_codec_get_id(id, par->bits_per_coded_sample);
}
if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
int cbSize = avio_rl16(pb); /* cbSize */
size -= 18;
cbSize = FFMIN(size, cbSize);
if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
- parse_waveformatex(pb, codec);
+ parse_waveformatex(pb, par);
cbSize -= 22;
size -= 22;
}
- codec->extradata_size = cbSize;
+ par->extradata_size = cbSize;
if (cbSize > 0) {
- av_free(codec->extradata);
- codec->extradata = av_mallocz(codec->extradata_size +
- AV_INPUT_BUFFER_PADDING_SIZE);
- if (!codec->extradata)
+ av_free(par->extradata);
+ par->extradata = av_mallocz(par->extradata_size +
+ AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!par->extradata)
return AVERROR(ENOMEM);
- avio_read(pb, codec->extradata, codec->extradata_size);
+ avio_read(pb, par->extradata, par->extradata_size);
size -= cbSize;
}
@@ -136,26 +135,26 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
av_log(s, AV_LOG_WARNING,
"The bitrate %"PRIu64" is too large, resetting to 0.",
bitrate);
- codec->bit_rate = 0;
+ par->bit_rate = 0;
}
} else {
- codec->bit_rate = bitrate;
+ par->bit_rate = bitrate;
}
- if (codec->sample_rate <= 0) {
+ if (par->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR,
- "Invalid sample rate: %d\n", codec->sample_rate);
+ "Invalid sample rate: %d\n", par->sample_rate);
return AVERROR_INVALIDDATA;
}
- if (codec->codec_id == AV_CODEC_ID_AAC_LATM) {
+ if (par->codec_id == AV_CODEC_ID_AAC_LATM) {
/* Channels and sample_rate values are those prior to applying SBR
* and/or PS. */
- codec->channels = 0;
- codec->sample_rate = 0;
+ par->channels = 0;
+ par->sample_rate = 0;
}
/* override bits_per_coded_sample for G.726 */
- if (codec->codec_id == AV_CODEC_ID_ADPCM_G726)
- codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate;
+ if (par->codec_id == AV_CODEC_ID_ADPCM_G726)
+ par->bits_per_coded_sample = par->bit_rate / par->sample_rate;
return 0;
}
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 83c860d..62dd458 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -102,7 +102,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t
size, AVStream **st)
if (!*st)
return AVERROR(ENOMEM);
- ret = ff_get_wav_header(s, pb, (*st)->codec, size);
+ ret = ff_get_wav_header(s, pb, (*st)->codecpar, size);
if (ret < 0)
return ret;
(*st)->need_parsing = AVSTREAM_PARSE_FULL;
@@ -498,7 +498,7 @@ static int w64_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
/* subtract chunk header size - normal wav file doesn't count it */
- ret = ff_get_wav_header(s, pb, st->codec, size - 24);
+ ret = ff_get_wav_header(s, pb, st->codecpar, size - 24);
if (ret < 0)
return ret;
avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index bab61f3..d5477c4 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -691,7 +691,7 @@ static AVStream * parse_media_type(AVFormatContext *s,
AVStream *st, int sid,
if (!st)
return NULL;
if (!ff_guidcmp(formattype, format_waveformatex)) {
- int ret = ff_get_wav_header(s, pb, st->codec, size);
+ int ret = ff_get_wav_header(s, pb, st->codecpar, size);
if (ret < 0)
return NULL;
} else {
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index b24cde8..6f1a1d6 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -75,7 +75,7 @@ static int xwma_read_header(AVFormatContext *s)
if (!st)
return AVERROR(ENOMEM);
- ret = ff_get_wav_header(s, pb, st->codec, size);
+ ret = ff_get_wav_header(s, pb, st->codecpar, size);
if (ret < 0)
return ret;
st->need_parsing = AVSTREAM_PARSE_NONE;
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel