* qatar/master: libschroedinger: Switch to function names more in line with Libav style. Move code shared between libdirac and libschroedinger to libschroedinger. lavfi: uninline avfilter_copy_buffer_ref_props(). lavf: add missing '*' in a doxy. h264: Remove a commented-out function pointer typedef. txd: Remove write-only variable in txd_decode_frame(). mmvideo.c: Remove unused variable in mm_decode_pal(). build: cosmetics: Add missing end-of-line backslashes to item lists. build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. libschroedinger: Move a function to avoid a forward declaration. pthread: warn on high thread counts vf_yadif: fix missing error handling for avfilter_poll_frame() avprobe: allow showing only one container/stream property. lavfi: support audio in avfilter_copy_frame_props(). lavfi: avfilter_merge_formats: handle case where inputs are same lavc: add sample rate and channel layout to AVFrame. zerocodec: check if the previous frame is missing doc: clarify check for NULL pointer style Conflicts: doc/APIchanges doc/developer.texi ffprobe.c libavcodec/Makefile libavcodec/avcodec.h libavcodec/libdirac_libschro.c libavcodec/libdirac_libschro.h libavcodec/mmvideo.c libavcodec/txd.c libavcodec/version.h libavcodec/zerocodec.c libavfilter/Makefile libavfilter/avfilter.c libavfilter/version.h libavformat/Makefile libavutil/Makefile
Unified · Split
| @@ -106,6 +106,11 @@ stream. · 105 unmodified lines | ||
| 106 | 106 | All the container format information is printed within a section with |
| 107 | 107 | name "FORMAT". |
| 108 | 108 | |
| 109 | +@item -show_format_entry @var{name} | |
| 110 | +Like @option{-show_format}, but only prints the specified entry of the | |
| 111 | +container format information, rather than all. This option may be given more | |
| 112 | +than once, then all specified entries will be shown. | |
| 113 | + | |
| 109 | 114 | @item -show_packets |
| 110 | 115 | Show information about each packet contained in the input multimedia |
| 111 | 116 | stream. |
| @@ -50,6 +50,7 @@ static int do_read_packets = 0; · 49 unmodified lines | ||
| 50 | 50 | static int do_show_error = 0; |
| 51 | 51 | static int do_show_format = 0; |
| 52 | 52 | static int do_show_frames = 0; |
| 53 | +static AVDictionary *fmt_entries_to_show = NULL; | |
| 53 | 54 | static int do_show_packets = 0; |
| 54 | 55 | static int do_show_streams = 0; |
| 55 | 56 | static int do_show_program_version = 0; |
| @@ -81,6 +82,7 @@ static uint64_t *nb_streams_frames; · 25 unmodified lines | ||
| 81 | 82 | |
| 82 | 83 | void av_noreturn exit_program(int ret) |
| 83 | 84 | { |
| 85 | + av_dict_free(&fmt_entries_to_show); | |
| 84 | 86 | exit(ret); |
| 85 | 87 | } |
| 86 | 88 | |
| @@ -279,8 +281,10 @@ static inline void writer_print_section_footer(WriterContext *wctx, · 192 unmodified lines | ||
| 279 | 281 | static inline void writer_print_integer(WriterContext *wctx, |
| 280 | 282 | const char *key, long long int val) |
| 281 | 283 | { |
| 282 | − wctx->writer->print_integer(wctx, key, val); | |
| 283 | − wctx->nb_item++; | |
| 284 | + if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |
| 285 | + wctx->writer->print_integer(wctx, key, val); | |
| 286 | + wctx->nb_item++; | |
| 287 | + } | |
| 284 | 288 | } |
| 285 | 289 | |
| 286 | 290 | static inline void writer_print_string(WriterContext *wctx, |
| @@ -288,8 +292,10 @@ static inline void writer_print_string(WriterContext *wctx, · 1 unmodified line | ||
| 288 | 292 | { |
| 289 | 293 | if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) |
| 290 | 294 | return; |
| 291 | − wctx->writer->print_string(wctx, key, val); | |
| 292 | − wctx->nb_item++; | |
| 295 | + if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |
| 296 | + wctx->writer->print_string(wctx, key, val); | |
| 297 | + wctx->nb_item++; | |
| 298 | + } | |
| 293 | 299 | } |
| 294 | 300 | |
| 295 | 301 | static void writer_print_time(WriterContext *wctx, const char *key, |
| @@ -297,12 +303,14 @@ static void writer_print_time(WriterContext *wctx, const char *key, · 1 unmodified line | ||
| 297 | 303 | { |
| 298 | 304 | char buf[128]; |
| 299 | 305 | |
| 300 | − if (ts == AV_NOPTS_VALUE) { | |
| 301 | − writer_print_string(wctx, key, "N/A", 1); | |
| 302 | − } else { | |
| 303 | − double d = ts * av_q2d(*time_base); | |
| 304 | − value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str}); | |
| 305 | − writer_print_string(wctx, key, buf, 0); | |
| 306 | + if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |
| 307 | + if (ts == AV_NOPTS_VALUE) { | |
| 308 | + writer_print_string(wctx, key, "N/A", 1); | |
| 309 | + } else { | |
| 310 | + double d = ts * av_q2d(*time_base); | |
| 311 | + value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str}); | |
| 312 | + writer_print_string(wctx, key, buf, 0); | |
| 313 | + } | |
| 306 | 314 | } |
| 307 | 315 | } |
| 308 | 316 | |
| @@ -1428,6 +1436,20 @@ static void show_streams(WriterContext *w, AVFormatContext *fmt_ctx) · 1119 unmodified lines | ||
| 1428 | 1436 | show_stream(w, fmt_ctx, i); |
| 1429 | 1437 | } |
| 1430 | 1438 | |
| 1439 | +static void print_format_entry(const char *tag, | |
| 1440 | + const char *val) | |
| 1441 | +{ | |
| 1442 | + if (!fmt_entries_to_show) { | |
| 1443 | + if (tag) { | |
| 1444 | + printf("%s=%s\n", tag, val); | |
| 1445 | + } else { | |
| 1446 | + printf("%s\n", val); | |
| 1447 | + } | |
| 1448 | + } else if (tag && av_dict_get(fmt_entries_to_show, tag, NULL, 0)) { | |
| 1449 | + printf("%s=%s\n", tag, val); | |
| 1450 | + } | |
| 1451 | +} | |
| 1452 | + | |
| 1431 | 1453 | static void show_format(WriterContext *w, AVFormatContext *fmt_ctx) |
| 1432 | 1454 | { |
| 1433 | 1455 | char val_str[128]; |
| @@ -1621,6 +1643,13 @@ static int opt_format(const char *opt, const char *arg) · 187 unmodified lines | ||
| 1621 | 1643 | return 0; |
| 1622 | 1644 | } |
| 1623 | 1645 | |
| 1646 | +static int opt_show_format_entry(const char *opt, const char *arg) | |
| 1647 | +{ | |
| 1648 | + do_show_format = 1; | |
| 1649 | + av_dict_set(&fmt_entries_to_show, arg, "", 0); | |
| 1650 | + return 0; | |
| 1651 | +} | |
| 1652 | + | |
| 1624 | 1653 | static void opt_input_file(void *optctx, const char *arg) |
| 1625 | 1654 | { |
| 1626 | 1655 | if (input_filename) { |
| @@ -1678,6 +1707,8 @@ static const OptionDef options[] = { · 51 unmodified lines | ||
| 1678 | 1707 | { "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" }, |
| 1679 | 1708 | { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, |
| 1680 | 1709 | { "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" }, |
| 1710 | + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, | |
| 1711 | + "show a particular entry from the format/container info", "entry" }, | |
| 1681 | 1712 | { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, |
| 1682 | 1713 | { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, |
| 1683 | 1714 | { "count_frames", OPT_BOOL, {(void*)&do_count_frames}, "count the number of frames per stream" }, |
| @@ -3,7 +3,14 @@ include $(SUBDIR)../config.mak · 2 unmodified lines | ||
| 3 | 3 | NAME = avcodec |
| 4 | 4 | FFLIBS = avutil |
| 5 | 5 | |
| 6 | −HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vda.h vdpau.h version.h xvmc.h | |
| 6 | +HEADERS = avcodec.h \ | |
| 7 | + avfft.h \ | |
| 8 | + dxva2.h \ | |
| 9 | + vaapi.h \ | |
| 10 | + vda.h \ | |
| 11 | + vdpau.h \ | |
| 12 | + version.h \ | |
| 13 | + xvmc.h \ | |
| 7 | 14 | |
| 8 | 15 | OBJS = allcodecs.o \ |
| 9 | 16 | audioconvert.o \ |
| @@ -651,11 +658,9 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o · 641 unmodified lines | ||
| 651 | 658 | OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o |
| 652 | 659 | OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o |
| 653 | 660 | OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ |
| 654 | − libschroedinger.o \ | |
| 655 | − libdirac_libschro.o | |
| 661 | + libschroedinger.o | |
| 656 | 662 | OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ |
| 657 | − libschroedinger.o \ | |
| 658 | − libdirac_libschro.o | |
| 663 | + libschroedinger.o | |
| 659 | 664 | OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o |
| 660 | 665 | OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o |
| 661 | 666 | OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o |
| @@ -753,7 +758,8 @@ SKIPHEADERS += %_tablegen.h \ · 91 unmodified lines | ||
| 753 | 758 | aac_tablegen_decl.h \ |
| 754 | 759 | fft-internal.h \ |
| 755 | 760 | tableprint.h \ |
| 756 | − $(ARCH)/vp56_arith.h | |
| 761 | + $(ARCH)/vp56_arith.h \ | |
| 762 | + | |
| 757 | 763 | SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h |
| 758 | 764 | SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h |
| 759 | 765 | SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h |
| @@ -762,13 +768,28 @@ SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h · 2 unmodified lines | ||
| 762 | 768 | SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h |
| 763 | 769 | SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h |
| 764 | 770 | |
| 765 | −TESTPROGS = cabac dct fft fft-fixed golomb iirfilter rangecoder snowenc | |
| 771 | +TESTPROGS = cabac \ | |
| 772 | + dct \ | |
| 773 | + fft \ | |
| 774 | + fft-fixed \ | |
| 775 | + golomb \ | |
| 776 | + iirfilter \ | |
| 777 | + rangecoder \ | |
| 778 | + snowenc \ | |
| 779 | + | |
| 766 | 780 | TESTPROGS-$(HAVE_MMX) += motion |
| 767 | 781 | TESTOBJS = dctref.o |
| 768 | 782 | |
| 769 | −HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ | |
| 770 | − dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ | |
| 771 | − pcm_tablegen qdm2_tablegen sinewin_tablegen | |
| 783 | +HOSTPROGS = aac_tablegen \ | |
| 784 | + aacps_tablegen \ | |
| 785 | + cbrt_tablegen \ | |
| 786 | + cos_tablegen \ | |
| 787 | + dv_tablegen \ | |
| 788 | + motionpixels_tablegen \ | |
| 789 | + mpegaudio_tablegen \ | |
| 790 | + pcm_tablegen \ | |
| 791 | + qdm2_tablegen \ | |
| 792 | + sinewin_tablegen \ | |
| 772 | 793 | |
| 773 | 794 | CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) |
| 774 | 795 | |
| @@ -1242,6 +1242,22 @@ typedef struct AVFrame { · 1241 unmodified lines | ||
| 1242 | 1242 | */ |
| 1243 | 1243 | uint8_t motion_subsample_log2; |
| 1244 | 1244 | |
| 1245 | + /** | |
| 1246 | + * Sample rate of the audio data. | |
| 1247 | + * | |
| 1248 | + * - encoding: unused | |
| 1249 | + * - decoding: read by user | |
| 1250 | + */ | |
| 1251 | + int sample_rate; | |
| 1252 | + | |
| 1253 | + /** | |
| 1254 | + * Channel layout of the audio data. | |
| 1255 | + * | |
| 1256 | + * - encoding: unused | |
| 1257 | + * - decoding: read by user. | |
| 1258 | + */ | |
| 1259 | + uint64_t channel_layout; | |
| 1260 | + | |
| 1245 | 1261 | /** |
| 1246 | 1262 | * frame timestamp estimated using various heuristics, in stream time base |
| 1247 | 1263 | * Code outside libavcodec should access this field using: |
| @@ -1260,24 +1276,6 @@ typedef struct AVFrame { · 12 unmodified lines | ||
| 1260 | 1276 | */ |
| 1261 | 1277 | int64_t pkt_pos; |
| 1262 | 1278 | |
| 1263 | − /** | |
| 1264 | − * channel layout of the audio frame | |
| 1265 | − * - encoding: unused | |
| 1266 | − * - decoding: read by user. | |
| 1267 | − * Code outside libavcodec should access this field using: | |
| 1268 | − * av_frame_get_channel_layout(frame) | |
| 1269 | − */ | |
| 1270 | − int64_t channel_layout; | |
| 1271 | − | |
| 1272 | − /** | |
| 1273 | − * sample rate of the audio frame | |
| 1274 | − * - encoding: unused | |
| 1275 | − * - decoding: read by user. | |
| 1276 | − * Code outside libavcodec should access this field using: | |
| 1277 | − * av_frame_get_channel_layout(frame) | |
| 1278 | − */ | |
| 1279 | − int sample_rate; | |
| 1280 | − | |
| 1281 | 1279 | } AVFrame; |
| 1282 | 1280 | |
| 1283 | 1281 | /** |
| @@ -30,7 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <stdint.h> |
| 31 | 31 | #include "dsputil.h" |
| 32 | 32 | |
| 33 | −//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); | |
| 34 | 33 | typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, |
| 35 | 34 | int log2_denom, int weight, int offset); |
| 36 | 35 | typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, |
| @@ -1,113 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > | |
| 3 | − * | |
| 4 | − * This file is part of FFmpeg. | |
| 5 | − * | |
| 6 | − * FFmpeg is free software; you can redistribute it and/or | |
| 7 | − * modify it under the terms of the GNU Lesser General Public | |
| 8 | − * License as published by the Free Software Foundation; either | |
| 9 | − * version 2.1 of the License, or (at your option) any later version. | |
| 10 | − * | |
| 11 | − * FFmpeg is distributed in the hope that it will be useful, | |
| 12 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | − * Lesser General Public License for more details. | |
| 15 | − * | |
| 16 | − * You should have received a copy of the GNU Lesser General Public | |
| 17 | − * License along with FFmpeg; if not, write to the Free Software | |
| 18 | − * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 19 | − */ | |
| 20 | − | |
| 21 | −/** | |
| 22 | −* @file | |
| 23 | −* functions common to libdirac and libschroedinger | |
| 24 | −*/ | |
| 25 | − | |
| 26 | −#include "libdirac_libschro.h" | |
| 27 | − | |
| 28 | −static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = { | |
| 29 | − { 640, 480, 24000, 1001}, | |
| 30 | − { 176, 120, 15000, 1001}, | |
| 31 | − { 176, 144, 25, 2 }, | |
| 32 | − { 352, 240, 15000, 1001}, | |
| 33 | − { 352, 288, 25, 2 }, | |
| 34 | − { 704, 480, 15000, 1001}, | |
| 35 | − { 704, 576, 25, 2 }, | |
| 36 | − { 720, 480, 30000, 1001}, | |
| 37 | − { 720, 576, 25, 1 }, | |
| 38 | − { 1280, 720, 60000, 1001}, | |
| 39 | − { 1280, 720, 50, 1 }, | |
| 40 | − { 1920, 1080, 30000, 1001}, | |
| 41 | − { 1920, 1080, 25, 1 }, | |
| 42 | − { 1920, 1080, 60000, 1001}, | |
| 43 | − { 1920, 1080, 50, 1 }, | |
| 44 | − { 2048, 1080, 24, 1 }, | |
| 45 | − { 4096, 2160, 24, 1 }, | |
| 46 | −}; | |
| 47 | − | |
| 48 | −unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext) | |
| 49 | −{ | |
| 50 | − unsigned int ret_idx = 0; | |
| 51 | − unsigned int idx; | |
| 52 | − unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) / | |
| 53 | − sizeof(ff_dirac_schro_video_format_info[0]); | |
| 54 | − | |
| 55 | − for (idx = 1; idx < num_formats; ++idx) { | |
| 56 | − const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx]; | |
| 57 | − if (avccontext->width == vf->width && | |
| 58 | − avccontext->height == vf->height) { | |
| 59 | − ret_idx = idx; | |
| 60 | − if (avccontext->time_base.den == vf->frame_rate_num && | |
| 61 | − avccontext->time_base.num == vf->frame_rate_denom) | |
| 62 | − return idx; | |
| 63 | − } | |
| 64 | − } | |
| 65 | − return ret_idx; | |
| 66 | −} | |
| 67 | − | |
| 68 | −void ff_dirac_schro_queue_init(DiracSchroQueue *queue) | |
| 69 | −{ | |
| 70 | − queue->p_head = queue->p_tail = NULL; | |
| 71 | − queue->size = 0; | |
| 72 | −} | |
| 73 | − | |
| 74 | −void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | |
| 75 | − void (*free_func)(void *)) | |
| 76 | −{ | |
| 77 | − while (queue->p_head) | |
| 78 | − free_func(ff_dirac_schro_queue_pop(queue)); | |
| 79 | −} | |
| 80 | − | |
| 81 | −int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data) | |
| 82 | −{ | |
| 83 | − DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement)); | |
| 84 | − | |
| 85 | − if (!p_new) | |
| 86 | − return -1; | |
| 87 | − | |
| 88 | − p_new->data = p_data; | |
| 89 | − | |
| 90 | − if (!queue->p_head) | |
| 91 | − queue->p_head = p_new; | |
| 92 | − else | |
| 93 | − queue->p_tail->next = p_new; | |
| 94 | − queue->p_tail = p_new; | |
| 95 | − | |
| 96 | − ++queue->size; | |
| 97 | − return 0; | |
| 98 | −} | |
| 99 | − | |
| 100 | −void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue) | |
| 101 | −{ | |
| 102 | − DiracSchroQueueElement *top = queue->p_head; | |
| 103 | − | |
| 104 | − if (top) { | |
| 105 | − void *data = top->data; | |
| 106 | − queue->p_head = queue->p_head->next; | |
| 107 | − --queue->size; | |
| 108 | − av_freep(&top); | |
| 109 | − return data; | |
| 110 | − } | |
| 111 | − | |
| 112 | − return NULL; | |
| 113 | −} | |
| @@ -1,105 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > | |
| 3 | − * | |
| 4 | − * This file is part of FFmpeg. | |
| 5 | − * | |
| 6 | − * FFmpeg is free software; you can redistribute it and/or | |
| 7 | − * modify it under the terms of the GNU Lesser General Public | |
| 8 | − * License as published by the Free Software Foundation; either | |
| 9 | − * version 2.1 of the License, or (at your option) any later version. | |
| 10 | − * | |
| 11 | − * FFmpeg is distributed in the hope that it will be useful, | |
| 12 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | − * Lesser General Public License for more details. | |
| 15 | − * | |
| 16 | − * You should have received a copy of the GNU Lesser General Public | |
| 17 | − * License along with FFmpeg; if not, write to the Free Software | |
| 18 | − * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 19 | − */ | |
| 20 | − | |
| 21 | −/** | |
| 22 | −* @file | |
| 23 | −* data structures common to libdirac and libschroedinger | |
| 24 | −*/ | |
| 25 | − | |
| 26 | −#ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H | |
| 27 | −#define AVCODEC_LIBDIRAC_LIBSCHRO_H | |
| 28 | − | |
| 29 | −#include "avcodec.h" | |
| 30 | − | |
| 31 | −typedef struct { | |
| 32 | − uint16_t width; | |
| 33 | − uint16_t height; | |
| 34 | − uint16_t frame_rate_num; | |
| 35 | − uint16_t frame_rate_denom; | |
| 36 | −} DiracSchroVideoFormatInfo; | |
| 37 | − | |
| 38 | −/** | |
| 39 | −* Returns the index into the Dirac Schro common video format info table | |
| 40 | −*/ | |
| 41 | −unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext); | |
| 42 | − | |
| 43 | −/** | |
| 44 | −* contains a single encoded frame returned from Dirac or Schroedinger | |
| 45 | −*/ | |
| 46 | −typedef struct DiracSchroEncodedFrame { | |
| 47 | − /** encoded frame data */ | |
| 48 | − uint8_t *p_encbuf; | |
| 49 | − | |
| 50 | − /** encoded frame size */ | |
| 51 | − uint32_t size; | |
| 52 | − | |
| 53 | − /** encoded frame number. Will be used as pts */ | |
| 54 | − uint32_t frame_num; | |
| 55 | − | |
| 56 | − /** key frame flag. 1 : is key frame , 0 : in not key frame */ | |
| 57 | − uint16_t key_frame; | |
| 58 | −} DiracSchroEncodedFrame; | |
| 59 | − | |
| 60 | −/** | |
| 61 | −* queue element | |
| 62 | −*/ | |
| 63 | −typedef struct DiracSchroQueueElement { | |
| 64 | − /** Data to be stored in queue*/ | |
| 65 | − void *data; | |
| 66 | − /** Pointer to next element queue */ | |
| 67 | − struct DiracSchroQueueElement *next; | |
| 68 | −} DiracSchroQueueElement; | |
| 69 | − | |
| 70 | − | |
| 71 | −/** | |
| 72 | −* A simple queue implementation used in libdirac and libschroedinger | |
| 73 | −*/ | |
| 74 | −typedef struct DiracSchroQueue { | |
| 75 | − /** Pointer to head of queue */ | |
| 76 | − DiracSchroQueueElement *p_head; | |
| 77 | − /** Pointer to tail of queue */ | |
| 78 | − DiracSchroQueueElement *p_tail; | |
| 79 | − /** Queue size*/ | |
| 80 | − int size; | |
| 81 | −} DiracSchroQueue; | |
| 82 | − | |
| 83 | −/** | |
| 84 | −* Initialise the queue | |
| 85 | −*/ | |
| 86 | −void ff_dirac_schro_queue_init(DiracSchroQueue *queue); | |
| 87 | − | |
| 88 | −/** | |
| 89 | −* Add an element to the end of the queue | |
| 90 | −*/ | |
| 91 | −int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data); | |
| 92 | − | |
| 93 | −/** | |
| 94 | −* Return the first element in the queue | |
| 95 | −*/ | |
| 96 | −void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue); | |
| 97 | − | |
| 98 | −/** | |
| 99 | −* Free the queue resources. free_func is a function supplied by the caller to | |
| 100 | −* free any resources allocated by the caller. The data field of the queue | |
| 101 | −* element is passed to it. | |
| 102 | −*/ | |
| 103 | −void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | |
| 104 | − void (*free_func)(void *)); | |
| 105 | −#endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ | |
| @@ -23,12 +23,97 @@ · 22 unmodified lines | ||
| 23 | 23 | * function definitions common to libschroedinger decoder and encoder |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | −#include "libdirac_libschro.h" | |
| 27 | 26 | #include "libschroedinger.h" |
| 28 | 27 | |
| 28 | +static const SchroVideoFormatInfo ff_schro_video_format_info[] = { | |
| 29 | + { 640, 480, 24000, 1001}, | |
| 30 | + { 176, 120, 15000, 1001}, | |
| 31 | + { 176, 144, 25, 2 }, | |
| 32 | + { 352, 240, 15000, 1001}, | |
| 33 | + { 352, 288, 25, 2 }, | |
| 34 | + { 704, 480, 15000, 1001}, | |
| 35 | + { 704, 576, 25, 2 }, | |
| 36 | + { 720, 480, 30000, 1001}, | |
| 37 | + { 720, 576, 25, 1 }, | |
| 38 | + { 1280, 720, 60000, 1001}, | |
| 39 | + { 1280, 720, 50, 1 }, | |
| 40 | + { 1920, 1080, 30000, 1001}, | |
| 41 | + { 1920, 1080, 25, 1 }, | |
| 42 | + { 1920, 1080, 60000, 1001}, | |
| 43 | + { 1920, 1080, 50, 1 }, | |
| 44 | + { 2048, 1080, 24, 1 }, | |
| 45 | + { 4096, 2160, 24, 1 }, | |
| 46 | +}; | |
| 47 | + | |
| 48 | +static unsigned int get_video_format_idx(AVCodecContext *avccontext) | |
| 49 | +{ | |
| 50 | + unsigned int ret_idx = 0; | |
| 51 | + unsigned int idx; | |
| 52 | + unsigned int num_formats = sizeof(ff_schro_video_format_info) / | |
| 53 | + sizeof(ff_schro_video_format_info[0]); | |
| 54 | + | |
| 55 | + for (idx = 1; idx < num_formats; ++idx) { | |
| 56 | + const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx]; | |
| 57 | + if (avccontext->width == vf->width && | |
| 58 | + avccontext->height == vf->height) { | |
| 59 | + ret_idx = idx; | |
| 60 | + if (avccontext->time_base.den == vf->frame_rate_num && | |
| 61 | + avccontext->time_base.num == vf->frame_rate_denom) | |
| 62 | + return idx; | |
| 63 | + } | |
| 64 | + } | |
| 65 | + return ret_idx; | |
| 66 | +} | |
| 67 | + | |
| 68 | +void ff_schro_queue_init(FFSchroQueue *queue) | |
| 69 | +{ | |
| 70 | + queue->p_head = queue->p_tail = NULL; | |
| 71 | + queue->size = 0; | |
| 72 | +} | |
| 73 | + | |
| 74 | +void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)) | |
| 75 | +{ | |
| 76 | + while (queue->p_head) | |
| 77 | + free_func(ff_schro_queue_pop(queue)); | |
| 78 | +} | |
| 79 | + | |
| 80 | +int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data) | |
| 81 | +{ | |
| 82 | + FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement)); | |
| 83 | + | |
| 84 | + if (!p_new) | |
| 85 | + return -1; | |
| 86 | + | |
| 87 | + p_new->data = p_data; | |
| 88 | + | |
| 89 | + if (!queue->p_head) | |
| 90 | + queue->p_head = p_new; | |
| 91 | + else | |
| 92 | + queue->p_tail->next = p_new; | |
| 93 | + queue->p_tail = p_new; | |
| 94 | + | |
| 95 | + ++queue->size; | |
| 96 | + return 0; | |
| 97 | +} | |
| 98 | + | |
| 99 | +void *ff_schro_queue_pop(FFSchroQueue *queue) | |
| 100 | +{ | |
| 101 | + FFSchroQueueElement *top = queue->p_head; | |
| 102 | + | |
| 103 | + if (top) { | |
| 104 | + void *data = top->data; | |
| 105 | + queue->p_head = queue->p_head->next; | |
| 106 | + --queue->size; | |
| 107 | + av_freep(&top); | |
| 108 | + return data; | |
| 109 | + } | |
| 110 | + | |
| 111 | + return NULL; | |
| 112 | +} | |
| 113 | + | |
| 29 | 114 | /** |
| 30 | 115 | * Schroedinger video preset table. Ensure that this tables matches up correctly |
| 31 | −* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c. | |
| 116 | +* with the ff_schro_video_format_info table. | |
| 32 | 117 | */ |
| 33 | 118 | static const SchroVideoFormatEnum ff_schro_video_formats[]={ |
| 34 | 119 | SCHRO_VIDEO_FORMAT_CUSTOM , |
| @@ -55,7 +140,7 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext · 20 unmodified lines | ||
| 55 | 140 | unsigned int num_formats = sizeof(ff_schro_video_formats) / |
| 56 | 141 | sizeof(ff_schro_video_formats[0]); |
| 57 | 142 | |
| 58 | − unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext); | |
| 143 | + unsigned int idx = get_video_format_idx(avccontext); | |
| 59 | 144 | |
| 60 | 145 | return (idx < num_formats) ? ff_schro_video_formats[idx] : |
| 61 | 146 | SCHRO_VIDEO_FORMAT_CUSTOM; |
| @@ -78,7 +163,7 @@ int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, · 16 unmodified lines | ||
| 78 | 163 | return -1; |
| 79 | 164 | } |
| 80 | 165 | |
| 81 | −static void FreeSchroFrame(SchroFrame *frame, void *priv) | |
| 166 | +static void free_schro_frame(SchroFrame *frame, void *priv) | |
| 82 | 167 | { |
| 83 | 168 | AVPicture *p_pic = priv; |
| 84 | 169 | |
| @@ -110,7 +195,7 @@ SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext, · 25 unmodified lines | ||
| 110 | 195 | p_frame->format = schro_frame_fmt; |
| 111 | 196 | p_frame->width = y_width; |
| 112 | 197 | p_frame->height = y_height; |
| 113 | − schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic); | |
| 198 | + schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic); | |
| 114 | 199 | |
| 115 | 200 | for (i = 0; i < 3; ++i) { |
| 116 | 201 | p_frame->components[i].width = i ? uv_width : y_width; |
| @@ -28,8 +28,78 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include <schroedinger/schrobitstream.h> |
| 30 | 30 | #include <schroedinger/schroframe.h> |
| 31 | + | |
| 31 | 32 | #include "avcodec.h" |
| 32 | 33 | |
| 34 | +typedef struct { | |
| 35 | + uint16_t width; | |
| 36 | + uint16_t height; | |
| 37 | + uint16_t frame_rate_num; | |
| 38 | + uint16_t frame_rate_denom; | |
| 39 | +} SchroVideoFormatInfo; | |
| 40 | + | |
| 41 | +/** | |
| 42 | +* contains a single encoded frame returned from Dirac or Schroedinger | |
| 43 | +*/ | |
| 44 | +typedef struct FFSchroEncodedFrame { | |
| 45 | + /** encoded frame data */ | |
| 46 | + uint8_t *p_encbuf; | |
| 47 | + | |
| 48 | + /** encoded frame size */ | |
| 49 | + uint32_t size; | |
| 50 | + | |
| 51 | + /** encoded frame number. Will be used as pts */ | |
| 52 | + uint32_t frame_num; | |
| 53 | + | |
| 54 | + /** key frame flag. 1 : is key frame , 0 : in not key frame */ | |
| 55 | + uint16_t key_frame; | |
| 56 | +} FFSchroEncodedFrame; | |
| 57 | + | |
| 58 | +/** | |
| 59 | +* queue element | |
| 60 | +*/ | |
| 61 | +typedef struct FFSchroQueueElement { | |
| 62 | + /** Data to be stored in queue*/ | |
| 63 | + void *data; | |
| 64 | + /** Pointer to next element queue */ | |
| 65 | + struct FFSchroQueueElement *next; | |
| 66 | +} FFSchroQueueElement; | |
| 67 | + | |
| 68 | + | |
| 69 | +/** | |
| 70 | +* A simple queue implementation used in libschroedinger | |
| 71 | +*/ | |
| 72 | +typedef struct FFSchroQueue { | |
| 73 | + /** Pointer to head of queue */ | |
| 74 | + FFSchroQueueElement *p_head; | |
| 75 | + /** Pointer to tail of queue */ | |
| 76 | + FFSchroQueueElement *p_tail; | |
| 77 | + /** Queue size*/ | |
| 78 | + int size; | |
| 79 | +} FFSchroQueue; | |
| 80 | + | |
| 81 | +/** | |
| 82 | +* Initialise the queue | |
| 83 | +*/ | |
| 84 | +void ff_schro_queue_init(FFSchroQueue *queue); | |
| 85 | + | |
| 86 | +/** | |
| 87 | +* Add an element to the end of the queue | |
| 88 | +*/ | |
| 89 | +int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data); | |
| 90 | + | |
| 91 | +/** | |
| 92 | +* Return the first element in the queue | |
| 93 | +*/ | |
| 94 | +void *ff_schro_queue_pop(FFSchroQueue *queue); | |
| 95 | + | |
| 96 | +/** | |
| 97 | +* Free the queue resources. free_func is a function supplied by the caller to | |
| 98 | +* free any resources allocated by the caller. The data field of the queue | |
| 99 | +* element is passed to it. | |
| 100 | +*/ | |
| 101 | +void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)); | |
| 102 | + | |
| 33 | 103 | static const struct { |
| 34 | 104 | enum PixelFormat ff_pix_fmt; |
| 35 | 105 | SchroChromaFormat schro_pix_fmt; |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #include "libavutil/imgutils.h" |
| 31 | 31 | #include "avcodec.h" |
| 32 | −#include "libdirac_libschro.h" | |
| 33 | 32 | #include "libschroedinger.h" |
| 34 | 33 | |
| 35 | 34 | #undef NDEBUG |
| @@ -52,7 +51,7 @@ typedef struct SchroDecoderParams { · 16 unmodified lines | ||
| 52 | 51 | SchroDecoder* decoder; |
| 53 | 52 | |
| 54 | 53 | /** queue storing decoded frames */ |
| 55 | − DiracSchroQueue dec_frame_queue; | |
| 54 | + FFSchroQueue dec_frame_queue; | |
| 56 | 55 | |
| 57 | 56 | /** end of sequence signalled */ |
| 58 | 57 | int eos_signalled; |
| @@ -71,16 +70,19 @@ typedef struct SchroParseUnitContext { · 12 unmodified lines | ||
| 71 | 70 | |
| 72 | 71 | |
| 73 | 72 | static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, |
| 74 | − void *priv); | |
| 73 | + void *priv) | |
| 74 | +{ | |
| 75 | + av_freep(&priv); | |
| 76 | +} | |
| 75 | 77 | |
| 76 | −static void SchroParseContextInit(SchroParseUnitContext *parse_ctx, | |
| 77 | − const uint8_t *buf, int buf_size) | |
| 78 | +static void parse_context_init(SchroParseUnitContext *parse_ctx, | |
| 79 | + const uint8_t *buf, int buf_size) | |
| 78 | 80 | { |
| 79 | 81 | parse_ctx->buf = buf; |
| 80 | 82 | parse_ctx->buf_size = buf_size; |
| 81 | 83 | } |
| 82 | 84 | |
| 83 | −static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx) | |
| 85 | +static SchroBuffer *find_next_parse_unit(SchroParseUnitContext *parse_ctx) | |
| 84 | 86 | { |
| 85 | 87 | SchroBuffer *enc_buf = NULL; |
| 86 | 88 | int next_pu_offset = 0; |
| @@ -152,16 +154,10 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) · 65 unmodified lines | ||
| 152 | 154 | return -1; |
| 153 | 155 | |
| 154 | 156 | /* Initialize the decoded frame queue. */ |
| 155 | − ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | |
| 157 | + ff_schro_queue_init(&p_schro_params->dec_frame_queue); | |
| 156 | 158 | return 0; |
| 157 | 159 | } |
| 158 | 160 | |
| 159 | −static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, | |
| 160 | − void *priv) | |
| 161 | −{ | |
| 162 | − av_freep(&priv); | |
| 163 | −} | |
| 164 | − | |
| 165 | 161 | static void libschroedinger_decode_frame_free(void *frame) |
| 166 | 162 | { |
| 167 | 163 | schro_frame_unref(frame); |
| @@ -223,7 +219,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 55 unmodified lines | ||
| 223 | 219 | |
| 224 | 220 | *data_size = 0; |
| 225 | 221 | |
| 226 | − SchroParseContextInit(&parse_ctx, buf, buf_size); | |
| 222 | + parse_context_init(&parse_ctx, buf, buf_size); | |
| 227 | 223 | if (!buf_size) { |
| 228 | 224 | if (!p_schro_params->eos_signalled) { |
| 229 | 225 | state = schro_decoder_push_end_of_stream(decoder); |
| @@ -233,7 +229,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 3 unmodified lines | ||
| 233 | 229 | |
| 234 | 230 | /* Loop through all the individual parse units in the input buffer */ |
| 235 | 231 | do { |
| 236 | − if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) { | |
| 232 | + if ((enc_buf = find_next_parse_unit(&parse_ctx))) { | |
| 237 | 233 | /* Push buffer into decoder. */ |
| 238 | 234 | if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && |
| 239 | 235 | SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) |
| @@ -270,8 +266,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 30 unmodified lines | ||
| 270 | 266 | frame = schro_decoder_pull(decoder); |
| 271 | 267 | |
| 272 | 268 | if (frame) |
| 273 | − ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue, | |
| 274 | − frame); | |
| 269 | + ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, | |
| 270 | + frame); | |
| 275 | 271 | break; |
| 276 | 272 | case SCHRO_DECODER_EOS: |
| 277 | 273 | go = 0; |
| @@ -288,7 +284,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 10 unmodified lines | ||
| 288 | 284 | } while (outer); |
| 289 | 285 | |
| 290 | 286 | /* Grab next frame to be returned from the top of the queue. */ |
| 291 | − frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue); | |
| 287 | + frame = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); | |
| 292 | 288 | |
| 293 | 289 | if (frame) { |
| 294 | 290 | memcpy(p_schro_params->dec_pic.data[0], |
| @@ -327,8 +323,8 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext) · 32 unmodified lines | ||
| 327 | 323 | avpicture_free(&p_schro_params->dec_pic); |
| 328 | 324 | |
| 329 | 325 | /* Free data in the output frame queue. */ |
| 330 | − ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | |
| 331 | − libschroedinger_decode_frame_free); | |
| 326 | + ff_schro_queue_free(&p_schro_params->dec_frame_queue, | |
| 327 | + libschroedinger_decode_frame_free); | |
| 332 | 328 | |
| 333 | 329 | return 0; |
| 334 | 330 | } |
| @@ -340,10 +336,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext) · 5 unmodified lines | ||
| 340 | 336 | SchroDecoderParams *p_schro_params = avccontext->priv_data; |
| 341 | 337 | |
| 342 | 338 | /* Free data in the output frame queue. */ |
| 343 | − ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | |
| 344 | − libschroedinger_decode_frame_free); | |
| 339 | + ff_schro_queue_free(&p_schro_params->dec_frame_queue, | |
| 340 | + libschroedinger_decode_frame_free); | |
| 345 | 341 | |
| 346 | − ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | |
| 342 | + ff_schro_queue_init(&p_schro_params->dec_frame_queue); | |
| 347 | 343 | schro_decoder_reset(p_schro_params->decoder); |
| 348 | 344 | p_schro_params->eos_pulled = 0; |
| 349 | 345 | p_schro_params->eos_signalled = 0; |
| @@ -36,7 +36,6 @@ · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | #include "avcodec.h" |
| 38 | 38 | #include "internal.h" |
| 39 | −#include "libdirac_libschro.h" | |
| 40 | 39 | #include "libschroedinger.h" |
| 41 | 40 | #include "bytestream.h" |
| 42 | 41 | |
| @@ -65,7 +64,7 @@ typedef struct SchroEncoderParams { · 22 unmodified lines | ||
| 65 | 64 | int enc_buf_size; |
| 66 | 65 | |
| 67 | 66 | /** queue storing encoded frames */ |
| 68 | − DiracSchroQueue enc_frame_queue; | |
| 67 | + FFSchroQueue enc_frame_queue; | |
| 69 | 68 | |
| 70 | 69 | /** end of sequence signalled */ |
| 71 | 70 | int eos_signalled; |
| @@ -80,7 +79,7 @@ typedef struct SchroEncoderParams { · 8 unmodified lines | ||
| 80 | 79 | /** |
| 81 | 80 | * Works out Schro-compatible chroma format. |
| 82 | 81 | */ |
| 83 | −static int SetSchroChromaFormat(AVCodecContext *avccontext) | |
| 82 | +static int set_chroma_format(AVCodecContext *avccontext) | |
| 84 | 83 | { |
| 85 | 84 | int num_formats = sizeof(schro_pixel_format_map) / |
| 86 | 85 | sizeof(schro_pixel_format_map[0]); |
| @@ -129,7 +128,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) · 42 unmodified lines | ||
| 129 | 128 | p_schro_params->format->width = avccontext->width; |
| 130 | 129 | p_schro_params->format->height = avccontext->height; |
| 131 | 130 | |
| 132 | − if (SetSchroChromaFormat(avccontext) == -1) | |
| 131 | + if (set_chroma_format(avccontext) == -1) | |
| 133 | 132 | return -1; |
| 134 | 133 | |
| 135 | 134 | if (avccontext->color_primaries == AVCOL_PRI_BT709) { |
| @@ -236,7 +235,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) · 100 unmodified lines | ||
| 236 | 235 | schro_encoder_start(p_schro_params->encoder); |
| 237 | 236 | |
| 238 | 237 | /* Initialize the encoded frame queue. */ |
| 239 | − ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue); | |
| 238 | + ff_schro_queue_init(&p_schro_params->enc_frame_queue); | |
| 240 | 239 | return 0; |
| 241 | 240 | } |
| 242 | 241 | |
| @@ -259,9 +258,9 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, · 16 unmodified lines | ||
| 259 | 258 | return in_frame; |
| 260 | 259 | } |
| 261 | 260 | |
| 262 | −static void SchroedingerFreeFrame(void *data) | |
| 261 | +static void libschroedinger_free_frame(void *data) | |
| 263 | 262 | { |
| 264 | − DiracSchroEncodedFrame *enc_frame = data; | |
| 263 | + FFSchroEncodedFrame *enc_frame = data; | |
| 265 | 264 | |
| 266 | 265 | av_freep(&enc_frame->p_encbuf); |
| 267 | 266 | av_free(enc_frame); |
| @@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 5 unmodified lines | ||
| 273 | 272 | int enc_size = 0; |
| 274 | 273 | SchroEncoderParams *p_schro_params = avccontext->priv_data; |
| 275 | 274 | SchroEncoder *encoder = p_schro_params->encoder; |
| 276 | − struct DiracSchroEncodedFrame *p_frame_output = NULL; | |
| 275 | + struct FFSchroEncodedFrame *p_frame_output = NULL; | |
| 277 | 276 | int go = 1; |
| 278 | 277 | SchroBuffer *enc_buf; |
| 279 | 278 | int presentation_frame; |
| @@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 53 unmodified lines | ||
| 333 | 332 | } |
| 334 | 333 | |
| 335 | 334 | /* Create output frame. */ |
| 336 | − p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame)); | |
| 335 | + p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame)); | |
| 337 | 336 | /* Set output data. */ |
| 338 | 337 | p_frame_output->size = p_schro_params->enc_buf_size; |
| 339 | 338 | p_frame_output->p_encbuf = p_schro_params->enc_buf; |
| @@ -345,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 5 unmodified lines | ||
| 345 | 344 | * through 17 represesent the frame number. */ |
| 346 | 345 | p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); |
| 347 | 346 | |
| 348 | − ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue, | |
| 349 | − p_frame_output); | |
| 347 | + ff_schro_queue_push_back(&p_schro_params->enc_frame_queue, | |
| 348 | + p_frame_output); | |
| 350 | 349 | p_schro_params->enc_buf_size = 0; |
| 351 | 350 | p_schro_params->enc_buf = NULL; |
| 352 | 351 | |
| @@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 20 unmodified lines | ||
| 373 | 372 | p_schro_params->eos_pulled) |
| 374 | 373 | last_frame_in_sequence = 1; |
| 375 | 374 | |
| 376 | − p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue); | |
| 375 | + p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue); | |
| 377 | 376 | |
| 378 | 377 | if (!p_frame_output) |
| 379 | 378 | return 0; |
| @@ -410,7 +409,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 30 unmodified lines | ||
| 410 | 409 | |
| 411 | 410 | error: |
| 412 | 411 | /* free frame */ |
| 413 | − SchroedingerFreeFrame(p_frame_output); | |
| 412 | + libschroedinger_free_frame(p_frame_output); | |
| 414 | 413 | return ret; |
| 415 | 414 | } |
| 416 | 415 | |
| @@ -423,8 +422,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) · 6 unmodified lines | ||
| 423 | 422 | schro_encoder_free(p_schro_params->encoder); |
| 424 | 423 | |
| 425 | 424 | /* Free data in the output frame queue. */ |
| 426 | − ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue, | |
| 427 | − SchroedingerFreeFrame); | |
| 425 | + ff_schro_queue_free(&p_schro_params->enc_frame_queue, | |
| 426 | + libschroedinger_free_frame); | |
| 428 | 427 | |
| 429 | 428 | |
| 430 | 429 | /* Free the encoder buffer. */ |
| @@ -85,8 +85,7 @@ static int mm_decode_pal(MmContext *s) · 84 unmodified lines | ||
| 85 | 85 | */ |
| 86 | 86 | static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) |
| 87 | 87 | { |
| 88 | − int x, y; | |
| 89 | − x=0; y=0; | |
| 88 | + int x = 0, y = 0; | |
| 90 | 89 | |
| 91 | 90 | while (bytestream2_get_bytes_left(&s->gb) > 0) { |
| 92 | 91 | int run_length, color; |
| @@ -1051,6 +1051,11 @@ static void validate_thread_parameters(AVCodecContext *avctx) · 1050 unmodified lines | ||
| 1051 | 1051 | avctx->thread_count = 1; |
| 1052 | 1052 | avctx->active_thread_type = 0; |
| 1053 | 1053 | } |
| 1054 | + | |
| 1055 | + if (avctx->thread_count > MAX_AUTO_THREADS) | |
| 1056 | + av_log(avctx, AV_LOG_WARNING, | |
| 1057 | + "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n", | |
| 1058 | + avctx->thread_count, MAX_AUTO_THREADS); | |
| 1054 | 1059 | } |
| 1055 | 1060 | |
| 1056 | 1061 | int ff_thread_init(AVCodecContext *avctx) |
| @@ -48,7 +48,6 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 47 unmodified lines | ||
| 48 | 48 | AVFrame *picture = data; |
| 49 | 49 | AVFrame * const p = &s->picture; |
| 50 | 50 | unsigned int version, w, h, d3d_format, depth, stride, flags; |
| 51 | − unsigned int av_unused mipmap_count; | |
| 52 | 51 | unsigned int y, v; |
| 53 | 52 | uint8_t *ptr; |
| 54 | 53 | uint32_t *pal; |
| @@ -60,8 +59,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 5 unmodified lines | ||
| 60 | 59 | w = bytestream2_get_le16(&gb); |
| 61 | 60 | h = bytestream2_get_le16(&gb); |
| 62 | 61 | depth = bytestream2_get_byte(&gb); |
| 63 | − mipmap_count = bytestream2_get_byte(&gb); | |
| 64 | − bytestream2_skip(&gb, 1); | |
| 62 | + bytestream2_skip(&gb, 2); | |
| 65 | 63 | flags = bytestream2_get_byte(&gb); |
| 66 | 64 | |
| 67 | 65 | if (version < 8 || version > 9) { |
| @@ -390,6 +390,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) · 389 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | frame->reordered_opaque = avctx->reordered_opaque; |
| 392 | 392 | |
| 393 | + frame->sample_rate = avctx->sample_rate; | |
| 394 | + frame->format = avctx->sample_fmt; | |
| 395 | + frame->channel_layout = avctx->channel_layout; | |
| 396 | + | |
| 393 | 397 | if (avctx->debug & FF_DEBUG_BUFFERS) |
| 394 | 398 | av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " |
| 395 | 399 | "internal audio buffer used\n", frame); |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #define LIBAVCODEC_VERSION_MAJOR 54 |
| 30 | −#define LIBAVCODEC_VERSION_MINOR 19 | |
| 30 | +#define LIBAVCODEC_VERSION_MINOR 20 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 32 | 32 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -65,8 +65,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, · 64 unmodified lines | ||
| 65 | 65 | pic->key_frame = 1; |
| 66 | 66 | pic->pict_type = AV_PICTURE_TYPE_I; |
| 67 | 67 | } else { |
| 68 | − if (prev == NULL) { | |
| 69 | − av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); | |
| 68 | + if (!prev) { | |
| 69 | + av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n"); | |
| 70 | 70 | return AVERROR_INVALIDDATA; |
| 71 | 71 | } |
| 72 | 72 | pic->key_frame = 0; |
| @@ -6,7 +6,8 @@ FFLIBS-$(CONFIG_LAVFI_INDEV) += avfilter · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | HEADERS = avdevice.h |
| 8 | 8 | |
| 9 | −OBJS = alldevices.o avdevice.o | |
| 9 | +OBJS = alldevices.o \ | |
| 10 | + avdevice.o \ | |
| 10 | 11 | |
| 11 | 12 | # input/output devices |
| 12 | 13 | OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ |
| @@ -11,7 +11,14 @@ FFLIBS-$(CONFIG_PAN_FILTER) += swresample · 10 unmodified lines | ||
| 11 | 11 | FFLIBS-$(CONFIG_REMOVELOGO_FILTER) += avformat avcodec |
| 12 | 12 | FFLIBS-$(CONFIG_MP_FILTER) += avcodec postproc |
| 13 | 13 | |
| 14 | −HEADERS = asrc_abuffer.h avcodec.h avfilter.h avfiltergraph.h buffersink.h buffersrc.h version.h vsrc_buffer.h | |
| 14 | +HEADERS = asrc_abuffer.h \ | |
| 15 | + avcodec.h \ | |
| 16 | + avfilter.h \ | |
| 17 | + avfiltergraph.h \ | |
| 18 | + buffersink.h \ | |
| 19 | + buffersrc.h \ | |
| 20 | + version.h \ | |
| 21 | + vsrc_buffer.h \ | |
| 15 | 22 | |
| 16 | 23 | OBJS = allfilters.o \ |
| 17 | 24 | avfilter.o \ |
| @@ -171,4 +178,5 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/pullup.o · 153 unmodified lines | ||
| 171 | 178 | |
| 172 | 179 | TESTPROGS = drawutils formats |
| 173 | 180 | |
| 174 | −TOOLS = graph2dot lavfi-showfiltfmts | |
| 181 | +TOOLS = graph2dot \ | |
| 182 | + lavfi-showfiltfmts \ | |
| @@ -41,10 +41,11 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) · 40 unmodified lines | ||
| 41 | 41 | dst->video->pict_type = src->pict_type; |
| 42 | 42 | break; |
| 43 | 43 | case AVMEDIA_TYPE_AUDIO: |
| 44 | − dst->audio->sample_rate = av_frame_get_sample_rate(src); | |
| 44 | + dst->audio->sample_rate = src->sample_rate; | |
| 45 | + dst->audio->channel_layout = src->channel_layout; | |
| 45 | 46 | break; |
| 46 | 47 | default: |
| 47 | − return AVERROR(ENOSYS); | |
| 48 | + return AVERROR(EINVAL); | |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | return 0; |
| @@ -901,3 +901,15 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 900 unmodified lines | ||
| 901 | 901 | return ret; |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | |
| 905 | +{ | |
| 906 | + // copy common properties | |
| 907 | + dst->pts = src->pts; | |
| 908 | + dst->pos = src->pos; | |
| 909 | + | |
| 910 | + switch (src->type) { | |
| 911 | + case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; | |
| 912 | + case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; | |
| 913 | + default: break; | |
| 914 | + } | |
| 915 | +} | |
| @@ -155,18 +155,7 @@ typedef struct AVFilterBufferRef { · 154 unmodified lines | ||
| 155 | 155 | /** |
| 156 | 156 | * Copy properties of src to dst, without copying the actual data |
| 157 | 157 | */ |
| 158 | −static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | |
| 159 | −{ | |
| 160 | − // copy common properties | |
| 161 | − dst->pts = src->pts; | |
| 162 | − dst->pos = src->pos; | |
| 163 | − | |
| 164 | − switch (src->type) { | |
| 165 | − case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; | |
| 166 | − case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; | |
| 167 | − default: break; | |
| 168 | − } | |
| 169 | −} | |
| 158 | +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src); | |
| 170 | 159 | |
| 171 | 160 | /** |
| 172 | 161 | * Add a new reference to a buffer. |
| @@ -47,7 +47,8 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) · 46 unmodified lines | ||
| 47 | 47 | AVFilterFormats *ret; |
| 48 | 48 | unsigned i, j, k = 0; |
| 49 | 49 | |
| 50 | − if (a == b) return a; | |
| 50 | + if (a == b) | |
| 51 | + return a; | |
| 51 | 52 | |
| 52 | 53 | ret = av_mallocz(sizeof(*ret)); |
| 53 | 54 | |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #define LIBAVFILTER_VERSION_MAJOR 2 |
| 32 | 32 | #define LIBAVFILTER_VERSION_MINOR 72 |
| 33 | −#define LIBAVFILTER_VERSION_MICRO 104 | |
| 33 | +#define LIBAVFILTER_VERSION_MICRO 105 | |
| 34 | 34 | |
| 35 | 35 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| 36 | 36 | LIBAVFILTER_VERSION_MINOR, \ |
| @@ -3,7 +3,9 @@ include $(SUBDIR)../config.mak · 2 unmodified lines | ||
| 3 | 3 | NAME = avformat |
| 4 | 4 | FFLIBS = avcodec avutil |
| 5 | 5 | |
| 6 | −HEADERS = avformat.h avio.h version.h | |
| 6 | +HEADERS = avformat.h \ | |
| 7 | + avio.h \ | |
| 8 | + version.h \ | |
| 7 | 9 | |
| 8 | 10 | OBJS = allformats.o \ |
| 9 | 11 | avio.o \ |
| @@ -378,4 +380,8 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o · 368 unmodified lines | ||
| 378 | 380 | |
| 379 | 381 | SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h |
| 380 | 382 | TESTPROGS = seek |
| 381 | −TOOLS = aviocat ismindex pktdumper probetest | |
| 383 | + | |
| 384 | +TOOLS = aviocat \ | |
| 385 | + ismindex \ | |
| 386 | + pktdumper \ | |
| 387 | + probetest \ | |
| @@ -856,7 +856,7 @@ typedef struct AVFormatContext { · 855 unmodified lines | ||
| 856 | 856 | */ |
| 857 | 857 | void *priv_data; |
| 858 | 858 | |
| 859 | − /* | |
| 859 | + /** | |
| 860 | 860 | * I/O context. |
| 861 | 861 | * |
| 862 | 862 | * decoding: either set by the user before avformat_open_input() (then |
| @@ -2,7 +2,7 @@ NAME = avresample · 1 unmodified line | ||
| 2 | 2 | FFLIBS = avutil |
| 3 | 3 | |
| 4 | 4 | HEADERS = avresample.h \ |
| 5 | − version.h | |
| 5 | + version.h \ | |
| 6 | 6 | |
| 7 | 7 | OBJS = audio_convert.o \ |
| 8 | 8 | audio_data.o \ |
| @@ -10,6 +10,6 @@ OBJS = audio_convert.o \ · 1 unmodified line | ||
| 10 | 10 | audio_mix_matrix.o \ |
| 11 | 11 | options.o \ |
| 12 | 12 | resample.o \ |
| 13 | − utils.o | |
| 13 | + utils.o \ | |
| 14 | 14 | |
| 15 | 15 | TESTPROGS = avresample |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | OBJS += x86/audio_convert_init.o \ |
| 2 | − x86/audio_mix_init.o | |
| 2 | + x86/audio_mix_init.o \ | |
| 3 | 3 | |
| 4 | 4 | YASM-OBJS += x86/audio_convert.o \ |
| 5 | − x86/audio_mix.o | |
| 5 | + x86/audio_mix.o \ | |
| @@ -42,6 +42,11 @@ HEADERS = adler32.h \ · 41 unmodified lines | ||
| 42 | 42 | timecode.h \ |
| 43 | 43 | timestamp.h \ |
| 44 | 44 | |
| 45 | +ARCH_HEADERS = bswap.h \ | |
| 46 | + intmath.h \ | |
| 47 | + intreadwrite.h \ | |
| 48 | + timer.h \ | |
| 49 | + | |
| 45 | 50 | BUILT_HEADERS = avconfig.h |
| 46 | 51 | |
| 47 | 52 | OBJS = adler32.o \ |
| @@ -81,12 +86,30 @@ OBJS = adler32.o \ · 33 unmodified lines | ||
| 81 | 86 | tree.o \ |
| 82 | 87 | utils.o \ |
| 83 | 88 | |
| 84 | −TESTPROGS = adler32 aes avstring base64 bprint cpu crc des eval file fifo \ | |
| 85 | − lfg lls md5 opt pca parseutils random_seed rational sha tree | |
| 89 | +TESTPROGS = adler32 \ | |
| 90 | + aes \ | |
| 91 | + avstring \ | |
| 92 | + base64 \ | |
| 93 | + bprint \ | |
| 94 | + cpu \ | |
| 95 | + crc \ | |
| 96 | + des \ | |
| 97 | + eval \ | |
| 98 | + file \ | |
| 99 | + fifo \ | |
| 100 | + lfg \ | |
| 101 | + lls \ | |
| 102 | + md5 \ | |
| 103 | + opt \ | |
| 104 | + pca \ | |
| 105 | + parseutils \ | |
| 106 | + random_seed \ | |
| 107 | + rational \ | |
| 108 | + sha \ | |
| 109 | + tree \ | |
| 110 | + | |
| 86 | 111 | TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo |
| 87 | 112 | |
| 88 | 113 | TOOLS = ffeval |
| 89 | 114 | |
| 90 | −ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h | |
| 91 | − | |
| 92 | 115 | $(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2 |
| @@ -1 +1 @@ | ||
| 1 | −OBJS += arm/cpu.o | |
| 1 | +OBJS += arm/cpu.o \ | |
| @@ -14,4 +14,5 @@ OBJS = input.o \ · 13 unmodified lines | ||
| 14 | 14 | utils.o \ |
| 15 | 15 | yuv2rgb.o \ |
| 16 | 16 | |
| 17 | −TESTPROGS = colorspace swscale | |
| 17 | +TESTPROGS = colorspace \ | |
| 18 | + swscale \ | |