From 9978ed7d6c07ef12220b57b5f9f8e48ab363141e Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Fri, 22 Apr 2011 21:39:56 +0900 Subject: [PATCH 1/4] aacdec: indentation cosmetics Signed-off-by: Diego Biurrun --- libavcodec/aacdec.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index c9761a1aef..3160c66d44 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -180,9 +180,8 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) * @return Returns error status. 0 - OK, !0 - error */ static av_cold int che_configure(AACContext *ac, - enum ChannelPosition che_pos[4][MAX_ELEM_ID], - int type, int id, - int *channels) + enum ChannelPosition che_pos[4][MAX_ELEM_ID], + int type, int id, int *channels) { if (che_pos[type][id]) { if (!ac->che[type][id] && !(ac->che[type][id] = av_mallocz(sizeof(ChannelElement)))) @@ -212,9 +211,9 @@ static av_cold int che_configure(AACContext *ac, * @return Returns error status. 0 - OK, !0 - error */ static av_cold int output_configure(AACContext *ac, - enum ChannelPosition che_pos[4][MAX_ELEM_ID], - enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], - int channel_config, enum OCStatus oc_type) + enum ChannelPosition che_pos[4][MAX_ELEM_ID], + enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], + int channel_config, enum OCStatus oc_type) { AVCodecContext *avctx = ac->avctx; int i, type, channels = 0, ret; @@ -231,7 +230,7 @@ static av_cold int output_configure(AACContext *ac, return ret; } - memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); + memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); avctx->channel_layout = aac_channel_layout[channel_config - 1]; } else { @@ -346,8 +345,8 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac, * @return Returns error status. 0 - OK, !0 - error */ static av_cold int set_default_channel_config(AVCodecContext *avctx, - enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], - int channel_config) + enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], + int channel_config) { if (channel_config < 1 || channel_config > 7) { av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", @@ -1235,7 +1234,7 @@ static av_always_inline float flt16_trunc(float pf) static av_always_inline void predict(PredictorState *ps, float *coef, float sf_scale, float inv_sf_scale, - int output_enable) + int output_enable) { const float a = 0.953125; // 61.0 / 64 const float alpha = 0.90625; // 29.0 / 32 From b2832c3904211f2e95f49059d15b94dfab55964a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 22 Apr 2011 19:46:54 +0200 Subject: [PATCH 2/4] vqavideo: We no longer need to ask for version 1 samples. --- libavcodec/vqavideo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 40004a0028..a842ac7d70 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -464,8 +464,6 @@ static void vqa_decode_chunk(VqaContext *s) switch (s->vqa_version) { case 1: -/* still need sample media for this case (only one game, "Legend of - * Kyrandia III : Malcolm's Revenge", is known to use this version) */ lobyte = s->decode_buffer[lobytes * 2]; hibyte = s->decode_buffer[(lobytes * 2) + 1]; vector_index = ((hibyte << 8) | lobyte) >> 3; From 44f566b79afcbbb152ec21db667ea3d2f42e8f8d Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 22 Apr 2011 19:30:25 +0200 Subject: [PATCH 3/4] Make av_log_ask_for_sample() accept a variable number of arguments. --- libavcodec/avcodec.h | 2 +- libavcodec/utils.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d1377ca0f8..14f00bb5d0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4116,7 +4116,7 @@ void av_log_missing_feature(void *avc, const char *feature, int want_sample); * 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, const char *msg, ...); /** * Register the hardware accelerator hwaccel. diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 744e0ada87..d60e236952 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1133,13 +1133,19 @@ void av_log_missing_feature(void *avc, const char *feature, int want_sample) av_log(avc, AV_LOG_WARNING, "\n"); } -void av_log_ask_for_sample(void *avc, const char *msg) +void av_log_ask_for_sample(void *avc, const char *msg, ...) { + va_list argument_list; + + va_start(argument_list, msg); + if (msg) - av_log(avc, AV_LOG_WARNING, "%s ", msg); + av_vlog(avc, AV_LOG_WARNING, msg, argument_list); 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"); + + va_end(argument_list); } static AVHWAccel *first_hwaccel = NULL; From d9dee728b8c50fb6dbff3701e1abcb2eac5895b3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 22 Apr 2011 19:41:59 +0200 Subject: [PATCH 4/4] Use av_log_ask_for_sample() to request samples from users. --- libavcodec/atrac3.c | 2 +- libavcodec/cook.c | 4 +++- libavcodec/loco.c | 2 +- libavcodec/wnv1.c | 6 ++++-- libavformat/oma.c | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 563352094d..78df5f1fb3 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -186,7 +186,7 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){ 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); + av_log_ask_for_sample(NULL, "Offset of %d not handled.\n", off); return off; } diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 0e792affca..282ca1029d 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1268,7 +1268,9 @@ 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_ask_for_sample(avctx, + "unknown amount of samples_per_channel = %d\n", + q->samples_per_channel); return -1; } diff --git a/libavcodec/loco.c b/libavcodec/loco.c index 0733d09e49..32b1bfc9b1 100644 --- a/libavcodec/loco.c +++ b/libavcodec/loco.c @@ -248,7 +248,7 @@ 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_ask_for_sample(avctx, "This is LOCO codec version %i.\n", version); } l->mode = AV_RL32(avctx->extradata + 4); diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 7c0a537082..65ad9cdd12 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -96,11 +96,13 @@ 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_ask_for_sample(avctx, "Unknown WNV1 frame header value %i\n", + buf[2] >> 4); 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_ask_for_sample(avctx, "Unknown WNV1 frame header value %i\n", + buf[2] >> 4); l->shift = 1; } } diff --git a/libavformat/oma.c b/libavformat/oma.c index ba8901dfdb..6dd56cf702 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -107,7 +107,8 @@ static int oma_read_header(AVFormatContext *s, 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); + av_log_ask_for_sample(s, "Unsupported sample rate: %d\n", + samplerate); framesize = (codec_params & 0x3FF) * 8; jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */