Do not call av_log_ask_for_sample() from av_log_missing_feature() depending on
the value of a flag parameter. Instead, call av_log_ask_for_sample() directly
where this is desired. This simplifies av_log_missing_feature() and makes for
a nicer API.
---
 libavcodec/aac_adtstoasc_bsf.c |    5 +++--
 libavcodec/aacdec.c            |   20 +++++++++++++-------
 libavcodec/aacsbr.c            |    5 +++--
 libavcodec/ac3dec.c            |    3 ++-
 libavcodec/alsdec.c            |    2 +-
 libavcodec/amrnbdec.c          |    3 ++-
 libavcodec/amrwbdec.c          |    6 ++++--
 libavcodec/avcodec.h           |    6 +-----
 libavcodec/eac3dec.c           |   12 ++++++++----
 libavcodec/flacdec.c           |    2 +-
 libavcodec/mpc8.c              |    3 ++-
 libavcodec/utils.c             |   10 +++-------
 libavcodec/vc1.c               |    2 +-
 libavcodec/vp8.c               |    6 ++++--
 libavcodec/wmavoice.c          |    3 ++-
 libavformat/rtpdec_latm.c      |    8 +++++---
 libavformat/rtpdec_qt.c        |    9 ++++++---
 libavformat/spdifdec.c         |    5 +++--
 18 files changed, 64 insertions(+), 46 deletions(-)

diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index fbb86f8..6071b5c 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,8 @@ 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 0c6312f..4292993 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -399,7 +399,8 @@ 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(avctx, "960/120 MDCT window is");
+        av_log_ask_for_sample(avctx, NULL);
         return -1;
     }
 
@@ -1349,7 +1350,8 @@ 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(ac->avctx, "SSR");
+            av_log_ask_for_sample(ac->avctx, NULL);
             return -1;
         }
     }
@@ -2060,7 +2062,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;
         }
     }
@@ -2263,8 +2266,9 @@ 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(latmctx->aac_ctx.avctx,
+                               "audio specific config not byte aligned.\n");
+        av_log_ask_for_sample(latmctx->aac_ctx.avctx, NULL);
         return AVERROR_INVALIDDATA;
     } else {
         bits_consumed =
@@ -2313,7 +2317,8 @@ static int read_stream_mux_config(struct LATMContext 
*latmctx,
         // numPrograms
         if (get_bits(gb, 4)) {                  // numPrograms
             av_log_missing_feature(latmctx->aac_ctx.avctx,
-                                   "multiple programs are not supported\n", 1);
+                                   "multiple programs are not supported\n");
+            av_log_ask_for_sample(latmctx->aac_ctx.avctx, NULL);
             return AVERROR_PATCHWELCOME;
         }
 
@@ -2322,7 +2327,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);
+                                   "multiple layers are not supported\n");
+            av_log_ask_for_sample(latmctx->aac_ctx.avctx, NULL);
             return AVERROR_PATCHWELCOME;
         }
 
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 0df5249..1726951 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -903,14 +903,15 @@ 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(ac->avctx, "Reserved SBR extensions are");
+        av_log_ask_for_sample(ac->avctx, NULL);
         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..afe515d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -915,7 +915,8 @@ 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(s->avctx, "Enhanced coupling");
+                av_log_ask_for_sample(s->avctx, NULL);
                 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..d623fe7 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -936,7 +936,8 @@ 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(avctx, "dtx mode");
+        av_log_ask_for_sample(avctx, NULL);
         return -1;
     }
 
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index d4bb776..9ec6bb5 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -1095,8 +1095,10 @@ static int amrwb_decode_frame(AVCodecContext *avctx, 
void *data, int *data_size,
     if (!ctx->fr_quality || ctx->fr_cur_mode > MODE_SID)
         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);
+    if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
+        av_log_missing_feature(avctx, "SID mode");
+        av_log_ask_for_sample(avctx, NULL);
+    }
 
     if (ctx->fr_cur_mode >= MODE_SID)
         return -1;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 14f00bb..19564ee 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4101,12 +4101,8 @@ 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);
 
 /**
  * Log a generic warning message asking for a sample. This function is
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
index 5400768..37b3c54 100644
--- a/libavcodec/eac3dec.c
+++ b/libavcodec/eac3dec.c
@@ -300,7 +300,8 @@ 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(s->avctx, "Dependent substream decoding");
+        av_log_ask_for_sample(s->avctx, NULL);
         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 +313,8 @@ 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(s->avctx, "Additional substreams");
+        av_log_ask_for_sample(s->avctx, NULL);
         return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
     }
 
@@ -321,7 +323,8 @@ 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(s->avctx, "Reduced sampling rates");
+        av_log_ask_for_sample(s->avctx, NULL);
         return -1;
     }
     skip_bits(gbc, 5); // skip bitstream id
@@ -593,7 +596,8 @@ 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(s->avctx, "Block start info");
+        av_log_ask_for_sample(s->avctx, NULL);
     }
 
     /* 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..28beb59 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -129,7 +129,8 @@ 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(avctx, "Multichannel MPC SV8");
+        av_log_ask_for_sample(avctx, NULL);
         return -1;
     }
     c->MSS = get_bits1(&gb);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d60e236..5b0f9eb 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,12 @@ 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");
+            "been implemented.\n", feature);
 }
 
 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..5593014 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -251,8 +251,10 @@ static int decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_size)
         buf      += 7;
         buf_size -= 7;
 
-        if (hscale || vscale)
-            av_log_missing_feature(s->avctx, "Upscaling", 1);
+        if (hscale || vscale) {
+            av_log_missing_feature(s->avctx, "Upscaling");
+            av_log_ask_for_sample(s->avctx, NULL);
+        }
 
         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..1be0b84 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1745,7 +1745,8 @@ 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(ctx, "WMAPro-in-WMAVoice support");
+        av_log_ask_for_sample(ctx, NULL);
         return -1;
     }
 
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index 5bf4c19..82b87e0 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -157,9 +157,11 @@ static int parse_fmtp(AVStream *stream, PayloadContext 
*data,
             return res;
     } 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);
+        if (cpresent != 0) {
+            av_log_missing_feature(NULL,
+                                   "RTP MP4A-LATM with in-band configuration");
+            av_log_ask_for_sample(NULL, NULL);
+        }
     }
 
     return 0;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index a295ba7..d14f2e8 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -97,7 +97,8 @@ static int qt_rtp_parse_packet(AVFormatContext *s, 
PayloadContext *qt,
         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);
+                                      "split over several packets");
+            av_log_ask_for_sample(s, NULL);
             return AVERROR(ENOSYS);
         }
         skip_bits(&gb, 12); // reserved
@@ -160,7 +161,8 @@ 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(s, "RTP-X-QT with packet specific info");
+        av_log_ask_for_sample(s, NULL);
         return AVERROR(ENOSYS);
     }
 
@@ -223,7 +225,8 @@ 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(NULL, "RTP-X-QT with packing scheme 2");
+        av_log_ask_for_sample(NULL, NULL);
         return AVERROR(ENOSYS);
     }
 }
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 1c09025..6cd2a1e 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -92,7 +92,8 @@ 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(s, " in IEC 61937 is");
+            av_log_ask_for_sample(s, NULL);
         }
         return AVERROR_PATCHWELCOME;
     }
@@ -213,7 +214,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

Reply via email to