Right now the function accepts an optional message parameter to print.
Split it into two variants instead, one without and one with message
parameter that is not optional.
---
libavcodec/anm.c | 6 +++---
libavcodec/ansi.c | 6 +++---
libavcodec/avcodec.h | 13 +++++++++++--
libavcodec/dca.c | 4 ++--
libavcodec/pictordec.c | 4 ++--
libavcodec/ptx.c | 4 ++--
libavcodec/qcelpdec.c | 2 +-
libavcodec/utils.c | 22 +++++++++++++---------
libavcodec/vc1dec.c | 4 ++--
libavcodec/wmaprodec.c | 20 ++++++++++----------
libavformat/anm.c | 4 ++--
libavformat/au.c | 2 +-
libavformat/filmstripdec.c | 2 +-
libavformat/mpegts.c | 2 +-
libavformat/rsodec.c | 2 +-
libavformat/spdifdec.c | 2 +-
libavformat/spdifenc.c | 4 ++--
libavformat/xwma.c | 4 ++--
18 files changed, 60 insertions(+), 47 deletions(-)
diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index ef037f2..6d4207d 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -125,11 +125,11 @@ static int decode_frame(AVCodecContext *avctx,
dst_end = s->frame.data[0] + s->frame.linesize[0]*avctx->height;
if (buf[0] != 0x42) {
- av_log_ask_for_sample(avctx, "unknown record type\n");
+ av_log_ask_for_sample_extra_message(avctx, "unknown record type\n");
return buf_size;
}
if (buf[1]) {
- av_log_ask_for_sample(avctx, "padding bytes not supported\n");
+ av_log_ask_for_sample_extra_message(avctx, "padding bytes not
supported\n");
return buf_size;
}
buf += 4;
@@ -159,7 +159,7 @@ static int decode_frame(AVCodecContext *avctx,
if (type == 0)
break; // stop
if (type == 2) {
- av_log_ask_for_sample(avctx, "unknown opcode");
+ av_log_ask_for_sample_extra_message(avctx, "unknown
opcode");
return AVERROR_INVALIDDATA;
}
continue;
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 892cc34..e1c05af 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -215,7 +215,7 @@ static int execute_code(AVCodecContext * avctx, int c)
height = 60<<4;
break;
default:
- av_log_ask_for_sample(avctx, "unsupported screen mode\n");
+ av_log_ask_for_sample_extra_message(avctx, "unsupported screen
mode\n");
}
if (width != avctx->width || height != avctx->height) {
if (s->frame.data[0])
@@ -285,7 +285,7 @@ static int execute_code(AVCodecContext * avctx, int c)
} else if (m == 49) {
s->fg = ansi_to_cga[DEFAULT_BG_COLOR];
} else {
- av_log_ask_for_sample(avctx, "unsupported rendition
parameter\n");
+ av_log_ask_for_sample_extra_message(avctx, "unsupported
rendition parameter\n");
}
}
break;
@@ -302,7 +302,7 @@ static int execute_code(AVCodecContext * avctx, int c)
s->y = av_clip(s->sy, 0, avctx->height - s->font_height);
break;
default:
- av_log_ask_for_sample(avctx, "unsupported escape code\n");
+ av_log_ask_for_sample_extra_message(avctx, "unsupported escape
code\n");
break;
}
return 0;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 19c2b11..2892135 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4109,9 +4109,18 @@ void av_log_missing_feature_sample(void *avc, const char
*feature);
* only, and would normally not be used by applications.
* @param[in] avc a pointer to an arbitrary struct of which the first field is
* a pointer to an AVClass struct
- * @param[in] msg string containing an optional message, or NULL if no message
*/
-void av_log_ask_for_sample(void *avc, const char *msg);
+void av_log_ask_for_sample(void *avc);
+
+/**
+ * Log a generic warning message asking for a sample and print some extra
+ * message before doing so. This function is intended to be used internally
+ * by Libav libraries only and not by applications.
+ * @param[in] avc a pointer to an arbitrary struct of which the first field is
+ * a pointer to an AVClass struct
+ * @param[in] msg string containing the message
+ */
+void av_log_ask_for_sample_extra_message(void *avc, const char *msg);
/**
* Register the hardware accelerator hwaccel.
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index e3c6466..0d82e9e 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -1565,14 +1565,14 @@ static void dca_exss_parse_header(DCAContext *s)
num_audiop = get_bits(&s->gb, 3) + 1;
if (num_audiop > 1) {
- av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio
presentations.");
+ av_log_ask_for_sample_extra_message(s->avctx, "Multiple DTS-HD
audio presentations.");
/* ignore such streams for now */
return;
}
num_assets = get_bits(&s->gb, 3) + 1;
if (num_assets > 1) {
- av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio assets.");
+ av_log_ask_for_sample_extra_message(s->avctx, "Multiple DTS-HD
audio assets.");
/* ignore such streams for now */
return;
}
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 74a49c8..014e907 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -118,7 +118,7 @@ static int decode_frame(AVCodecContext *avctx,
s->nb_planes = (*buf++ >> 4) + 1;
bpp = s->nb_planes ? bits_per_plane*s->nb_planes :
bits_per_plane;
if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
- av_log_ask_for_sample(s, "unsupported bit depth\n");
+ av_log_ask_for_sample_extra_message(s, "unsupported bit depth\n");
return AVERROR_INVALIDDATA;
}
@@ -220,7 +220,7 @@ static int decode_frame(AVCodecContext *avctx,
}
}
} else {
- av_log_ask_for_sample(s, "uncompressed image\n");
+ av_log_ask_for_sample_extra_message(s, "uncompressed image\n");
return buf_size;
}
diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
index 94f1656..4468602 100644
--- a/libavcodec/ptx.c
+++ b/libavcodec/ptx.c
@@ -51,14 +51,14 @@ static int ptx_decode_frame(AVCodecContext *avctx, void
*data, int *data_size,
bytes_per_pixel = AV_RL16(buf+12) >> 3;
if (bytes_per_pixel != 2) {
- av_log_ask_for_sample(avctx, "Image format is not RGB15.\n");
+ av_log_ask_for_sample_extra_message(avctx, "Image format is not
RGB15.\n");
return -1;
}
avctx->pix_fmt = PIX_FMT_RGB555;
if (offset != 0x2c)
- av_log_ask_for_sample(avctx, "offset != 0x2c\n");
+ av_log_ask_for_sample_extra_message(avctx, "offset != 0x2c\n");
buf += offset;
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 3095a24..8325035 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -689,7 +689,7 @@ static qcelp_packet_rate determine_bitrate(AVCodecContext
*avctx, const int buf_
if(bitrate == SILENCE)
{
//FIXME: Remove experimental warning when tested with samples.
- av_log_ask_for_sample(avctx, "'Blank frame handling is experimental.");
+ av_log_ask_for_sample_extra_message(avctx, "'Blank frame handling is
experimental.");
}
return bitrate;
}
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index dcdd52b..b09d5ff 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1129,19 +1129,23 @@ void av_log_missing_feature(void *avc, const char
*feature)
"been implemented.\n", feature);
}
-void av_log_missing_feature_sample(void *avc, const char *feature)
+void av_log_ask_for_sample(void *avc)
{
- av_log_missing_feature(avc, feature);
- av_log_ask_for_sample(avc, NULL);
+ av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
+ "of this file to ftp://upload.libav.org/incoming/ "
+ "and contact the libav-devel mailing list.\n");
}
-void av_log_ask_for_sample(void *avc, const char *msg)
+void av_log_ask_for_sample_extra_message(void *avc, const char *msg)
{
- if (msg)
- av_log(avc, AV_LOG_WARNING, "%s ", msg);
- av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
- "of this file to ftp://upload.libav.org/incoming/ "
- "and contact the libav-devel mailing list.\n");
+ av_log(avc, AV_LOG_WARNING, "%s ", msg);
+ av_log_ask_for_sample(avc);
+}
+
+void av_log_missing_feature_sample(void *avc, const char *feature)
+{
+ av_log_missing_feature(avc, feature);
+ av_log_ask_for_sample(avc);
}
static AVHWAccel *first_hwaccel = NULL;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 6e73317..05d68ff 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -3122,7 +3122,7 @@ static void vc1_sprite_parse_transform(VC1Context *v,
GetBitContext* gb, float c
c[4] = get_float_val(gb);
break;
case 3:
- av_log_ask_for_sample(v->s.avctx, NULL);
+ av_log_ask_for_sample(v->s.avctx);
c[0] = get_float_val(gb);
c[1] = get_float_val(gb);
c[2] = get_float_val(gb);
@@ -3171,7 +3171,7 @@ static void vc1_parse_sprites(VC1Context *v,
GetBitContext* gb)
vc1_sprite_parse_transform(v, gb, &effect_params1[7]);
break;
default:
- av_log_ask_for_sample(v->s.avctx, NULL);
+ av_log_ask_for_sample(v->s.avctx);
return;
}
if (effect_type != 13 || effect_params1[0] != coefs[0][6]) {
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index c9048a9..2ba0caa 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -293,7 +293,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_dlog(avctx, "\n");
} else {
- av_log_ask_for_sample(avctx, "Unknown extradata size\n");
+ av_log_ask_for_sample_extra_message(avctx, "Unknown extradata size\n");
return AVERROR_INVALIDDATA;
}
@@ -347,7 +347,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n",
s->num_channels);
return AVERROR_INVALIDDATA;
} else if (s->num_channels > WMAPRO_MAX_CHANNELS) {
- av_log_ask_for_sample(avctx, "unsupported number of channels\n");
+ av_log_ask_for_sample_extra_message(avctx, "unsupported number of
channels\n");
return AVERROR_PATCHWELCOME;
}
@@ -663,8 +663,8 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
int remaining_channels = s->channels_for_cur_subframe;
if (get_bits1(&s->gb)) {
- av_log_ask_for_sample(s->avctx,
- "unsupported channel transform bit\n");
+ av_log_ask_for_sample_extra_message(s->avctx,
+ "unsupported channel transform
bit\n");
return AVERROR_INVALIDDATA;
}
@@ -700,8 +700,8 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
if (chgroup->num_channels == 2) {
if (get_bits1(&s->gb)) {
if (get_bits1(&s->gb)) {
- av_log_ask_for_sample(s->avctx,
- "unsupported channel transform
type\n");
+ av_log_ask_for_sample_extra_message(s->avctx,
+ "unsupported
channel transform type\n");
}
} else {
chgroup->transform = 1;
@@ -726,8 +726,8 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
} else {
/** FIXME: more than 6 coupled channels not supported
*/
if (chgroup->num_channels > 6) {
- av_log_ask_for_sample(s->avctx,
- "coupled channels > 6\n");
+ av_log_ask_for_sample_extra_message(s->avctx,
+ "coupled
channels > 6\n");
} else {
memcpy(chgroup->decorrelation_matrix,
default_decorrelation[chgroup->num_channels],
@@ -1134,7 +1134,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
/** no idea for what the following bit is used */
if (get_bits1(&s->gb)) {
- av_log_ask_for_sample(s->avctx, "reserved bit set\n");
+ av_log_ask_for_sample_extra_message(s->avctx, "reserved bit set\n");
return AVERROR_INVALIDDATA;
}
@@ -1439,7 +1439,7 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext*
gb, int len,
buflen = (s->num_saved_bits + len + 8) >> 3;
if (len <= 0 || buflen > MAX_FRAMESIZE) {
- av_log_ask_for_sample(s->avctx, "input buffer too small\n");
+ av_log_ask_for_sample_extra_message(s->avctx, "input buffer too
small\n");
s->packet_loss = 1;
return;
}
diff --git a/libavformat/anm.c b/libavformat/anm.c
index 4d1b5f7..4d678cf 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -85,7 +85,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 4); /* magic number */
if (avio_rl16(pb) != MAX_PAGES) {
- av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
+ av_log_ask_for_sample_extra_message(s, "max_pages != "
AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA;
}
@@ -165,7 +165,7 @@ static int read_header(AVFormatContext *s,
return 0;
invalid:
- av_log_ask_for_sample(s, NULL);
+ av_log_ask_for_sample(s);
ret = AVERROR_INVALIDDATA;
close_and_return:
diff --git a/libavformat/au.c b/libavformat/au.c
index 6cffe1c..e8d4022 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -141,7 +141,7 @@ static int au_read_header(AVFormatContext *s,
codec = ff_codec_get_id(codec_au_tags, id);
if (!av_get_bits_per_sample(codec)) {
- av_log_ask_for_sample(s, "could not determine bits per sample\n");
+ av_log_ask_for_sample_extra_message(s, "could not determine bits per
sample\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 095bf9e..20fe0ae 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -55,7 +55,7 @@ static int read_header(AVFormatContext *s,
st->nb_frames = avio_rb32(pb);
if (avio_rb16(pb) != 0) {
- av_log_ask_for_sample(s, "unsupported packing method\n");
+ av_log_ask_for_sample_extra_message(s, "unsupported packing method\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d7f2c0c..8319f41 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -944,7 +944,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream
*st, int stream_type
}
if (st->codec->extradata) {
if (st->codec->extradata_size == 4 && memcmp(st->codec->extradata,
*pp, 4))
- av_log_ask_for_sample(fc, "DVB sub with multiple IDs\n");
+ av_log_ask_for_sample_extra_message(fc, "DVB sub with multiple
IDs\n");
} else {
st->codec->extradata = av_malloc(4 + FF_INPUT_BUFFER_PADDING_SIZE);
if (st->codec->extradata) {
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index 98de8fe..63f82ab 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -49,7 +49,7 @@ static int rso_read_header(AVFormatContext *s,
AVFormatParameters *ap)
bps = av_get_bits_per_sample(codec);
if (!bps) {
- av_log_ask_for_sample(s, "could not determine bits per sample\n");
+ av_log_ask_for_sample_extra_message(s, "could not determine bits per
sample\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index bf9990e..46ab9a6 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -179,7 +179,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket
*pkt)
pkt_size_bits = avio_rl16(pb);
if (pkt_size_bits % 16)
- av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary.");
+ av_log_ask_for_sample_extra_message(s, "Packet does not end to a
16-bit boundary.");
ret = av_new_packet(pkt, FFALIGN(pkt_size_bits, 16) >> 3);
if (ret)
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 35c7b16..8acbdc4 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -300,7 +300,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket
*pkt)
* discs and dts-in-wav. */
ctx->use_preamble = 0;
} else if (ctx->out_bytes > ctx->pkt_offset - BURST_HEADER_SIZE) {
- av_log_ask_for_sample(s, "Unrecognized large DTS frame.");
+ av_log_ask_for_sample_extra_message(s, "Unrecognized large DTS
frame.");
/* This will fail with a "bitrate too high" in the caller */
}
@@ -406,7 +406,7 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket
*pkt)
/* if such frames exist, we'd need some more complex logic to
* distribute the TrueHD frames in the MAT frame */
av_log(s, AV_LOG_ERROR, "TrueHD frame too big, %d bytes\n", pkt->size);
- av_log_ask_for_sample(s, NULL);
+ av_log_ask_for_sample(s);
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index d18ab48..1d542b9 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -86,7 +86,7 @@ static int xwma_read_header(AVFormatContext *s,
AVFormatParameters *ap)
if (st->codec->codec_id != CODEC_ID_WMAV2) {
av_log(s, AV_LOG_WARNING, "unexpected codec (tag 0x04%x; id %d)\n",
st->codec->codec_tag, st->codec->codec_id);
- av_log_ask_for_sample(s, NULL);
+ av_log_ask_for_sample(s);
} else {
/* In all xWMA files I have seen, there is no extradata. But the WMA
* codecs require extradata, so we provide our own fake extradata.
@@ -102,7 +102,7 @@ static int xwma_read_header(AVFormatContext *s,
AVFormatParameters *ap)
*/
av_log(s, AV_LOG_WARNING, "unexpected extradata (%d bytes)\n",
st->codec->extradata_size);
- av_log_ask_for_sample(s, NULL);
+ av_log_ask_for_sample(s);
} else {
st->codec->extradata_size = 6;
st->codec->extradata = av_mallocz(6 +
FF_INPUT_BUFFER_PADDING_SIZE);
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel