* qatar/master:
ARM: ac3: update ff_ac3_extract_exponents_neon per 8b7b2d6
ARM: NEON optimised vector_clip_int32()
swscale: disable full_chroma_int when converting to non-24/32bpp RGB.
suggest to use av_get_bytes_per_sample() in av_get_bits_per_sample_format() doxy
ffmpeg: use av_get_bytes_per_sample() in place of av_get_bits_per_sample_fmt()
put_bits: remove ALT_BITSTREAM_WRITER
put_bits: always use intreadwrite.h macros
libavformat: Add an example how to use the metadata API
doxygen: Prefer member groups over grouping into modules
doxygen: be more permissive when searching for API examples
avformat: doxify the Metadata API
lavf: restore old behavior for custom AVIOContex with an AVFMT_NOFILE format.
lavf: use the correct pointer in av_open_input_stream().
avidec: infer absolute vs relative index from first packet
Conflicts:
libavformat/Makefile
libavformat/avidec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.9
| @@ -591,14 +591,14 @@ EXCLUDE_SYMBOLS = | |||
| # directories that contain example code fragments that are included (see | |||
| # the \include command). | |||
| EXAMPLE_PATH = libavcodec/api-example.c libavformat/output-example.c | |||
| EXAMPLE_PATH = libavcodec/ libavformat/ | |||
| # If the value of the EXAMPLE_PATH tag contains directories, you can use the | |||
| # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp | |||
| # and *.h) to filter out the source-files in the directories. If left | |||
| # blank all files are included. | |||
| EXAMPLE_PATTERNS = | |||
| EXAMPLE_PATTERNS = *-example.c | |||
| # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be | |||
| # searched for input files to be used with the \include or \dontinclude | |||
| @@ -1859,7 +1859,7 @@ static int output_packet(AVInputStream *ist, int ist_index, | |||
| ret = 0; | |||
| /* encode any samples remaining in fifo */ | |||
| if (fifo_bytes > 0) { | |||
| int osize = av_get_bits_per_sample_fmt(enc->sample_fmt) >> 3; | |||
| int osize = av_get_bytes_per_sample(enc->sample_fmt); | |||
| int fs_tmp = enc->frame_size; | |||
| av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); | |||
| @@ -258,7 +258,7 @@ typedef struct { | |||
| DynamicRangeControl che_drc; | |||
| /** | |||
| * @defgroup elements Channel element related data. | |||
| * @name Channel element related data | |||
| * @{ | |||
| */ | |||
| enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the | |||
| @@ -270,14 +270,15 @@ typedef struct { | |||
| /** @} */ | |||
| /** | |||
| * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.) | |||
| * @name temporary aligned temporary buffers | |||
| * (We do not want to have these on the stack.) | |||
| * @{ | |||
| */ | |||
| DECLARE_ALIGNED(32, float, buf_mdct)[1024]; | |||
| /** @} */ | |||
| /** | |||
| * @defgroup tables Computed / set up during initialization. | |||
| * @name Computed / set up during initialization | |||
| * @{ | |||
| */ | |||
| FFTContext mdct; | |||
| @@ -289,7 +290,7 @@ typedef struct { | |||
| /** @} */ | |||
| /** | |||
| * @defgroup output Members used for output interleaving. | |||
| * @name Members used for output interleaving | |||
| * @{ | |||
| */ | |||
| float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output). | |||
| @@ -94,7 +94,7 @@ typedef struct AC3BitAllocParameters { | |||
| * Coded AC-3 header values up to the lfeon element, plus derived values. | |||
| */ | |||
| typedef struct { | |||
| /** @defgroup coded Coded elements | |||
| /** @name Coded elements | |||
| * @{ | |||
| */ | |||
| uint16_t sync_word; | |||
| @@ -112,7 +112,7 @@ typedef struct { | |||
| int num_blocks; ///< number of audio blocks | |||
| /** @} */ | |||
| /** @defgroup derived Derived values | |||
| /** @name Derived values | |||
| * @{ | |||
| */ | |||
| uint8_t sr_shift; | |||
| @@ -69,7 +69,7 @@ typedef struct { | |||
| AVCodecContext *avctx; ///< parent context | |||
| GetBitContext gbc; ///< bitstream reader | |||
| ///@defgroup bsi bit stream information | |||
| ///@name Bit stream information | |||
| ///@{ | |||
| int frame_type; ///< frame type (strmtyp) | |||
| int substreamid; ///< substream identification | |||
| @@ -87,7 +87,7 @@ typedef struct { | |||
| int eac3; ///< indicates if current frame is E-AC-3 | |||
| ///@} | |||
| ///@defgroup audfrm frame syntax parameters | |||
| ///@name Frame syntax parameters | |||
| int snr_offset_strategy; ///< SNR offset strategy (snroffststr) | |||
| int block_switch_syntax; ///< block switch syntax enabled (blkswe) | |||
| int dither_flag_syntax; ///< dither flag syntax enabled (dithflage) | |||
| @@ -97,7 +97,7 @@ typedef struct { | |||
| int skip_syntax; ///< skip field syntax enabled (skipflde) | |||
| ///@} | |||
| ///@defgroup cpl standard coupling | |||
| ///@name Standard coupling | |||
| int cpl_in_use[AC3_MAX_BLOCKS]; ///< coupling in use (cplinu) | |||
| int cpl_strategy_exists[AC3_MAX_BLOCKS];///< coupling strategy exists (cplstre) | |||
| int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) | |||
| @@ -110,7 +110,7 @@ typedef struct { | |||
| int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; ///< coupling coordinates (cplco) | |||
| ///@} | |||
| ///@defgroup spx spectral extension | |||
| ///@name Spectral extension | |||
| ///@{ | |||
| int spx_in_use; ///< spectral extension in use (spxinu) | |||
| uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension (chinspx) | |||
| @@ -126,12 +126,12 @@ typedef struct { | |||
| float spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS];///< spx signal blending factor (sblendfact) | |||
| ///@} | |||
| ///@defgroup aht adaptive hybrid transform | |||
| ///@name Adaptive hybrid transform | |||
| int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu) | |||
| int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][AC3_MAX_BLOCKS]; ///< pre-IDCT mantissas | |||
| ///@} | |||
| ///@defgroup channel channel | |||
| ///@name Channel | |||
| int fbw_channels; ///< number of full-bandwidth channels | |||
| int channels; ///< number of total channels | |||
| int lfe_ch; ///< index of LFE channel | |||
| @@ -141,27 +141,27 @@ typedef struct { | |||
| int out_channels; ///< number of output channels | |||
| ///@} | |||
| ///@defgroup dynrng dynamic range | |||
| ///@name Dynamic range | |||
| float dynamic_range[2]; ///< dynamic range | |||
| ///@} | |||
| ///@defgroup bandwidth bandwidth | |||
| ///@name Bandwidth | |||
| int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant) | |||
| int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant) | |||
| ///@} | |||
| ///@defgroup rematrixing rematrixing | |||
| ///@name Rematrixing | |||
| int num_rematrixing_bands; ///< number of rematrixing bands (nrematbnd) | |||
| int rematrixing_flags[4]; ///< rematrixing flags (rematflg) | |||
| ///@} | |||
| ///@defgroup exponents exponents | |||
| ///@name Exponents | |||
| int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups (nexpgrp) | |||
| int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents | |||
| int exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies (expstr) | |||
| ///@} | |||
| ///@defgroup bitalloc bit allocation | |||
| ///@name Bit allocation | |||
| AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters | |||
| int first_cpl_leak; ///< first coupling leak state (firstcplleak) | |||
| int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets (snroffst) | |||
| @@ -177,25 +177,25 @@ typedef struct { | |||
| uint8_t dba_values[AC3_MAX_CHANNELS][8]; ///< delta values for each segment | |||
| ///@} | |||
| ///@defgroup dithering zero-mantissa dithering | |||
| ///@name Zero-mantissa dithering | |||
| int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags (dithflg) | |||
| AVLFG dith_state; ///< for dither generation | |||
| ///@} | |||
| ///@defgroup imdct IMDCT | |||
| ///@name IMDCT | |||
| int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags (blksw) | |||
| FFTContext imdct_512; ///< for 512 sample IMDCT | |||
| FFTContext imdct_256; ///< for 256 sample IMDCT | |||
| ///@} | |||
| ///@defgroup opt optimization | |||
| ///@name Optimization | |||
| DSPContext dsp; ///< for optimization | |||
| AC3DSPContext ac3dsp; | |||
| FmtConvertContext fmt_conv; ///< optimized conversion functions | |||
| float mul_bias; ///< scaling for float_to_int16 conversion | |||
| ///@} | |||
| ///@defgroup arrays aligned arrays | |||
| ///@name Aligned arrays | |||
| DECLARE_ALIGNED(16, int, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< fixed-point transform coefficients | |||
| DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< transform coefficients | |||
| DECLARE_ALIGNED(32, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< delay - added to the next block | |||
| @@ -204,7 +204,7 @@ static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf, | |||
| } | |||
| /// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions | |||
| /// @name AMR pitch LPC coefficient decoding functions | |||
| /// @{ | |||
| /** | |||
| @@ -341,7 +341,7 @@ static void lsf2lsp_3(AMRContext *p) | |||
| /// @} | |||
| /// @defgroup amr_pitch_vector_decoding AMR pitch vector decoding functions | |||
| /// @name AMR pitch vector decoding functions | |||
| /// @{ | |||
| /** | |||
| @@ -403,7 +403,7 @@ static void decode_pitch_vector(AMRContext *p, | |||
| /// @} | |||
| /// @defgroup amr_algebraic_code_book AMR algebraic code book (fixed) vector decoding functions | |||
| /// @name AMR algebraic code book (fixed) vector decoding functions | |||
| /// @{ | |||
| /** | |||
| @@ -547,7 +547,7 @@ static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode, | |||
| /// @} | |||
| /// @defgroup amr_gain_decoding AMR gain decoding functions | |||
| /// @name AMR gain decoding functions | |||
| /// @{ | |||
| /** | |||
| @@ -633,7 +633,7 @@ static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe, | |||
| /// @} | |||
| /// @defgroup amr_pre_processing AMR pre-processing functions | |||
| /// @name AMR preprocessing functions | |||
| /// @{ | |||
| /** | |||
| @@ -751,7 +751,7 @@ static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse, | |||
| /// @} | |||
| /// @defgroup amr_synthesis AMR synthesis functions | |||
| /// @name AMR synthesis functions | |||
| /// @{ | |||
| /** | |||
| @@ -812,7 +812,7 @@ static int synthesis(AMRContext *p, float *lpc, | |||
| /// @} | |||
| /// @defgroup amr_update AMR update functions | |||
| /// @name AMR update functions | |||
| /// @{ | |||
| /** | |||
| @@ -837,7 +837,7 @@ static void update_state(AMRContext *p) | |||
| /// @} | |||
| /// @defgroup amr_postproc AMR Post processing functions | |||
| /// @name AMR Postprocessing functions | |||
| /// @{ | |||
| /** | |||
| @@ -217,7 +217,7 @@ static av_cold int ape_decode_close(AVCodecContext * avctx) | |||
| } | |||
| /** | |||
| * @defgroup rangecoder APE range decoder | |||
| * @name APE range decoding functions | |||
| * @{ | |||
| */ | |||
| @@ -95,19 +95,14 @@ function ff_float_to_fixed24_neon, export=1 | |||
| endfunc | |||
| function ff_ac3_extract_exponents_neon, export=1 | |||
| vmov.i32 q14, #24 | |||
| vmov.i32 q15, #8 | |||
| 1: | |||
| vld1.32 {q0}, [r1,:128] | |||
| vld1.32 {q0}, [r1,:128]! | |||
| vabs.s32 q1, q0 | |||
| vclz.i32 q3, q1 | |||
| vsub.i32 q3, q3, q15 | |||
| vcge.s32 q2, q3, q14 | |||
| vbit q3, q14, q2 | |||
| vbic q0, q0, q2 | |||
| vmovn.i32 d6, q3 | |||
| vmovn.i16 d6, q3 | |||
| vst1.32 {q0}, [r1,:128]! | |||
| vst1.32 {d6[0]}, [r0,:32]! | |||
| subs r2, r2, #4 | |||
| bgt 1b | |||
| @@ -160,6 +160,8 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, | |||
| void ff_vector_clipf_neon(float *dst, const float *src, float min, float max, | |||
| int len); | |||
| void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min, | |||
| int32_t max, unsigned int len); | |||
| void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize); | |||
| @@ -316,6 +318,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) | |||
| c->vector_fmul_reverse = ff_vector_fmul_reverse_neon; | |||
| c->vector_fmul_add = ff_vector_fmul_add_neon; | |||
| c->vector_clipf = ff_vector_clipf_neon; | |||
| c->vector_clip_int32 = ff_vector_clip_int32_neon; | |||
| c->vector_fmul_sv_scalar[0] = ff_vector_fmul_sv_scalar_2_neon; | |||
| c->vector_fmul_sv_scalar[1] = ff_vector_fmul_sv_scalar_4_neon; | |||
| @@ -815,3 +815,19 @@ function ff_apply_window_int16_neon, export=1 | |||
| pop {r4,pc} | |||
| endfunc | |||
| function ff_vector_clip_int32_neon, export=1 | |||
| vdup.32 q0, r2 | |||
| vdup.32 q1, r3 | |||
| ldr r2, [sp] | |||
| 1: | |||
| vld1.32 {q2-q3}, [r1,:128]! | |||
| vmin.s32 q2, q2, q1 | |||
| vmin.s32 q3, q3, q1 | |||
| vmax.s32 q2, q2, q0 | |||
| vmax.s32 q3, q3, q0 | |||
| vst1.32 {q2-q3}, [r0,:128]! | |||
| subs r2, r2, #8 | |||
| bgt 1b | |||
| bx lr | |||
| endfunc | |||
| @@ -25,8 +25,7 @@ | |||
| #include "avcodec.h" | |||
| /** | |||
| * Default values for ASS style. | |||
| * @defgroup ass_default | |||
| * @name Default values for ASS style | |||
| * @{ | |||
| */ | |||
| #define ASS_DEFAULT_FONT "Arial" | |||
| @@ -2535,7 +2535,7 @@ typedef struct AVCodecContext { | |||
| #if FF_API_FLAC_GLOBAL_OPTS | |||
| /** | |||
| * @defgroup flac_opts FLAC options | |||
| * @name FLAC options | |||
| * @deprecated Use FLAC encoder private options instead. | |||
| * @{ | |||
| */ | |||
| @@ -2957,7 +2957,7 @@ typedef struct AVCodec { | |||
| const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} | |||
| /** | |||
| * @defgroup framethreading Frame-level threading support functions. | |||
| * @name Frame-level threading support functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| @@ -3915,7 +3915,7 @@ int av_get_bits_per_sample(enum CodecID codec_id); | |||
| #if FF_API_OLD_SAMPLE_FMT | |||
| /** | |||
| * @deprecated Use av_get_bits_per_sample_fmt() instead. | |||
| * @deprecated Use av_get_bytes_per_sample() instead. | |||
| */ | |||
| attribute_deprecated | |||
| int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt); | |||
| @@ -43,11 +43,7 @@ const uint8_t ff_log2_run[41]={ | |||
| void align_put_bits(PutBitContext *s) | |||
| { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| put_bits(s,( - s->index) & 7,0); | |||
| #else | |||
| put_bits(s,s->bit_left & 7,0); | |||
| #endif | |||
| } | |||
| void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) | |||
| @@ -507,7 +507,7 @@ typedef struct H264Context{ | |||
| int cabac_init_idc; | |||
| /** | |||
| * @defgroup multithreading Members for slice based multithreading | |||
| * @name Members for slice based multithreading | |||
| * @{ | |||
| */ | |||
| struct H264Context *thread_context[MAX_THREADS]; | |||
| @@ -2170,9 +2170,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ | |||
| int d= 100 / s->avctx->error_rate; | |||
| if(r % d == 0){ | |||
| current_packet_size=0; | |||
| #ifndef ALT_BITSTREAM_WRITER | |||
| s->pb.buf_ptr= s->ptr_lastgob; | |||
| #endif | |||
| assert(put_bits_ptr(&s->pb) == s->ptr_lastgob); | |||
| } | |||
| } | |||
| @@ -36,19 +36,10 @@ | |||
| #include "mathops.h" | |||
| #include "config.h" | |||
| //#define ALT_BITSTREAM_WRITER | |||
| //#define ALIGNED_BITSTREAM_WRITER | |||
| /* buf and buf_end must be present and used by every alternative writer. */ | |||
| typedef struct PutBitContext { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| uint8_t *buf, *buf_end; | |||
| int index; | |||
| #else | |||
| uint32_t bit_buf; | |||
| int bit_left; | |||
| uint8_t *buf, *buf_ptr, *buf_end; | |||
| #endif | |||
| int size_in_bits; | |||
| } PutBitContext; | |||
| @@ -68,15 +59,9 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_s | |||
| s->size_in_bits= 8*buffer_size; | |||
| s->buf = buffer; | |||
| s->buf_end = s->buf + buffer_size; | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| s->index=0; | |||
| ((uint32_t*)(s->buf))[0]=0; | |||
| // memset(buffer, 0, buffer_size); | |||
| #else | |||
| s->buf_ptr = s->buf; | |||
| s->bit_left=32; | |||
| s->bit_buf=0; | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -84,11 +69,7 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_s | |||
| */ | |||
| static inline int put_bits_count(PutBitContext *s) | |||
| { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| return s->index; | |||
| #else | |||
| return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -96,9 +77,6 @@ static inline int put_bits_count(PutBitContext *s) | |||
| */ | |||
| static inline void flush_put_bits(PutBitContext *s) | |||
| { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| align_put_bits(s); | |||
| #else | |||
| #ifndef BITSTREAM_WRITER_LE | |||
| s->bit_buf<<= s->bit_left; | |||
| #endif | |||
| @@ -115,10 +93,9 @@ static inline void flush_put_bits(PutBitContext *s) | |||
| } | |||
| s->bit_left=32; | |||
| s->bit_buf=0; | |||
| #endif | |||
| } | |||
| #if defined(ALT_BITSTREAM_WRITER) || defined(BITSTREAM_WRITER_LE) | |||
| #ifdef BITSTREAM_WRITER_LE | |||
| #define align_put_bits align_put_bits_unsupported_here | |||
| #define ff_put_string ff_put_string_unsupported_here | |||
| #define ff_copy_bits ff_copy_bits_unsupported_here | |||
| @@ -148,7 +125,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length); | |||
| * Use put_bits32 to write 32 bits. | |||
| */ | |||
| static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| #ifndef ALT_BITSTREAM_WRITER | |||
| { | |||
| unsigned int bit_buf; | |||
| int bit_left; | |||
| @@ -164,12 +140,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| #ifdef BITSTREAM_WRITER_LE | |||
| bit_buf |= value << (32 - bit_left); | |||
| if (n >= bit_left) { | |||
| #if !HAVE_FAST_UNALIGNED | |||
| if (3 & (intptr_t) s->buf_ptr) { | |||
| AV_WL32(s->buf_ptr, bit_buf); | |||
| } else | |||
| #endif | |||
| *(uint32_t *)s->buf_ptr = av_le2ne32(bit_buf); | |||
| AV_WL32(s->buf_ptr, bit_buf); | |||
| s->buf_ptr+=4; | |||
| bit_buf = (bit_left==32)?0:value >> bit_left; | |||
| bit_left+=32; | |||
| @@ -182,12 +153,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| } else { | |||
| bit_buf<<=bit_left; | |||
| bit_buf |= value >> (n - bit_left); | |||
| #if !HAVE_FAST_UNALIGNED | |||
| if (3 & (intptr_t) s->buf_ptr) { | |||
| AV_WB32(s->buf_ptr, bit_buf); | |||
| } else | |||
| #endif | |||
| *(uint32_t *)s->buf_ptr = av_be2ne32(bit_buf); | |||
| AV_WB32(s->buf_ptr, bit_buf); | |||
| //printf("bitbuf = %08x\n", bit_buf); | |||
| s->buf_ptr+=4; | |||
| bit_left+=32 - n; | |||
| @@ -198,70 +164,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| s->bit_buf = bit_buf; | |||
| s->bit_left = bit_left; | |||
| } | |||
| #else /* ALT_BITSTREAM_WRITER defined */ | |||
| { | |||
| # ifdef ALIGNED_BITSTREAM_WRITER | |||
| # if ARCH_X86 | |||
| __asm__ volatile( | |||
| "movl %0, %%ecx \n\t" | |||
| "xorl %%eax, %%eax \n\t" | |||
| "shrdl %%cl, %1, %%eax \n\t" | |||
| "shrl %%cl, %1 \n\t" | |||
| "movl %0, %%ecx \n\t" | |||
| "shrl $3, %%ecx \n\t" | |||
| "andl $0xFFFFFFFC, %%ecx \n\t" | |||
| "bswapl %1 \n\t" | |||
| "orl %1, (%2, %%ecx) \n\t" | |||
| "bswapl %%eax \n\t" | |||
| "addl %3, %0 \n\t" | |||
| "movl %%eax, 4(%2, %%ecx) \n\t" | |||
| : "=&r" (s->index), "=&r" (value) | |||
| : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n)) | |||
| : "%eax", "%ecx" | |||
| ); | |||
| # else | |||
| int index= s->index; | |||
| uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); | |||
| value<<= 32-n; | |||
| ptr[0] |= av_be2ne32(value>>(index&31)); | |||
| ptr[1] = av_be2ne32(value<<(32-(index&31))); | |||
| //if(n>24) printf("%d %d\n", n, value); | |||
| index+= n; | |||
| s->index= index; | |||
| # endif | |||
| # else //ALIGNED_BITSTREAM_WRITER | |||
| # if ARCH_X86 | |||
| __asm__ volatile( | |||
| "movl $7, %%ecx \n\t" | |||
| "andl %0, %%ecx \n\t" | |||
| "addl %3, %%ecx \n\t" | |||
| "negl %%ecx \n\t" | |||
| "shll %%cl, %1 \n\t" | |||
| "bswapl %1 \n\t" | |||
| "movl %0, %%ecx \n\t" | |||
| "shrl $3, %%ecx \n\t" | |||
| "orl %1, (%%ecx, %2) \n\t" | |||
| "addl %3, %0 \n\t" | |||
| "movl $0, 4(%%ecx, %2) \n\t" | |||
| : "=&r" (s->index), "=&r" (value) | |||
| : "r" (s->buf), "r" (n), "0" (s->index), "1" (value) | |||
| : "%ecx" | |||
| ); | |||
| # else | |||
| int index= s->index; | |||
| uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); | |||
| ptr[0] |= av_be2ne32(value<<(32-n-(index&7) )); | |||
| ptr[1] = 0; | |||
| //if(n>24) printf("%d %d\n", n, value); | |||
| index+= n; | |||
| s->index= index; | |||
| # endif | |||
| # endif //!ALIGNED_BITSTREAM_WRITER | |||
| } | |||
| #endif | |||
| static inline void put_sbits(PutBitContext *pb, int n, int32_t value) | |||
| { | |||
| @@ -292,11 +194,7 @@ static void av_unused put_bits32(PutBitContext *s, uint32_t value) | |||
| */ | |||
| static inline uint8_t* put_bits_ptr(PutBitContext *s) | |||
| { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| return s->buf + (s->index>>3); | |||
| #else | |||
| return s->buf_ptr; | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -306,13 +204,8 @@ static inline uint8_t* put_bits_ptr(PutBitContext *s) | |||
| static inline void skip_put_bytes(PutBitContext *s, int n) | |||
| { | |||
| assert((put_bits_count(s)&7)==0); | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| FIXME may need some cleaning of the buffer | |||
| s->index += n<<3; | |||
| #else | |||
| assert(s->bit_left==32); | |||
| s->buf_ptr += n; | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -322,13 +215,9 @@ static inline void skip_put_bytes(PutBitContext *s, int n) | |||
| */ | |||
| static inline void skip_put_bits(PutBitContext *s, int n) | |||
| { | |||
| #ifdef ALT_BITSTREAM_WRITER | |||
| s->index += n; | |||
| #else | |||
| s->bit_left -= n; | |||
| s->buf_ptr-= 4*(s->bit_left>>5); | |||
| s->bit_left &= 31; | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -38,14 +38,14 @@ | |||
| * QCELP unpacked data frame | |||
| */ | |||
| typedef struct { | |||
| /// @defgroup qcelp_codebook_parameters QCELP excitation codebook parameters | |||
| /// @name QCELP excitation codebook parameters | |||
| /// @{ | |||
| uint8_t cbsign[16]; ///!< sign of the codebook gain for each codebook subframe | |||
| uint8_t cbgain[16]; ///!< unsigned codebook gain for each codebook subframe | |||
| uint8_t cindex[16]; ///!< codebook index for each codebook subframe | |||
| /// @} | |||
| /// @defgroup qcelp_pitch_parameters QCELP pitch prediction parameters | |||
| /// @name QCELP pitch prediction parameters | |||
| /// @{ | |||
| uint8_t plag[4]; ///!< pitch lag for each pitch subframe | |||
| uint8_t pfrac[4]; ///!< fractional pitch lag for each pitch subframe | |||
| @@ -62,8 +62,10 @@ static const int rv34_mb_type_to_lavc[12] = { | |||
| static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES]; | |||
| static int rv34_decode_mv(RV34DecContext *r, int block_type); | |||
| /** | |||
| * @defgroup vlc RV30/40 VLC generating functions | |||
| * @name RV30/40 VLC generating functions | |||
| * @{ | |||
| */ | |||
| @@ -171,7 +173,7 @@ static av_cold void rv34_init_tables(void) | |||
| /** | |||
| * @defgroup transform RV30/40 inverse transform functions | |||
| * @name RV30/40 inverse transform functions | |||
| * @{ | |||
| */ | |||
| @@ -246,7 +248,7 @@ static void rv34_inv_transform_noround(DCTELEM *block){ | |||
| /** | |||
| * @defgroup block RV30/40 4x4 block decoding functions | |||
| * @name RV30/40 4x4 block decoding functions | |||
| * @{ | |||
| */ | |||
| @@ -393,7 +395,7 @@ static inline void rv34_dequant4x4_16x16(DCTELEM *block, int Qdc, int Q) | |||
| /** | |||
| * @defgroup rv3040_bitstream RV30/40 bitstream parsing | |||
| * @name RV30/40 bitstream parsing | |||
| * @{ | |||
| */ | |||
| @@ -432,10 +434,76 @@ static inline int rv34_decode_dquant(GetBitContext *gb, int quant) | |||
| return get_bits(gb, 5); | |||
| } | |||
| /** | |||
| * Decode macroblock header and return CBP in case of success, -1 otherwise. | |||
| */ | |||
| static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types) | |||
| { | |||
| MpegEncContext *s = &r->s; | |||
| GetBitContext *gb = &s->gb; | |||
| int mb_pos = s->mb_x + s->mb_y * s->mb_stride; | |||
| int i, t; | |||
| if(!r->si.type){ | |||
| r->is16 = get_bits1(gb); | |||
| if(!r->is16 && !r->rv30){ | |||
| if(!get_bits1(gb)) | |||
| av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n"); | |||
| } | |||
| s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA; | |||
| r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA; | |||
| }else{ | |||
| r->block_type = r->decode_mb_info(r); | |||
| if(r->block_type == -1) | |||
| return -1; | |||
| s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; | |||
| r->mb_type[mb_pos] = r->block_type; | |||
| if(r->block_type == RV34_MB_SKIP){ | |||
| if(s->pict_type == AV_PICTURE_TYPE_P) | |||
| r->mb_type[mb_pos] = RV34_MB_P_16x16; | |||
| if(s->pict_type == AV_PICTURE_TYPE_B) | |||
| r->mb_type[mb_pos] = RV34_MB_B_DIRECT; | |||
| } | |||
| r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]); | |||
| rv34_decode_mv(r, r->block_type); | |||
| if(r->block_type == RV34_MB_SKIP){ | |||
| fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0])); | |||
| return 0; | |||
| } | |||
| r->chroma_vlc = 1; | |||
| r->luma_vlc = 0; | |||
| } | |||
| if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){ | |||
| if(r->is16){ | |||
| t = get_bits(gb, 2); | |||
| fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); | |||
| r->luma_vlc = 2; | |||
| }else{ | |||
| if(r->decode_intra_types(r, gb, intra_types) < 0) | |||
| return -1; | |||
| r->luma_vlc = 1; | |||
| } | |||
| r->chroma_vlc = 0; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0); | |||
| }else{ | |||
| for(i = 0; i < 16; i++) | |||
| intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1); | |||
| if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){ | |||
| r->is16 = 1; | |||
| r->chroma_vlc = 1; | |||
| r->luma_vlc = 2; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0); | |||
| } | |||
| } | |||
| return rv34_decode_cbp(gb, r->cur_vlcs, r->is16); | |||
| } | |||
| /** @} */ //bitstream functions | |||
| /** | |||
| * @defgroup mv motion vector related code (prediction, reconstruction, motion compensation) | |||
| * @name motion vector related code (prediction, reconstruction, motion compensation) | |||
| * @{ | |||
| */ | |||
| @@ -885,7 +953,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) | |||
| /** @} */ // mv group | |||
| /** | |||
| * @defgroup recons Macroblock reconstruction functions | |||
| * @name Macroblock reconstruction functions | |||
| * @{ | |||
| */ | |||
| /** mapping of RV30/40 intra prediction types to standard H.264 types */ | |||
| @@ -1027,79 +1095,6 @@ static void rv34_output_macroblock(RV34DecContext *r, int8_t *intra_types, int c | |||
| } | |||
| } | |||
| /** @} */ // recons group | |||
| /** | |||
| * @addtogroup bitstream | |||
| * Decode macroblock header and return CBP in case of success, -1 otherwise. | |||
| */ | |||
| static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types) | |||
| { | |||
| MpegEncContext *s = &r->s; | |||
| GetBitContext *gb = &s->gb; | |||
| int mb_pos = s->mb_x + s->mb_y * s->mb_stride; | |||
| int i, t; | |||
| if(!r->si.type){ | |||
| r->is16 = get_bits1(gb); | |||
| if(!r->is16 && !r->rv30){ | |||
| if(!get_bits1(gb)) | |||
| av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n"); | |||
| } | |||
| s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA; | |||
| r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA; | |||
| }else{ | |||
| r->block_type = r->decode_mb_info(r); | |||
| if(r->block_type == -1) | |||
| return -1; | |||
| s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; | |||
| r->mb_type[mb_pos] = r->block_type; | |||
| if(r->block_type == RV34_MB_SKIP){ | |||
| if(s->pict_type == AV_PICTURE_TYPE_P) | |||
| r->mb_type[mb_pos] = RV34_MB_P_16x16; | |||
| if(s->pict_type == AV_PICTURE_TYPE_B) | |||
| r->mb_type[mb_pos] = RV34_MB_B_DIRECT; | |||
| } | |||
| r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]); | |||
| rv34_decode_mv(r, r->block_type); | |||
| if(r->block_type == RV34_MB_SKIP){ | |||
| fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0])); | |||
| return 0; | |||
| } | |||
| r->chroma_vlc = 1; | |||
| r->luma_vlc = 0; | |||
| } | |||
| if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){ | |||
| if(r->is16){ | |||
| t = get_bits(gb, 2); | |||
| fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); | |||
| r->luma_vlc = 2; | |||
| }else{ | |||
| if(r->decode_intra_types(r, gb, intra_types) < 0) | |||
| return -1; | |||
| r->luma_vlc = 1; | |||
| } | |||
| r->chroma_vlc = 0; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0); | |||
| }else{ | |||
| for(i = 0; i < 16; i++) | |||
| intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1); | |||
| if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){ | |||
| r->is16 = 1; | |||
| r->chroma_vlc = 1; | |||
| r->luma_vlc = 2; | |||
| r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0); | |||
| } | |||
| } | |||
| return rv34_decode_cbp(gb, r->cur_vlcs, r->is16); | |||
| } | |||
| /** | |||
| * @addtogroup recons | |||
| * @{ | |||
| */ | |||
| /** | |||
| * mask for retrieving all bits in coded block pattern | |||
| * corresponding to one 8x8 block | |||
| @@ -1109,6 +1104,8 @@ static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types) | |||
| #define U_CBP_MASK 0x0F0000 | |||
| #define V_CBP_MASK 0xF00000 | |||
| /** @} */ // recons group | |||
| static void rv34_apply_differences(RV34DecContext *r, int cbp) | |||
| { | |||
| @@ -65,7 +65,7 @@ static const uint8_t rv40_luma_dc_quant[2][32] = { | |||
| }; | |||
| /** | |||
| * @defgroup loopfilter coefficients used by the RV40 loop filter | |||
| * @name Coefficients used by the RV40 loop filter | |||
| * @{ | |||
| */ | |||
| /** | |||
| @@ -42,7 +42,7 @@ typedef struct { | |||
| uint8_t bs_xover_band; | |||
| /** | |||
| * @defgroup bs_header_extra_1 Variables associated with bs_header_extra_1 | |||
| * @name Variables associated with bs_header_extra_1 | |||
| * @{ | |||
| */ | |||
| uint8_t bs_freq_scale; | |||
| @@ -58,7 +58,7 @@ typedef struct { | |||
| */ | |||
| typedef struct { | |||
| /** | |||
| * @defgroup aac_bitstream Main bitstream data variables | |||
| * @name Main bitstream data variables | |||
| * @{ | |||
| */ | |||
| unsigned bs_frame_class; | |||
| @@ -74,7 +74,7 @@ typedef struct { | |||
| /** @} */ | |||
| /** | |||
| * @defgroup state State variables | |||
| * @name State variables | |||
| * @{ | |||
| */ | |||
| DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE]; | |||
| @@ -116,7 +116,7 @@ typedef struct { | |||
| SpectrumParameters spectrum_params; | |||
| int bs_amp_res_header; | |||
| /** | |||
| * @defgroup bs_header_extra_2 variables associated with bs_header_extra_2 | |||
| * @name Variables associated with bs_header_extra_2 | |||
| * @{ | |||
| */ | |||
| unsigned bs_limiter_bands; | |||
| @@ -56,7 +56,7 @@ void write_##type##_2d_array(const void *arg, int len, int len2)\ | |||
| } | |||
| /** | |||
| * @defgroup printfuncs Predefined functions for printing tables | |||
| * @name Predefined functions for printing tables | |||
| * | |||
| * \{ | |||
| */ | |||
| @@ -40,7 +40,7 @@ | |||
| /***********************************************************************/ | |||
| /** | |||
| * @defgroup vc1bitplane VC-1 Bitplane decoding | |||
| * @name VC-1 Bitplane decoding | |||
| * @see 8.7, p56 | |||
| * @{ | |||
| */ | |||
| @@ -137,7 +137,7 @@ static int vc1_init_common(VC1Context *v) | |||
| /***********************************************************************/ | |||
| /** | |||
| * @defgroup vc1bitplane VC-1 Bitplane decoding | |||
| * @name VC-1 Bitplane decoding | |||
| * @see 8.7, p56 | |||
| * @{ | |||
| */ | |||
| @@ -774,7 +774,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v) | |||
| /***********************************************************************/ | |||
| /** | |||
| * @defgroup vc1block VC-1 Block-level functions | |||
| * @name VC-1 Block-level functions | |||
| * @see 7.1.4, p91 and 8.1.1.7, p(1)04 | |||
| * @{ | |||
| */ | |||
| @@ -1512,7 +1512,7 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, | |||
| /** @} */ // Block group | |||
| /** | |||
| * @defgroup vc1_std_mb VC1 Macroblock-level functions in Simple/Main Profiles | |||
| * @name VC1 Macroblock-level functions in Simple/Main Profiles | |||
| * @see 7.1.4, p91 and 8.1.1.7, p(1)04 | |||
| * @{ | |||
| */ | |||
| @@ -128,9 +128,7 @@ static const struct frame_type_desc { | |||
| */ | |||
| typedef struct { | |||
| /** | |||
| * @defgroup struct_global Global values | |||
| * Global values, specified in the stream header / extradata or used | |||
| * all over. | |||
| * @name Global values specified in the stream header / extradata or used all over. | |||
| * @{ | |||
| */ | |||
| GetBitContext gb; ///< packet bitreader. During decoder init, | |||
| @@ -182,8 +180,9 @@ typedef struct { | |||
| /** | |||
| * @} | |||
| * @defgroup struct_packet Packet values | |||
| * Packet values, specified in the packet header or related to a packet. | |||
| * | |||
| * @name Packet values specified in the packet header or related to a packet. | |||
| * | |||
| * A packet is considered to be a single unit of data provided to this | |||
| * decoder by the demuxer. | |||
| * @{ | |||
| @@ -213,7 +212,8 @@ typedef struct { | |||
| /** | |||
| * @} | |||
| * @defgroup struct_frame Frame and superframe values | |||
| * | |||
| * @name Frame and superframe values | |||
| * Superframe and frame data - these can change from frame to frame, | |||
| * although some of them do in that case serve as a cache / history for | |||
| * the next frame or superframe. | |||
| @@ -256,7 +256,9 @@ typedef struct { | |||
| float synth_history[MAX_LSPS]; ///< see #excitation_history | |||
| /** | |||
| * @} | |||
| * @defgroup post_filter Postfilter values | |||
| * | |||
| * @name Postfilter values | |||
| * | |||
| * Variables used for postfilter implementation, mostly history for | |||
| * smoothing and so on, and context variables for FFT/iFFT. | |||
| * @{ | |||
| @@ -432,7 +434,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx) | |||
| } | |||
| /** | |||
| * @defgroup postfilter Postfilter functions | |||
| * @name Postfilter functions | |||
| * Postfilter functions (gain control, wiener denoise filter, DC filter, | |||
| * kalman smoothening, plus surrounding code to wrap it) | |||
| * @{ | |||
| @@ -825,7 +827,7 @@ static void dequant_lsps(double *lsps, int num, | |||
| } | |||
| /** | |||
| * @defgroup lsp_dequant LSP dequantization routines | |||
| * @name LSP dequantization routines | |||
| * LSP dequantization routines, for 10/16LSPs and independent/residual coding. | |||
| * @note we assume enough bits are available, caller should check. | |||
| * lsp10i() consumes 24 bits; lsp10r() consumes an additional 24 bits; | |||
| @@ -969,7 +971,7 @@ static void dequant_lsp16r(GetBitContext *gb, | |||
| /** | |||
| * @} | |||
| * @defgroup aw Pitch-adaptive window coding functions | |||
| * @name Pitch-adaptive window coding functions | |||
| * The next few functions are for pitch-adaptive window coding. | |||
| * @{ | |||
| */ | |||
| @@ -341,6 +341,7 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o | |||
| OBJS-$(CONFIG_ALSA_INDEV) += timefilter.o | |||
| OBJS-$(CONFIG_JACK_INDEV) += timefilter.o | |||
| EXAMPLES = metadata | |||
| TESTPROGS = timefilter | |||
| include $(SRC_PATH)/subdir.mak | |||
| @@ -48,63 +48,70 @@ const char *avformat_license(void); | |||
| struct AVFormatContext; | |||
| /* | |||
| * Public Metadata API. | |||
| /** | |||
| * @defgroup metadata_api Public Metadata API | |||
| * @{ | |||
| * The metadata API allows libavformat to export metadata tags to a client | |||
| * application using a sequence of key/value pairs. Like all strings in FFmpeg, | |||
| * metadata must be stored as UTF-8 encoded Unicode. Note that metadata | |||
| * exported by demuxers isn't checked to be valid UTF-8 in most cases. | |||
| * Important concepts to keep in mind: | |||
| * 1. Keys are unique; there can never be 2 tags with the same key. This is | |||
| * - Keys are unique; there can never be 2 tags with the same key. This is | |||
| * also meant semantically, i.e., a demuxer should not knowingly produce | |||
| * several keys that are literally different but semantically identical. | |||
| * E.g., key=Author5, key=Author6. In this example, all authors must be | |||
| * placed in the same tag. | |||
| * 2. Metadata is flat, not hierarchical; there are no subtags. If you | |||
| * - Metadata is flat, not hierarchical; there are no subtags. If you | |||
| * want to store, e.g., the email address of the child of producer Alice | |||
| * and actor Bob, that could have key=alice_and_bobs_childs_email_address. | |||
| * 3. Several modifiers can be applied to the tag name. This is done by | |||
| * - Several modifiers can be applied to the tag name. This is done by | |||
| * appending a dash character ('-') and the modifier name in the order | |||
| * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. | |||
| * a) language -- a tag whose value is localized for a particular language | |||
| * - language -- a tag whose value is localized for a particular language | |||
| * is appended with the ISO 639-2/B 3-letter language code. | |||
| * For example: Author-ger=Michael, Author-eng=Mike | |||
| * The original/default language is in the unqualified "Author" tag. | |||
| * A demuxer should set a default if it sets any translated tag. | |||
| * b) sorting -- a modified version of a tag that should be used for | |||
| * - sorting -- a modified version of a tag that should be used for | |||
| * sorting will have '-sort' appended. E.g. artist="The Beatles", | |||
| * artist-sort="Beatles, The". | |||
| * | |||
| * 4. Demuxers attempt to export metadata in a generic format, however tags | |||
| * - Demuxers attempt to export metadata in a generic format, however tags | |||
| * with no generic equivalents are left as they are stored in the container. | |||
| * Follows a list of generic tag names: | |||
| * | |||
| * album -- name of the set this work belongs to | |||
| * album_artist -- main creator of the set/album, if different from artist. | |||
| * e.g. "Various Artists" for compilation albums. | |||
| * artist -- main creator of the work | |||
| * comment -- any additional description of the file. | |||
| * composer -- who composed the work, if different from artist. | |||
| * copyright -- name of copyright holder. | |||
| * creation_time-- date when the file was created, preferably in ISO 8601. | |||
| * date -- date when the work was created, preferably in ISO 8601. | |||
| * disc -- number of a subset, e.g. disc in a multi-disc collection. | |||
| * encoder -- name/settings of the software/hardware that produced the file. | |||
| * encoded_by -- person/group who created the file. | |||
| * filename -- original name of the file. | |||
| * genre -- <self-evident>. | |||
| * language -- main language in which the work is performed, preferably | |||
| * in ISO 639-2 format. Multiple languages can be specified by | |||
| * separating them with commas. | |||
| * performer -- artist who performed the work, if different from artist. | |||
| * E.g for "Also sprach Zarathustra", artist would be "Richard | |||
| * Strauss" and performer "London Philharmonic Orchestra". | |||
| * publisher -- name of the label/publisher. | |||
| * service_name -- name of the service in broadcasting (channel name). | |||
| * service_provider -- name of the service provider in broadcasting. | |||
| * title -- name of the work. | |||
| * track -- number of this work in the set, can be in form current/total. | |||
| * variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of | |||
| @verbatim | |||
| album -- name of the set this work belongs to | |||
| album_artist -- main creator of the set/album, if different from artist. | |||
| e.g. "Various Artists" for compilation albums. | |||
| artist -- main creator of the work | |||
| comment -- any additional description of the file. | |||
| composer -- who composed the work, if different from artist. | |||
| copyright -- name of copyright holder. | |||
| creation_time-- date when the file was created, preferably in ISO 8601. | |||
| date -- date when the work was created, preferably in ISO 8601. | |||
| disc -- number of a subset, e.g. disc in a multi-disc collection. | |||
| encoder -- name/settings of the software/hardware that produced the file. | |||
| encoded_by -- person/group who created the file. | |||
| filename -- original name of the file. | |||
| genre -- <self-evident>. | |||
| language -- main language in which the work is performed, preferably | |||
| in ISO 639-2 format. Multiple languages can be specified by | |||
| separating them with commas. | |||
| performer -- artist who performed the work, if different from artist. | |||
| E.g for "Also sprach Zarathustra", artist would be "Richard | |||
| Strauss" and performer "London Philharmonic Orchestra". | |||
| publisher -- name of the label/publisher. | |||
| service_name -- name of the service in broadcasting (channel name). | |||
| service_provider -- name of the service provider in broadcasting. | |||
| title -- name of the work. | |||
| track -- number of this work in the set, can be in form current/total. | |||
| variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of | |||
| @endverbatim | |||
| * | |||
| * Look in the examples section for an application example how to use the Metadata API. | |||
| * | |||
| * @} | |||
| */ | |||
| #if FF_API_OLD_METADATA2 | |||
| @@ -861,7 +861,7 @@ static int get_stream_idx(int *d){ | |||
| } | |||
| } | |||
| static int avi_sync(AVFormatContext *s) | |||
| static int avi_sync(AVFormatContext *s, int exit_early) | |||
| { | |||
| AVIContext *avi = s->priv_data; | |||
| AVIOContext *pb = s->pb; | |||
| @@ -941,7 +941,9 @@ start_sync: | |||
| if( (st->discard >= AVDISCARD_DEFAULT && size==0) | |||
| /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering | |||
| || st->discard >= AVDISCARD_ALL){ | |||
| ast->frame_offset += get_duration(ast, size); | |||
| if (!exit_early) { | |||
| ast->frame_offset += get_duration(ast, size); | |||
| } | |||
| avio_skip(pb, size); | |||
| goto start_sync; | |||
| } | |||
| @@ -961,6 +963,8 @@ start_sync: | |||
| (d[2] == 'd' && d[3] == 'c') || | |||
| (d[2] == 'w' && d[3] == 'b')*/) { | |||
| if (exit_early) | |||
| return 0; | |||
| //av_log(s, AV_LOG_DEBUG, "OK\n"); | |||
| if(d[2]*256+d[3] == ast->prefix) | |||
| ast->prefix_count++; | |||
| @@ -1165,7 +1169,7 @@ resync: | |||
| return size; | |||
| } | |||
| if ((err = avi_sync(s)) < 0) | |||
| if ((err = avi_sync(s, 0)) < 0) | |||
| return err; | |||
| goto resync; | |||
| } | |||
| @@ -1179,13 +1183,22 @@ static int avi_read_idx1(AVFormatContext *s, int size) | |||
| int nb_index_entries, i; | |||
| AVStream *st; | |||
| AVIStream *ast; | |||
| unsigned int index, tag, flags, pos, len; | |||
| unsigned int index, tag, flags, pos, len, first_packet = 1; | |||
| unsigned last_pos= -1; | |||
| int64_t idx1_pos, first_packet_pos = 0, data_offset = 0; | |||
| nb_index_entries = size / 16; | |||
| if (nb_index_entries <= 0) | |||
| return -1; | |||
| idx1_pos = avio_tell(pb); | |||
| avio_seek(pb, avi->movi_list+4, SEEK_SET); | |||
| if (avi_sync(s, 1) == 0) { | |||
| first_packet_pos = avio_tell(pb) - 8; | |||
| } | |||
| avi->stream_index = -1; | |||
| avio_seek(pb, idx1_pos, SEEK_SET); | |||
| /* Read the entries and sort them in each stream component. */ | |||
| for(i = 0; i < nb_index_entries; i++) { | |||
| tag = avio_rl32(pb); | |||
| @@ -1194,9 +1207,6 @@ static int avi_read_idx1(AVFormatContext *s, int size) | |||
| len = avio_rl32(pb); | |||
| av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", | |||
| i, tag, flags, pos, len); | |||
| if(i==0 && pos > avi->movi_list) | |||
| avi->movi_list= 0; //FIXME better check | |||
| pos += avi->movi_list; | |||
| index = ((tag & 0xff) - '0') * 10; | |||
| index += ((tag >> 8) & 0xff) - '0'; | |||
| @@ -1205,9 +1215,14 @@ static int avi_read_idx1(AVFormatContext *s, int size) | |||
| st = s->streams[index]; | |||
| ast = st->priv_data; | |||
| #if defined(DEBUG_SEEK) | |||
| av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len); | |||
| #endif | |||
| if(first_packet && first_packet_pos && len) { | |||
| data_offset = first_packet_pos - pos; | |||
| first_packet = 0; | |||
| } | |||
| pos += data_offset; | |||
| av_dlog(s, "%d cum_len=%"PRId64"\n", len, ast->cum_len); | |||
| if(url_feof(pb)) | |||
| return -1; | |||
| @@ -145,7 +145,7 @@ typedef struct URLPollEntry { | |||
| attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); | |||
| /** | |||
| * @defgroup open_modes URL open modes | |||
| * @name URL open modes | |||
| * The flags argument to url_open and cosins must be one of the following | |||
| * constants, optionally ORed with other flags. | |||
| * @{ | |||
| @@ -176,7 +176,7 @@ extern URLInterruptCB *url_interrupt_cb; | |||
| /** | |||
| * @defgroup old_url_funcs Old url_* functions | |||
| * @deprecated use the buffered API based on AVIOContext instead | |||
| * The following functions are deprecated. Use the buffered API based on #AVIOContext instead. | |||
| * @{ | |||
| */ | |||
| attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, | |||
| @@ -236,7 +236,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( | |||
| /** | |||
| * @defgroup old_avio_funcs Old put_/get_*() functions | |||
| * @deprecated use the avio_ -prefixed functions instead. | |||
| * The following functions are deprecated. Use the "avio_"-prefixed functions instead. | |||
| * @{ | |||
| */ | |||
| attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); | |||
| @@ -273,7 +273,7 @@ attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_in | |||
| /** | |||
| * @defgroup old_url_f_funcs Old url_f* functions | |||
| * @deprecated use the avio_ -prefixed functions instead. | |||
| * The following functions are deprecated, use the "avio_"-prefixed functions instead. | |||
| * @{ | |||
| */ | |||
| attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); | |||
| @@ -471,7 +471,7 @@ void avio_flush(AVIOContext *s); | |||
| int avio_read(AVIOContext *s, unsigned char *buf, int size); | |||
| /** | |||
| * @defgroup avio_read Functions for reading from AVIOContext. | |||
| * @name Functions for reading from AVIOContext | |||
| * @{ | |||
| * | |||
| * @note return 0 if EOF, so you cannot use it if EOF handling is | |||
| @@ -515,7 +515,7 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); | |||
| /** | |||
| * @defgroup open_modes URL open modes | |||
| * @name URL open modes | |||
| * The flags argument to avio_open must be one of the following | |||
| * constants, optionally ORed with other flags. | |||
| * @{ | |||
| @@ -0,0 +1,56 @@ | |||
| /* | |||
| * Copyright (c) 2011 Reinhard Tartler | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| * of this software and associated documentation files (the "Software"), to deal | |||
| * in the Software without restriction, including without limitation the rights | |||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| * copies of the Software, and to permit persons to whom the Software is | |||
| * furnished to do so, subject to the following conditions: | |||
| * | |||
| * The above copyright notice and this permission notice shall be included in | |||
| * all copies or substantial portions of the Software. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||
| * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
| * THE SOFTWARE. | |||
| */ | |||
| /** | |||
| * @file | |||
| * @example libavformat/metadata-example.c | |||
| * Shows how the metadata API can be used in application programs. | |||
| */ | |||
| #include <stdio.h> | |||
| #include <libavformat/avformat.h> | |||
| #include <libavutil/dict.h> | |||
| int main (int argc, char **argv) | |||
| { | |||
| AVFormatContext *fmt_ctx = NULL; | |||
| AVDictionaryEntry *tag = NULL; | |||
| int ret; | |||
| if (argc != 2) { | |||
| printf("usage: %s <input_file>\n" | |||
| "example program to demonstrate the use of the libavformat metadata API.\n" | |||
| "\n", argv[0]); | |||
| return 1; | |||
| } | |||
| av_register_all(); | |||
| if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL))) | |||
| return ret; | |||
| while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) | |||
| printf("%s=%s\n", tag->key, tag->value); | |||
| avformat_free_context(fmt_ctx); | |||
| return 0; | |||
| } | |||
| @@ -138,7 +138,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *p, | |||
| void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p); | |||
| /** | |||
| * @defgroup amffuncs functions used to work with AMF format (which is also used in .flv) | |||
| * @name Functions used to work with the AMF format (which is also used in .flv) | |||
| * @see amf_* funcs in libavformat/flvdec.c | |||
| * @{ | |||
| */ | |||
| @@ -464,10 +464,16 @@ int av_open_input_stream(AVFormatContext **ic_ptr, | |||
| err = AVERROR(ENOMEM); | |||
| goto fail; | |||
| } | |||
| ic->pb = pb; | |||
| if (pb && fmt && fmt->flags & AVFMT_NOFILE) | |||
| av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and " | |||
| "will be ignored with AVFMT_NOFILE format.\n"); | |||
| else | |||
| ic->pb = pb; | |||
| err = avformat_open_input(ic_ptr, filename, fmt, &opts); | |||
| err = avformat_open_input(&ic, filename, fmt, &opts); | |||
| ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above | |||
| *ic_ptr = ic; | |||
| fail: | |||
| av_dict_free(&opts); | |||
| return err; | |||
| @@ -24,7 +24,7 @@ | |||
| #include <stdint.h> | |||
| /** @defgroup errflags Error flags returned by av_lzo1x_decode | |||
| /** @name Error flags returned by av_lzo1x_decode | |||
| * \{ */ | |||
| //! end of the input buffer reached before decoding finished | |||
| #define AV_LZO_INPUT_DEPLETED 1 | |||