The function currently acts differently according to a boolean flag
parameter and asks for a sample or not. Split the function into two
variants instead, one which asks for a sample and one which does not.
---
libavcodec/aac_adtstoasc_bsf.c | 4 ++--
libavcodec/aacdec.c | 19 ++++++++++---------
libavcodec/aacsbr.c | 4 ++--
libavcodec/ac3dec.c | 2 +-
libavcodec/alsdec.c | 2 +-
libavcodec/amrnbdec.c | 2 +-
libavcodec/amrwbdec.c | 2 +-
libavcodec/avcodec.h | 17 ++++++++++++-----
libavcodec/eac3dec.c | 8 ++++----
libavcodec/flacdec.c | 2 +-
libavcodec/mpc8.c | 2 +-
libavcodec/utils.c | 20 +++++++++++---------
libavcodec/vc1.c | 2 +-
libavcodec/vp8.c | 2 +-
libavcodec/wmavoice.c | 2 +-
libavformat/rtpdec_latm.c | 4 ++--
libavformat/rtpdec_qt.c | 8 ++++----
libavformat/spdifdec.c | 4 ++--
18 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index fbb86f8..08b499b 100644
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ b/libavcodec/aac_adtstoasc_bsf.c
@@ -61,7 +61,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext
*bsfc,
}
if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
- av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC is",
0);
+ av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC is");
return -1;
}
@@ -74,7 +74,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext
*bsfc,
if (!hdr.chan_config) {
init_get_bits(&gb, buf, buf_size);
if (get_bits(&gb, 3) != 5) {
- av_log_missing_feature(avctx, "PCE based channel
configuration, where the PCE is not the first syntax element is", 0);
+ av_log_missing_feature(avctx, "PCE based channel
configuration, where the PCE is not the first syntax element is");
return -1;
}
init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index c9761a1..d05d02c 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -400,7 +400,7 @@ static int decode_ga_specific_config(AACContext *ac,
AVCodecContext *avctx,
int extension_flag, ret;
if (get_bits1(gb)) { // frameLengthFlag
- av_log_missing_feature(avctx, "960/120 MDCT window is", 1);
+ av_log_missing_feature_sample(avctx, "960/120 MDCT window is");
return -1;
}
@@ -1341,7 +1341,7 @@ static int decode_ics(AACContext *ac,
SingleChannelElement *sce,
if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
return -1;
if (get_bits1(gb)) {
- av_log_missing_feature(ac->avctx, "SSR", 1);
+ av_log_missing_feature_sample(ac->avctx, "SSR");
return -1;
}
}
@@ -2052,7 +2052,8 @@ static int parse_adts_frame_header(AACContext *ac,
GetBitContext *gb)
if (!hdr_info.crc_absent)
skip_bits(gb, 16);
} else {
- av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS
frame is", 0);
+ av_log_missing_feature(ac->avctx,
+ "More than one AAC RDB per ADTS frame is");
return -1;
}
}
@@ -2255,8 +2256,8 @@ static int latm_decode_audio_specific_config(struct
LATMContext *latmctx,
int bits_consumed, esize;
if (config_start_bit % 8) {
- av_log_missing_feature(latmctx->aac_ctx.avctx, "audio specific "
- "config not byte aligned.\n", 1);
+ av_log_missing_feature_sample(latmctx->aac_ctx.avctx,
+ "audio specific config not byte
aligned.\n");
return AVERROR_INVALIDDATA;
} else {
bits_consumed =
@@ -2304,8 +2305,8 @@ static int read_stream_mux_config(struct LATMContext
*latmctx,
skip_bits(gb, 6); // numSubFrames
// numPrograms
if (get_bits(gb, 4)) { // numPrograms
- av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple programs are not supported\n", 1);
+ av_log_missing_feature_sample(latmctx->aac_ctx.avctx,
+ "multiple programs are not
supported\n");
return AVERROR_PATCHWELCOME;
}
@@ -2313,8 +2314,8 @@ static int read_stream_mux_config(struct LATMContext
*latmctx,
// for each layer (which there is only on in DVB)
if (get_bits(gb, 3)) { // numLayer
- av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple layers are not supported\n", 1);
+ av_log_missing_feature_sample(latmctx->aac_ctx.avctx,
+ "multiple layers are not
supported\n");
return AVERROR_PATCHWELCOME;
}
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 0df5249..bab3494 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -903,14 +903,14 @@ static void read_sbr_extension(AACContext *ac,
SpectralBandReplication *sbr,
#if 1
*num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps,
*num_bits_left);
#else
- av_log_missing_feature(ac->avctx, "Parametric Stereo is", 0);
+ av_log_missing_feature(ac->avctx, "Parametric Stereo is");
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0;
#endif
}
break;
default:
- av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
+ av_log_missing_feature_sample(ac->avctx, "Reserved SBR extensions
are");
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0;
break;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 015ebae..5f4347d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -915,7 +915,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
/* check for enhanced coupling */
if (s->eac3 && get_bits1(gbc)) {
/* TODO: parse enhanced coupling strategy info */
- av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
+ av_log_missing_feature_sample(s->avctx, "Enhanced coupling");
return -1;
}
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 17c5490..481b94a 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -421,7 +421,7 @@ static int check_specific_config(ALSDecContext *ctx)
#define MISSING_ERR(cond, str, errval) \
{ \
if (cond) { \
- av_log_missing_feature(ctx->avctx, str, 0); \
+ av_log_missing_feature(ctx->avctx, str); \
error = errval; \
} \
}
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index 4e24e26..3ffc8d3 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -936,7 +936,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void
*data, int *data_size,
p->cur_frame_mode = unpack_bitstream(p, buf, buf_size);
if (p->cur_frame_mode == MODE_DTX) {
- av_log_missing_feature(avctx, "dtx mode", 1);
+ av_log_missing_feature_sample(avctx, "dtx mode");
return -1;
}
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index d4bb776..0c8e56e 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -1096,7 +1096,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void
*data, int *data_size,
av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
if (ctx->fr_cur_mode == MODE_SID) /* Comfort noise frame */
- av_log_missing_feature(avctx, "SID mode", 1);
+ av_log_missing_feature_sample(avctx, "SID mode");
if (ctx->fr_cur_mode >= MODE_SID)
return -1;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 40d3b22..19c2b11 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4089,12 +4089,19 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned
int v);
* @param[in] avc a pointer to an arbitrary struct of which the first field is
* a pointer to an AVClass struct
* @param[in] feature string containing the name of the missing feature
- * @param[in] want_sample indicates if samples are wanted which exhibit this
feature.
- * If want_sample is non-zero, additional verbage will be added to the log
- * message which tells the user how to report samples to the development
- * mailing list.
*/
-void av_log_missing_feature(void *avc, const char *feature, int want_sample);
+void av_log_missing_feature(void *avc, const char *feature);
+
+/**
+ * Logs a generic warning message about a missing feature like
+ * av_log_missing_feature() but also asks for a sample to be uploaded.
+ * 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] feature string containing the name of the missing feature
+ */
+void av_log_missing_feature_sample(void *avc, const char *feature);
/**
* Log a generic warning message asking for a sample. This function is
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
index 5400768..f0eb62c 100644
--- a/libavcodec/eac3dec.c
+++ b/libavcodec/eac3dec.c
@@ -300,7 +300,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
application can select from. each independent stream can also contain
dependent streams which are used to add or replace channels. */
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
- av_log_missing_feature(s->avctx, "Dependent substream decoding", 1);
+ av_log_missing_feature_sample(s->avctx, "Dependent substream
decoding");
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
} else if (s->frame_type == EAC3_FRAME_TYPE_RESERVED) {
av_log(s->avctx, AV_LOG_ERROR, "Reserved frame type\n");
@@ -312,7 +312,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
associated to an independent stream have matching substream id's. */
if (s->substreamid) {
/* only decode substream with id=0. skip any additional substreams. */
- av_log_missing_feature(s->avctx, "Additional substreams", 1);
+ av_log_missing_feature_sample(s->avctx, "Additional substreams");
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
}
@@ -321,7 +321,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
rates in bit allocation. The best assumption would be that it is
handled like AC-3 DolbyNet, but we cannot be sure until we have a
sample which utilizes this feature. */
- av_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
+ av_log_missing_feature_sample(s->avctx, "Reduced sampling rates");
return -1;
}
skip_bits(gbc, 5); // skip bitstream id
@@ -593,7 +593,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
It is likely the offset of each block within the frame. */
int block_start_bits = (s->num_blocks-1) * (4 +
av_log2(s->frame_size-2));
skip_bits_long(gbc, block_start_bits);
- av_log_missing_feature(s->avctx, "Block start info", 1);
+ av_log_missing_feature_sample(s->avctx, "Block start info");
}
/* syntax state initialization */
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 1ce8559..ae0992e 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -424,7 +424,7 @@ static inline int decode_subframe(FLACContext *s, int
channel)
s->curr_bps -= wasted;
}
if (s->curr_bps > 32) {
- av_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
+ av_log_missing_feature(s->avctx, "decorrelated bit depth > 32");
return -1;
}
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 5de8c15..785f66a 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -129,7 +129,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
c->maxbands = get_bits(&gb, 5) + 1;
channels = get_bits(&gb, 4) + 1;
if (channels > 2) {
- av_log_missing_feature(avctx, "Multichannel MPC SV8", 1);
+ av_log_missing_feature_sample(avctx, "Multichannel MPC SV8");
return -1;
}
c->MSS = get_bits1(&gb);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0190e66..dcdd52b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -249,7 +249,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame
*pic){
if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt !=
s->pix_fmt)){
if(s->active_thread_type&FF_THREAD_FRAME) {
- av_log_missing_feature(s, "Width/height changing with frame
threads is", 0);
+ av_log_missing_feature(s, "Width/height changing with frame
threads is");
return -1;
}
@@ -1121,16 +1121,18 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int
size, int a, int b){
return i;
}
-void av_log_missing_feature(void *avc, const char *feature, int want_sample)
+void av_log_missing_feature(void *avc, const char *feature)
{
av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your Libav "
- "version to the newest one from Git. If the problem still "
- "occurs, it means that your file has a feature which has not "
- "been implemented.", feature);
- if(want_sample)
- av_log_ask_for_sample(avc, NULL);
- else
- av_log(avc, AV_LOG_WARNING, "\n");
+ "version to the newest one from Git. If the problem still "
+ "occurs, it means that your file has a feature which has not "
+ "been implemented.\n", feature);
+}
+
+void av_log_missing_feature_sample(void *avc, const char *feature)
+{
+ av_log_missing_feature(avc, feature);
+ av_log_ask_for_sample(avc, NULL);
}
void av_log_ask_for_sample(void *avc, const char *msg)
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index b058a38..f352088 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -860,7 +860,7 @@ int vc1_parse_frame_header_adv(VC1Context *v,
GetBitContext* gb)
}
}
if(v->panscanflag) {
- av_log_missing_feature(v->s.avctx, "Pan-scan", 0);
+ av_log_missing_feature(v->s.avctx, "Pan-scan");
//...
}
v->rnd = get_bits1(gb);
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index de4a51d..56ec32b 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -252,7 +252,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t
*buf, int buf_size)
buf_size -= 7;
if (hscale || vscale)
- av_log_missing_feature(s->avctx, "Upscaling", 1);
+ av_log_missing_feature_sample(s->avctx, "Upscaling");
s->update_golden = s->update_altref = VP56_FRAME_CURRENT;
for (i = 0; i < 4; i++)
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 33c34a0..c3554ae 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1745,7 +1745,7 @@ static int synth_superframe(AVCodecContext *ctx,
* are really WMAPro-in-WMAVoice-superframes. I've never seen those in
* the wild yet. */
if (!get_bits1(gb)) {
- av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1);
+ av_log_missing_feature_sample(ctx, "WMAPro-in-WMAVoice support");
return -1;
}
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index 5bf4c19..dca52a5 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -158,8 +158,8 @@ static int parse_fmtp(AVStream *stream, PayloadContext
*data,
} else if (!strcmp(attr, "cpresent")) {
int cpresent = atoi(value);
if (cpresent != 0)
- av_log_missing_feature(NULL, "RTP MP4A-LATM with in-band "
- "configuration", 1);
+ av_log_missing_feature_sample(NULL,
+ "RTP MP4A-LATM with in-band
configuration");
}
return 0;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index a295ba7..b3dae59 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -96,8 +96,8 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
is_start = get_bits1(&gb);
is_finish = get_bits1(&gb);
if (!is_start || !is_finish) {
- av_log_missing_feature(s, "RTP-X-QT with payload description "
- "split over several packets", 1);
+ av_log_missing_feature_sample(s, "RTP-X-QT with payload
description"
+ " split over several packets");
return AVERROR(ENOSYS);
}
skip_bits(&gb, 12); // reserved
@@ -160,7 +160,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
avio_seek(&pb, 4, SEEK_SET);
if (has_packet_info) {
- av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1);
+ av_log_missing_feature_sample(s, "RTP-X-QT with packet specific info");
return AVERROR(ENOSYS);
}
@@ -223,7 +223,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
return 0;
default: /* unimplemented */
- av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1);
+ av_log_missing_feature_sample(NULL, "RTP-X-QT with packing scheme 2");
return AVERROR(ENOSYS);
}
}
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 1c09025..bf9990e 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -92,7 +92,7 @@ static int spdif_get_offset_and_codec(AVFormatContext *s,
default:
if (s) { /* be silent during a probe */
av_log(s, AV_LOG_WARNING, "Data type 0x%04x", data_type);
- av_log_missing_feature(s, " in IEC 61937 is", 1);
+ av_log_missing_feature_sample(s, " in IEC 61937 is");
}
return AVERROR_PATCHWELCOME;
}
@@ -213,7 +213,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket
*pkt)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = codec_id;
} else if (codec_id != s->streams[0]->codec->codec_id) {
- av_log_missing_feature(s, "codec change in IEC 61937", 0);
+ av_log_missing_feature(s, "codec change in IEC 61937");
return AVERROR_PATCHWELCOME;
}
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel