diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-04 00:32:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-04 00:32:31 +0200 |
commit | 86e107a7d468666189506d3edd4f4b5ca14cd59e (patch) | |
tree | 7270750bbe78c241461a844d7c1c8de3696e3765 | |
parent | af392efe51d5cc3536cb3c75bce8954179222d18 (diff) | |
parent | 1a068bfefd5da09f596e5079b39b418933bad0ea (diff) | |
download | ffmpeg-86e107a7d468666189506d3edd4f4b5ca14cd59e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
cosmetics: Consistently use C-style comments with multiple inclusion guards
anm: fix a few Doxygen comments
misc typo and wording fixes
attributes: add av_noreturn
attributes: drop pointless define guards
configure: do not disable av_always_inline with --enable-small
flvdec: initial stream switch support
avplay: fix write on freed memory for rawvideo
snow: remove a VLA used for edge emulation
x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
snow: remove the runs[] VLA.
snow: Check mallocs at init
flacdec: remove redundant setting of avctx->sample_fmt
Conflicts:
ffplay.c
libavcodec/h264.c
libavcodec/snow.c
libavcodec/snow.h
libavcodec/snowdec.c
libavcodec/snowenc.c
libavformat/flvdec.c
libavutil/attributes.h
tools/patcheck
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | cmdutils.h | 2 | ||||
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | ffplay.c | 9 | ||||
-rw-r--r-- | libavcodec/anm.c | 9 | ||||
-rw-r--r-- | libavcodec/dsputil.h | 4 | ||||
-rw-r--r-- | libavcodec/flacdec.c | 2 | ||||
-rw-r--r-- | libavcodec/h264.c | 4 | ||||
-rw-r--r-- | libavcodec/snow.c | 25 | ||||
-rw-r--r-- | libavcodec/snow.h | 3 | ||||
-rw-r--r-- | libavcodec/snowdec.c | 7 | ||||
-rw-r--r-- | libavcodec/snowenc.c | 21 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavcodec/xvmc.h | 2 | ||||
-rw-r--r-- | libavfilter/formats.h | 2 | ||||
-rw-r--r-- | libavfilter/version.h | 4 | ||||
-rw-r--r-- | libavfilter/x86/gradfun.c | 24 | ||||
-rw-r--r-- | libavfilter/x86/yadif.c | 16 | ||||
-rw-r--r-- | libavformat/flvdec.c | 94 | ||||
-rw-r--r-- | libavformat/rtp.h | 2 | ||||
-rw-r--r-- | libavformat/version.h | 2 | ||||
-rw-r--r-- | libavutil/arm/intmath.h | 3 | ||||
-rw-r--r-- | libavutil/attributes.h | 34 | ||||
-rw-r--r-- | libavutil/dict.h | 2 | ||||
-rwxr-xr-x | tools/patcheck | 3 |
24 files changed, 185 insertions, 100 deletions
diff --git a/cmdutils.h b/cmdutils.h index d26089cca4..925df5014e 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -376,7 +376,7 @@ FILE *get_preset_file(char *filename, size_t filename_size, * Do all the necessary cleanup and abort. * This function is implemented in the avtools, not cmdutils. */ -void exit_program(int ret); +av_noreturn void exit_program(int ret); /** * Realloc array to hold new_size elements of elem_size. @@ -3856,15 +3856,6 @@ test -n "$assert_level" && test -n "$malloc_prefix" && echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH -if enabled small || disabled optimizations; then - echo "#undef av_always_inline" >> $TMPH - if enabled small; then - echo "#define av_always_inline inline" >> $TMPH - else - echo "#define av_always_inline av_unused" >> $TMPH - fi -fi - if enabled yasm; then append config_files $TMPASM printf '' >$TMPASM @@ -1632,6 +1632,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c static int video_thread(void *arg) { + AVPacket pkt = { 0 }; VideoState *is = arg; AVFrame *frame = avcodec_alloc_frame(); int64_t pts_int = AV_NOPTS_VALUE, pos = -1; @@ -1655,7 +1656,6 @@ static int video_thread(void *arg) #endif for (;;) { - AVPacket pkt; #if CONFIG_AVFILTER AVFilterBufferRef *picref; AVRational tb; @@ -1664,14 +1664,14 @@ static int video_thread(void *arg) SDL_Delay(10); avcodec_get_frame_defaults(frame); + av_free_packet(&pkt); + ret = get_video_frame(is, frame, &pts_int, &pkt); if (ret < 0) goto the_end; - if (!ret) { - av_free_packet(&pkt); + if (!ret) continue; - } #if CONFIG_AVFILTER if ( last_w != is->video_st->codec->width @@ -1766,6 +1766,7 @@ static int video_thread(void *arg) av_freep(&vfilters); avfilter_graph_free(&graph); #endif + av_free_packet(&pkt); av_free(frame); return 0; } diff --git a/libavcodec/anm.c b/libavcodec/anm.c index d3f9d095b2..7fdfc94d0f 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -56,8 +56,9 @@ static av_cold int decode_init(AVCodecContext *avctx) /** * Perform decode operation - * @param dst, dst_end Destination image buffer - * @param gb, GetByteContext (optional, see below) + * @param dst pointer to destination image buffer + * @param dst_end pointer to end of destination image buffer + * @param gb GetByteContext (optional, see below) * @param pixel Fill color (optional, see below) * @param count Pixel count * @param x Pointer to x-axis counter @@ -66,8 +67,8 @@ static av_cold int decode_init(AVCodecContext *avctx) * @return non-zero if destination buffer is exhausted * * a copy operation is achieved when 'gb' is set - * a fill operation is acheived when 'gb' is null and pixel is >= 0 - * a skip operation is acheived when 'gb' is null and pixel is < 0 + * a fill operation is achieved when 'gb' is null and pixel is >= 0 + * a skip operation is achieved when 'gb' is null and pixel is < 0 */ static inline int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index e1aefe1eb6..c1397980f9 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -552,9 +552,9 @@ typedef struct DSPContext { * @param src source array * constraints: 16-byte aligned * @param min minimum value - * constraints: must in the the range [-(1<<24), 1<<24] + * constraints: must be in the range [-(1 << 24), 1 << 24] * @param max maximum value - * constraints: must in the the range [-(1<<24), 1<<24] + * constraints: must be in the range [-(1 << 24), 1 << 24] * @param len number of elements in the array * constraints: multiple of 32 greater than zero */ diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 82c4e807dd..02ed463eb3 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -108,8 +108,6 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) FLACContext *s = avctx->priv_data; s->avctx = avctx; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - /* for now, the raw FLAC header is allowed to be passed to the decoder as frame data instead of extradata. */ if (!avctx->extradata) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 0958c09fc6..5cf8d54f51 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1737,7 +1737,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, } top_border = h->top_borders[top_idx][s->mb_x]; - /* There are two lines saved, the line above the the top macroblock + /* There are two lines saved, the line above the top macroblock * of a pair, and the line above the bottom macroblock. */ AV_COPY128(top_border, src_y + 16 * linesize); if (pixel_shift) @@ -4443,7 +4443,7 @@ again: init_get_bits(&s->gb, ptr, bit_length); if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)) { av_log(h->s.avctx, AV_LOG_DEBUG, - "SPS decoding failure, trying alternative mode\n"); + "SPS decoding failure, trying again with the complete NAL\n"); if (h->is_avc) av_assert0(next_avc - buf_index + consumed == nalsize); init_get_bits(&s->gb, &buf[buf_index + 1 - consumed], diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 309e1bf040..04072501ad 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -394,7 +394,8 @@ mca( 8, 8,8) av_cold int ff_snow_common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; - int i, j; + int i, j, ret; + int emu_buf_size; s->avctx= avctx; s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe @@ -447,19 +448,27 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ width= s->avctx->width; height= s->avctx->height; - s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM)); - s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here - s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM)); - s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM)); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here + FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); + FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); for(i=0; i<MAX_REF_FRAMES; i++) for(j=0; j<MAX_REF_FRAMES; j++) ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1); - s->avctx->get_buffer(s->avctx, &s->mconly_picture); - s->scratchbuf = av_mallocz(s->mconly_picture.linesize[0]*7*MB_SIZE); + if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) { +// av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); +// return ret; + } + FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture.linesize[0], 2*width+256)*7*MB_SIZE, fail); + emu_buf_size = FFMAX(s->mconly_picture.linesize[0], 2*width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); + FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); return 0; +fail: + return AVERROR(ENOMEM); } int ff_snow_common_init_after_header(AVCodecContext *avctx) { @@ -632,6 +641,7 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->temp_dwt_buffer); av_freep(&s->spatial_idwt_buffer); av_freep(&s->temp_idwt_buffer); + av_freep(&s->run_buffer); s->m.me.temp= NULL; av_freep(&s->m.me.scratchpad); @@ -641,6 +651,7 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->block); av_freep(&s->scratchbuf); + av_freep(&s->emu_edge_buffer); for(i=0; i<MAX_REF_FRAMES; i++){ av_freep(&s->ref_mvs[i]); diff --git a/libavcodec/snow.h b/libavcodec/snow.h index c5d6492a9f..7e35b5f1be 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -135,6 +135,7 @@ typedef struct SnowContext{ DWTELEM *temp_dwt_buffer; IDWTELEM *spatial_idwt_buffer; IDWTELEM *temp_idwt_buffer; + int *run_buffer; int colorspace_type; int chroma_h_shift; int chroma_v_shift; @@ -165,7 +166,7 @@ typedef struct SnowContext{ MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX) uint8_t *scratchbuf; - int *runs; + uint8_t *emu_edge_buffer; }SnowContext; /* Tables */ diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c index 405166c5fe..11a54dca71 100644 --- a/libavcodec/snowdec.c +++ b/libavcodec/snowdec.c @@ -365,7 +365,12 @@ static int decode_header(SnowContext *s){ static av_cold int decode_init(AVCodecContext *avctx) { - ff_snow_common_init(avctx); + int ret; + + if ((ret = ff_snow_common_init(avctx)) < 0) { + ff_snow_common_end(avctx->priv_data); + return ret; + } return 0; } diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 1a60dbf96d..d6dd58cc2c 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -156,7 +156,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i static av_cold int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; - int plane_index; + int plane_index, ret; if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n" @@ -185,7 +185,10 @@ static av_cold int encode_init(AVCodecContext *avctx) s->plane[plane_index].fast_mc= 1; } - ff_snow_common_init(avctx); + if ((ret = ff_snow_common_init(avctx)) < 0) { + ff_snow_common_end(avctx->priv_data); + return ret; + } ff_snow_alloc_blocks(s); s->version=0; @@ -246,8 +249,6 @@ static av_cold int encode_init(AVCodecContext *avctx) } } - s->runs = av_malloc(avctx->width * avctx->height * sizeof(*s->runs)); - return 0; } @@ -677,7 +678,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uin uint8_t *src= s-> input_picture.data[plane_index]; IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4; uint8_t *cur = s->scratchbuf; - uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)]; + uint8_t *tmp = s->emu_edge_buffer; const int b_stride = s->b_width << s->block_max_depth; const int b_height = s->b_height<< s->block_max_depth; const int w= p->width; @@ -843,6 +844,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, if(1){ int run=0; + int *runs = s->run_buffer; int run_index=0; int max_index; @@ -876,7 +878,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, } if(!(/*ll|*/l|lt|t|rt|p)){ if(v){ - s->runs[run_index++]= run; + runs[run_index++]= run; run=0; }else{ run++; @@ -885,9 +887,9 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, } } max_index= run_index; - s->runs[run_index++]= run; + runs[run_index++]= run; run_index=0; - run= s->runs[run_index++]; + run= runs[run_index++]; put_symbol2(&s->c, b->state[30], max_index, 0); if(run_index <= max_index) @@ -931,7 +933,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, put_rac(&s->c, &b->state[0][context], !!v); }else{ if(!run){ - run= s->runs[run_index++]; + run= runs[run_index++]; if(run_index <= max_index) put_symbol2(&s->c, b->state[1], run, 3); @@ -1909,7 +1911,6 @@ static av_cold int encode_end(AVCodecContext *avctx) if (s->input_picture.data[0]) avctx->release_buffer(avctx, &s->input_picture); av_free(avctx->stats_out); - av_freep(&s->runs); return 0; } diff --git a/libavcodec/version.h b/libavcodec/version.h index 275200f16b..8709230c24 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,7 +41,7 @@ #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_REQUEST_CHANNELS diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h index fdaea7eab7..b2bf518d0c 100644 --- a/libavcodec/xvmc.h +++ b/libavcodec/xvmc.h @@ -147,7 +147,7 @@ struct xvmc_pix_fmt { */ int filled_mv_blocks_num; - /** Number of the the next free data block; one data block consists of + /** Number of the next free data block; one data block consists of 64 short values in the data_blocks array. All blocks before this one have already been claimed by placing their position into the corresponding block description structure field, diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 1de10ca768..f884294cf0 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -221,4 +221,4 @@ void ff_formats_unref(AVFilterFormats **ref); */ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref); -#endif // AVFILTER_FORMATS_H +#endif /* AVFILTER_FORMATS_H */ diff --git a/libavfilter/version.h b/libavfilter/version.h index 26b630f5af..6a4de3f7aa 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -41,7 +41,7 @@ #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_OLD_ALL_FORMATS_API @@ -60,4 +60,4 @@ #define FF_API_BUFFERSRC_BUFFER (LIBAVFILTER_VERSION_MAJOR < 4) #endif -#endif // AVFILTER_VERSION_H +#endif /* AVFILTER_VERSION_H */ diff --git a/libavfilter/x86/gradfun.c b/libavfilter/x86/gradfun.c index 7600539b6f..6511746a72 100644 --- a/libavfilter/x86/gradfun.c +++ b/libavfilter/x86/gradfun.c @@ -26,9 +26,9 @@ DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F}; DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; +#if HAVE_MMX2 static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) { -#if HAVE_MMX2 intptr_t x; if (width & 3) { x = width & ~3; @@ -71,12 +71,12 @@ static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uin "rm"(thresh), "m"(*dithers), "m"(*pw_7f) :"memory" ); -#endif } +#endif +#if HAVE_SSSE3 static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) { -#if HAVE_SSSE3 intptr_t x; if (width & 7) { // could be 10% faster if I somehow eliminated this @@ -118,12 +118,12 @@ static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const ui "rm"(thresh), "m"(*dithers), "m"(*pw_7f) :"memory" ); -#endif // HAVE_SSSE3 } +#endif // HAVE_SSSE3 +#if HAVE_SSE static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width) { -#if HAVE_SSE #define BLURV(load)\ intptr_t x = -2*width;\ __asm__ volatile(\ @@ -161,17 +161,23 @@ static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t * } else { BLURV("movdqa"); } -#endif // HAVE_SSE } +#endif // HAVE_SSE av_cold void ff_gradfun_init_x86(GradFunContext *gf) { int cpu_flags = av_get_cpu_flags(); - if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) +#if HAVE_MMX2 + if (cpu_flags & AV_CPU_FLAG_MMX2) gf->filter_line = gradfun_filter_line_mmx2; - if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) +#endif +#if HAVE_SSSE3 + if (cpu_flags & AV_CPU_FLAG_SSSE3) gf->filter_line = gradfun_filter_line_ssse3; - if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) +#endif +#if HAVE_SSE + if (cpu_flags & AV_CPU_FLAG_SSE2) gf->blur_line = gradfun_blur_line_sse2; +#endif } diff --git a/libavfilter/x86/yadif.c b/libavfilter/x86/yadif.c index 22799a3c5f..373d9b8c97 100644 --- a/libavfilter/x86/yadif.c +++ b/libavfilter/x86/yadif.c @@ -24,10 +24,6 @@ #include "libavcodec/x86/dsputil_mmx.h" #include "libavfilter/yadif.h" -static void yadif_filter_line_ssse3(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); -static void yadif_filter_line_sse2(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); -static void yadif_filter_line_mmx(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); - DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL}; DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL}; @@ -57,10 +53,16 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif) { int cpu_flags = av_get_cpu_flags(); - if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) +#if HAVE_MMX + if (cpu_flags & AV_CPU_FLAG_MMX) yadif->filter_line = yadif_filter_line_mmx; - if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) +#endif +#if HAVE_SSE + if (cpu_flags & AV_CPU_FLAG_SSE2) yadif->filter_line = yadif_filter_line_sse2; - if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) +#endif +#if HAVE_SSSE3 + if (cpu_flags & AV_CPU_FLAG_SSSE3) yadif->filter_line = yadif_filter_line_ssse3; +#endif } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index c5e4582913..302e7b687f 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -76,6 +76,59 @@ static AVStream *create_stream(AVFormatContext *s, int tag, int codec_type){ avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ return st; } +static int flv_same_audio_codec(AVCodecContext *acodec, int flags) +{ + int bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; + int flv_codecid = flags & FLV_AUDIO_CODECID_MASK; + int codec_id; + + if (!acodec->codec_id && !acodec->codec_tag) + return 1; + + if (acodec->bits_per_coded_sample != bits_per_coded_sample) + return 0; + + switch(flv_codecid) { + //no distinction between S16 and S8 PCM codec flags + case FLV_CODECID_PCM: + codec_id = bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : +#if HAVE_BIGENDIAN + CODEC_ID_PCM_S16BE; +#else + CODEC_ID_PCM_S16LE; +#endif + return codec_id == acodec->codec_id; + case FLV_CODECID_PCM_LE: + codec_id = bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : CODEC_ID_PCM_S16LE; + return codec_id == acodec->codec_id; + case FLV_CODECID_AAC: + return acodec->codec_id == CODEC_ID_AAC; + case FLV_CODECID_ADPCM: + return acodec->codec_id == CODEC_ID_ADPCM_SWF; + case FLV_CODECID_SPEEX: + return acodec->codec_id == CODEC_ID_SPEEX; + case FLV_CODECID_MP3: + return acodec->codec_id == CODEC_ID_MP3; + case FLV_CODECID_NELLYMOSER_8KHZ_MONO: + return acodec->sample_rate == 8000 && + acodec->codec_id == CODEC_ID_NELLYMOSER; + case FLV_CODECID_NELLYMOSER_16KHZ_MONO: + return acodec->sample_rate == 16000 && + acodec->codec_id == CODEC_ID_NELLYMOSER; + case FLV_CODECID_NELLYMOSER: + return acodec->codec_id == CODEC_ID_NELLYMOSER; + case FLV_CODECID_PCM_MULAW: + return acodec->sample_rate == 8000 && + acodec->codec_id == CODEC_ID_PCM_MULAW; + case FLV_CODECID_PCM_ALAW: + return acodec->sample_rate = 8000 && + acodec->codec_id == CODEC_ID_PCM_ALAW; + default: + return acodec->codec_tag == (flv_codecid >> FLV_AUDIO_CODECID_OFFSET); + } + + return 0; +} static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecContext *acodec, int flv_codecid) { switch(flv_codecid) { @@ -122,6 +175,33 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecCo } } +static int flv_same_video_codec(AVCodecContext *vcodec, int flags) +{ + int flv_codecid = flags & FLV_VIDEO_CODECID_MASK; + + if (!vcodec->codec_id && !vcodec->codec_tag) + return 1; + + switch (flv_codecid) { + case FLV_CODECID_H263: + return vcodec->codec_id == CODEC_ID_FLV1; + case FLV_CODECID_SCREEN: + return vcodec->codec_id == CODEC_ID_FLASHSV; + case FLV_CODECID_SCREEN2: + return vcodec->codec_id == CODEC_ID_FLASHSV2; + case FLV_CODECID_VP6: + return vcodec->codec_id == CODEC_ID_VP6F; + case FLV_CODECID_VP6A: + return vcodec->codec_id == CODEC_ID_VP6A; + case FLV_CODECID_H264: + return vcodec->codec_id == CODEC_ID_H264; + default: + return vcodec->codec_tag == flv_codecid; + } + + return 0; +} + static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) { AVCodecContext *vcodec = vstream->codec; switch(flv_codecid) { @@ -516,7 +596,7 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt, for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; - if (st->id == 2) + if (st->codec->codec_type == AVMEDIA_TYPE_DATA) break; } @@ -616,8 +696,18 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) /* now find stream */ for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; - if (st->id == stream_type) + if (stream_type == FLV_STREAM_TYPE_AUDIO && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { + if (flv_same_audio_codec(st->codec, flags)) { + break; + } + } else + if (stream_type == FLV_STREAM_TYPE_VIDEO && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + if (flv_same_video_codec(st->codec, flags)) { + break; + } + } else if (st->id == stream_type) { break; + } } if(i == s->nb_streams){ av_log(s, AV_LOG_WARNING, "Stream discovered after head already parsed\n"); diff --git a/libavformat/rtp.h b/libavformat/rtp.h index 5cd77fed9b..03fdb606ca 100644 --- a/libavformat/rtp.h +++ b/libavformat/rtp.h @@ -77,7 +77,7 @@ enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type); #define RTCP_TX_RATIO_DEN 1000 /* An arbitrary id value for RTP Xiph streams - only relevant to indicate - * the the configuration has changed within a stream (by changing the + * that the configuration has changed within a stream (by changing the * ident value sent). */ #define RTP_XIPH_IDENT 0xfecdba diff --git a/libavformat/version.h b/libavformat/version.h index 6090d651be..f562a9923f 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -44,7 +44,7 @@ #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_OLD_AVIO diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h index f5a59a6928..52af66e722 100644 --- a/libavutil/arm/intmath.h +++ b/libavutil/arm/intmath.h @@ -75,7 +75,6 @@ static av_always_inline av_const int16_t av_clip_int16_arm(int a) return x; } -#if !CONFIG_SMALL //the code below cannot be compiled without always_inline #define av_clip_uintp2 av_clip_uintp2_arm static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) { @@ -83,7 +82,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); return x; } -#endif //!CONFIG_SMALL + #else /* HAVE_ARMV6 */ diff --git a/libavutil/attributes.h b/libavutil/attributes.h index 9a837a7d15..c1f26f5ba4 100644 --- a/libavutil/attributes.h +++ b/libavutil/attributes.h @@ -50,65 +50,45 @@ #endif #endif -#ifndef av_noreturn -#if AV_GCC_VERSION_AT_LEAST(2,5) -# define av_noreturn __attribute__((noreturn)) -#else -# define av_noreturn -#endif -#endif - -#ifndef av_noinline #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_noinline __attribute__((noinline)) #else # define av_noinline #endif -#endif -#ifndef av_pure #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_pure __attribute__((pure)) #else # define av_pure #endif -#endif #ifndef av_restrict #define av_restrict restrict #endif -#ifndef av_const #if AV_GCC_VERSION_AT_LEAST(2,6) # define av_const __attribute__((const)) #else # define av_const #endif -#endif -#ifndef av_cold #if AV_GCC_VERSION_AT_LEAST(4,3) # define av_cold __attribute__((cold)) #else # define av_cold #endif -#endif -#ifndef av_flatten #if AV_GCC_VERSION_AT_LEAST(4,1) # define av_flatten __attribute__((flatten)) #else # define av_flatten #endif -#endif -#ifndef attribute_deprecated #if AV_GCC_VERSION_AT_LEAST(3,1) # define attribute_deprecated __attribute__((deprecated)) #else # define attribute_deprecated #endif -#endif /** * Disable warnings about deprecated features @@ -128,42 +108,34 @@ #endif -#ifndef av_unused #if defined(__GNUC__) # define av_unused __attribute__((unused)) #else # define av_unused #endif -#endif /** * Mark a variable as used and prevent the compiler from optimizing it * away. This is useful for variables accessed only from inline * assembler without the compiler being aware. */ -#ifndef av_used #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_used __attribute__((used)) #else # define av_used #endif -#endif -#ifndef av_alias #if AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((may_alias)) #else # define av_alias #endif -#endif -#ifndef av_uninit #if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define av_uninit(x) x=x #else # define av_uninit(x) x #endif -#endif #ifdef __GNUC__ # define av_builtin_constant_p __builtin_constant_p @@ -173,4 +145,10 @@ # define av_printf_format(fmtpos, attrpos) #endif +#if AV_GCC_VERSION_AT_LEAST(2,5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + #endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/libavutil/dict.h b/libavutil/dict.h index 5a572248fb..54ecba0c2d 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -124,4 +124,4 @@ void av_dict_free(AVDictionary **m); * @} */ -#endif // AVUTIL_DICT_H +#endif /* AVUTIL_DICT_H */ diff --git a/tools/patcheck b/tools/patcheck index 517b842c53..80073aead9 100755 --- a/tools/patcheck +++ b/tools/patcheck @@ -67,7 +67,8 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^ cat $TMP hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $* -hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $* +hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $* + hiegrep 'av_log\( *NULL' 'Missing context in av_log' $* hiegrep '[^sn]printf' 'Please use av_log' $* hiegrep '\bmalloc' 'Please use av_malloc' $* |