---
 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     | 69 +++++++++++++++++++++++------------------------
 libavformat/wavdec.c      |  4 +--
 libavformat/wtv.c         |  2 +-
 libavformat/xwma.c        |  2 +-
 10 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 85e800d..364b0b1 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -426,7 +426,7 @@ static int asf_read_stream_properties(AVFormatContext *s, 
int64_t size)
 
     st->codec->codec_type = type;
     if (type == AVMEDIA_TYPE_AUDIO) {
-        int ret = ff_get_wav_header(pb, st->codec, type_specific_size);
+        int ret = ff_get_wav_header(pb, st->codecpar, type_specific_size);
         if (ret < 0)
             return ret;
         if (is_dvr_ms_audio) {
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c24a6c4..1d5be4e 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -673,7 +673,7 @@ static int avi_read_header(AVFormatContext *s)
 //                    avio_skip(pb, size - 5 * 4);
                     break;
                 case AVMEDIA_TYPE_AUDIO:
-                    ret = ff_get_wav_header(pb, st->codec, size);
+                    ret = ff_get_wav_header(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 78e7290..9825759 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(pb, ast->codec, fsize);
+        ret = ff_get_wav_header(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 42204a4..2644641 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1596,7 +1596,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(&b, st->codec, track->codec_priv.size);
+            ret = ff_get_wav_header(&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 3734689..e21b5a7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -646,7 +646,7 @@ static int mov_read_wfex(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];
 
-    ff_get_wav_header(pb, st->codec, atom.size);
+    ff_get_wav_header(pb, st->codecpar, atom.size);
 
     return 0;
 }
diff --git a/libavformat/riff.h b/libavformat/riff.h
index ddfb0fa..e560d83 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(AVIOContext *pb, AVCodecContext *codec, int size);
+int ff_get_wav_header(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 74f93ac..d6af381 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -54,65 +54,64 @@ 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(AVIOContext *pb, AVCodecContext *codec, int size)
+int ff_get_wav_header(AVIOContext *pb, AVCodecParameters *par, int size)
 {
     int id;
 
     id                 = avio_rl16(pb);
-    codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    codec->channels    = avio_rl16(pb);
-    codec->sample_rate = avio_rl32(pb);
-    codec->bit_rate    = avio_rl32(pb) * 8;
-    codec->block_align = avio_rl16(pb);
+    par->codec_type  = AVMEDIA_TYPE_AUDIO;
+    par->channels    = avio_rl16(pb);
+    par->sample_rate = avio_rl32(pb);
+    par->bit_rate    = avio_rl32(pb) * 8;
+    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 +
-                                          FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!codec->extradata)
+            av_free(par->extradata);
+            par->extradata = av_mallocz(par->extradata_size +
+                                        FF_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;
         }
 
@@ -120,20 +119,20 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext 
*codec, int size)
         if (size > 0)
             avio_skip(pb, size);
     }
-    if (codec->sample_rate <= 0) {
+    if (par->sample_rate <= 0) {
         av_log(NULL, 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 f65a66a..0c52f12 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(pb, (*st)->codec, size);
+    ret = ff_get_wav_header(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(pb, st->codec, size - 24);
+    ret = ff_get_wav_header(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 c85f374..0e42ff8 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -682,7 +682,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(pb, st->codec, size);
+            int ret = ff_get_wav_header(pb, st->codecpar, size);
             if (ret < 0)
                 return NULL;
         } else {
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 45d74de..b1f42ad 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(pb, st->codec, size);
+    ret = ff_get_wav_header(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

Reply via email to