From 83daced0a3e9a4419e94b06a2a4956884c84170c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Nov 2011 15:16:18 +0100 Subject: [PATCH 01/14] lavf: expand doxy for some AVFormatContext fields. --- libavformat/avformat.h | 49 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 2fa93af31c..82d245e688 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -736,17 +736,56 @@ typedef struct AVChapter { * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. - * sizeof(AVFormatContext) must not be used outside libav*. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. */ typedef struct AVFormatContext { - const AVClass *av_class; /**< Set by avformat_alloc_context. */ - /* Can only be iformat or oformat, not both at the same time. */ + /** + * A class for logging and AVOptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * Can only be iformat or oformat, not both at the same time. + * + * decoding: set by avformat_open_input(). + * encoding: set by the user. + */ struct AVInputFormat *iformat; struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + */ void *priv_data; + + /* + * I/O context. + * + * decoding: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * encoding: set by the user. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ AVIOContext *pb; + + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * decoding: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * encoding: streams are created by the user before avformat_write_header(). + */ unsigned int nb_streams; AVStream **streams; + char filename[1024]; /**< input or output filename */ /* stream info */ #if FF_API_TIMESTAMP @@ -853,8 +892,8 @@ typedef struct AVFormatContext { unsigned int probesize; /** - * Maximum time (in AV_TIME_BASE units) during which the input should - * be analyzed in av_find_stream_info(). + * decoding: maximum time (in AV_TIME_BASE units) during which the input should + * be analyzed in avformat_find_stream_info(). */ int max_analyze_duration; From 8a691dfdabc03b85255d9bd16337de737e5285c8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 8 Nov 2011 08:07:51 +0100 Subject: [PATCH 02/14] doc/git-howto: expand format-patch and send-email notes. --- doc/git-howto.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/git-howto.txt b/doc/git-howto.txt index ba377c99e0..036b567084 100644 --- a/doc/git-howto.txt +++ b/doc/git-howto.txt @@ -205,8 +205,19 @@ I. BASICS: git format-patch [-o directory] - will generate a set of patches out of the current branch starting from - commit. By default the patches are created in the current directory. + will generate a set of patches for each commit between and + current HEAD. E.g. + + git format-patch origin/master + + will generate patches for all commits on current branch which are not + present in upstream. + A useful shortcut is also + + git format-patch -n + + which will generate patches from last n commits. + By default the patches are created in the current directory. 11. Sending patches for review @@ -215,6 +226,8 @@ I. BASICS: will send the patches created by git format-patch or directly generates them. All the email fields can be configured in the global/local configuration or overridden by command line. + Note that this tool must often be installed separately (e.g. git-email + package on Debian-based distros). 12. Pushing changes to remote trees From f9324d5adda6147b3faad5970b6d88263397c76b Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 8 Nov 2011 10:33:18 -0500 Subject: [PATCH 03/14] avplay: reset rdft when closing stream. this fixes a crash when cycling audio streams if the spectrograph is displayed. --- avplay.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/avplay.c b/avplay.c index c67cc75fe8..01c0f118e9 100644 --- a/avplay.c +++ b/avplay.c @@ -2279,6 +2279,8 @@ static void stream_component_close(VideoState *is, int stream_index) if (is->rdft) { av_rdft_end(is->rdft); av_freep(&is->rdft_data); + is->rdft = NULL; + is->rdft_bits = 0; } break; case AVMEDIA_TYPE_VIDEO: From 276b995d85786dd4af57a9eda798423860cbf3fe Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 8 Nov 2011 13:46:18 +0100 Subject: [PATCH 04/14] x86: drop pointless ARCH_X86 #ifdef from files in x86 subdirectory --- libavcodec/x86/cabac.h | 4 ++-- libavcodec/x86/h264_i386.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h index 545cf7c464..5da421a90a 100644 --- a/libavcodec/x86/cabac.h +++ b/libavcodec/x86/cabac.h @@ -82,7 +82,7 @@ "add "tmp" , "low" \n\t"\ "1: \n\t" -#if ARCH_X86 && HAVE_7REGS && !defined(BROKEN_RELOCATIONS) +#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS) #define get_cabac_inline get_cabac_inline_x86 static av_always_inline int get_cabac_inline_x86(CABACContext *c, uint8_t *const state) @@ -99,7 +99,7 @@ static av_always_inline int get_cabac_inline_x86(CABACContext *c, ); return bit & 1; } -#endif /* ARCH_X86 && HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */ +#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */ #define get_cabac_bypass_sign get_cabac_bypass_sign_x86 static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val) diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h index f32310ca0c..7a361cdb37 100644 --- a/libavcodec/x86/h264_i386.h +++ b/libavcodec/x86/h264_i386.h @@ -36,7 +36,7 @@ //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet //as that would make optimization work hard) -#if ARCH_X86 && HAVE_7REGS && !defined(BROKEN_RELOCATIONS) +#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS) static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index, x86_reg last_off){ @@ -145,6 +145,6 @@ static int decode_significance_8x8_x86(CABACContext *c, ); return coeff_count; } -#endif /* ARCH_X86 && HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */ +#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */ #endif /* AVCODEC_X86_H264_I386_H */ From 9412f81138364241c8979f7b9399b28eb2abf9f3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 8 Nov 2011 16:06:50 +0100 Subject: [PATCH 05/14] indeo3data: add missing config.h #include for HAVE_BIGENDIAN --- libavcodec/indeo3data.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h index a19fdd3e83..6bb55ce902 100644 --- a/libavcodec/indeo3data.h +++ b/libavcodec/indeo3data.h @@ -24,6 +24,8 @@ #include +#include "config.h" + /* * Define compressed VQ tables. */ From ce33320b30f27b221d140196f7107e3eccf80568 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 30 Oct 2011 22:08:47 +0100 Subject: [PATCH 06/14] Remove redundant filename self-references inside files. Filenames are brittle across renames and add no useful information. --- libavcodec/arm/simple_idct_arm.S | 1 - libavcodec/jfdctfst.c | 2 -- libavcodec/jfdctint_template.c | 2 -- libavcodec/jrevdct.c | 2 -- libavcodec/libdirac.h | 2 +- libavcodec/libschroedinger.c | 2 +- libavcodec/libschroedinger.h | 2 +- libavcodec/x86/idct_mmx.c | 1 - 8 files changed, 3 insertions(+), 11 deletions(-) diff --git a/libavcodec/arm/simple_idct_arm.S b/libavcodec/arm/simple_idct_arm.S index 717b12c64b..fce40b7d8c 100644 --- a/libavcodec/arm/simple_idct_arm.S +++ b/libavcodec/arm/simple_idct_arm.S @@ -1,5 +1,4 @@ /* - * simple_idct_arm.S * Copyright (C) 2002 Frederic 'dilb' Boulay * * Author: Frederic Boulay diff --git a/libavcodec/jfdctfst.c b/libavcodec/jfdctfst.c index 8d3448a676..b8dc407f7b 100644 --- a/libavcodec/jfdctfst.c +++ b/libavcodec/jfdctfst.c @@ -1,6 +1,4 @@ /* - * jfdctfst.c - * * This file is part of the Independent JPEG Group's software. * * The authors make NO WARRANTY or representation, either express or implied, diff --git a/libavcodec/jfdctint_template.c b/libavcodec/jfdctint_template.c index e60e72a412..02b6f09381 100644 --- a/libavcodec/jfdctint_template.c +++ b/libavcodec/jfdctint_template.c @@ -1,6 +1,4 @@ /* - * jfdctint.c - * * This file is part of the Independent JPEG Group's software. * * The authors make NO WARRANTY or representation, either express or implied, diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c index 9e28daeae6..5ed96da2ca 100644 --- a/libavcodec/jrevdct.c +++ b/libavcodec/jrevdct.c @@ -1,6 +1,4 @@ /* - * jrevdct.c - * * This file is part of the Independent JPEG Group's software. * * The authors make NO WARRANTY or representation, either express or implied, diff --git a/libavcodec/libdirac.h b/libavcodec/libdirac.h index e054f61a78..4403fb2a39 100644 --- a/libavcodec/libdirac.h +++ b/libavcodec/libdirac.h @@ -20,7 +20,7 @@ /** * @file -* data structures common to libdiracenc.c and libdiracdec.c +* data structures common to libdirac encoder and decoder */ #ifndef AVCODEC_LIBDIRAC_H diff --git a/libavcodec/libschroedinger.c b/libavcodec/libschroedinger.c index 1d31712d44..527c4927ae 100644 --- a/libavcodec/libschroedinger.c +++ b/libavcodec/libschroedinger.c @@ -20,7 +20,7 @@ /** * @file -* function definitions common to libschroedingerdec.c and libschroedingerenc.c +* function definitions common to libschroedinger decoder and encoder */ #include "libdirac_libschro.h" diff --git a/libavcodec/libschroedinger.h b/libavcodec/libschroedinger.h index c6ae5ea642..814782111b 100644 --- a/libavcodec/libschroedinger.h +++ b/libavcodec/libschroedinger.h @@ -20,7 +20,7 @@ /** * @file -* data structures common to libschroedingerdec.c and libschroedingerenc.c +* data structures common to libschroedinger decoder and encoder */ #ifndef AVCODEC_LIBSCHROEDINGER_H diff --git a/libavcodec/x86/idct_mmx.c b/libavcodec/x86/idct_mmx.c index 57fa81892d..ed2d3217e5 100644 --- a/libavcodec/x86/idct_mmx.c +++ b/libavcodec/x86/idct_mmx.c @@ -1,5 +1,4 @@ /* - * idct_mmx.c * Copyright (C) 1999-2001 Aaron Holtzman * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. From f50b6be57d2e68823a690c5a98639e1ac73bbd3e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 28 Oct 2011 21:27:36 -0400 Subject: [PATCH 07/14] mace: only calculate output buffer size once --- libavcodec/mace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 5e870a2d2e..a55a041696 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -243,11 +243,14 @@ static int mace_decode_frame(AVCodecContext *avctx, int16_t *samples = data; MACEContext *ctx = avctx->priv_data; int i, j, k, l; + int out_size; int is_mace3 = (avctx->codec_id == CODEC_ID_MACE3); - if (*data_size < (3 * buf_size << (2-is_mace3))) { - av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n"); - return -1; + out_size = 3 * (buf_size << (1 - is_mace3)) * + av_get_bytes_per_sample(avctx->sample_fmt); + if (*data_size < out_size) { + av_log(avctx, AV_LOG_ERROR, "Output buffer is too small\n"); + return AVERROR(EINVAL); } for(i = 0; i < avctx->channels; i++) { @@ -274,7 +277,7 @@ static int mace_decode_frame(AVCodecContext *avctx, } } - *data_size = 3 * buf_size << (2-is_mace3); + *data_size = out_size; return buf_size; } From 03e5d6118c239edc0f420d8912454d8b37f789f3 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 29 Oct 2011 00:09:03 -0400 Subject: [PATCH 08/14] ra288: use memcpy() to copy decoded samples to output --- libavcodec/ra288.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 2166d8ca61..d82e52df2f 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -168,7 +168,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; float *out = data; - int i, j, out_size; + int i, out_size; RA288Context *ractx = avctx->priv_data; GetBitContext gb; @@ -194,8 +194,8 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, decode(ractx, gain, cb_coef); - for (j=0; j < RA288_BLOCK_SIZE; j++) - *(out++) = ractx->sp_hist[70 + 36 + j]; + memcpy(out, &ractx->sp_hist[70 + 36], RA288_BLOCK_SIZE * sizeof(*out)); + out += RA288_BLOCK_SIZE; if ((i & 7) == 3) { backward_filter(ractx->sp_hist, ractx->sp_rec, syn_window, From 0131e70af51ccaeb7faadef001a1aa1fea0271e2 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 29 Oct 2011 00:42:48 -0400 Subject: [PATCH 09/14] ra288: utilize DSPContext.vector_fmul() --- libavcodec/ra288.c | 34 ++++++++++++++++++---------------- libavcodec/ra288.h | 9 +++++---- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index d82e52df2f..c58bc31f62 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -26,6 +26,7 @@ #include "lpc.h" #include "celp_math.h" #include "celp_filters.h" +#include "dsputil.h" #define MAX_BACKWARD_FILTER_ORDER 36 #define MAX_BACKWARD_FILTER_LEN 40 @@ -35,8 +36,9 @@ #define RA288_BLOCKS_PER_FRAME 32 typedef struct { - float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A) - float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB) + DSPContext dsp; + DECLARE_ALIGNED(16, float, sp_lpc)[FFALIGN(36, 8)]; ///< LPC coefficients for speech data (spec: A) + DECLARE_ALIGNED(16, float, gain_lpc)[FFALIGN(10, 8)]; ///< LPC coefficients for gain (spec: GB) /** speech data history (spec: SB). * Its first 70 coefficients are updated only at backward filtering. @@ -57,16 +59,12 @@ typedef struct { static av_cold int ra288_decode_init(AVCodecContext *avctx) { + RA288Context *ractx = avctx->priv_data; avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + dsputil_init(&ractx->dsp, avctx); return 0; } -static void apply_window(float *tgt, const float *m1, const float *m2, int n) -{ - while (n--) - *tgt++ = *m1++ * *m2++; -} - static void convolve(float *tgt, const float *src, int len, int n) { for (; n >= 0; n--) @@ -123,15 +121,18 @@ static void decode(RA288Context *ractx, float gain, int cb_coef) * @param out2 pointer to the recursive part of the output * @param window pointer to the windowing function table */ -static void do_hybrid_window(int order, int n, int non_rec, float *out, +static void do_hybrid_window(RA288Context *ractx, + int order, int n, int non_rec, float *out, float *hist, float *out2, const float *window) { int i; float buffer1[MAX_BACKWARD_FILTER_ORDER + 1]; float buffer2[MAX_BACKWARD_FILTER_ORDER + 1]; - float work[MAX_BACKWARD_FILTER_ORDER + MAX_BACKWARD_FILTER_LEN + MAX_BACKWARD_FILTER_NONREC]; + LOCAL_ALIGNED_16(float, work)[FFALIGN(MAX_BACKWARD_FILTER_ORDER + + MAX_BACKWARD_FILTER_LEN + + MAX_BACKWARD_FILTER_NONREC, 8)]; - apply_window(work, window, hist, order + n + non_rec); + ractx->dsp.vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 8)); convolve(buffer1, work + order , n , order); convolve(buffer2, work + order + n, non_rec, order); @@ -148,16 +149,17 @@ static void do_hybrid_window(int order, int n, int non_rec, float *out, /** * Backward synthesis filter, find the LPC coefficients from past speech data. */ -static void backward_filter(float *hist, float *rec, const float *window, +static void backward_filter(RA288Context *ractx, + float *hist, float *rec, const float *window, float *lpc, const float *tab, int order, int n, int non_rec, int move_size) { float temp[MAX_BACKWARD_FILTER_ORDER+1]; - do_hybrid_window(order, n, non_rec, temp, hist, rec, window); + do_hybrid_window(ractx, order, n, non_rec, temp, hist, rec, window); if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1)) - apply_window(lpc, lpc, tab, order); + ractx->dsp.vector_fmul(lpc, lpc, tab, FFALIGN(order, 8)); memmove(hist, hist + n, move_size*sizeof(*hist)); } @@ -198,10 +200,10 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, out += RA288_BLOCK_SIZE; if ((i & 7) == 3) { - backward_filter(ractx->sp_hist, ractx->sp_rec, syn_window, + backward_filter(ractx, ractx->sp_hist, ractx->sp_rec, syn_window, ractx->sp_lpc, syn_bw_tab, 36, 40, 35, 70); - backward_filter(ractx->gain_hist, ractx->gain_rec, gain_window, + backward_filter(ractx, ractx->gain_hist, ractx->gain_rec, gain_window, ractx->gain_lpc, gain_bw_tab, 10, 8, 20, 28); } } diff --git a/libavcodec/ra288.h b/libavcodec/ra288.h index 8857f40ac8..1c98c16ea4 100644 --- a/libavcodec/ra288.h +++ b/libavcodec/ra288.h @@ -23,6 +23,7 @@ #define AVCODEC_RA288_H #include +#include "dsputil.h" static const float amptable[8]={ 0.515625, 0.90234375, 1.57910156, 2.76342773, @@ -96,7 +97,7 @@ static const int16_t codetable[128][5]={ { 3746, -606, 53, -269, -3301}, { 606, 2018, -1316, 4064, 398} }; -static const float syn_window[111]={ +DECLARE_ALIGNED(16, static const float, syn_window)[FFALIGN(111, 8)]={ 0.576690972, 0.580838025, 0.585013986, 0.589219987, 0.59345597, 0.597723007, 0.602020264, 0.606384277, 0.610748291, 0.615142822, 0.619598389, 0.624084473, 0.628570557, 0.633117676, 0.637695313, 0.642272949, 0.646911621, 0.651580811, @@ -118,7 +119,7 @@ static const float syn_window[111]={ 0.142852783, 0.0954284668,0.0477600098 }; -static const float gain_window[38]={ +DECLARE_ALIGNED(16, static const float, gain_window)[FFALIGN(38, 8)]={ 0.505699992, 0.524200022, 0.54339999, 0.563300014, 0.583953857, 0.60534668, 0.627502441, 0.650482178, 0.674316406, 0.699005127, 0.724578857, 0.75112915, 0.778625488, 0.807128906, 0.836669922, 0.86730957, 0.899078369, 0.932006836, @@ -129,7 +130,7 @@ static const float gain_window[38]={ }; /** synthesis bandwidth broadening table */ -static const float syn_bw_tab[36]={ +DECLARE_ALIGNED(16, static const float, syn_bw_tab)[FFALIGN(36, 8)] = { 0.98828125, 0.976699829, 0.965254128, 0.953942537, 0.942763507, 0.931715488, 0.920796931, 0.910006344, 0.899342179, 0.888803005, 0.878387332, 0.868093729, 0.857920766, 0.847867012, 0.837931097, 0.828111589, 0.818407178, 0.808816493, @@ -139,7 +140,7 @@ static const float syn_bw_tab[36]={ }; /** gain bandwidth broadening table */ -static const float gain_bw_tab[10]={ +DECLARE_ALIGNED(16, static const float, gain_bw_tab)[FFALIGN(10, 8)] = { 0.90625, 0.821289063, 0.74432373, 0.674499512, 0.61126709, 0.553955078, 0.50201416, 0.454956055, 0.41229248, 0.373657227 }; From 2467d8d9eaae52eb8e18e276a44a15d1d8fd7f97 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 3 Nov 2011 20:41:17 -0400 Subject: [PATCH 10/14] ra288: return error if input buffer is too small --- libavcodec/ra288.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index c58bc31f62..ddbda1de4c 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -178,7 +178,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, av_log(avctx, AV_LOG_ERROR, "Error! Input buffer is too small [%d<%d]\n", buf_size, avctx->block_align); - return 0; + return AVERROR_INVALIDDATA; } out_size = RA288_BLOCK_SIZE * RA288_BLOCKS_PER_FRAME * From 3110ad8329c39d1512eea86db617fa339ba5d076 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 8 Nov 2011 14:13:30 +0100 Subject: [PATCH 11/14] mpegts: set stream id on just created stream, not an unrelated variable Bug introduced in 84ad31ff180fa089cd6bfd93c246336a16036455. Thanks to Uoti Urpala for finding it. --- libavformat/mpegts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2e390e4268..71447fa507 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1445,7 +1445,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len pes = ts->pids[pid]->u.pes_filter.opaque; if (!pes->st) { pes->st = avformat_new_stream(pes->stream, NULL); - st->id = pes->pid; + pes->st->id = pes->pid; } st = pes->st; } else if (stream_type != 0x13) { From 735e601be1b7731d256a41e942b31a96255a6bec Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Mon, 7 Nov 2011 10:14:54 -0800 Subject: [PATCH 12/14] mxfdec: Fix comparison of unsigned expression < 0. 'size' is populated by functions returning int64_t and int that return negative error codes. --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c0386583bd..95699a614e 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -251,7 +251,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int64_t end = avio_tell(pb) + klv->length; - uint64_t size; + int64_t size; uint64_t orig_size; uint64_t plaintext_size; uint8_t ivec[16]; From 1149fbc7631a8c2258386f9aa247806715493b10 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Mon, 7 Nov 2011 18:46:46 -0800 Subject: [PATCH 13/14] indeo3: Fix a fencepost error. Found with asan and the venerable 1-dog.avi sample. --- libavcodec/indeo3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 2a929a53c7..2c7e96b738 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -444,7 +444,7 @@ static int decode_cell_data(Cell *cell, uint8_t *block, uint8_t *ref_block, BUFFER_PRECHECK; dyad1 = bytestream_get_byte(data_ptr); dyad2 = code; - if (dyad1 > delta_tab->num_dyads || dyad1 >= 248) + if (dyad1 >= delta_tab->num_dyads || dyad1 >= 248) return IV3_BAD_DATA; } else { /* process QUADS */ From f38f3b88a5a74d0573dc299a512a87f6d579323b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 7 Nov 2011 11:19:17 +0200 Subject: [PATCH 14/14] tls: Use ERR_get_error() in do_tls_poll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The return value ret isn't an error code that can be passed to ERR_error_string(). This makes the error messages printed actually contain useful information. Signed-off-by: Martin Storsjö --- libavformat/tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tls.c b/libavformat/tls.c index 85bf46f903..bd73febd4d 100644 --- a/libavformat/tls.c +++ b/libavformat/tls.c @@ -87,7 +87,7 @@ static int do_tls_poll(URLContext *h, int ret) } else if (ret == SSL_ERROR_WANT_WRITE) { p.events = POLLOUT; } else { - av_log(NULL, AV_LOG_ERROR, "%s\n", ERR_error_string(ret, NULL)); + av_log(NULL, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); return AVERROR(EIO); } #endif