From e004bc16a1304822226b5b1ceebdb899d72ee538 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 4 May 2012 10:03:42 -0700 Subject: [PATCH 01/18] doc: clarify check for NULL pointer style Our code should be terse and clear. --- doc/developer.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/developer.texi b/doc/developer.texi index de642396dc..fed28cdbcd 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -73,6 +73,10 @@ const char *avfilter_configuration(void) @} @end example @item +Do not check for NULL values by comparison, @samp{if (p)} and +@samp{if (!p)} are correct; @samp{if (p == NULL)} and @samp{if (p != NULL)} +are not. +@item In case of a single-statement if, no curly braces are required: @example if (!pic || !picref) From 37f4a976b374398a846b354cf16417b9a81d57e2 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 4 May 2012 12:32:43 -0400 Subject: [PATCH 02/18] zerocodec: check if the previous frame is missing ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. A keyframe flags incorrectly set will lead to this condition. Signed-off-by: Paul B Mahol Signed-off-by: Luca Barbato --- libavcodec/zerocodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05197..487cb32797 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { + if (!prev) { + av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n"); + return AVERROR_INVALIDDATA; + } pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } From 828bd088f3f74dcdb8451d58557b0d8caefa3227 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 4 May 2012 19:12:31 +0200 Subject: [PATCH 03/18] lavc: add sample rate and channel layout to AVFrame. Rationale is the same as for video width/height etc. --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 16 ++++++++++++++++ libavcodec/utils.c | 4 ++++ libavcodec/version.h | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index fd834f170b..66a0786c68 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h + Add sample_rate and channel_layout fields to AVFrame. + 2012-xx-xx - xxxxxxx - lavr 0.0.1 Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8020582b6e..bec13e7c1a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1207,6 +1207,22 @@ typedef struct AVFrame { * - decoding: Set by libavcodec. */ uint8_t motion_subsample_log2; + + /** + * Sample rate of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + int sample_rate; + + /** + * Channel layout of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + uint64_t channel_layout; } AVFrame; struct AVCodecInternal; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4492486771..2e8a86c1fa 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -356,6 +356,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) else frame->pkt_pts = AV_NOPTS_VALUE; frame->reordered_opaque = avctx->reordered_opaque; + frame->sample_rate = avctx->sample_rate; + frame->format = avctx->sample_fmt; + frame->channel_layout = avctx->channel_layout; + if (avctx->debug & FF_DEBUG_BUFFERS) av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " "internal audio buffer used\n", frame); diff --git a/libavcodec/version.h b/libavcodec/version.h index 5119874379..be39f4ffca 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,7 +27,7 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 12 +#define LIBAVCODEC_VERSION_MINOR 13 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From 11b6a82412bcd372adf694a26d83b07d337e1325 Mon Sep 17 00:00:00 2001 From: Mina Nagy Zaki Date: Wed, 8 Jun 2011 19:24:25 +0300 Subject: [PATCH 04/18] lavfi: avfilter_merge_formats: handle case where inputs are same This fixes a double-free crash if lists are the same due to the two merge_ref() calls at the end of the (useless) merging that happens. Signed-off-by: Anton Khirnov --- libavfilter/formats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 9d048d7be2..206eff5587 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -45,6 +45,9 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) AVFilterFormats *ret; unsigned i, j, k = 0, m_count; + if (a == b) + return a; + ret = av_mallocz(sizeof(*ret)); /* merge list of formats */ From 0bbd874743538103c74f3c81df4f25b1bb3f1b2e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 5 May 2012 13:11:53 +0200 Subject: [PATCH 05/18] lavfi: support audio in avfilter_copy_frame_props(). --- libavfilter/avfilter.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d42659112a..91eb7f97cf 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -684,19 +684,26 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) { - if (dst->type != AVMEDIA_TYPE_VIDEO) - return AVERROR(EINVAL); - dst->pts = src->pts; dst->format = src->format; - dst->video->w = src->width; - dst->video->h = src->height; - dst->video->pixel_aspect = src->sample_aspect_ratio; - dst->video->interlaced = src->interlaced_frame; - dst->video->top_field_first = src->top_field_first; - dst->video->key_frame = src->key_frame; - dst->video->pict_type = src->pict_type; + switch (dst->type) { + case AVMEDIA_TYPE_VIDEO: + dst->video->w = src->width; + dst->video->h = src->height; + dst->video->pixel_aspect = src->sample_aspect_ratio; + dst->video->interlaced = src->interlaced_frame; + dst->video->top_field_first = src->top_field_first; + dst->video->key_frame = src->key_frame; + dst->video->pict_type = src->pict_type; + break; + case AVMEDIA_TYPE_AUDIO: + dst->audio->sample_rate = src->sample_rate; + dst->audio->channel_layout = src->channel_layout; + break; + default: + return AVERROR(EINVAL); + } return 0; } From 08354bf45849cba65fe6336908e5b9cfec5e28a2 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 3 May 2012 20:23:01 +0200 Subject: [PATCH 06/18] avprobe: allow showing only one container/stream property. This is useful for writing unit tests. Signed-off-by: Anton Khirnov --- avprobe.c | 68 ++++++++++++++++++++++++++++++++++-------------- doc/avprobe.texi | 5 ++++ 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/avprobe.c b/avprobe.c index fe2b6e2860..8d2ec24042 100644 --- a/avprobe.c +++ b/avprobe.c @@ -33,6 +33,7 @@ const char program_name[] = "avprobe"; const int program_birth_year = 2007; static int do_show_format = 0; +static AVDictionary *fmt_entries_to_show = NULL; static int do_show_packets = 0; static int do_show_streams = 0; @@ -58,6 +59,7 @@ static const char unit_bit_per_second_str[] = "bit/s"; void exit_program(int ret) { + av_dict_free(&fmt_entries_to_show); exit(ret); } @@ -257,36 +259,53 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("[/STREAM]\n"); } +static void print_format_entry(const char *tag, + const char *val) +{ + if (!fmt_entries_to_show) { + if (tag) { + printf("%s=%s\n", tag, val); + } else { + printf("%s\n", val); + } + } else if (tag && av_dict_get(fmt_entries_to_show, tag, NULL, 0)) { + printf("%s=%s\n", tag, val); + } +} + static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) + print_format_entry(NULL, "[FORMAT]"); + print_format_entry("filename", fmt_ctx->filename); + snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); + print_format_entry("nb_streams", val_str); + print_format_entry("format_name", fmt_ctx->iformat->name); + print_format_entry("format_long_name", fmt_ctx->iformat->long_name); + print_format_entry("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + print_format_entry("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + print_format_entry("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); + print_format_entry("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); + AV_DICT_IGNORE_SUFFIX))) { + snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); + print_format_entry(val_str, tag->value); + } - printf("[/FORMAT]\n"); + print_format_entry(NULL, "[/FORMAT]"); } static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) @@ -372,6 +391,13 @@ static int opt_format(const char *opt, const char *arg) return 0; } +static int opt_show_format_entry(const char *opt, const char *arg) +{ + do_show_format = 1; + av_dict_set(&fmt_entries_to_show, arg, "", 0); + return 0; +} + static void opt_input_file(void *optctx, const char *arg) { if (input_filename) { @@ -416,6 +442,8 @@ static const OptionDef options[] = { { "pretty", 0, {(void*)&opt_pretty}, "prettify the format of displayed values, make it more human readable" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + "show a particular entry from the format/container info", "entry" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, diff --git a/doc/avprobe.texi b/doc/avprobe.texi index 6b2c800bf1..67c5e20813 100644 --- a/doc/avprobe.texi +++ b/doc/avprobe.texi @@ -94,6 +94,11 @@ stream. All the container format information is printed within a section with name "FORMAT". +@item -show_format_entry @var{name} +Like @option{-show_format}, but only prints the specified entry of the +container format information, rather than all. This option may be given more +than once, then all specified entries will be shown. + @item -show_packets Show information about each packet contained in the input multimedia stream. From a07578f3f2a5ad5cd5dcc5de5ee173254f191435 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 15 Apr 2012 15:46:37 +0200 Subject: [PATCH 07/18] vf_yadif: fix missing error handling for avfilter_poll_frame() --- libavfilter/vf_yadif.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 12b37836f8..790dda5a0b 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -316,11 +316,15 @@ static int poll_frame(AVFilterLink *link) return 1; val = avfilter_poll_frame(link->src->inputs[0]); + if (val <= 0) + return val; if (val==1 && !yadif->next) { //FIXME change API to not requre this red tape if ((ret = avfilter_request_frame(link->src->inputs[0])) < 0) return ret; val = avfilter_poll_frame(link->src->inputs[0]); + if (val <= 0) + return val; } assert(yadif->next || !val); From b68c4ac2936c0e407da869a4f0919c26e2c16645 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Mon, 19 Mar 2012 01:08:14 -0400 Subject: [PATCH 08/18] pthread: warn on high thread counts Signed-off-by: Diego Biurrun --- libavcodec/pthread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 1889d2ae91..88d8ade57e 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -1015,6 +1015,11 @@ static void validate_thread_parameters(AVCodecContext *avctx) avctx->thread_count = 1; avctx->active_thread_type = 0; } + + if (avctx->thread_count > MAX_AUTO_THREADS) + av_log(avctx, AV_LOG_WARNING, + "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n", + avctx->thread_count, MAX_AUTO_THREADS); } int ff_thread_init(AVCodecContext *avctx) From 1f4f752117c0519345a1b0a725a57440cc8924ec Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 14 Apr 2012 15:40:58 +0200 Subject: [PATCH 09/18] libschroedinger: Move a function to avoid a forward declaration. --- libavcodec/libschroedingerdec.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index 68d9a255ef..1e632de017 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -71,7 +71,10 @@ typedef struct SchroParseUnitContext { static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, - void *priv); + void *priv) +{ + av_freep(&priv); +} static void SchroParseContextInit(SchroParseUnitContext *parse_ctx, const uint8_t *buf, int buf_size) @@ -156,12 +159,6 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) return 0; } -static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, - void *priv) -{ - av_freep(&priv); -} - static void libschroedinger_decode_frame_free(void *frame) { schro_frame_unref(frame); From 9eb83a56aad355608ff8ae57648ddcf76e218798 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 14 Apr 2012 13:05:08 +0200 Subject: [PATCH 10/18] build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. --- libavcodec/Makefile | 31 ++++++++++++++++++++++++++----- libavdevice/Makefile | 3 ++- libavfilter/Makefile | 9 +++++++-- libavformat/Makefile | 14 +++++++++++--- libavutil/Makefile | 25 +++++++++++++++++++++---- libswscale/Makefile | 3 ++- 6 files changed, 69 insertions(+), 16 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 367dc1d646..ba62ffa145 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1,7 +1,14 @@ NAME = avcodec FFLIBS = avutil -HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vda.h vdpau.h version.h xvmc.h +HEADERS = avcodec.h \ + avfft.h \ + dxva2.h \ + vaapi.h \ + vda.h \ + vdpau.h \ + version.h \ + xvmc.h \ OBJS = allcodecs.o \ audioconvert.o \ @@ -700,13 +707,27 @@ SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h EXAMPLES = api -TESTPROGS = cabac dct fft fft-fixed golomb iirfilter rangecoder +TESTPROGS = cabac \ + dct \ + fft \ + fft-fixed \ + golomb \ + iirfilter \ + rangecoder \ + TESTPROGS-$(HAVE_MMX) += motion TESTOBJS = dctref.o -HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ - dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ - pcm_tablegen qdm2_tablegen sinewin_tablegen +HOSTPROGS = aac_tablegen \ + aacps_tablegen \ + cbrt_tablegen \ + cos_tablegen \ + dv_tablegen \ + motionpixels_tablegen \ + mpegaudio_tablegen \ + pcm_tablegen \ + qdm2_tablegen \ + sinewin_tablegen \ CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 82268172c3..bc55405470 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -3,7 +3,8 @@ FFLIBS = avformat avcodec avutil HEADERS = avdevice.h -OBJS = alldevices.o avdevice.o +OBJS = alldevices.o \ + avdevice.o \ # input/output devices OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 46fa93dc4f..619cef7445 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -2,7 +2,11 @@ NAME = avfilter FFLIBS = avutil swscale FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec -HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h +HEADERS = avfilter.h \ + avfiltergraph.h \ + buffersrc.h \ + version.h \ + vsrc_buffer.h \ OBJS = allfilters.o \ avfilter.o \ @@ -68,4 +72,5 @@ OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o -TOOLS = graph2dot lavfi-showfiltfmts +TOOLS = graph2dot \ + lavfi-showfiltfmts \ diff --git a/libavformat/Makefile b/libavformat/Makefile index 681ea1ba9a..9a6cb558ea 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -1,7 +1,9 @@ NAME = avformat FFLIBS = avcodec avutil -HEADERS = avformat.h avio.h version.h +HEADERS = avformat.h \ + avio.h \ + version.h \ OBJS = allformats.o \ avio.o \ @@ -352,8 +354,14 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h -EXAMPLES = metadata output +EXAMPLES = metadata \ + output \ + TESTPROGS = seek -TOOLS = aviocat ismindex pktdumper probetest + +TOOLS = aviocat \ + ismindex \ + pktdumper \ + probetest \ $(SUBDIR)output-example$(EXESUF): ELIBS = -lswscale diff --git a/libavutil/Makefile b/libavutil/Makefile index 69f2acd72e..fb19ebf1e2 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -37,6 +37,11 @@ HEADERS = adler32.h \ samplefmt.h \ sha.h \ +ARCH_HEADERS = bswap.h \ + intmath.h \ + intreadwrite.h \ + timer.h \ + BUILT_HEADERS = avconfig.h OBJS = adler32.o \ @@ -74,7 +79,19 @@ OBJS = adler32.o \ tree.o \ utils.o \ -TESTPROGS = adler32 aes avstring base64 cpu crc des eval fifo lfg lls \ - md5 opt parseutils sha tree - -ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h +TESTPROGS = adler32 \ + aes \ + avstring \ + base64 \ + cpu \ + crc \ + des \ + eval \ + fifo \ + lfg \ + lls \ + md5 \ + opt \ + parseutils \ + sha \ + tree \ diff --git a/libswscale/Makefile b/libswscale/Makefile index 29f3f12793..349dd99789 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -12,4 +12,5 @@ OBJS = input.o \ utils.o \ yuv2rgb.o \ -TESTPROGS = colorspace swscale +TESTPROGS = colorspace \ + swscale \ From dbe6ba55a320f5880c2b72c349be12164e6e4267 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 7 May 2012 12:08:58 +0200 Subject: [PATCH 11/18] build: cosmetics: Add missing end-of-line backslashes to item lists. --- libavcodec/Makefile | 3 ++- libavfilter/Makefile | 2 +- libavresample/Makefile | 4 ++-- libavresample/x86/Makefile | 4 ++-- libavutil/arm/Makefile | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ba62ffa145..55767f7c39 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -696,7 +696,8 @@ SKIPHEADERS += %_tablegen.h \ aac_tablegen_decl.h \ fft-internal.h \ tableprint.h \ - $(ARCH)/vp56_arith.h + $(ARCH)/vp56_arith.h \ + SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 619cef7445..ae858397df 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -16,7 +16,7 @@ OBJS = allfilters.o \ formats.o \ graphparser.o \ vf_scale.o \ - vsrc_buffer.o + vsrc_buffer.o \ OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o diff --git a/libavresample/Makefile b/libavresample/Makefile index ce3fe81953..c0c20a900a 100644 --- a/libavresample/Makefile +++ b/libavresample/Makefile @@ -2,7 +2,7 @@ NAME = avresample FFLIBS = avutil HEADERS = avresample.h \ - version.h + version.h \ OBJS = audio_convert.o \ audio_data.o \ @@ -10,6 +10,6 @@ OBJS = audio_convert.o \ audio_mix_matrix.o \ options.o \ resample.o \ - utils.o + utils.o \ TESTPROGS = avresample diff --git a/libavresample/x86/Makefile b/libavresample/x86/Makefile index 63697faee7..65bed899ba 100644 --- a/libavresample/x86/Makefile +++ b/libavresample/x86/Makefile @@ -1,5 +1,5 @@ OBJS += x86/audio_convert_init.o \ - x86/audio_mix_init.o + x86/audio_mix_init.o \ YASM-OBJS += x86/audio_convert.o \ - x86/audio_mix.o + x86/audio_mix.o \ diff --git a/libavutil/arm/Makefile b/libavutil/arm/Makefile index 246f73a8ac..e600383b9c 100644 --- a/libavutil/arm/Makefile +++ b/libavutil/arm/Makefile @@ -1 +1 @@ -OBJS += arm/cpu.o +OBJS += arm/cpu.o \ From 246b050f51aa3c1ddd5260dee66e7bc56bc02ea1 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 19 Apr 2012 14:49:51 +0200 Subject: [PATCH 12/18] mmvideo.c: Remove unused variable in mm_decode_pal(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libavcodec/mmvideo.c:87:9: warning: variable ‘i’ set but not used --- libavcodec/mmvideo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 6c81fd4ce1..1a9dfdd9ed 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -84,8 +84,7 @@ static int mm_decode_pal(MmContext *s) */ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) { - int i, x, y; - i=0; x=0; y=0; + int x = 0, y = 0; while (bytestream2_get_bytes_left(&s->gb) > 0) { int run_length, color; From ea1405064284a9a67793076c8048747480f01a96 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 19 Apr 2012 14:55:06 +0200 Subject: [PATCH 13/18] txd: Remove write-only variable in txd_decode_frame(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libavcodec/txd.c:49:60: warning: variable ‘mipmap_count’ set but not used --- libavcodec/txd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/txd.c b/libavcodec/txd.c index bfb2bb6ea2..d69f9fa0ae 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -46,7 +46,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, GetByteContext gb; AVFrame *picture = data; AVFrame * const p = &s->picture; - unsigned int version, w, h, d3d_format, depth, stride, mipmap_count, flags; + unsigned int version, w, h, d3d_format, depth, stride, flags; unsigned int y, v; uint8_t *ptr; uint32_t *pal; @@ -58,8 +58,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, w = bytestream2_get_le16(&gb); h = bytestream2_get_le16(&gb); depth = bytestream2_get_byte(&gb); - mipmap_count = bytestream2_get_byte(&gb); - bytestream2_skip(&gb, 1); + bytestream2_skip(&gb, 2); flags = bytestream2_get_byte(&gb); if (version < 8 || version > 9) { From 10d2ea2604b66fc600ca3df2510068a4b97ab2f7 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 7 May 2012 13:45:13 +0200 Subject: [PATCH 14/18] h264: Remove a commented-out function pointer typedef. --- libavcodec/h264dsp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h index 7cae215a95..08a25a54c9 100644 --- a/libavcodec/h264dsp.h +++ b/libavcodec/h264dsp.h @@ -30,7 +30,6 @@ #include #include "dsputil.h" -//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, int log2_denom, int weight, int offset); typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, From 1432c1c429fb4817ca0d309096ea40a9d03c1035 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 May 2012 12:21:19 +0200 Subject: [PATCH 15/18] lavf: add missing '*' in a doxy. --- libavformat/avformat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 087b0b45e1..33e9098ff3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -817,7 +817,7 @@ typedef struct AVFormatContext { */ void *priv_data; - /* + /** * I/O context. * * decoding: either set by the user before avformat_open_input() (then From 8134fafe9bdda58e24a9574c251ed3a9b5809c51 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 May 2012 07:15:06 +0200 Subject: [PATCH 16/18] lavfi: uninline avfilter_copy_buffer_ref_props(). A nontrivial public function such as this should most certainly NOT be inline. --- libavfilter/avfilter.c | 13 +++++++++++++ libavfilter/avfilter.h | 13 +------------ libavfilter/version.h | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 91eb7f97cf..d1c82cee2f 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -707,3 +707,16 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) return 0; } + +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) +{ + // copy common properties + dst->pts = src->pts; + dst->pos = src->pos; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; + case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; + default: break; + } +} diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 89ab7dbe2a..c2049f98fe 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -145,18 +145,7 @@ typedef struct AVFilterBufferRef { /** * Copy properties of src to dst, without copying the actual data */ -static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) -{ - // copy common properties - dst->pts = src->pts; - dst->pos = src->pos; - - switch (src->type) { - case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; - case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; - default: break; - } -} +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src); /** * Add a new reference to a buffer. diff --git a/libavfilter/version.h b/libavfilter/version.h index 5d646e4f86..718ed7812e 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MINOR 16 -#define LIBAVFILTER_VERSION_MICRO 0 +#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ From 9cef0669c4e0e98cd6b5746e6de5b0da800f7edb Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 14 Apr 2012 15:24:57 +0200 Subject: [PATCH 17/18] Move code shared between libdirac and libschroedinger to libschroedinger. This also involves making some function static and changing the name prefixes of some functions and structures. --- libavcodec/Makefile | 6 +- libavcodec/libdirac_libschro.c | 113 -------------------------------- libavcodec/libdirac_libschro.h | 105 ----------------------------- libavcodec/libschroedinger.c | 91 ++++++++++++++++++++++++- libavcodec/libschroedinger.h | 70 ++++++++++++++++++++ libavcodec/libschroedingerdec.c | 21 +++--- libavcodec/libschroedingerenc.c | 21 +++--- 7 files changed, 180 insertions(+), 247 deletions(-) delete mode 100644 libavcodec/libdirac_libschro.c delete mode 100644 libavcodec/libdirac_libschro.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 55767f7c39..98d70f07d8 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -601,11 +601,9 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpeg.o OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ - libschroedinger.o \ - libdirac_libschro.o + libschroedinger.o OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ - libschroedinger.o \ - libdirac_libschro.o + libschroedinger.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o diff --git a/libavcodec/libdirac_libschro.c b/libavcodec/libdirac_libschro.c deleted file mode 100644 index 45b5b83264..0000000000 --- a/libavcodec/libdirac_libschro.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2008 BBC, Anuradha Suraparaju - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** -* @file -* functions common to libdirac and libschroedinger -*/ - -#include "libdirac_libschro.h" - -static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = { - { 640, 480, 24000, 1001}, - { 176, 120, 15000, 1001}, - { 176, 144, 25, 2 }, - { 352, 240, 15000, 1001}, - { 352, 288, 25, 2 }, - { 704, 480, 15000, 1001}, - { 704, 576, 25, 2 }, - { 720, 480, 30000, 1001}, - { 720, 576, 25, 1 }, - { 1280, 720, 60000, 1001}, - { 1280, 720, 50, 1 }, - { 1920, 1080, 30000, 1001}, - { 1920, 1080, 25, 1 }, - { 1920, 1080, 60000, 1001}, - { 1920, 1080, 50, 1 }, - { 2048, 1080, 24, 1 }, - { 4096, 2160, 24, 1 }, -}; - -unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext) -{ - unsigned int ret_idx = 0; - unsigned int idx; - unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) / - sizeof(ff_dirac_schro_video_format_info[0]); - - for (idx = 1; idx < num_formats; ++idx) { - const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx]; - if (avccontext->width == vf->width && - avccontext->height == vf->height) { - ret_idx = idx; - if (avccontext->time_base.den == vf->frame_rate_num && - avccontext->time_base.num == vf->frame_rate_denom) - return idx; - } - } - return ret_idx; -} - -void ff_dirac_schro_queue_init(DiracSchroQueue *queue) -{ - queue->p_head = queue->p_tail = NULL; - queue->size = 0; -} - -void ff_dirac_schro_queue_free(DiracSchroQueue *queue, - void (*free_func)(void *)) -{ - while (queue->p_head) - free_func(ff_dirac_schro_queue_pop(queue)); -} - -int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data) -{ - DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement)); - - if (!p_new) - return -1; - - p_new->data = p_data; - - if (!queue->p_head) - queue->p_head = p_new; - else - queue->p_tail->next = p_new; - queue->p_tail = p_new; - - ++queue->size; - return 0; -} - -void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue) -{ - DiracSchroQueueElement *top = queue->p_head; - - if (top) { - void *data = top->data; - queue->p_head = queue->p_head->next; - --queue->size; - av_freep(&top); - return data; - } - - return NULL; -} diff --git a/libavcodec/libdirac_libschro.h b/libavcodec/libdirac_libschro.h deleted file mode 100644 index a80558f820..0000000000 --- a/libavcodec/libdirac_libschro.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2008 BBC, Anuradha Suraparaju - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** -* @file -* data structures common to libdirac and libschroedinger -*/ - -#ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H -#define AVCODEC_LIBDIRAC_LIBSCHRO_H - -#include "avcodec.h" - -typedef struct { - uint16_t width; - uint16_t height; - uint16_t frame_rate_num; - uint16_t frame_rate_denom; -} DiracSchroVideoFormatInfo; - -/** -* Returns the index into the Dirac Schro common video format info table -*/ -unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext); - -/** -* contains a single encoded frame returned from Dirac or Schroedinger -*/ -typedef struct DiracSchroEncodedFrame { - /** encoded frame data */ - uint8_t *p_encbuf; - - /** encoded frame size */ - uint32_t size; - - /** encoded frame number. Will be used as pts */ - uint32_t frame_num; - - /** key frame flag. 1 : is key frame , 0 : in not key frame */ - uint16_t key_frame; -} DiracSchroEncodedFrame; - -/** -* queue element -*/ -typedef struct DiracSchroQueueElement { - /** Data to be stored in queue*/ - void *data; - /** Pointer to next element queue */ - struct DiracSchroQueueElement *next; -} DiracSchroQueueElement; - - -/** -* A simple queue implementation used in libdirac and libschroedinger -*/ -typedef struct DiracSchroQueue { - /** Pointer to head of queue */ - DiracSchroQueueElement *p_head; - /** Pointer to tail of queue */ - DiracSchroQueueElement *p_tail; - /** Queue size*/ - int size; -} DiracSchroQueue; - -/** -* Initialise the queue -*/ -void ff_dirac_schro_queue_init(DiracSchroQueue *queue); - -/** -* Add an element to the end of the queue -*/ -int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data); - -/** -* Return the first element in the queue -*/ -void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue); - -/** -* Free the queue resources. free_func is a function supplied by the caller to -* free any resources allocated by the caller. The data field of the queue -* element is passed to it. -*/ -void ff_dirac_schro_queue_free(DiracSchroQueue *queue, - void (*free_func)(void *)); -#endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ diff --git a/libavcodec/libschroedinger.c b/libavcodec/libschroedinger.c index 527c4927ae..fb0bfaa84d 100644 --- a/libavcodec/libschroedinger.c +++ b/libavcodec/libschroedinger.c @@ -23,12 +23,97 @@ * function definitions common to libschroedinger decoder and encoder */ -#include "libdirac_libschro.h" #include "libschroedinger.h" +static const SchroVideoFormatInfo ff_schro_video_format_info[] = { + { 640, 480, 24000, 1001}, + { 176, 120, 15000, 1001}, + { 176, 144, 25, 2 }, + { 352, 240, 15000, 1001}, + { 352, 288, 25, 2 }, + { 704, 480, 15000, 1001}, + { 704, 576, 25, 2 }, + { 720, 480, 30000, 1001}, + { 720, 576, 25, 1 }, + { 1280, 720, 60000, 1001}, + { 1280, 720, 50, 1 }, + { 1920, 1080, 30000, 1001}, + { 1920, 1080, 25, 1 }, + { 1920, 1080, 60000, 1001}, + { 1920, 1080, 50, 1 }, + { 2048, 1080, 24, 1 }, + { 4096, 2160, 24, 1 }, +}; + +static unsigned int get_video_format_idx(AVCodecContext *avccontext) +{ + unsigned int ret_idx = 0; + unsigned int idx; + unsigned int num_formats = sizeof(ff_schro_video_format_info) / + sizeof(ff_schro_video_format_info[0]); + + for (idx = 1; idx < num_formats; ++idx) { + const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx]; + if (avccontext->width == vf->width && + avccontext->height == vf->height) { + ret_idx = idx; + if (avccontext->time_base.den == vf->frame_rate_num && + avccontext->time_base.num == vf->frame_rate_denom) + return idx; + } + } + return ret_idx; +} + +void ff_schro_queue_init(FFSchroQueue *queue) +{ + queue->p_head = queue->p_tail = NULL; + queue->size = 0; +} + +void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)) +{ + while (queue->p_head) + free_func(ff_schro_queue_pop(queue)); +} + +int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data) +{ + FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement)); + + if (!p_new) + return -1; + + p_new->data = p_data; + + if (!queue->p_head) + queue->p_head = p_new; + else + queue->p_tail->next = p_new; + queue->p_tail = p_new; + + ++queue->size; + return 0; +} + +void *ff_schro_queue_pop(FFSchroQueue *queue) +{ + FFSchroQueueElement *top = queue->p_head; + + if (top) { + void *data = top->data; + queue->p_head = queue->p_head->next; + --queue->size; + av_freep(&top); + return data; + } + + return NULL; +} + /** * Schroedinger video preset table. Ensure that this tables matches up correctly -* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c. +* with the ff_schro_video_format_info table. */ static const SchroVideoFormatEnum ff_schro_video_formats[]={ SCHRO_VIDEO_FORMAT_CUSTOM , @@ -55,7 +140,7 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext unsigned int num_formats = sizeof(ff_schro_video_formats) / sizeof(ff_schro_video_formats[0]); - unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext); + unsigned int idx = get_video_format_idx(avccontext); return (idx < num_formats) ? ff_schro_video_formats[idx] : SCHRO_VIDEO_FORMAT_CUSTOM; diff --git a/libavcodec/libschroedinger.h b/libavcodec/libschroedinger.h index 814782111b..8d04d2cdcb 100644 --- a/libavcodec/libschroedinger.h +++ b/libavcodec/libschroedinger.h @@ -28,8 +28,78 @@ #include #include + #include "avcodec.h" +typedef struct { + uint16_t width; + uint16_t height; + uint16_t frame_rate_num; + uint16_t frame_rate_denom; +} SchroVideoFormatInfo; + +/** +* contains a single encoded frame returned from Dirac or Schroedinger +*/ +typedef struct FFSchroEncodedFrame { + /** encoded frame data */ + uint8_t *p_encbuf; + + /** encoded frame size */ + uint32_t size; + + /** encoded frame number. Will be used as pts */ + uint32_t frame_num; + + /** key frame flag. 1 : is key frame , 0 : in not key frame */ + uint16_t key_frame; +} FFSchroEncodedFrame; + +/** +* queue element +*/ +typedef struct FFSchroQueueElement { + /** Data to be stored in queue*/ + void *data; + /** Pointer to next element queue */ + struct FFSchroQueueElement *next; +} FFSchroQueueElement; + + +/** +* A simple queue implementation used in libschroedinger +*/ +typedef struct FFSchroQueue { + /** Pointer to head of queue */ + FFSchroQueueElement *p_head; + /** Pointer to tail of queue */ + FFSchroQueueElement *p_tail; + /** Queue size*/ + int size; +} FFSchroQueue; + +/** +* Initialise the queue +*/ +void ff_schro_queue_init(FFSchroQueue *queue); + +/** +* Add an element to the end of the queue +*/ +int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data); + +/** +* Return the first element in the queue +*/ +void *ff_schro_queue_pop(FFSchroQueue *queue); + +/** +* Free the queue resources. free_func is a function supplied by the caller to +* free any resources allocated by the caller. The data field of the queue +* element is passed to it. +*/ +void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)); + static const struct { enum PixelFormat ff_pix_fmt; SchroChromaFormat schro_pix_fmt; diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index 1e632de017..20f9447fc6 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -29,7 +29,6 @@ #include "libavutil/imgutils.h" #include "avcodec.h" -#include "libdirac_libschro.h" #include "libschroedinger.h" #undef NDEBUG @@ -52,7 +51,7 @@ typedef struct SchroDecoderParams { SchroDecoder* decoder; /** queue storing decoded frames */ - DiracSchroQueue dec_frame_queue; + FFSchroQueue dec_frame_queue; /** end of sequence signalled */ int eos_signalled; @@ -155,7 +154,7 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) return -1; /* Initialize the decoded frame queue. */ - ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); + ff_schro_queue_init(&p_schro_params->dec_frame_queue); return 0; } @@ -267,8 +266,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, frame = schro_decoder_pull(decoder); if (frame) - ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue, - frame); + ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, + frame); break; case SCHRO_DECODER_EOS: go = 0; @@ -285,7 +284,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, } while (outer); /* Grab next frame to be returned from the top of the queue. */ - frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue); + frame = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); if (frame) { memcpy(p_schro_params->dec_pic.data[0], @@ -324,8 +323,8 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext) avpicture_free(&p_schro_params->dec_pic); /* Free data in the output frame queue. */ - ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, - libschroedinger_decode_frame_free); + ff_schro_queue_free(&p_schro_params->dec_frame_queue, + libschroedinger_decode_frame_free); return 0; } @@ -337,10 +336,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext) SchroDecoderParams *p_schro_params = avccontext->priv_data; /* Free data in the output frame queue. */ - ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, - libschroedinger_decode_frame_free); + ff_schro_queue_free(&p_schro_params->dec_frame_queue, + libschroedinger_decode_frame_free); - ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); + ff_schro_queue_init(&p_schro_params->dec_frame_queue); schro_decoder_reset(p_schro_params->decoder); p_schro_params->eos_pulled = 0; p_schro_params->eos_signalled = 0; diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index f07c83e105..d9b8b06a7d 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -36,7 +36,6 @@ #include "avcodec.h" #include "internal.h" -#include "libdirac_libschro.h" #include "libschroedinger.h" #include "bytestream.h" @@ -65,7 +64,7 @@ typedef struct SchroEncoderParams { int enc_buf_size; /** queue storing encoded frames */ - DiracSchroQueue enc_frame_queue; + FFSchroQueue enc_frame_queue; /** end of sequence signalled */ int eos_signalled; @@ -236,7 +235,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) schro_encoder_start(p_schro_params->encoder); /* Initialize the encoded frame queue. */ - ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue); + ff_schro_queue_init(&p_schro_params->enc_frame_queue); return 0; } @@ -261,7 +260,7 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, static void SchroedingerFreeFrame(void *data) { - DiracSchroEncodedFrame *enc_frame = data; + FFSchroEncodedFrame *enc_frame = data; av_freep(&enc_frame->p_encbuf); av_free(enc_frame); @@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk int enc_size = 0; SchroEncoderParams *p_schro_params = avccontext->priv_data; SchroEncoder *encoder = p_schro_params->encoder; - struct DiracSchroEncodedFrame *p_frame_output = NULL; + struct FFSchroEncodedFrame *p_frame_output = NULL; int go = 1; SchroBuffer *enc_buf; int presentation_frame; @@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk } /* Create output frame. */ - p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame)); + p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame)); /* Set output data. */ p_frame_output->size = p_schro_params->enc_buf_size; p_frame_output->p_encbuf = p_schro_params->enc_buf; @@ -345,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk * through 17 represesent the frame number. */ p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); - ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue, - p_frame_output); + ff_schro_queue_push_back(&p_schro_params->enc_frame_queue, + p_frame_output); p_schro_params->enc_buf_size = 0; p_schro_params->enc_buf = NULL; @@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk p_schro_params->eos_pulled) last_frame_in_sequence = 1; - p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue); + p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue); if (!p_frame_output) return 0; @@ -425,8 +424,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) schro_encoder_free(p_schro_params->encoder); /* Free data in the output frame queue. */ - ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue, - SchroedingerFreeFrame); + ff_schro_queue_free(&p_schro_params->enc_frame_queue, + SchroedingerFreeFrame); /* Free the encoder buffer. */ From fdc918632f5c16cf377a2170cd2f101933fb15ff Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 14 Apr 2012 15:39:22 +0200 Subject: [PATCH 18/18] libschroedinger: Switch to function names more in line with Libav style. --- libavcodec/libschroedinger.c | 4 ++-- libavcodec/libschroedingerdec.c | 10 +++++----- libavcodec/libschroedingerenc.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/libschroedinger.c b/libavcodec/libschroedinger.c index fb0bfaa84d..2046761713 100644 --- a/libavcodec/libschroedinger.c +++ b/libavcodec/libschroedinger.c @@ -163,7 +163,7 @@ int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, return -1; } -static void FreeSchroFrame(SchroFrame *frame, void *priv) +static void free_schro_frame(SchroFrame *frame, void *priv) { AVPicture *p_pic = priv; @@ -195,7 +195,7 @@ SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext, p_frame->format = schro_frame_fmt; p_frame->width = y_width; p_frame->height = y_height; - schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic); + schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic); for (i = 0; i < 3; ++i) { p_frame->components[i].width = i ? uv_width : y_width; diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index 20f9447fc6..6a3b9bdb99 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -75,14 +75,14 @@ static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, av_freep(&priv); } -static void SchroParseContextInit(SchroParseUnitContext *parse_ctx, - const uint8_t *buf, int buf_size) +static void parse_context_init(SchroParseUnitContext *parse_ctx, + const uint8_t *buf, int buf_size) { parse_ctx->buf = buf; parse_ctx->buf_size = buf_size; } -static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx) +static SchroBuffer *find_next_parse_unit(SchroParseUnitContext *parse_ctx) { SchroBuffer *enc_buf = NULL; int next_pu_offset = 0; @@ -219,7 +219,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, *data_size = 0; - SchroParseContextInit(&parse_ctx, buf, buf_size); + parse_context_init(&parse_ctx, buf, buf_size); if (!buf_size) { if (!p_schro_params->eos_signalled) { state = schro_decoder_push_end_of_stream(decoder); @@ -229,7 +229,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, /* Loop through all the individual parse units in the input buffer */ do { - if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) { + if ((enc_buf = find_next_parse_unit(&parse_ctx))) { /* Push buffer into decoder. */ if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index d9b8b06a7d..63d354e04e 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -79,7 +79,7 @@ typedef struct SchroEncoderParams { /** * Works out Schro-compatible chroma format. */ -static int SetSchroChromaFormat(AVCodecContext *avccontext) +static int set_chroma_format(AVCodecContext *avccontext) { int num_formats = sizeof(schro_pixel_format_map) / sizeof(schro_pixel_format_map[0]); @@ -128,7 +128,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) p_schro_params->format->width = avccontext->width; p_schro_params->format->height = avccontext->height; - if (SetSchroChromaFormat(avccontext) == -1) + if (set_chroma_format(avccontext) == -1) return -1; if (avccontext->color_primaries == AVCOL_PRI_BT709) { @@ -258,7 +258,7 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, return in_frame; } -static void SchroedingerFreeFrame(void *data) +static void libschroedinger_free_frame(void *data) { FFSchroEncodedFrame *enc_frame = data; @@ -411,7 +411,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk error: /* free frame */ - SchroedingerFreeFrame(p_frame_output); + libschroedinger_free_frame(p_frame_output); return ret; } @@ -425,7 +425,7 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) /* Free data in the output frame queue. */ ff_schro_queue_free(&p_schro_params->enc_frame_queue, - SchroedingerFreeFrame); + libschroedinger_free_frame); /* Free the encoder buffer. */