Hi,

On Thu, Apr 21, 2011 at 1:19 PM, Justin Ruggles
<[email protected]> wrote:
> On 04/21/2011 01:02 PM, Diego Biurrun wrote:
>
>> ---
>>  libavcodec/atrac3.c      |    6 ++++--
>>  libavcodec/cook.c        |   17 ++++++++++-------
>>  libavcodec/loco.c        |    3 ++-
>>  libavcodec/truemotion1.c |    4 ++--
>>  libavcodec/tta.c         |    5 +++--
>>  libavcodec/v210x.c       |    2 +-
>>  libavcodec/wnv1.c        |    8 ++++++--
>>  libavformat/oma.c        |    6 ++++--
>>  8 files changed, 32 insertions(+), 19 deletions(-)
>>
>> diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
>> index 5633520..b33046f 100644
>> --- a/libavcodec/atrac3.c
>> +++ b/libavcodec/atrac3.c
>> @@ -185,8 +185,10 @@ static int decode_bytes(const uint8_t* inbuffer, 
>> uint8_t* out, int bytes){
>>      for (i = 0; i < bytes/4; i++)
>>          obuf[i] = c ^ buf[i];
>>
>> -    if (off)
>> -        av_log(NULL,AV_LOG_DEBUG,"Offset of %d not handled, post sample on 
>> ffmpeg-dev.\n",off);
>> +    if (off) {
>> +        av_log(NULL, AV_LOG_DEBUG, "Offset of %d not handled.\n", off);
>> +        av_log_ask_for_sample(NULL, NULL);
>> +    }
>>
>>      return off;
>>  }
>> diff --git a/libavcodec/cook.c b/libavcodec/cook.c
>> index 7717c4b..a809241 100644
>> --- a/libavcodec/cook.c
>> +++ b/libavcodec/cook.c
>> @@ -1136,7 +1136,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>          switch (q->subpacket[s].cookversion) {
>>              case MONO:
>>                  if (q->nb_channels != 1) {
>> -                    av_log(avctx,AV_LOG_ERROR,"Container channels != 1, 
>> report sample!\n");
>> +                    av_log_ask_for_sample(avctx, "Container channels != 
>> 1.!\n");
>>                      return -1;
>>                  }
>>                  av_log(avctx,AV_LOG_DEBUG,"MONO\n");
>> @@ -1150,7 +1150,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>                  break;
>>              case JOINT_STEREO:
>>                  if (q->nb_channels != 2) {
>> -                    av_log(avctx,AV_LOG_ERROR,"Container channels != 2, 
>> report sample!\n");
>> +                    av_log_ask_for_sample(avctx, "Container channels != 
>> 2.\n");
>>                      return -1;
>>                  }
>>                  av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n");
>> @@ -1188,7 +1188,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>
>>                  break;
>>              default:
>> -                av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report 
>> sample!\n");
>> +                av_log_ask_for_sample(avctx, "Unknown Cook version.\n");
>>                  return -1;
>>                  break;
>>          }
>> @@ -1205,7 +1205,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>
>>          /* Try to catch some obviously faulty streams, othervise it might 
>> be exploitable */
>>          if (q->subpacket[s].total_subbands > 53) {
>> -            av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report 
>> sample!\n");
>> +            av_log_ask_for_sample(avctx, "total_subbands > 53\n");
>>              return -1;
>>          }
>>
>> @@ -1215,7 +1215,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>          }
>>
>>          if (q->subpacket[s].subbands > 50) {
>> -            av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n");
>> +            av_log_ask_for_sample(avctx, "subbands > 50\n");
>>              return -1;
>>          }
>>          q->subpacket[s].gains1.now      = q->subpacket[s].gain_1;
>> @@ -1226,7 +1226,7 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>          q->num_subpackets++;
>>          s++;
>>          if (s > MAX_SUBPACKETS) {
>> -            av_log(avctx,AV_LOG_ERROR,"Too many subpackets > 5, report 
>> file!\n");
>> +            av_log_ask_for_sample(avctx, "Too many subpackets > 5\n");
>>              return -1;
>>          }
>>      }
>> @@ -1268,7 +1268,10 @@ static av_cold int cook_decode_init(AVCodecContext 
>> *avctx)
>>      /* Try to catch some obviously faulty streams, othervise it might be 
>> exploitable */
>>      if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) 
>> || (q->samples_per_channel == 1024)) {
>>      } else {
>> -        av_log(avctx,AV_LOG_ERROR,"unknown amount of samples_per_channel = 
>> %d, report sample!\n",q->samples_per_channel);
>> +        av_log(avctx, AV_LOG_ERROR,
>> +               "unknown amount of samples_per_channel = %d\n",
>> +               q->samples_per_channel);
>> +        av_log_ask_for_sample(avctx, NULL);
>>          return -1;
>>      }
>>
>> diff --git a/libavcodec/loco.c b/libavcodec/loco.c
>> index 0733d09..87a2630 100644
>> --- a/libavcodec/loco.c
>> +++ b/libavcodec/loco.c
>> @@ -248,7 +248,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
>>          break;
>>      default:
>>          l->lossy = AV_RL32(avctx->extradata + 8);
>> -        av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please 
>> upload file for study\n", version);
>> +        av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i.\n", 
>> version);
>> +        av_log_ask_for_sample(avctx, NULL);
>>      }
>>
>>      l->mode = AV_RL32(avctx->extradata + 4);
>> diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
>> index afa9cf2..97330d1 100644
>> --- a/libavcodec/truemotion1.c
>> +++ b/libavcodec/truemotion1.c
>> @@ -353,7 +353,7 @@ static int truemotion1_decode_header(TrueMotion1Context 
>> *s)
>>          s->flags = FLAG_KEYFRAME;
>>
>>      if (s->flags & FLAG_SPRITE) {
>> -        av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report 
>> the sample to the developers\n");
>> +        av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n");
>>          /* FIXME header.width, height, xoffset and yoffset aren't 
>> initialized */
>>  #if 0
>>          s->w = header.width;
>> @@ -370,7 +370,7 @@ static int truemotion1_decode_header(TrueMotion1Context 
>> *s)
>>              if ((s->w < 213) && (s->h >= 176))
>>              {
>>                  s->flags |= FLAG_INTERPOLATED;
>> -                av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, 
>> please report the sample to the developers\n");
>> +                av_log_ask_for_sample(s->avctx, "INTERPOLATION 
>> selected.\n");
>>              }
>>          }
>>      }
>> diff --git a/libavcodec/tta.c b/libavcodec/tta.c
>> index fbfc59e..57f5818 100644
>> --- a/libavcodec/tta.c
>> +++ b/libavcodec/tta.c
>> @@ -247,7 +247,7 @@ static av_cold int tta_decode_init(AVCodecContext * 
>> avctx)
>>          if (s->is_float)
>>          {
>>              avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
>> -            av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. 
>> Please contact the developers.\n");
>> +            av_log_ask_for_sample(s->avctx, "Unsupported sample format.\n");
>>              return -1;
>>          }
>>          else switch(s->bps) {
>> @@ -256,7 +256,8 @@ static av_cold int tta_decode_init(AVCodecContext * 
>> avctx)
>>  //            case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break;
>>              case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break;
>>              default:
>> -                av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample 
>> format. Please contact the developers.\n");
>> +                av_log_ask_for_sample(s->avctx,
>> +                                      "Invalid/unsupported sample 
>> format.\n");
>>                  return -1;
>>          }
>>
>> diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
>> index 3d8bdcf..511548f 100644
>> --- a/libavcodec/v210x.c
>> +++ b/libavcodec/v210x.c
>> @@ -52,7 +52,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
>> int *data_size, AVPac
>>      }
>>
>>      if(avpkt->size > avctx->width * avctx->height * 8 / 3){
>> -        av_log(avctx, AV_LOG_ERROR, "Probably padded data, need sample!\n");
>> +        av_log_ask_for_sample(avctx, "Probably padded data\n");
>>      }
>>
>>      pic->reference= 0;
>> diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
>> index 7c0a537..6588f28 100644
>> --- a/libavcodec/wnv1.c
>> +++ b/libavcodec/wnv1.c
>> @@ -96,11 +96,15 @@ static int decode_frame(AVCodecContext *avctx,
>>      else {
>>          l->shift = 8 - (buf[2] >> 4);
>>          if (l->shift > 4) {
>> -            av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value 
>> %i, please upload file for study\n", buf[2] >> 4);
>> +            av_log(avctx, AV_LOG_WARNING,
>> +                   "Unknown WNV1 frame header value %i.\n", buf[2] >> 4);
>> +            av_log_ask_for_sample(avctx, NULL);
>>              l->shift = 4;
>>          }
>>          if (l->shift < 1) {
>> -            av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value 
>> %i, please upload file for study\n", buf[2] >> 4);
>> +            av_log(avctx, AV_LOG_WARNING,
>> +                   "Unknown WNV1 frame header value %i.\n", buf[2] >> 4);
>> +            av_log_ask_for_sample(avctx, NULL);
>>              l->shift = 1;
>>          }
>>      }
>> diff --git a/libavformat/oma.c b/libavformat/oma.c
>> index ba8901d..d8fdbb4 100644
>> --- a/libavformat/oma.c
>> +++ b/libavformat/oma.c
>> @@ -106,8 +106,10 @@ static int oma_read_header(AVFormatContext *s,
>>      switch (buf[32]) {
>>          case OMA_CODECID_ATRAC3:
>>              samplerate = srate_tab[(codec_params >> 13) & 7]*100;
>> -            if (samplerate != 44100)
>> -                av_log(s, AV_LOG_ERROR, "Unsupported sample rate, send 
>> sample file to developers: %d\n", samplerate);
>> +            if (samplerate != 44100) {
>> +                av_log(s, AV_LOG_ERROR, "Unsupported sample rate: %d\n", 
>> samplerate);
>> +                av_log_ask_for_sample(s, NULL);
>> +            }
>>
>>              framesize = (codec_params & 0x3FF) * 8;
>>              jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 
>> for joint-stereo */
>
>
> ok.

Not yet. This is a coding exercise for Diego. I want him to write
av_log_ask_for_sample(ctx, fmt, args);

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to