diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 01d753f80ae9ba220ff122c3bd955321927b39a3..8e706fbf09a88cb8a5d9a7b849380dc05f6b26aa 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -752,7 +752,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(pb, st->codec, ts_data_len)) < 0) + if ((ret = ff_get_wav_header(s, pb, st->codec, ts_data_len)) < 0) return ret; break; case AVMEDIA_TYPE_VIDEO: diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 4caba46f469c28d7f74119d206d90a01fd58158d..86397653bc1854ae08c6b4beb222abbe1d3d4566 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -708,7 +708,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(s, pb, st->codec, 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 4a4d7c2cb0577aa10460180acfcb261c291fd8f1..34085cf446fc106aee855bb0c15dd428b3913cab 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(s, pb, ast->codec, fsize); if (ret < 0) return ret; if (ast->codec->sample_rate > 0) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 34bbf372527452a720ebb8666142bfb0eb48c23c..0425d24dc4b2f7e640eac79e7be8fb8143e32ccd 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1597,7 +1597,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(s, &b, st->codec, 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 d075645bea9e5af24a071c0b40b1640602617cc8..66a03911e313925537fea450fb759504ead16196 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -758,7 +758,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(pb, st->codec, atom.size); + return ff_get_wav_header(c->fc, pb, st->codec, atom.size); } static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) diff --git a/libavformat/riff.h b/libavformat/riff.h index ddfb0fa664d33cbff819a213a363d04bf9aa24b3..5bac95a853b748a80e3107218dba5858ade7e1b1 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(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, 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 2c43afc27cfe2291ee8335d44b831e88b4f522a9..fc6f76ceaf2a5292a0174dc272795a060baa0623 100644 --- a/libavformat/riffdec.c +++ b/libavformat/riffdec.c @@ -75,7 +75,8 @@ static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c) } } -int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) +int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, + AVCodecContext *codec, int size) { int id; @@ -124,7 +125,7 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) avio_skip(pb, size); } if (codec->sample_rate <= 0) { - av_log(NULL, AV_LOG_ERROR, + av_log(s, AV_LOG_ERROR, "Invalid sample rate: %d\n", codec->sample_rate); return AVERROR_INVALIDDATA; } diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index f65a66a0066b424468945e0be88b55106c086c91..83c860d3cdc83f5b857c255ee38446a3ac92e08b 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(s, pb, (*st)->codec, 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(s, pb, st->codec, 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 7fe737ed53ac3aaf9deafe18e6e244480f2dd0c2..bab61f3422036f6c4a04c70924576974e30d4c2c 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(pb, st->codec, size); + int ret = ff_get_wav_header(s, pb, st->codec, size); if (ret < 0) return NULL; } else { diff --git a/libavformat/xwma.c b/libavformat/xwma.c index 4a30001f765473f3148264b59fa28e4a2a4dbe16..cab461607042409c0aede4e83592c8476c31bfa2 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(s, pb, st->codec, size); if (ret < 0) return ret; st->need_parsing = AVSTREAM_PARSE_NONE;