History

Merge remote-tracking branch 'qatar/master'

* qatar/master: (47 commits) lavc: hide private symbols. lavc: deprecate img_get_alpha_info(). lavc: use avpriv_ prefix for ff_toupper4. lavc: use avpriv_ prefix for ff_copy_bits and align_put_bits. lavc: use avpriv_ prefix for ff_ac3_parse_header. lavc: use avpriv_ prefix for ff_frame_rate_tab. lavc: rename ff_find_start_code to avpriv_mpv_find_start_code lavc: use avpriv_ prefix for ff_split_xiph_headers. lavc: use avpriv_ prefix for ff_dirac_parse_sequence_header. lavc: use avpriv_ prefix for some dv symbols used in lavf. lavc: use avpriv_ prefix for some flac symbols used in lavf. lavc: use avpriv_ prefix for some mpeg4audio symbols used in lavf. lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf. lavc: use avpriv_ prefix for ff_aac_parse_header(). lavf: hide private symbols. lavf: use avpriv_ prefix for some dv functions. lavf: use avpriv_ prefix for ff_new_chapter(). avcodec: add CODEC_CAP_DELAY note to avcodec_decode_audio3() documentation avcodec: clarify the CODEC_CAP_DELAY note in avcodec_decode_video2() avcodec: clarify documentation of CODEC_CAP_DELAY ... Conflicts: configure doc/general.texi libavcodec/Makefile libavcodec/aacdec.c libavcodec/allcodecs.c libavcodec/avcodec.h libavcodec/dv.c libavcodec/dvdata.c libavcodec/dvdata.h libavcodec/libspeexenc.c libavcodec/mpegvideo.c libavcodec/version.h libavformat/avidec.c libavformat/dv.c libavformat/dv.h libavformat/flvenc.c libavformat/mov.c libavformat/mp3enc.c libavformat/oggparsespeex.c

Michael Niedermayer committed 15 years ago

Commit dd8ffc12 parents 44a2bb7 65d3176113 files · +860 −599Browse files

Unified · Split

113 files
  1. Changelog +1 −0
  2. configure +1 −1
  3. libavcodec/Makefile +1 −0
  4. libavcodec/aac_adtstoasc_bsf.c +2 −2
  5. libavcodec/aac_parser.c +1 −1
  6. libavcodec/aacadtsdec.c +3 −3
  7. libavcodec/aacadtsdec.h +1 −1
  8. libavcodec/aacdec.c +2 −2
  9. libavcodec/aacenc.c +2 −2
  10. libavcodec/ac3_parser.c +2 −2
  11. libavcodec/ac3_parser.h +1 −1
  12. libavcodec/ac3dec.c +1 −1
  13. libavcodec/alsdec.c +1 −1
  14. libavcodec/asv1.c +1 −1
  15. libavcodec/avcodec.h +16 −4
  16. libavcodec/bitstream.c +2 −2
  17. libavcodec/cavsdec.c +3 −3
  18. libavcodec/cljr.c +1 −1
  19. libavcodec/dirac.c +2 −2
  20. libavcodec/dirac.h +2 −2
  21. libavcodec/dv.c +3 −3
  22. libavcodec/dvdata.c +4 −4
  23. libavcodec/dvdata.h +3 −3
  24. libavcodec/flac.h +7 −7
  25. libavcodec/flacdec.c +8 −8
  26. libavcodec/flvenc.c +1 −1
  27. libavcodec/h261enc.c +1 −1
  28. libavcodec/h264_parser.c +1 −1
  29. libavcodec/imgconvert.c +2 −0
  30. libavcodec/internal.h +1 −1
  31. libavcodec/ituh263enc.c +1 −1
  32. libavcodec/jpeglsenc.c +1 −1
  33. libavcodec/libavcodec.v +6 −7
  34. libavcodec/libspeexenc.c +266 −120
  35. libavcodec/libvo-aacenc.c +1 −1
  36. libavcodec/mp3_header_decompress_bsf.c +2 −2
  37. libavcodec/mpeg12.c +8 −8
  38. libavcodec/mpeg12data.c +1 −1
  39. libavcodec/mpeg12data.h +1 −1
  40. libavcodec/mpeg12enc.c +5 −5
  41. libavcodec/mpeg4audio.c +5 −5
  42. libavcodec/mpeg4audio.h +3 −3
  43. libavcodec/mpeg4videoenc.c +2 −2
  44. libavcodec/mpegaudio_parser.c +1 −1
  45. libavcodec/mpegaudiodata.c +2 −2
  46. libavcodec/mpegaudiodata.h +2 −2
  47. libavcodec/mpegaudiodec.c +4 −4
  48. libavcodec/mpegaudiodecheader.c +5 −5
  49. libavcodec/mpegaudiodecheader.h +2 −2
  50. libavcodec/mpegaudioenc.c +3 −3
  51. libavcodec/mpegvideo.c +3 −4
  52. libavcodec/mpegvideo.h +1 −1
  53. libavcodec/mpegvideo_enc.c +5 −5
  54. libavcodec/mpegvideo_parser.c +3 −3
  55. libavcodec/msmpeg4.c +1 −1
  56. libavcodec/put_bits.h +4 −4
  57. libavcodec/rv10enc.c +1 −1
  58. libavcodec/shorten.c +297 −214
  59. libavcodec/svq1enc.c +2 −2
  60. libavcodec/utils.c +1 −1
  61. libavcodec/vcr1.c +1 −1
  62. libavcodec/version.h +4 −1
  63. libavcodec/vorbisdec.c +1 −1
  64. libavcodec/vp3.c +1 −1
  65. libavcodec/wmaenc.c +2 −2
  66. libavcodec/wmaprodec.c +2 −2
  67. libavcodec/wmavoice.c +2 −2
  68. libavcodec/x86/ac3dsp_mmx.c +1 −1
  69. libavcodec/x86/h264_intrapred_init.c +1 −1
  70. libavcodec/x86/proresdsp-init.c +2 −2
  71. libavcodec/x86/vp8dsp-init.c +1 −1
  72. libavcodec/xiph.c +1 −1
  73. libavcodec/xiph.h +3 −3
  74. libavcodec/xsubenc.c +2 −2
  75. libavdevice/dv1394.c +3 −3
  76. libavdevice/libcdio.c +1 −1
  77. libavformat/ac3dec.c +1 −1
  78. libavformat/adtsenc.c +2 −2
  79. libavformat/asfdec.c +1 −1
  80. libavformat/avidec.c +3 −3
  81. libavformat/dv.c +9 −9
  82. libavformat/dv.h +3 −3
  83. libavformat/dvenc.c +1 −1
  84. libavformat/ffmetadec.c +1 −1
  85. libavformat/flacdec.c +2 −2
  86. libavformat/flacenc.c +1 −1
  87. libavformat/flacenc_header.c +1 −1
  88. libavformat/flvdec.c +1 −1
  89. libavformat/flvenc.c +15 −13
  90. libavformat/gxf.c +2 −2
  91. libavformat/internal.h +2 −2
  92. libavformat/isom.c +2 −2
  93. libavformat/latmenc.c +5 −5
  94. libavformat/libavformat.v +21 −5
  95. libavformat/matroskadec.c +3 −3
  96. libavformat/matroskaenc.c +2 −2
  97. libavformat/mov.c +5 −5
  98. libavformat/mp3dec.c +2 −2
  99. libavformat/mp3enc.c +4 −4
  100. libavformat/mpegtsenc.c +1 −1
  101. libavformat/nutdec.c +1 −1
  102. libavformat/nutenc.c +2 −2
  103. libavformat/oggenc.c +2 −2
  104. libavformat/oggparsedirac.c +1 −1
  105. libavformat/oggparseflac.c +1 −1
  106. libavformat/oggparsespeex.c +9 −11
  107. libavformat/oggparsevorbis.c +1 −1
  108. libavformat/rtpenc_mpv.c +1 −1
  109. libavformat/sdp.c +2 −2
  110. libavformat/spdifdec.c +1 −1
  111. libavformat/spdifenc.c +1 −1
  112. libavformat/utils.c +3 −4
  113. tests/ref/fate/lossless-shortenaudio +1 −1
Changelog+1−0
@@ -66,6 +66,7 @@ easier to use. The changes are: · 65 unmodified lines
66- libutvideo wrapper (--enable-libutvideo)66- libutvideo wrapper (--enable-libutvideo)
67- aevalsrc audio source added67- aevalsrc audio source added
68- Ut Video decoder68- Ut Video decoder
69- Speex encoding via libspeex
69 70
70 71
71version 0.8:72version 0.8:
configure+1−1
@@ -182,7 +182,7 @@ External library support: · 181 unmodified lines
182 --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]182 --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
183 --enable-librtmp enable RTMP[E] support via librtmp [no]183 --enable-librtmp enable RTMP[E] support via librtmp [no]
184 --enable-libschroedinger enable Dirac support via libschroedinger [no]184 --enable-libschroedinger enable Dirac support via libschroedinger [no]
185 --enable-libspeex enable Speex encoding and decoding via libspeex [no]185 --enable-libspeex enable Speex support via libspeex [no]
186 --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]186 --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
187 --enable-libtheora enable Theora encoding via libtheora [no]187 --enable-libtheora enable Theora encoding via libtheora [no]
188 --enable-libutvideo enable Ut Video decoding via libutvideo [no]188 --enable-libutvideo enable Ut Video decoding via libutvideo [no]
libavcodec/Makefile+1−0
@@ -702,6 +702,7 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h · 701 unmodified lines
702SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h702SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
703SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h703SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
704SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h704SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
705SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h
705 706
706TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow707TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow
707TESTPROGS-$(HAVE_MMX) += motion708TESTPROGS-$(HAVE_MMX) += motion
libavcodec/aac_adtstoasc_bsf.c+2−2
@@ -55,7 +55,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, · 54 unmodified lines
55 if (show_bits(&gb, 12) != 0xfff)55 if (show_bits(&gb, 12) != 0xfff)
56 return 0;56 return 0;
57 57
58 if (ff_aac_parse_header(&gb, &hdr) < 0) {58 if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
59 av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");59 av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
60 return -1;60 return -1;
61 }61 }
@@ -78,7 +78,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, · 16 unmodified lines
78 return -1;78 return -1;
79 }79 }
80 init_put_bits(&pb, pce_data, MAX_PCE_SIZE);80 init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
81 pce_size = ff_copy_pce_data(&pb, &gb)/8;81 pce_size = avpriv_copy_pce_data(&pb, &gb)/8;
82 flush_put_bits(&pb);82 flush_put_bits(&pb);
83 buf_size -= get_bits_count(&gb)/8;83 buf_size -= get_bits_count(&gb)/8;
84 buf += get_bits_count(&gb)/8;84 buf += get_bits_count(&gb)/8;
libavcodec/aac_parser.c+1−1
@@ -40,7 +40,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, · 39 unmodified lines
40 tmp.u64 = av_be2ne64(state);40 tmp.u64 = av_be2ne64(state);
41 init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);41 init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);
42 42
43 if ((size = ff_aac_parse_header(&bits, &hdr)) < 0)43 if ((size = avpriv_aac_parse_header(&bits, &hdr)) < 0)
44 return 0;44 return 0;
45 *need_next_header = 0;45 *need_next_header = 0;
46 *new_frame_start = 1;46 *new_frame_start = 1;
libavcodec/aacadtsdec.c+3−3
@@ -26,7 +26,7 @@ · 25 unmodified lines
26#include "get_bits.h"26#include "get_bits.h"
27#include "mpeg4audio.h"27#include "mpeg4audio.h"
28 28
29int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)29int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
30{30{
31 int size, rdb, ch, sr;31 int size, rdb, ch, sr;
32 int aot, crc_abs;32 int aot, crc_abs;
@@ -39,7 +39,7 @@ int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) · 6 unmodified lines
39 crc_abs = get_bits1(gbc); /* protection_absent */39 crc_abs = get_bits1(gbc); /* protection_absent */
40 aot = get_bits(gbc, 2); /* profile_objecttype */40 aot = get_bits(gbc, 2); /* profile_objecttype */
41 sr = get_bits(gbc, 4); /* sample_frequency_index */41 sr = get_bits(gbc, 4); /* sample_frequency_index */
42 if(!ff_mpeg4audio_sample_rates[sr])42 if(!avpriv_mpeg4audio_sample_rates[sr])
43 return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;43 return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
44 skip_bits1(gbc); /* private_bit */44 skip_bits1(gbc); /* private_bit */
45 ch = get_bits(gbc, 3); /* channel_configuration */45 ch = get_bits(gbc, 3); /* channel_configuration */
@@ -62,7 +62,7 @@ int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) · 16 unmodified lines
62 hdr->crc_absent = crc_abs;62 hdr->crc_absent = crc_abs;
63 hdr->num_aac_frames = rdb + 1;63 hdr->num_aac_frames = rdb + 1;
64 hdr->sampling_index = sr;64 hdr->sampling_index = sr;
65 hdr->sample_rate = ff_mpeg4audio_sample_rates[sr];65 hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr];
66 hdr->samples = (rdb + 1) * 1024;66 hdr->samples = (rdb + 1) * 1024;
67 hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples;67 hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples;
68 68
libavcodec/aacadtsdec.h+1−1
@@ -49,6 +49,6 @@ typedef struct { · 48 unmodified lines
49 * -2 if the version element is invalid, -3 if the sample rate49 * -2 if the version element is invalid, -3 if the sample rate
50 * element is invalid, or -4 if the bit rate element is invalid.50 * element is invalid, or -4 if the bit rate element is invalid.
51 */51 */
52int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);52int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
53 53
54#endif /* AVCODEC_AACADTSDEC_H */54#endif /* AVCODEC_AACADTSDEC_H */
libavcodec/aacdec.c+2−2
@@ -472,7 +472,7 @@ static int decode_audio_specific_config(AACContext *ac, · 471 unmodified lines
472 472
473 init_get_bits(&gb, data, data_size * 8);473 init_get_bits(&gb, data, data_size * 8);
474 474
475 if ((i = ff_mpeg4audio_get_config(m4ac, data, asclen/8)) < 0)475 if ((i = avpriv_mpeg4audio_get_config(m4ac, data, asclen/8)) < 0)
476 return -1;476 return -1;
477 if (m4ac->sampling_index > 12) {477 if (m4ac->sampling_index > 12) {
478 av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);478 av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
@@ -2077,7 +2077,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) · 1598 unmodified lines
2077 int size;2077 int size;
2078 AACADTSHeaderInfo hdr_info;2078 AACADTSHeaderInfo hdr_info;
2079 2079
2080 size = ff_aac_parse_header(gb, &hdr_info);2080 size = avpriv_aac_parse_header(gb, &hdr_info);
2081 if (size > 0) {2081 if (size > 0) {
2082 if (hdr_info.chan_config) {2082 if (hdr_info.chan_config) {
2083 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];2083 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
libavcodec/aacenc.c+2−2
@@ -180,7 +180,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 179 unmodified lines
180 avctx->frame_size = 1024;180 avctx->frame_size = 1024;
181 181
182 for (i = 0; i < 16; i++)182 for (i = 0; i < 16; i++)
183 if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i])183 if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
184 break;184 break;
185 if (i == 16) {185 if (i == 16) {
186 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);186 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);
@@ -491,7 +491,7 @@ static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s, · 304 unmodified lines
491 put_bits(&s->pb, 8, namelen - 16);491 put_bits(&s->pb, 8, namelen - 16);
492 put_bits(&s->pb, 4, 0); //extension type - filler492 put_bits(&s->pb, 4, 0); //extension type - filler
493 padbits = 8 - (put_bits_count(&s->pb) & 7);493 padbits = 8 - (put_bits_count(&s->pb) & 7);
494 align_put_bits(&s->pb);494 avpriv_align_put_bits(&s->pb);
495 for (i = 0; i < namelen - 2; i++)495 for (i = 0; i < namelen - 2; i++)
496 put_bits(&s->pb, 8, name[i]);496 put_bits(&s->pb, 8, name[i]);
497 put_bits(&s->pb, 12 - padbits, 0);497 put_bits(&s->pb, 12 - padbits, 0);
libavcodec/ac3_parser.c+2−2
@@ -35,7 +35,7 @@ static const uint8_t eac3_blocks[4] = { · 34 unmodified lines
35};35};
36 36
37 37
38int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)38int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
39{39{
40 int frame_size_code;40 int frame_size_code;
41 41
@@ -141,7 +141,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, · 99 unmodified lines
141 GetBitContext gbc;141 GetBitContext gbc;
142 142
143 init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);143 init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
144 err = ff_ac3_parse_header(&gbc, &hdr);144 err = avpriv_ac3_parse_header(&gbc, &hdr);
145 145
146 if(err < 0)146 if(err < 0)
147 return 0;147 return 0;
libavcodec/ac3_parser.h+1−1
@@ -36,6 +36,6 @@ · 35 unmodified lines
36 * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)36 * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
37 * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.37 * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
38 */38 */
39int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);39int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
40 40
41#endif /* AVCODEC_AC3_PARSER_H */41#endif /* AVCODEC_AC3_PARSER_H */
libavcodec/ac3dec.c+1−1
@@ -261,7 +261,7 @@ static int parse_frame_header(AC3DecodeContext *s) · 260 unmodified lines
261 AC3HeaderInfo hdr;261 AC3HeaderInfo hdr;
262 int err;262 int err;
263 263
264 err = ff_ac3_parse_header(&s->gbc, &hdr);264 err = avpriv_ac3_parse_header(&s->gbc, &hdr);
265 if(err)265 if(err)
266 return err;266 return err;
267 267
libavcodec/alsdec.c+1−1
@@ -289,7 +289,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx) · 288 unmodified lines
289 289
290 init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);290 init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
291 291
292 config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata,292 config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,
293 avctx->extradata_size);293 avctx->extradata_size);
294 294
295 if (config_offset < 0)295 if (config_offset < 0)
libavcodec/asv1.c+1−1
@@ -497,7 +497,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, · 496 unmodified lines
497 }497 }
498 emms_c();498 emms_c();
499 499
500 align_put_bits(&a->pb);500 avpriv_align_put_bits(&a->pb);
501 while(put_bits_count(&a->pb)&31)501 while(put_bits_count(&a->pb)&31)
502 put_bits(&a->pb, 8, 0);502 put_bits(&a->pb, 8, 0);
503 503
libavcodec/avcodec.h+16−4
@@ -210,8 +210,10 @@ enum CodecID { · 209 unmodified lines
210 CODEC_ID_DFA,210 CODEC_ID_DFA,
211 CODEC_ID_WMV3IMAGE,211 CODEC_ID_WMV3IMAGE,
212 CODEC_ID_VC1IMAGE,212 CODEC_ID_VC1IMAGE,
213#if LIBAVCODEC_VERSION_MAJOR == 53
213 CODEC_ID_8SVX_RAW,214 CODEC_ID_8SVX_RAW,
214 CODEC_ID_G2M,215 CODEC_ID_G2M,
216#endif
215 CODEC_ID_UTVIDEO_DEPRECATED,217 CODEC_ID_UTVIDEO_DEPRECATED,
216 CODEC_ID_UTVIDEO = 0x800,218 CODEC_ID_UTVIDEO = 0x800,
217 219
@@ -676,8 +678,10 @@ typedef struct RcOverride{ · 458 unmodified lines
676/* Codec can export data for HW decoding (XvMC). */678/* Codec can export data for HW decoding (XvMC). */
677#define CODEC_CAP_HWACCEL 0x0010679#define CODEC_CAP_HWACCEL 0x0010
678/**680/**
679 * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data.681 * Codec has a nonzero delay and needs to be fed with avpkt->data=NULL,
680 * If this is not set, the codec is guaranteed to never be fed with NULL data.682 * avpkt->size=0 at the end to get the delayed data until the decoder no longer
683 * returns frames. If this is not set, the codec is guaranteed to never be fed
684 * with NULL data.
681 */685 */
682#define CODEC_CAP_DELAY 0x0020686#define CODEC_CAP_DELAY 0x0020
683/**687/**
@@ -3608,6 +3612,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma · 2924 unmodified lines
3608enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,3612enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
3609 enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);3613 enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
3610 3614
3615#if FF_API_GET_ALPHA_INFO
3611#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */3616#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
3612#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */3617#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
3613 3618
@@ -3615,8 +3620,10 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum · 1 unmodified line
3615 * Tell if an image really has transparent alpha values.3620 * Tell if an image really has transparent alpha values.
3616 * @return ored mask of FF_ALPHA_xxx constants3621 * @return ored mask of FF_ALPHA_xxx constants
3617 */3622 */
3623attribute_deprecated
3618int img_get_alpha_info(const AVPicture *src,3624int img_get_alpha_info(const AVPicture *src,
3619 enum PixelFormat pix_fmt, int width, int height);3625 enum PixelFormat pix_fmt, int width, int height);
3626#endif
3620 3627
3621/* deinterlace a picture */3628/* deinterlace a picture */
3622/* deinterlace - if not supported return -1 */3629/* deinterlace - if not supported return -1 */
@@ -3940,6 +3947,10 @@ int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) · 317 unmodified lines
3940 * samples should be 16 byte aligned unless the CPU doesn't need it3947 * samples should be 16 byte aligned unless the CPU doesn't need it
3941 * (AltiVec and SSE do).3948 * (AltiVec and SSE do).
3942 *3949 *
3950 * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
3951 * between input and output, these need to be fed with avpkt->data=NULL,
3952 * avpkt->size=0 at the end to return the remaining frames.
3953 *
3943 * @param avctx the codec context3954 * @param avctx the codec context
3944 * @param[out] samples the output buffer, sample type in avctx->sample_fmt3955 * @param[out] samples the output buffer, sample type in avctx->sample_fmt
3945 * @param[in,out] frame_size_ptr the output buffer size in bytes3956 * @param[in,out] frame_size_ptr the output buffer size in bytes
@@ -3973,8 +3984,9 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, · 27 unmodified lines
3973 *3984 *
3974 * In practice, avpkt->data should have 4 byte alignment at minimum.3985 * In practice, avpkt->data should have 4 byte alignment at minimum.
3975 *3986 *
3976 * @note Some codecs have a delay between input and output, these need to be3987 * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
3977 * fed with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames.3988 * between input and output, these need to be fed with avpkt->data=NULL,
3989 * avpkt->size=0 at the end to return the remaining frames.
3978 *3990 *
3979 * @param avctx the codec context3991 * @param avctx the codec context
3980 * @param[out] picture The AVFrame in which the decoded video frame will be stored.3992 * @param[out] picture The AVFrame in which the decoded video frame will be stored.
libavcodec/bitstream.c+2−2
@@ -41,7 +41,7 @@ const uint8_t ff_log2_run[41]={ · 40 unmodified lines
4124,4124,
42};42};
43 43
44void align_put_bits(PutBitContext *s)44void avpriv_align_put_bits(PutBitContext *s)
45{45{
46 put_bits(s,s->bit_left & 7,0);46 put_bits(s,s->bit_left & 7,0);
47}47}
@@ -56,7 +56,7 @@ void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) · 8 unmodified lines
56 put_bits(pb, 8, 0);56 put_bits(pb, 8, 0);
57}57}
58 58
59void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)59void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
60{60{
61 int words= length>>4;61 int words= length>>4;
62 int bits= length&15;62 int bits= length&15;
libavcodec/cavsdec.c+3−3
@@ -625,8 +625,8 @@ static int decode_seq_header(AVSContext *h) { · 624 unmodified lines
625 s->low_delay = get_bits1(&s->gb);625 s->low_delay = get_bits1(&s->gb);
626 h->mb_width = (s->width + 15) >> 4;626 h->mb_width = (s->width + 15) >> 4;
627 h->mb_height = (s->height + 15) >> 4;627 h->mb_height = (s->height + 15) >> 4;
628 h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num;628 h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num;
629 h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den;629 h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den;
630 h->s.avctx->width = s->width;630 h->s.avctx->width = s->width;
631 h->s.avctx->height = s->height;631 h->s.avctx->height = s->height;
632 if(!h->top_qp)632 if(!h->top_qp)
@@ -664,7 +664,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, · 31 unmodified lines
664 buf_ptr = buf;664 buf_ptr = buf;
665 buf_end = buf + buf_size;665 buf_end = buf + buf_size;
666 for(;;) {666 for(;;) {
667 buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc);667 buf_ptr = avpriv_mpv_find_start_code(buf_ptr,buf_end, &stc);
668 if((stc & 0xFFFFFE00) || buf_ptr == buf_end)668 if((stc & 0xFFFFFE00) || buf_ptr == buf_end)
669 return FFMAX(0, buf_ptr - buf - s->parse_context.last_index);669 return FFMAX(0, buf_ptr - buf - s->parse_context.last_index);
670 input_size = (buf_end - buf_ptr)*8;670 input_size = (buf_end - buf_ptr)*8;
libavcodec/cljr.c+1−1
@@ -105,7 +105,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, · 104 unmodified lines
105 105
106 emms_c();106 emms_c();
107 107
108 align_put_bits(&a->pb);108 avpriv_align_put_bits(&a->pb);
109 while(get_bit_count(&a->pb)&31)109 while(get_bit_count(&a->pb)&31)
110 put_bits(&a->pb, 8, 0);110 put_bits(&a->pb, 8, 0);
111 111
libavcodec/dirac.c+2−2
@@ -145,7 +145,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, · 144 unmodified lines
145 }145 }
146 if (source->frame_rate_index > 0) {146 if (source->frame_rate_index > 0) {
147 if (source->frame_rate_index <= 8)147 if (source->frame_rate_index <= 8)
148 frame_rate = ff_frame_rate_tab[source->frame_rate_index];148 frame_rate = avpriv_frame_rate_tab[source->frame_rate_index];
149 else149 else
150 frame_rate = dirac_frame_rate[source->frame_rate_index-9];150 frame_rate = dirac_frame_rate[source->frame_rate_index-9];
151 }151 }
@@ -242,7 +242,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, · 90 unmodified lines
242 return 0;242 return 0;
243}243}
244 244
245int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,245int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
246 dirac_source_params *source)246 dirac_source_params *source)
247{247{
248 unsigned version_major;248 unsigned version_major;
libavcodec/dirac.h+2−2
@@ -51,7 +51,7 @@ typedef struct { · 50 unmodified lines
51 uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]51 uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]
52} dirac_source_params;52} dirac_source_params;
53 53
54int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,54int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
55 dirac_source_params *source);55 dirac_source_params *source);
56 56
57#endif /* AVCODEC_DIRAC_H */57#endif /* AVCODEC_DIRAC_H */
libavcodec/dv.c+3−3
@@ -349,7 +349,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx) · 348 unmodified lines
349 349
350static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)350static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
351{351{
352 if (!ff_dv_codec_profile(avctx)) {352 if (!avpriv_dv_codec_profile(avctx)) {
353 av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",353 av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
354 avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));354 avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
355 return -1;355 return -1;
@@ -1072,7 +1072,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, · 716 unmodified lines
1072 const uint8_t* vsc_pack;1072 const uint8_t* vsc_pack;
1073 int apt, is16_9;1073 int apt, is16_9;
1074 1074
1075 s->sys = ff_dv_frame_profile2(avctx, s->sys, buf, buf_size);1075 s->sys = avpriv_dv_frame_profile2(avctx, s->sys, buf, buf_size);
1076 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {1076 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
1077 av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");1077 av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
1078 return -1; /* NOTE: we only accept several full frames */1078 return -1; /* NOTE: we only accept several full frames */
@@ -1246,7 +1246,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, · 167 unmodified lines
1246{1246{
1247 DVVideoContext *s = c->priv_data;1247 DVVideoContext *s = c->priv_data;
1248 1248
1249 s->sys = ff_dv_codec_profile(c);1249 s->sys = avpriv_dv_codec_profile(c);
1250 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))1250 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))
1251 return -1;1251 return -1;
1252 1252
libavcodec/dvdata.c+4−4
@@ -246,7 +246,7 @@ static const DVprofile dv_profiles[] = { · 245 unmodified lines
246 }246 }
247};247};
248 248
249const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,249const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
250 const uint8_t* frame, unsigned buf_size)250 const uint8_t* frame, unsigned buf_size)
251{251{
252 int i, dsf, stype;252 int i, dsf, stype;
@@ -276,13 +276,13 @@ const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sy · 23 unmodified lines
276 return NULL;276 return NULL;
277}277}
278 278
279const DVprofile* ff_dv_frame_profile(const DVprofile *sys,279const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
280 const uint8_t* frame, unsigned buf_size)280 const uint8_t* frame, unsigned buf_size)
281{281{
282 return ff_dv_frame_profile2(NULL, sys, frame, buf_size);282 return avpriv_dv_frame_profile2(NULL, sys, frame, buf_size);
283}283}
284 284
285const DVprofile* ff_dv_codec_profile(AVCodecContext* codec)285const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec)
286{286{
287 int i;287 int i;
288 288
libavcodec/dvdata.h+3−3
@@ -274,11 +274,11 @@ enum dv_pack_type { · 273 unmodified lines
274 */274 */
275#define DV_MAX_BPM 8275#define DV_MAX_BPM 8
276 276
277const DVprofile* ff_dv_frame_profile(const DVprofile *sys,277const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
278 const uint8_t* frame, unsigned buf_size);278 const uint8_t* frame, unsigned buf_size);
279const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,279const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
280 const uint8_t* frame, unsigned buf_size);280 const uint8_t* frame, unsigned buf_size);
281const DVprofile* ff_dv_codec_profile(AVCodecContext* codec);281const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
282 282
283static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,283static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
284 uint8_t seq_num, uint8_t dif_num,284 uint8_t seq_num, uint8_t dif_num,
libavcodec/flac.h+7−7
@@ -95,8 +95,8 @@ typedef struct FLACFrameInfo { · 94 unmodified lines
95 * @param[out] s where parsed information is stored95 * @param[out] s where parsed information is stored
96 * @param[in] buffer pointer to start of 34-byte streaminfo data96 * @param[in] buffer pointer to start of 34-byte streaminfo data
97 */97 */
98void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,98void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
99 const uint8_t *buffer);99 const uint8_t *buffer);
100 100
101/**101/**
102 * Validate the FLAC extradata.102 * Validate the FLAC extradata.
@@ -105,9 +105,9 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, · 2 unmodified lines
105 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.105 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.
106 * @return 1 if valid, 0 if not valid.106 * @return 1 if valid, 0 if not valid.
107 */107 */
108int ff_flac_is_extradata_valid(AVCodecContext *avctx,108int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
109 enum FLACExtradataFormat *format,109 enum FLACExtradataFormat *format,
110 uint8_t **streaminfo_start);110 uint8_t **streaminfo_start);
111 111
112/**112/**
113 * Parse the metadata block parameters from the header.113 * Parse the metadata block parameters from the header.
@@ -116,8 +116,8 @@ int ff_flac_is_extradata_valid(AVCodecContext *avctx, · 2 unmodified lines
116 * @param[out] type metadata block type116 * @param[out] type metadata block type
117 * @param[out] size metadata block size117 * @param[out] size metadata block size
118 */118 */
119void ff_flac_parse_block_header(const uint8_t *block_header,119void avpriv_flac_parse_block_header(const uint8_t *block_header,
120 int *last, int *type, int *size);120 int *last, int *type, int *size);
121 121
122/**122/**
123 * Calculate an estimate for the maximum frame size based on verbatim mode.123 * Calculate an estimate for the maximum frame size based on verbatim mode.
libavcodec/flacdec.c+8−8
@@ -63,7 +63,7 @@ typedef struct FLACContext { · 62 unmodified lines
63 63
64static void allocate_buffers(FLACContext *s);64static void allocate_buffers(FLACContext *s);
65 65
66int ff_flac_is_extradata_valid(AVCodecContext *avctx,66int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
67 enum FLACExtradataFormat *format,67 enum FLACExtradataFormat *format,
68 uint8_t **streaminfo_start)68 uint8_t **streaminfo_start)
69{69{
@@ -104,11 +104,11 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) · 34 unmodified lines
104 if (!avctx->extradata)104 if (!avctx->extradata)
105 return 0;105 return 0;
106 106
107 if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))107 if (!avpriv_flac_is_extradata_valid(avctx, &format, &streaminfo))
108 return -1;108 return -1;
109 109
110 /* initialize based on the demuxer-supplied streamdata header */110 /* initialize based on the demuxer-supplied streamdata header */
111 ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);111 avpriv_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
112 if (s->bps > 16)112 if (s->bps > 16)
113 avctx->sample_fmt = AV_SAMPLE_FMT_S32;113 avctx->sample_fmt = AV_SAMPLE_FMT_S32;
114 else114 else
@@ -140,7 +140,7 @@ static void allocate_buffers(FLACContext *s) · 25 unmodified lines
140 }140 }
141}141}
142 142
143void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,143void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
144 const uint8_t *buffer)144 const uint8_t *buffer)
145{145{
146 GetBitContext gb;146 GetBitContext gb;
@@ -174,7 +174,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, · 27 unmodified lines
174 dump_headers(avctx, s);174 dump_headers(avctx, s);
175}175}
176 176
177void ff_flac_parse_block_header(const uint8_t *block_header,177void avpriv_flac_parse_block_header(const uint8_t *block_header,
178 int *last, int *type, int *size)178 int *last, int *type, int *size)
179{179{
180 int tmp = bytestream_get_byte(&block_header);180 int tmp = bytestream_get_byte(&block_header);
@@ -201,12 +201,12 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size) · 20 unmodified lines
201 /* need more data */201 /* need more data */
202 return 0;202 return 0;
203 }203 }
204 ff_flac_parse_block_header(&buf[4], NULL, &metadata_type, &metadata_size);204 avpriv_flac_parse_block_header(&buf[4], NULL, &metadata_type, &metadata_size);
205 if (metadata_type != FLAC_METADATA_TYPE_STREAMINFO ||205 if (metadata_type != FLAC_METADATA_TYPE_STREAMINFO ||
206 metadata_size != FLAC_STREAMINFO_SIZE) {206 metadata_size != FLAC_STREAMINFO_SIZE) {
207 return AVERROR_INVALIDDATA;207 return AVERROR_INVALIDDATA;
208 }208 }
209 ff_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);209 avpriv_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);
210 allocate_buffers(s);210 allocate_buffers(s);
211 s->got_streaminfo = 1;211 s->got_streaminfo = 1;
212 212
@@ -228,7 +228,7 @@ static int get_metadata_size(const uint8_t *buf, int buf_size) · 15 unmodified lines
228 do {228 do {
229 if (buf_end - buf < 4)229 if (buf_end - buf < 4)
230 return 0;230 return 0;
231 ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);231 avpriv_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
232 buf += 4;232 buf += 4;
233 if (buf_end - buf < metadata_size) {233 if (buf_end - buf < metadata_size) {
234 /* need more data in order to read the complete header */234 /* need more data in order to read the complete header */
libavcodec/flvenc.c+1−1
@@ -25,7 +25,7 @@ void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number) · 24 unmodified lines
25{25{
26 int format;26 int format;
27 27
28 align_put_bits(&s->pb);28 avpriv_align_put_bits(&s->pb);
29 29
30 put_bits(&s->pb, 17, 1);30 put_bits(&s->pb, 17, 1);
31 put_bits(&s->pb, 5, (s->h263_flv-1)); /* 0: h263 escape codes 1: 11-bit escape codes */31 put_bits(&s->pb, 5, (s->h263_flv-1)); /* 0: h263 escape codes 1: 11-bit escape codes */
libavcodec/h261enc.c+1−1
@@ -53,7 +53,7 @@ void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number){ · 52 unmodified lines
53 H261Context * h = (H261Context *) s;53 H261Context * h = (H261Context *) s;
54 int format, temp_ref;54 int format, temp_ref;
55 55
56 align_put_bits(&s->pb);56 avpriv_align_put_bits(&s->pb);
57 57
58 /* Update the pointer to last GOB */58 /* Update the pointer to last GOB */
59 s->ptr_lastgob = put_bits_ptr(&s->pb);59 s->ptr_lastgob = put_bits_ptr(&s->pb);
libavcodec/h264_parser.c+1−1
@@ -153,7 +153,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, · 152 unmodified lines
153 153
154 for(;;) {154 for(;;) {
155 int src_length, dst_length, consumed;155 int src_length, dst_length, consumed;
156 buf = ff_find_start_code(buf, buf_end, &state);156 buf = avpriv_mpv_find_start_code(buf, buf_end, &state);
157 if(buf >= buf_end)157 if(buf >= buf_end)
158 break;158 break;
159 --buf;159 --buf;
libavcodec/imgconvert.c+2−0
@@ -747,6 +747,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, · 746 unmodified lines
747 return 0;747 return 0;
748}748}
749 749
750#if FF_API_GET_ALPHA_INFO
750/* NOTE: we scan all the pixels to have an exact information */751/* NOTE: we scan all the pixels to have an exact information */
751static int get_alpha_info_pal8(const AVPicture *src, int width, int height)752static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
752{753{
@@ -793,6 +794,7 @@ int img_get_alpha_info(const AVPicture *src, · 40 unmodified lines
793 }794 }
794 return ret;795 return ret;
795}796}
797#endif
796 798
797#if !(HAVE_MMX && HAVE_YASM)799#if !(HAVE_MMX && HAVE_YASM)
798/* filter parameters: [-1 4 2 4 -1] // 8 */800/* filter parameters: [-1 4 2 4 -1] // 8 */
libavcodec/internal.h+1−1
@@ -53,7 +53,7 @@ AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt); · 52 unmodified lines
53 */53 */
54int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);54int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
55 55
56unsigned int ff_toupper4(unsigned int x);56unsigned int avpriv_toupper4(unsigned int x);
57 57
58/**58/**
59 * does needed setup of pkt_pts/pos and such for (re)get_buffer();59 * does needed setup of pkt_pts/pos and such for (re)get_buffer();
libavcodec/ituh263enc.c+1−1
@@ -126,7 +126,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) · 125 unmodified lines
126 coded_frame_rate= 1800000;126 coded_frame_rate= 1800000;
127 coded_frame_rate_base= (1000+best_clock_code)*best_divisor;127 coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
128 128
129 align_put_bits(&s->pb);129 avpriv_align_put_bits(&s->pb);
130 130
131 /* Update the pointer to last GOB */131 /* Update the pointer to last GOB */
132 s->ptr_lastgob = put_bits_ptr(&s->pb);132 s->ptr_lastgob = put_bits_ptr(&s->pb);
libavcodec/jpeglsenc.c+1−1
@@ -357,7 +357,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ · 356 unmodified lines
357 put_bits(&pb, 8, v);357 put_bits(&pb, 8, v);
358 }358 }
359 }359 }
360 align_put_bits(&pb);360 avpriv_align_put_bits(&pb);
361 av_free(buf2);361 av_free(buf2);
362 362
363 /* End of image */363 /* End of image */
libavcodec/libavcodec.v+6−7
@@ -1,9 +1,8 @@
1LIBAVCODEC_$MAJOR {1LIBAVCODEC_$MAJOR {
2 global: *;2 global: av*;
3 local:3 audio_resample;
4 ff_*_bsf;4 audio_resample_close;
5 ff_*_decoder;5 #deprecated, remove after next bump
6 ff_*_encoder;6 img_get_alpha_info;
7 ff_*_hwaccel;7 local: *;
8 ff_*_parser;
9};8};
libavcodec/libspeexenc.c+266−120
@@ -1,5 +1,7 @@
1/*1/*
2 * Copyright (c) 2009 by Xuggle Incorporated. All rights reserved.2 * Copyright (C) 2009 Justin Ruggles
3 * Copyright (c) 2009 Xuggle Incorporated
4 *
3 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
4 *6 *
5 * FFmpeg is free software; you can redistribute it and/or7 * FFmpeg is free software; you can redistribute it and/or
@@ -16,163 +18,307 @@ · 10 unmodified lines
16 * License along with FFmpeg; if not, write to the Free Software18 * License along with FFmpeg; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */20 */
19#include <libavcodec/avcodec.h>21
22/**
23 * @file
24 * libspeex Speex audio encoder
25 *
26 * Usage Guide
27 * This explains the values that need to be set prior to initialization in
28 * order to control various encoding parameters.
29 *
30 * Channels
31 * Speex only supports mono or stereo, so avctx->channels must be set to
32 * 1 or 2.
33 *
34 * Sample Rate / Encoding Mode
35 * Speex has 3 modes, each of which uses a specific sample rate.
36 * narrowband : 8 kHz
37 * wideband : 16 kHz
38 * ultra-wideband : 32 kHz
39 * avctx->sample_rate must be set to one of these 3 values. This will be
40 * used to set the encoding mode.
41 *
42 * Rate Control
43 * VBR mode is turned on by setting CODEC_FLAG_QSCALE in avctx->flags.
44 * avctx->global_quality is used to set the encoding quality.
45 * For CBR mode, avctx->bit_rate can be used to set the constant bitrate.
46 * Alternatively, the 'cbr_quality' option can be set from 0 to 10 to set
47 * a constant bitrate based on quality.
48 * For ABR mode, set avctx->bit_rate and set the 'abr' option to 1.
49 * Approx. Bitrate Range:
50 * narrowband : 2400 - 25600 bps
51 * wideband : 4000 - 43200 bps
52 * ultra-wideband : 4400 - 45200 bps
53 *
54 * Complexity
55 * Encoding complexity is controlled by setting avctx->compression_level.
56 * The valid range is 0 to 10. A higher setting gives generally better
57 * quality at the expense of encoding speed. This does not affect the
58 * bit rate.
59 *
60 * Frames-per-Packet
61 * The encoder defaults to using 1 frame-per-packet. However, it is
62 * sometimes desirable to use multiple frames-per-packet to reduce the
63 * amount of container overhead. This can be done by setting the
64 * 'frames_per_packet' option to a value 1 to 8.
65 */
66
20#include <speex/speex.h>67#include <speex/speex.h>
21#include <speex/speex_header.h>68#include <speex/speex_header.h>
22#include <speex/speex_stereo.h>69#include <speex/speex_stereo.h>
70#include "libavutil/mathematics.h"
71#include "libavutil/opt.h"
72#include "avcodec.h"
73#include "internal.h"
23 74
24typedef struct {75typedef struct {
25 SpeexBits bits;76 AVClass *class; ///< AVClass for private options
26 void *enc_state;77 SpeexBits bits; ///< libspeex bitwriter context
27 SpeexHeader header;78 SpeexHeader header; ///< libspeex header struct
79 void *enc_state; ///< libspeex encoder state
80 int frames_per_packet; ///< number of frames to encode in each packet
81 float vbr_quality; ///< VBR quality 0.0 to 10.0
82 int cbr_quality; ///< CBR quality 0 to 10
83 int abr; ///< flag to enable ABR
84 int pkt_frame_count; ///< frame count for the current packet
85 int lookahead; ///< encoder delay
86 int sample_count; ///< total sample count (used for pts)
28} LibSpeexEncContext;87} LibSpeexEncContext;
29 88
89static av_cold void print_enc_params(AVCodecContext *avctx,
90 LibSpeexEncContext *s)
91{
92 const char *mode_str = "unknown";
93
94 av_log(avctx, AV_LOG_DEBUG, "channels: %d\n", avctx->channels);
95 switch (s->header.mode) {
96 case SPEEX_MODEID_NB: mode_str = "narrowband"; break;
97 case SPEEX_MODEID_WB: mode_str = "wideband"; break;
98 case SPEEX_MODEID_UWB: mode_str = "ultra-wideband"; break;
99 }
100 av_log(avctx, AV_LOG_DEBUG, "mode: %s\n", mode_str);
101 if (s->header.vbr) {
102 av_log(avctx, AV_LOG_DEBUG, "rate control: VBR\n");
103 av_log(avctx, AV_LOG_DEBUG, " quality: %f\n", s->vbr_quality);
104 } else if (s->abr) {
105 av_log(avctx, AV_LOG_DEBUG, "rate control: ABR\n");
106 av_log(avctx, AV_LOG_DEBUG, " bitrate: %d bps\n", avctx->bit_rate);
107 } else {
108 av_log(avctx, AV_LOG_DEBUG, "rate control: CBR\n");
109 av_log(avctx, AV_LOG_DEBUG, " bitrate: %d bps\n", avctx->bit_rate);
110 }
111 av_log(avctx, AV_LOG_DEBUG, "complexity: %d\n",
112 avctx->compression_level);
113 av_log(avctx, AV_LOG_DEBUG, "frame size: %d samples\n",
114 avctx->frame_size);
115 av_log(avctx, AV_LOG_DEBUG, "frames per packet: %d\n",
116 s->frames_per_packet);
117 av_log(avctx, AV_LOG_DEBUG, "packet size: %d\n",
118 avctx->frame_size * s->frames_per_packet);
119}
30 120
31static av_cold int libspeex_encode_init(AVCodecContext *avctx)121static av_cold int encode_init(AVCodecContext *avctx)
32{122{
33 LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;123 LibSpeexEncContext *s = avctx->priv_data;
34 const SpeexMode *mode;124 const SpeexMode *mode;
125 uint8_t *header_data;
126 int header_size;
127 int32_t complexity;
35 128
36 if ((avctx->sample_fmt != SAMPLE_FMT_S16 && avctx->sample_fmt != SAMPLE_FMT_FLT) ||129 /* channels */
37 avctx->sample_rate <= 0 ||130 if (avctx->channels < 1 || avctx->channels > 2) {
38 avctx->channels <= 0 ||131 av_log(avctx, AV_LOG_ERROR, "Invalid channels (%d). Only stereo and "
39 avctx->channels > 2)132 "mono are supported\n", avctx->channels);
40 {133 return AVERROR(EINVAL);
41 av_log(avctx, AV_LOG_ERROR, "Unsupported sample format, rate, or channels for speex");
42 return -1;
43 }134 }
44 135
45 if (avctx->sample_rate <= 8000)136 /* sample rate and encoding mode */
46 mode = &speex_nb_mode;137 switch (avctx->sample_rate) {
47 else if (avctx->sample_rate <= 16000)138 case 8000: mode = &speex_nb_mode; break;
48 mode = &speex_wb_mode;139 case 16000: mode = &speex_wb_mode; break;
49 else140 case 32000: mode = &speex_uwb_mode; break;
50 mode = &speex_uwb_mode;141 default:
142 av_log(avctx, AV_LOG_ERROR, "Sample rate of %d Hz is not supported. "
143 "Resample to 8, 16, or 32 kHz.\n", avctx->sample_rate);
144 return AVERROR(EINVAL);
145 }
51 146
52 speex_bits_init(&s->bits);147 /* initialize libspeex */
53 s->enc_state = speex_encoder_init(mode);148 s->enc_state = speex_encoder_init(mode);
54 if (!s->enc_state)149 if (!s->enc_state) {
55 {150 av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex\n");
56 av_log(avctx, AV_LOG_ERROR, "could not initialize speex encoder");
57 return -1;151 return -1;
58 }152 }
153 speex_init_header(&s->header, avctx->sample_rate, avctx->channels, mode);
59 154
60 // initialize the header155 /* rate control method and parameters */
61 speex_init_header(&s->header, avctx->sample_rate,
62 avctx->channels, mode);
63
64 // TODO: It'd be nice to support VBR here, but
65 // I'm uncertain what AVCodecContext options to use
66 // to signal whether to turn it on.
67 if (avctx->flags & CODEC_FLAG_QSCALE) {156 if (avctx->flags & CODEC_FLAG_QSCALE) {
68 spx_int32_t quality = 0;157 /* VBR */
69 // Map global_quality's mpeg 1/2/4 scale into Speex's 0-10 scale158 s->header.vbr = 1;
70 if (avctx->global_quality > FF_LAMBDA_MAX)159 speex_encoder_ctl(s->enc_state, SPEEX_SET_VBR, &s->header.vbr);
71 quality = 0; // lowest possible quality160 s->vbr_quality = av_clipf(avctx->global_quality / (float)FF_QP2LAMBDA,
72 else161 0.0f, 10.0f);
73 quality = (spx_int32_t)((FF_LAMBDA_MAX-avctx->global_quality)*10.0/FF_LAMBDA_MAX);162 speex_encoder_ctl(s->enc_state, SPEEX_SET_VBR_QUALITY, &s->vbr_quality);
74 speex_encoder_ctl(s->enc_state, SPEEX_SET_QUALITY, &quality);
75 } else {163 } else {
76 // default to CBR164 s->header.bitrate = avctx->bit_rate;
77 if (avctx->bit_rate > 0)165 if (avctx->bit_rate > 0) {
78 speex_encoder_ctl(s->enc_state, SPEEX_SET_BITRATE, &avctx->bit_rate);166 /* CBR or ABR by bitrate */
79 // otherwise just take the default quality setting167 if (s->abr) {
168 speex_encoder_ctl(s->enc_state, SPEEX_SET_ABR,
169 &s->header.bitrate);
170 speex_encoder_ctl(s->enc_state, SPEEX_GET_ABR,
171 &s->header.bitrate);
172 } else {
173 speex_encoder_ctl(s->enc_state, SPEEX_SET_BITRATE,
174 &s->header.bitrate);
175 speex_encoder_ctl(s->enc_state, SPEEX_GET_BITRATE,
176 &s->header.bitrate);
177 }
178 } else {
179 /* CBR by quality */
180 speex_encoder_ctl(s->enc_state, SPEEX_SET_QUALITY,
181 &s->cbr_quality);
182 speex_encoder_ctl(s->enc_state, SPEEX_GET_BITRATE,
183 &s->header.bitrate);
184 }
185 /* stereo side information adds about 800 bps to the base bitrate */
186 /* TODO: this should be calculated exactly */
187 avctx->bit_rate = s->header.bitrate + (avctx->channels == 2 ? 800 : 0);
80 }188 }
81 // reset the bit-rate to the actual bit rate speex will use189
82 speex_encoder_ctl(s->enc_state, SPEEX_GET_BITRATE, &s->header.bitrate);190 /* set encoding complexity */
83 avctx->bit_rate = s->header.bitrate;191 if (avctx->compression_level > FF_COMPRESSION_DEFAULT) {
84 192 complexity = av_clip(avctx->compression_level, 0, 10);
85 // get the actual sample rate193 speex_encoder_ctl(s->enc_state, SPEEX_SET_COMPLEXITY, &complexity);
86 speex_encoder_ctl(s->enc_state, SPEEX_GET_SAMPLING_RATE, &s->header.rate);194 }
87 avctx->sample_rate = s->header.rate;195 speex_encoder_ctl(s->enc_state, SPEEX_GET_COMPLEXITY, &complexity);
88 196 avctx->compression_level = complexity;
89 // get the frame-size. To align with FLV, we're going to put 2 frames197
90 // per packet. If someone can tell me how to make this configurable198 /* set packet size */
91 // from the avcodec contents, I'll mod this so it's not hard-coded.199 avctx->frame_size = s->header.frame_size;
92 // but without this, FLV files with speex data won't play correctly200 s->header.frames_per_packet = s->frames_per_packet;
93 // in flash player 10.201
94 speex_encoder_ctl(s->enc_state, SPEEX_GET_FRAME_SIZE, &s->header.frame_size);202 /* set encoding delay */
95 s->header.frames_per_packet = 2; // Need for FLV container support203 speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &s->lookahead);
96 avctx->frame_size = s->header.frame_size*s->header.frames_per_packet;204 s->sample_count = -s->lookahead;
97 205
98 // and we'll put a speex header packet into extradata so that muxers206 /* create header packet bytes from header struct */
99 // can use it.207 /* note: libspeex allocates the memory for header_data, which is freed
100 avctx->extradata = speex_header_to_packet(&s->header, &avctx->extradata_size);208 below with speex_header_free() */
209 header_data = speex_header_to_packet(&s->header, &header_size);
210
211 /* allocate extradata and coded_frame */
212 avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
213 avctx->coded_frame = avcodec_alloc_frame();
214 if (!avctx->extradata || !avctx->coded_frame) {
215 speex_header_free(header_data);
216 speex_encoder_destroy(s->enc_state);
217 av_log(avctx, AV_LOG_ERROR, "memory allocation error\n");
218 return AVERROR(ENOMEM);
219 }
220
221 /* copy header packet to extradata */
222 memcpy(avctx->extradata, header_data, header_size);
223 avctx->extradata_size = header_size;
224 speex_header_free(header_data);
225
226 /* init libspeex bitwriter */
227 speex_bits_init(&s->bits);
228
229 print_enc_params(avctx, s);
101 return 0;230 return 0;
102}231}
103 232
104static av_cold int libspeex_encode_frame(233static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
105 AVCodecContext *avctx, uint8_t *frame,234 void *data)
106 int buf_size, void *data)
107{235{
108 LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;236 LibSpeexEncContext *s = avctx->priv_data;
109 int i = 0;237 int16_t *samples = data;
110 238 int sample_count = s->sample_count;
111 if (!data)239
112 // nothing to flush240 if (data) {
113 return 0;241 /* encode Speex frame */
114 242 if (avctx->channels == 2)
115 speex_bits_reset(&s->bits);243 speex_encode_stereo_int(samples, s->header.frame_size, &s->bits);
116 for(i = 0; i < s->header.frames_per_packet; i++)244 speex_encode_int(s->enc_state, samples, &s->bits);
117 {245 s->pkt_frame_count++;
118 if (avctx->sample_fmt == SAMPLE_FMT_FLT)246 s->sample_count += avctx->frame_size;
119 {247 } else {
120 if (avctx->channels == 2) {248 /* handle end-of-stream */
121 speex_encode_stereo(249 if (!s->pkt_frame_count)
122 (float*)data+i*s->header.frame_size,250 return 0;
123 s->header.frame_size,251 /* add extra terminator codes for unused frames in last packet */
124 &s->bits);252 while (s->pkt_frame_count < s->frames_per_packet) {
125 }253 speex_bits_pack(&s->bits, 15, 5);
126 speex_encode(s->enc_state,254 s->pkt_frame_count++;
127 (float*)data+i*s->header.frame_size, &s->bits);
128 } else {
129 if (avctx->channels == 2) {
130 speex_encode_stereo_int(
131 (spx_int16_t*)data+i*s->header.frame_size,
132 s->header.frame_size,
133 &s->bits);
134 }
135 speex_encode_int(s->enc_state,
136 (spx_int16_t*)data+i*s->header.frame_size, &s->bits);
137 }255 }
138 }256 }
139 // put in a terminator so this will fit in a OGG or FLV packet
140 speex_bits_insert_terminator(&s->bits);
141 257
142 if (buf_size >= speex_bits_nbytes(&s->bits)) {258 /* write output if all frames for the packet have been encoded */
143 return speex_bits_write(&s->bits, frame, buf_size);259 if (s->pkt_frame_count == s->frames_per_packet) {
144 } else {260 s->pkt_frame_count = 0;
145 av_log(avctx, AV_LOG_ERROR, "output buffer too small");261 avctx->coded_frame->pts =
146 return -1;262 av_rescale_q(sample_count, (AVRational){ 1, avctx->sample_rate },
263 avctx->time_base);
264 if (buf_size > speex_bits_nbytes(&s->bits)) {
265 int ret = speex_bits_write(&s->bits, frame, buf_size);
266 speex_bits_reset(&s->bits);
267 return ret;
268 } else {
269 av_log(avctx, AV_LOG_ERROR, "output buffer too small");
270 return AVERROR(EINVAL);
271 }
147 }272 }
273 return 0;
148}274}
149 275
150static av_cold int libspeex_encode_close(AVCodecContext *avctx)276static av_cold int encode_close(AVCodecContext *avctx)
151{277{
152 LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;278 LibSpeexEncContext *s = avctx->priv_data;
153 279
154 speex_bits_destroy(&s->bits);280 speex_bits_destroy(&s->bits);
155 speex_encoder_destroy(s->enc_state);281 speex_encoder_destroy(s->enc_state);
156 s->enc_state = 0;282
157 if (avctx->extradata)283 av_freep(&avctx->coded_frame);
158 speex_header_free(avctx->extradata);284 av_freep(&avctx->extradata);
159 avctx->extradata = 0;
160 avctx->extradata_size = 0;
161 285
162 return 0;286 return 0;
163}287}
164 288
289#define OFFSET(x) offsetof(LibSpeexEncContext, x)
290#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
291static const AVOption options[] = {
292 { "abr", "Use average bit rate", OFFSET(abr), AV_OPT_TYPE_INT, { 0 }, 0, 1, AE },
293 { "cbr_quality", "Set quality value (0 to 10) for CBR", OFFSET(cbr_quality), AV_OPT_TYPE_INT, { 8 }, 0, 10, AE },
294 { "frames_per_packet", "Number of frames to encode in each packet", OFFSET(frames_per_packet), AV_OPT_TYPE_INT, { 1 }, 1, 8, AE },
295 { NULL },
296};
297
298static const AVClass class = {
299 .class_name = "libspeex",
300 .item_name = av_default_item_name,
301 .option = options,
302 .version = LIBAVUTIL_VERSION_INT,
303};
304
305static const AVCodecDefault defaults[] = {
306 { "b", "0" },
307 { "compression_level", "3" },
308 { NULL },
309};
310
165AVCodec ff_libspeex_encoder = {311AVCodec ff_libspeex_encoder = {
166 "libspeex",312 .name = "libspeex",
167 AVMEDIA_TYPE_AUDIO,313 .type = AVMEDIA_TYPE_AUDIO,
168 CODEC_ID_SPEEX,314 .id = CODEC_ID_SPEEX,
169 sizeof(LibSpeexEncContext),315 .priv_data_size = sizeof(LibSpeexEncContext),
170 libspeex_encode_init,316 .init = encode_init,
171 libspeex_encode_frame,317 .encode = encode_frame,
172 libspeex_encode_close,318 .close = encode_close,
173 0,319 .capabilities = CODEC_CAP_DELAY,
174 .capabilities = CODEC_CAP_DELAY,320 .sample_fmts = (const enum SampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
175 .supported_samplerates = (const int[]){8000, 16000, 32000, 0},321 .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
176 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},322 .priv_class = &class,
177 .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex Encoder"),323 .defaults = defaults,
178};324};
libavcodec/libvo-aacenc.c+1−1
@@ -63,7 +63,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 62 unmodified lines
63 }63 }
64 64
65 for (index = 0; index < 16; index++)65 for (index = 0; index < 16; index++)
66 if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index])66 if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[index])
67 break;67 break;
68 if (index == 16) {68 if (index == 16) {
69 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",69 av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",
libavcodec/mp3_header_decompress_bsf.c+2−2
@@ -50,10 +50,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext · 49 unmodified lines
50 lsf = sample_rate < (24000+32000)/2;50 lsf = sample_rate < (24000+32000)/2;
51 mpeg25 = sample_rate < (12000+16000)/2;51 mpeg25 = sample_rate < (12000+16000)/2;
52 sample_rate_index= (header>>10)&3;52 sample_rate_index= (header>>10)&3;
53 sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off53 sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
54 54
55 for(bitrate_index=2; bitrate_index<30; bitrate_index++){55 for(bitrate_index=2; bitrate_index<30; bitrate_index++){
56 frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1];56 frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
57 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);57 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
58 if(frame_size == buf_size + 4)58 if(frame_size == buf_size + 4)
59 break;59 break;
libavcodec/mpeg12.c+8−8
@@ -1290,8 +1290,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1289 unmodified lines
1290 assert((avctx->sub_id == 1) == (avctx->codec_id == CODEC_ID_MPEG1VIDEO));1290 assert((avctx->sub_id == 1) == (avctx->codec_id == CODEC_ID_MPEG1VIDEO));
1291 if (avctx->codec_id == CODEC_ID_MPEG1VIDEO) {1291 if (avctx->codec_id == CODEC_ID_MPEG1VIDEO) {
1292 //MPEG-1 fps1292 //MPEG-1 fps
1293 avctx->time_base.den = ff_frame_rate_tab[s->frame_rate_index].num;1293 avctx->time_base.den = avpriv_frame_rate_tab[s->frame_rate_index].num;
1294 avctx->time_base.num = ff_frame_rate_tab[s->frame_rate_index].den;1294 avctx->time_base.num = avpriv_frame_rate_tab[s->frame_rate_index].den;
1295 //MPEG-1 aspect1295 //MPEG-1 aspect
1296 avctx->sample_aspect_ratio = av_d2q(1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);1296 avctx->sample_aspect_ratio = av_d2q(1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);
1297 avctx->ticks_per_frame=1;1297 avctx->ticks_per_frame=1;
@@ -1299,8 +1299,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1 unmodified line
1299 //MPEG-2 fps1299 //MPEG-2 fps
1300 av_reduce(&s->avctx->time_base.den,1300 av_reduce(&s->avctx->time_base.den,
1301 &s->avctx->time_base.num,1301 &s->avctx->time_base.num,
1302 ff_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,1302 avpriv_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,
1303 ff_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,1303 avpriv_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
1304 1 << 30);1304 1 << 30);
1305 avctx->ticks_per_frame = 2;1305 avctx->ticks_per_frame = 2;
1306 //MPEG-2 aspect1306 //MPEG-2 aspect
@@ -1732,7 +1732,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y, · 425 unmodified lines
1732 if (avctx->hwaccel) {1732 if (avctx->hwaccel) {
1733 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */1733 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
1734 int start_code = -1;1734 int start_code = -1;
1735 buf_end = ff_find_start_code(buf_start + 2, *buf + buf_size, &start_code);1735 buf_end = avpriv_mpv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
1736 if (buf_end < *buf + buf_size)1736 if (buf_end < *buf + buf_size)
1737 buf_end -= 4;1737 buf_end -= 4;
1738 s->mb_y = mb_y;1738 s->mb_y = mb_y;
@@ -1923,7 +1923,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg) · 184 unmodified lines
1923 return 0;1923 return 0;
1924 1924
1925 start_code = -1;1925 start_code = -1;
1926 buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code);1926 buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);
1927 mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;1927 mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
1928 if (s->picture_structure == PICT_BOTTOM_FIELD)1928 if (s->picture_structure == PICT_BOTTOM_FIELD)
1929 mb_y++;1929 mb_y++;
@@ -2217,7 +2217,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, · 287 unmodified lines
2217 }2217 }
2218 state++;2218 state++;
2219 } else {2219 } else {
2220 i = ff_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;2220 i = avpriv_mpv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;
2221 if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {2221 if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {
2222 i++;2222 i++;
2223 pc->frame_start_found = 4;2223 pc->frame_start_found = 4;
@@ -2308,7 +2308,7 @@ static int decode_chunks(AVCodecContext *avctx, · 84 unmodified lines
2308 for (;;) {2308 for (;;) {
2309 /* find next start code */2309 /* find next start code */
2310 uint32_t start_code = -1;2310 uint32_t start_code = -1;
2311 buf_ptr = ff_find_start_code(buf_ptr, buf_end, &start_code);2311 buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &start_code);
2312 if (start_code > 0x1ff) {2312 if (start_code > 0x1ff) {
2313 if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {2313 if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
2314 if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {2314 if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
libavcodec/mpeg12data.c+1−1
@@ -305,7 +305,7 @@ const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = { · 304 unmodified lines
305{ 0xc, 10 },305{ 0xc, 10 },
306};306};
307 307
308const AVRational ff_frame_rate_tab[] = {308const AVRational avpriv_frame_rate_tab[] = {
309 { 0, 0},309 { 0, 0},
310 {24000, 1001},310 {24000, 1001},
311 { 24, 1},311 { 24, 1},
libavcodec/mpeg12data.h+1−1
@@ -48,7 +48,7 @@ extern const uint8_t ff_mpeg12_mbPatTable[64][2]; · 47 unmodified lines
48 48
49extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2];49extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2];
50 50
51extern const AVRational ff_frame_rate_tab[];51extern const AVRational avpriv_frame_rate_tab[];
52 52
53extern const float ff_mpeg1_aspect[16];53extern const float ff_mpeg1_aspect[16];
54extern const AVRational ff_mpeg2_aspect[16];54extern const AVRational ff_mpeg2_aspect[16];
libavcodec/mpeg12enc.c+5−5
@@ -121,7 +121,7 @@ static int find_frame_rate_index(MpegEncContext *s){ · 120 unmodified lines
121 int64_t d;121 int64_t d;
122 122
123 for(i=1;i<14;i++) {123 for(i=1;i<14;i++) {
124 int64_t n0= 1001LL/ff_frame_rate_tab[i].den*ff_frame_rate_tab[i].num*s->avctx->time_base.num;124 int64_t n0= 1001LL/avpriv_frame_rate_tab[i].den*avpriv_frame_rate_tab[i].num*s->avctx->time_base.num;
125 int64_t n1= 1001LL*s->avctx->time_base.den;125 int64_t n1= 1001LL*s->avctx->time_base.den;
126 if(s->avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && i>=9) break;126 if(s->avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && i>=9) break;
127 127
@@ -200,7 +200,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 72 unmodified lines
200 200
201static void put_header(MpegEncContext *s, int header)201static void put_header(MpegEncContext *s, int header)
202{202{
203 align_put_bits(&s->pb);203 avpriv_align_put_bits(&s->pb);
204 put_bits(&s->pb, 16, header>>16);204 put_bits(&s->pb, 16, header>>16);
205 put_sbits(&s->pb, 16, header);205 put_sbits(&s->pb, 16, header);
206}206}
@@ -219,7 +219,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) · 12 unmodified lines
219 if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)219 if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)
220 220
221 if (s->current_picture.f.key_frame) {221 if (s->current_picture.f.key_frame) {
222 AVRational framerate= ff_frame_rate_tab[s->frame_rate_index];222 AVRational framerate= avpriv_frame_rate_tab[s->frame_rate_index];
223 223
224 /* mpeg1 header repeated every gop */224 /* mpeg1 header repeated every gop */
225 put_header(s, SEQ_START_CODE);225 put_header(s, SEQ_START_CODE);
@@ -978,7 +978,7 @@ AVCodec ff_mpeg1video_encoder = { · 752 unmodified lines
978 .init = encode_init,978 .init = encode_init,
979 .encode = MPV_encode_picture,979 .encode = MPV_encode_picture,
980 .close = MPV_encode_end,980 .close = MPV_encode_end,
981 .supported_framerates= ff_frame_rate_tab+1,981 .supported_framerates= avpriv_frame_rate_tab+1,
982 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},982 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
983 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,983 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
984 .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),984 .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
@@ -993,7 +993,7 @@ AVCodec ff_mpeg2video_encoder = { · 8 unmodified lines
993 .init = encode_init,993 .init = encode_init,
994 .encode = MPV_encode_picture,994 .encode = MPV_encode_picture,
995 .close = MPV_encode_end,995 .close = MPV_encode_end,
996 .supported_framerates= ff_frame_rate_tab+1,996 .supported_framerates= avpriv_frame_rate_tab+1,
997 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},997 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
998 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,998 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
999 .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),999 .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
libavcodec/mpeg4audio.c+5−5
@@ -52,7 +52,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c) · 51 unmodified lines
52 return 0;52 return 0;
53}53}
54 54
55const int ff_mpeg4audio_sample_rates[16] = {55const int avpriv_mpeg4audio_sample_rates[16] = {
56 96000, 88200, 64000, 48000, 44100, 32000,56 96000, 88200, 64000, 48000, 44100, 32000,
57 24000, 22050, 16000, 12000, 11025, 8000, 735057 24000, 22050, 16000, 12000, 11025, 8000, 7350
58};58};
@@ -73,10 +73,10 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) · 14 unmodified lines
73{73{
74 *index = get_bits(gb, 4);74 *index = get_bits(gb, 4);
75 return *index == 0x0f ? get_bits(gb, 24) :75 return *index == 0x0f ? get_bits(gb, 24) :
76 ff_mpeg4audio_sample_rates[*index];76 avpriv_mpeg4audio_sample_rates[*index];
77}77}
78 78
79int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)79int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)
80{80{
81 GetBitContext gb;81 GetBitContext gb;
82 int specific_config_bitindex;82 int specific_config_bitindex;
@@ -151,7 +151,7 @@ static av_always_inline unsigned int copy_bits(PutBitContext *pb, · 68 unmodified lines
151 return el;151 return el;
152}152}
153 153
154int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb)154int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb)
155{155{
156 int five_bit_ch, four_bit_ch, comment_size, bits;156 int five_bit_ch, four_bit_ch, comment_size, bits;
157 int offset = put_bits_count(pb);157 int offset = put_bits_count(pb);
@@ -173,7 +173,7 @@ int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb) · 15 unmodified lines
173 copy_bits(pb, gb, 16);173 copy_bits(pb, gb, 16);
174 if (bits)174 if (bits)
175 copy_bits(pb, gb, bits);175 copy_bits(pb, gb, bits);
176 align_put_bits(pb);176 avpriv_align_put_bits(pb);
177 align_get_bits(gb);177 align_get_bits(gb);
178 comment_size = copy_bits(pb, gb, 8);178 comment_size = copy_bits(pb, gb, 8);
179 for (; comment_size > 0; comment_size--)179 for (; comment_size > 0; comment_size--)
libavcodec/mpeg4audio.h+3−3
@@ -40,7 +40,7 @@ typedef struct { · 39 unmodified lines
40 int ps; ///< -1 implicit, 1 presence40 int ps; ///< -1 implicit, 1 presence
41} MPEG4AudioConfig;41} MPEG4AudioConfig;
42 42
43extern const int ff_mpeg4audio_sample_rates[16];43extern const int avpriv_mpeg4audio_sample_rates[16];
44extern const uint8_t ff_mpeg4audio_channels[8];44extern const uint8_t ff_mpeg4audio_channels[8];
45/**45/**
46 * Parse MPEG-4 systems extradata to retrieve audio configuration.46 * Parse MPEG-4 systems extradata to retrieve audio configuration.
@@ -49,7 +49,7 @@ extern const uint8_t ff_mpeg4audio_channels[8]; · 2 unmodified lines
49 * @param[in] buf_size Extradata size.49 * @param[in] buf_size Extradata size.
50 * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata.50 * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata.
51 */51 */
52int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size);52int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size);
53 53
54enum AudioObjectType {54enum AudioObjectType {
55 AOT_NULL,55 AOT_NULL,
@@ -101,6 +101,6 @@ enum AudioObjectType { · 45 unmodified lines
101#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE101#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
102 ///<marker and the comment102 ///<marker and the comment
103 103
104int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb);104int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
105 105
106#endif /* AVCODEC_MPEG4AUDIO_H */106#endif /* AVCODEC_MPEG4AUDIO_H */
libavcodec/mpeg4videoenc.c+2−2
@@ -1268,8 +1268,8 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s) · 1267 unmodified lines
1268 flush_put_bits(&s->tex_pb);1268 flush_put_bits(&s->tex_pb);
1269 1269
1270 set_put_bits_buffer_size(&s->pb, s->pb2.buf_end - s->pb.buf);1270 set_put_bits_buffer_size(&s->pb, s->pb2.buf_end - s->pb.buf);
1271 ff_copy_bits(&s->pb, s->pb2.buf , pb2_len);1271 avpriv_copy_bits(&s->pb, s->pb2.buf , pb2_len);
1272 ff_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);1272 avpriv_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
1273 s->last_bits= put_bits_count(&s->pb);1273 s->last_bits= put_bits_count(&s->pb);
1274}1274}
1275 1275
libavcodec/mpegaudio_parser.c+1−1
@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, · 63 unmodified lines
64 64
65 state= (state<<8) + buf[i++];65 state= (state<<8) + buf[i++];
66 66
67 ret = ff_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate);67 ret = avpriv_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate);
68 if (ret < 4) {68 if (ret < 4) {
69 if(i > 4)69 if(i > 4)
70 s->header_count= -2;70 s->header_count= -2;
libavcodec/mpegaudiodata.c+2−2
@@ -27,7 +27,7 @@ · 26 unmodified lines
27#include "mpegaudiodata.h"27#include "mpegaudiodata.h"
28 28
29 29
30const uint16_t ff_mpa_bitrate_tab[2][3][15] = {30const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
31 { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },31 { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
32 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },32 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
33 {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },33 {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
@@ -37,7 +37,7 @@ const uint16_t ff_mpa_bitrate_tab[2][3][15] = { · 3 unmodified lines
37 }37 }
38};38};
39 39
40const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 };40const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
41 41
42/*******************************************************/42/*******************************************************/
43/* half mpeg encoding window (full precision) */43/* half mpeg encoding window (full precision) */
libavcodec/mpegaudiodata.h+2−2
@@ -32,8 +32,8 @@ · 31 unmodified lines
32#define MODE_EXT_MS_STEREO 232#define MODE_EXT_MS_STEREO 2
33#define MODE_EXT_I_STEREO 133#define MODE_EXT_I_STEREO 1
34 34
35extern const uint16_t ff_mpa_bitrate_tab[2][3][15];35extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
36extern const uint16_t ff_mpa_freq_tab[3];36extern const uint16_t avpriv_mpa_freq_tab[3];
37extern const int32_t ff_mpa_enwindow[257];37extern const int32_t ff_mpa_enwindow[257];
38extern const int ff_mpa_sblimit_table[5];38extern const int ff_mpa_sblimit_table[5];
39extern const int ff_mpa_quant_steps[17];39extern const int ff_mpa_quant_steps[17];
libavcodec/mpegaudiodec.c+4−4
@@ -1789,7 +1789,7 @@ static int decode_frame(AVCodecContext * avctx, · 1788 unmodified lines
1789 return -1;1789 return -1;
1790 }1790 }
1791 1791
1792 if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {1792 if (avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
1793 /* free format: prepare to compute frame size */1793 /* free format: prepare to compute frame size */
1794 s->frame_size = -1;1794 s->frame_size = -1;
1795 return -1;1795 return -1;
@@ -1862,7 +1862,7 @@ static int decode_frame_adu(AVCodecContext * avctx, · 66 unmodified lines
1862 return buf_size;1862 return buf_size;
1863 }1863 }
1864 1864
1865 ff_mpegaudio_decode_header((MPADecodeHeader *)s, header);1865 avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header);
1866 /* update codec info */1866 /* update codec info */
1867 avctx->sample_rate = s->sample_rate;1867 avctx->sample_rate = s->sample_rate;
1868 avctx->channels = s->nb_channels;1868 avctx->channels = s->nb_channels;
@@ -1923,7 +1923,7 @@ static int decode_init_mp3on4(AVCodecContext * avctx) · 54 unmodified lines
1923 return -1;1923 return -1;
1924 }1924 }
1925 1925
1926 ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);1926 avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
1927 if (!cfg.chan_config || cfg.chan_config > 7) {1927 if (!cfg.chan_config || cfg.chan_config > 7) {
1928 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");1928 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
1929 return -1;1929 return -1;
@@ -2015,7 +2015,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, · 85 unmodified lines
2015 if (ff_mpa_check_header(header) < 0) // Bad header, discard block2015 if (ff_mpa_check_header(header) < 0) // Bad header, discard block
2016 break;2016 break;
2017 2017
2018 ff_mpegaudio_decode_header((MPADecodeHeader *)m, header);2018 avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
2019 out_size += mp_decode_frame(m, outptr, buf, fsize);2019 out_size += mp_decode_frame(m, outptr, buf, fsize);
2020 buf += fsize;2020 buf += fsize;
2021 len -= fsize;2021 len -= fsize;
libavcodec/mpegaudiodecheader.c+5−5
@@ -31,7 +31,7 @@ · 30 unmodified lines
31#include "mpegaudiodecheader.h"31#include "mpegaudiodecheader.h"
32 32
33 33
34int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)34int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
35{35{
36 int sample_rate, frame_size, mpeg25, padding;36 int sample_rate, frame_size, mpeg25, padding;
37 int sample_rate_index, bitrate_index;37 int sample_rate_index, bitrate_index;
@@ -46,7 +46,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 8 unmodified lines
46 s->layer = 4 - ((header >> 17) & 3);46 s->layer = 4 - ((header >> 17) & 3);
47 /* extract frequency */47 /* extract frequency */
48 sample_rate_index = (header >> 10) & 3;48 sample_rate_index = (header >> 10) & 3;
49 sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);49 sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
50 sample_rate_index += 3 * (s->lsf + mpeg25);50 sample_rate_index += 3 * (s->lsf + mpeg25);
51 s->sample_rate_index = sample_rate_index;51 s->sample_rate_index = sample_rate_index;
52 s->error_protection = ((header >> 16) & 1) ^ 1;52 s->error_protection = ((header >> 16) & 1) ^ 1;
@@ -67,7 +67,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 14 unmodified lines
67 s->nb_channels = 2;67 s->nb_channels = 2;
68 68
69 if (bitrate_index != 0) {69 if (bitrate_index != 0) {
70 frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];70 frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
71 s->bit_rate = frame_size * 1000;71 s->bit_rate = frame_size * 1000;
72 switch(s->layer) {72 switch(s->layer) {
73 case 1:73 case 1:
@@ -109,14 +109,14 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 35 unmodified lines
109 return 0;109 return 0;
110}110}
111 111
112int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)112int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
113{113{
114 MPADecodeHeader s1, *s = &s1;114 MPADecodeHeader s1, *s = &s1;
115 115
116 if (ff_mpa_check_header(head) != 0)116 if (ff_mpa_check_header(head) != 0)
117 return -1;117 return -1;
118 118
119 if (ff_mpegaudio_decode_header(s, head) != 0) {119 if (avpriv_mpegaudio_decode_header(s, head) != 0) {
120 return -1;120 return -1;
121 }121 }
122 122
libavcodec/mpegaudiodecheader.h+2−2
@@ -50,11 +50,11 @@ typedef struct MPADecodeHeader { · 49 unmodified lines
50/* header decoding. MUST check the header before because no50/* header decoding. MUST check the header before because no
51 consistency check is done there. Return 1 if free format found and51 consistency check is done there. Return 1 if free format found and
52 that the frame size must be computed externally */52 that the frame size must be computed externally */
53int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);53int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
54 54
55/* useful helper to get mpeg audio stream infos. Return -1 if error in55/* useful helper to get mpeg audio stream infos. Return -1 if error in
56 header, otherwise the coded frame size in bytes */56 header, otherwise the coded frame size in bytes */
57int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);57int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
58 58
59/* fast header check for resync */59/* fast header check for resync */
60static inline int ff_mpa_check_header(uint32_t header){60static inline int ff_mpa_check_header(uint32_t header){
libavcodec/mpegaudioenc.c+3−3
@@ -84,9 +84,9 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) · 83 unmodified lines
84 /* encoding freq */84 /* encoding freq */
85 s->lsf = 0;85 s->lsf = 0;
86 for(i=0;i<3;i++) {86 for(i=0;i<3;i++) {
87 if (ff_mpa_freq_tab[i] == freq)87 if (avpriv_mpa_freq_tab[i] == freq)
88 break;88 break;
89 if ((ff_mpa_freq_tab[i] / 2) == freq) {89 if ((avpriv_mpa_freq_tab[i] / 2) == freq) {
90 s->lsf = 1;90 s->lsf = 1;
91 break;91 break;
92 }92 }
@@ -99,7 +99,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) · 6 unmodified lines
99 99
100 /* encoding bitrate & frequency */100 /* encoding bitrate & frequency */
101 for(i=0;i<15;i++) {101 for(i=0;i<15;i++) {
102 if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate)102 if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
103 break;103 break;
104 }104 }
105 if (i == 15){105 if (i == 15){
libavcodec/mpegvideo.c+3−4
@@ -122,7 +122,7 @@ const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = { · 121 unmodified lines
122 PIX_FMT_NONE122 PIX_FMT_NONE
123};123};
124 124
125const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){125const uint8_t *avpriv_mpv_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
126 int i;126 int i;
127 127
128 assert(p<=end);128 assert(p<=end);
@@ -645,9 +645,8 @@ av_cold int MPV_common_init(MpegEncContext *s) · 516 unmodified lines
645 yc_size = y_size + 2 * c_size;645 yc_size = y_size + 2 * c_size;
646 646
647 /* convert fourcc to upper case */647 /* convert fourcc to upper case */
648 s->codec_tag = ff_toupper4(s->avctx->codec_tag);648 s->codec_tag = avpriv_toupper4(s->avctx->codec_tag);
649 649 s->stream_codec_tag = avpriv_toupper4(s->avctx->stream_codec_tag);
650 s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag);
651 650
652 s->avctx->coded_frame= (AVFrame*)&s->current_picture;651 s->avctx->coded_frame= (AVFrame*)&s->current_picture;
653 652
libavcodec/mpegvideo.h+1−1
@@ -725,7 +725,7 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); · 724 unmodified lines
725int MPV_lowest_referenced_row(MpegEncContext *s, int dir);725int MPV_lowest_referenced_row(MpegEncContext *s, int dir);
726void MPV_report_decode_progress(MpegEncContext *s);726void MPV_report_decode_progress(MpegEncContext *s);
727int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);727int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
728const uint8_t *ff_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);728const uint8_t *avpriv_mpv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
729void ff_set_qscale(MpegEncContext * s, int qscale);729void ff_set_qscale(MpegEncContext * s, int qscale);
730 730
731void ff_er_frame_start(MpegEncContext *s);731void ff_er_frame_start(MpegEncContext *s);
libavcodec/mpegvideo_enc.c+5−5
@@ -2051,7 +2051,7 @@ static void write_slice_end(MpegEncContext *s){ · 2050 unmodified lines
2051 ff_mjpeg_encode_stuffing(&s->pb);2051 ff_mjpeg_encode_stuffing(&s->pb);
2052 }2052 }
2053 2053
2054 align_put_bits(&s->pb);2054 avpriv_align_put_bits(&s->pb);
2055 flush_put_bits(&s->pb);2055 flush_put_bits(&s->pb);
2056 2056
2057 if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame)2057 if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame)
@@ -2492,18 +2492,18 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 434 unmodified lines
2492 2492
2493 pb_bits_count= put_bits_count(&s->pb);2493 pb_bits_count= put_bits_count(&s->pb);
2494 flush_put_bits(&s->pb);2494 flush_put_bits(&s->pb);
2495 ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);2495 avpriv_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);
2496 s->pb= backup_s.pb;2496 s->pb= backup_s.pb;
2497 2497
2498 if(s->data_partitioning){2498 if(s->data_partitioning){
2499 pb2_bits_count= put_bits_count(&s->pb2);2499 pb2_bits_count= put_bits_count(&s->pb2);
2500 flush_put_bits(&s->pb2);2500 flush_put_bits(&s->pb2);
2501 ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);2501 avpriv_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);
2502 s->pb2= backup_s.pb2;2502 s->pb2= backup_s.pb2;
2503 2503
2504 tex_pb_bits_count= put_bits_count(&s->tex_pb);2504 tex_pb_bits_count= put_bits_count(&s->tex_pb);
2505 flush_put_bits(&s->tex_pb);2505 flush_put_bits(&s->tex_pb);
2506 ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);2506 avpriv_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);
2507 s->tex_pb= backup_s.tex_pb;2507 s->tex_pb= backup_s.tex_pb;
2508 }2508 }
2509 s->last_bits= put_bits_count(&s->pb);2509 s->last_bits= put_bits_count(&s->pb);
@@ -2726,7 +2726,7 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) · 216 unmodified lines
2726 2726
2727 assert(put_bits_count(&src->pb) % 8 ==0);2727 assert(put_bits_count(&src->pb) % 8 ==0);
2728 assert(put_bits_count(&dst->pb) % 8 ==0);2728 assert(put_bits_count(&dst->pb) % 8 ==0);
2729 ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));2729 avpriv_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));
2730 flush_put_bits(&dst->pb);2730 flush_put_bits(&dst->pb);
2731}2731}
2732 2732
libavcodec/mpegvideo_parser.c+3−3
@@ -40,7 +40,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 39 unmodified lines
40 40
41 while (buf < buf_end) {41 while (buf < buf_end) {
42 start_code= -1;42 start_code= -1;
43 buf= ff_find_start_code(buf, buf_end, &start_code);43 buf= avpriv_mpv_find_start_code(buf, buf_end, &start_code);
44 bytes_left = buf_end - buf;44 bytes_left = buf_end - buf;
45 switch(start_code) {45 switch(start_code) {
46 case PICTURE_START_CODE:46 case PICTURE_START_CODE:
@@ -57,8 +57,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 10 unmodified lines
57 did_set_size=1;57 did_set_size=1;
58 }58 }
59 frame_rate_index = buf[3] & 0xf;59 frame_rate_index = buf[3] & 0xf;
60 pc->frame_rate.den = avctx->time_base.den = ff_frame_rate_tab[frame_rate_index].num;60 pc->frame_rate.den = avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_index].num;
61 pc->frame_rate.num = avctx->time_base.num = ff_frame_rate_tab[frame_rate_index].den;61 pc->frame_rate.num = avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_index].den;
62 avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;62 avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
63 avctx->codec_id = CODEC_ID_MPEG1VIDEO;63 avctx->codec_id = CODEC_ID_MPEG1VIDEO;
64 avctx->sub_id = 1;64 avctx->sub_id = 1;
libavcodec/msmpeg4.c+1−1
@@ -351,7 +351,7 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) · 350 unmodified lines
351{351{
352 find_best_tables(s);352 find_best_tables(s);
353 353
354 align_put_bits(&s->pb);354 avpriv_align_put_bits(&s->pb);
355 put_bits(&s->pb, 2, s->pict_type - 1);355 put_bits(&s->pb, 2, s->pict_type - 1);
356 356
357 put_bits(&s->pb, 5, s->qscale);357 put_bits(&s->pb, 5, s->qscale);
libavcodec/put_bits.h+4−4
@@ -97,14 +97,14 @@ static inline void flush_put_bits(PutBitContext *s) · 96 unmodified lines
97}97}
98 98
99#ifdef BITSTREAM_WRITER_LE99#ifdef BITSTREAM_WRITER_LE
100#define align_put_bits align_put_bits_unsupported_here100#define avpriv_align_put_bits align_put_bits_unsupported_here
101#define ff_put_string ff_put_string_unsupported_here101#define ff_put_string ff_put_string_unsupported_here
102#define ff_copy_bits ff_copy_bits_unsupported_here102#define avpriv_copy_bits avpriv_copy_bits_unsupported_here
103#else103#else
104/**104/**
105 * Pad the bitstream with zeros up to the next byte boundary.105 * Pad the bitstream with zeros up to the next byte boundary.
106 */106 */
107void align_put_bits(PutBitContext *s);107void avpriv_align_put_bits(PutBitContext *s);
108 108
109/**109/**
110 * Put the string string in the bitstream.110 * Put the string string in the bitstream.
@@ -118,7 +118,7 @@ void ff_put_string(PutBitContext *pb, const char *string, int terminate_string); · 7 unmodified lines
118 *118 *
119 * @param length the number of bits of src to copy119 * @param length the number of bits of src to copy
120 */120 */
121void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);121void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
122#endif122#endif
123 123
124/**124/**
libavcodec/rv10enc.c+1−1
@@ -32,7 +32,7 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number) · 31 unmodified lines
32{32{
33 int full_frame= 0;33 int full_frame= 0;
34 34
35 align_put_bits(&s->pb);35 avpriv_align_put_bits(&s->pb);
36 36
37 put_bits(&s->pb, 1, 1); /* marker */37 put_bits(&s->pb, 1, 1); /* marker */
38 38
libavcodec/shorten.c+297−214
@@ -28,6 +28,7 @@ · 27 unmodified lines
28 28
29#include <limits.h>29#include <limits.h>
30#include "avcodec.h"30#include "avcodec.h"
31#include "bytestream.h"
31#include "get_bits.h"32#include "get_bits.h"
32#include "golomb.h"33#include "golomb.h"
33 34
@@ -69,6 +70,9 @@ · 35 unmodified lines
69#define FN_ZERO 870#define FN_ZERO 8
70#define FN_VERBATIM 971#define FN_VERBATIM 9
71 72
73/** indicates if the FN_* command is audio or non-audio */
74static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
75
72#define VERBATIM_CKSIZE_SIZE 576#define VERBATIM_CKSIZE_SIZE 5
73#define VERBATIM_BYTE_SIZE 877#define VERBATIM_BYTE_SIZE 8
74#define CANONICAL_HEADER_SIZE 4478#define CANONICAL_HEADER_SIZE 44
@@ -98,6 +102,8 @@ typedef struct ShortenContext { · 23 unmodified lines
98 int blocksize;102 int blocksize;
99 int bitindex;103 int bitindex;
100 int32_t lpcqoffset;104 int32_t lpcqoffset;
105 int got_header;
106 int got_quit_command;
101} ShortenContext;107} ShortenContext;
102 108
103static av_cold int shorten_decode_init(AVCodecContext * avctx)109static av_cold int shorten_decode_init(AVCodecContext * avctx)
@@ -113,6 +119,7 @@ static int allocate_buffers(ShortenContext *s) · 9 unmodified lines
113{119{
114 int i, chan;120 int i, chan;
115 int *coeffs;121 int *coeffs;
122 void *tmp_ptr;
116 123
117 for (chan=0; chan<s->channels; chan++) {124 for (chan=0; chan<s->channels; chan++) {
118 if(FFMAX(1, s->nmean) >= UINT_MAX/sizeof(int32_t)){125 if(FFMAX(1, s->nmean) >= UINT_MAX/sizeof(int32_t)){
@@ -124,9 +131,15 @@ static int allocate_buffers(ShortenContext *s) · 5 unmodified lines
124 return -1;131 return -1;
125 }132 }
126 133
127 s->offset[chan] = av_realloc(s->offset[chan], sizeof(int32_t)*FFMAX(1, s->nmean));134 tmp_ptr = av_realloc(s->offset[chan], sizeof(int32_t)*FFMAX(1, s->nmean));
135 if (!tmp_ptr)
136 return AVERROR(ENOMEM);
137 s->offset[chan] = tmp_ptr;
128 138
129 s->decoded[chan] = av_realloc(s->decoded[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));139 tmp_ptr = av_realloc(s->decoded[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
140 if (!tmp_ptr)
141 return AVERROR(ENOMEM);
142 s->decoded[chan] = tmp_ptr;
130 for (i=0; i<s->nwrap; i++)143 for (i=0; i<s->nwrap; i++)
131 s->decoded[chan][i] = 0;144 s->decoded[chan][i] = 0;
132 s->decoded[chan] += s->nwrap;145 s->decoded[chan] += s->nwrap;
@@ -181,47 +194,37 @@ static void init_offset(ShortenContext *s) · 48 unmodified lines
181 s->offset[chan][i] = mean;194 s->offset[chan][i] = mean;
182}195}
183 196
184static inline int get_le32(GetBitContext *gb)197static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
185{198 int header_size)
186 return av_bswap32(get_bits_long(gb, 32));
187}
188
189static inline short get_le16(GetBitContext *gb)
190{
191 return av_bswap16(get_bits_long(gb, 16));
192}
193
194static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header_size)
195{199{
196 GetBitContext hb;
197 int len;200 int len;
198 short wave_format;201 short wave_format;
199 202
200 init_get_bits(&hb, header, header_size*8);203
201 if (get_le32(&hb) != MKTAG('R','I','F','F')) {204 if (bytestream_get_le32(&header) != MKTAG('R','I','F','F')) {
202 av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");205 av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
203 return -1;206 return -1;
204 }207 }
205 208
206 skip_bits_long(&hb, 32); /* chunk_size */209 header += 4; /* chunk size */;
207 210
208 if (get_le32(&hb) != MKTAG('W','A','V','E')) {211 if (bytestream_get_le32(&header) != MKTAG('W','A','V','E')) {
209 av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");212 av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");
210 return -1;213 return -1;
211 }214 }
212 215
213 while (get_le32(&hb) != MKTAG('f','m','t',' ')) {216 while (bytestream_get_le32(&header) != MKTAG('f','m','t',' ')) {
214 len = get_le32(&hb);217 len = bytestream_get_le32(&header);
215 skip_bits(&hb, 8*len);218 header += len;
216 }219 }
217 len = get_le32(&hb);220 len = bytestream_get_le32(&header);
218 221
219 if (len < 16) {222 if (len < 16) {
220 av_log(avctx, AV_LOG_ERROR, "fmt chunk was too short\n");223 av_log(avctx, AV_LOG_ERROR, "fmt chunk was too short\n");
221 return -1;224 return -1;
222 }225 }
223 226
224 wave_format = get_le16(&hb);227 wave_format = bytestream_get_le16(&header);
225 228
226 switch (wave_format) {229 switch (wave_format) {
227 case WAVE_FORMAT_PCM:230 case WAVE_FORMAT_PCM:
@@ -231,11 +234,11 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header · 3 unmodified lines
231 return -1;234 return -1;
232 }235 }
233 236
234 avctx->channels = get_le16(&hb);237 header += 2; // skip channels (already got from shorten header)
235 avctx->sample_rate = get_le32(&hb);238 avctx->sample_rate = bytestream_get_le32(&header);
236 avctx->bit_rate = get_le32(&hb) * 8;239 header += 4; // skip bit rate (represents original uncompressed bit rate)
237 avctx->block_align = get_le16(&hb);240 header += 2; // skip block align (not needed)
238 avctx->bits_per_coded_sample = get_le16(&hb);241 avctx->bits_per_coded_sample = bytestream_get_le16(&header);
239 242
240 if (avctx->bits_per_coded_sample != 16) {243 if (avctx->bits_per_coded_sample != 16) {
241 av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample\n");244 av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample\n");
@@ -253,26 +256,142 @@ static int16_t * interleave_buffer(int16_t *samples, int nchan, int blocksize, i · 11 unmodified lines
253 int i, chan;256 int i, chan;
254 for (i=0; i<blocksize; i++)257 for (i=0; i<blocksize; i++)
255 for (chan=0; chan < nchan; chan++)258 for (chan=0; chan < nchan; chan++)
256 *samples++ = FFMIN(buffer[chan][i], 32768);259 *samples++ = av_clip_int16(buffer[chan][i]);
257 return samples;260 return samples;
258}261}
259 262
260static void decode_subframe_lpc(ShortenContext *s, int channel, int residual_size, int pred_order)263static const int fixed_coeffs[3][3] = {
264 { 1, 0, 0 },
265 { 2, -1, 0 },
266 { 3, -3, 1 }
267};
268
269static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
270 int residual_size, int32_t coffset)
261{271{
262 int sum, i, j;272 int pred_order, sum, qshift, init_sum, i, j;
263 int *coeffs = s->coeffs;273 const int *coeffs;
274
275 if (command == FN_QLPC) {
276 /* read/validate prediction order */
277 pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
278 if (pred_order > s->nwrap) {
279 av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order);
280 return AVERROR(EINVAL);
281 }
282 /* read LPC coefficients */
283 for (i=0; i<pred_order; i++)
284 s->coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT);
285 coeffs = s->coeffs;
286
287 qshift = LPCQUANT;
288 } else {
289 /* fixed LPC coeffs */
290 pred_order = command;
291 coeffs = fixed_coeffs[pred_order-1];
292 qshift = 0;
293 }
264 294
265 for (i=0; i<pred_order; i++)295 /* subtract offset from previous samples to use in prediction */
266 coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT);296 if (command == FN_QLPC && coffset)
297 for (i = -pred_order; i < 0; i++)
298 s->decoded[channel][i] -= coffset;
267 299
300 /* decode residual and do LPC prediction */
301 init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset;
268 for (i=0; i < s->blocksize; i++) {302 for (i=0; i < s->blocksize; i++) {
269 sum = s->lpcqoffset;303 sum = init_sum;
270 for (j=0; j<pred_order; j++)304 for (j=0; j<pred_order; j++)
271 sum += coeffs[j] * s->decoded[channel][i-j-1];305 sum += coeffs[j] * s->decoded[channel][i-j-1];
272 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> LPCQUANT);306 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> qshift);
273 }307 }
308
309 /* add offset to current samples */
310 if (command == FN_QLPC && coffset)
311 for (i = 0; i < s->blocksize; i++)
312 s->decoded[channel][i] += coffset;
313
314 return 0;
274}315}
275 316
317static int read_header(ShortenContext *s)
318{
319 int i, ret;
320 int maxnlpc = 0;
321 /* shorten signature */
322 if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) {
323 av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
324 return -1;
325 }
326
327 s->lpcqoffset = 0;
328 s->blocksize = DEFAULT_BLOCK_SIZE;
329 s->channels = 1;
330 s->nmean = -1;
331 s->version = get_bits(&s->gb, 8);
332 s->internal_ftype = get_uint(s, TYPESIZE);
333
334 s->channels = get_uint(s, CHANSIZE);
335 if (s->channels > MAX_CHANNELS) {
336 av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
337 return -1;
338 }
339 s->avctx->channels = s->channels;
340
341 /* get blocksize if version > 0 */
342 if (s->version > 0) {
343 int skip_bytes, blocksize;
344
345 blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
346 if (!blocksize || blocksize > MAX_BLOCKSIZE) {
347 av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n",
348 blocksize);
349 return AVERROR(EINVAL);
350 }
351 s->blocksize = blocksize;
352
353 maxnlpc = get_uint(s, LPCQSIZE);
354 s->nmean = get_uint(s, 0);
355
356 skip_bytes = get_uint(s, NSKIPSIZE);
357 for (i=0; i<skip_bytes; i++) {
358 skip_bits(&s->gb, 8);
359 }
360 }
361 s->nwrap = FFMAX(NWRAP, maxnlpc);
362
363 if ((ret = allocate_buffers(s)) < 0)
364 return ret;
365
366 init_offset(s);
367
368 if (s->version > 1)
369 s->lpcqoffset = V2LPCQOFFSET;
370
371 if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {
372 av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");
373 return -1;
374 }
375
376 s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
377 if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {
378 av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);
379 return -1;
380 }
381
382 for (i=0; i<s->header_size; i++)
383 s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
384
385 if (decode_wave_header(s->avctx, s->header, s->header_size) < 0)
386 return -1;
387
388 s->cur_chan = 0;
389 s->bitshift = 0;
390
391 s->got_header = 1;
392
393 return 0;
394}
276 395
277static int shorten_decode_frame(AVCodecContext *avctx,396static int shorten_decode_frame(AVCodecContext *avctx,
278 void *data, int *data_size,397 void *data, int *data_size,
@@ -283,226 +402,189 @@ static int shorten_decode_frame(AVCodecContext *avctx, · 4 unmodified lines
283 ShortenContext *s = avctx->priv_data;402 ShortenContext *s = avctx->priv_data;
284 int i, input_buf_size = 0;403 int i, input_buf_size = 0;
285 int16_t *samples = data;404 int16_t *samples = data;
405 int ret;
406
407 /* allocate internal bitstream buffer */
286 if(s->max_framesize == 0){408 if(s->max_framesize == 0){
409 void *tmp_ptr;
287 s->max_framesize= 1024; // should hopefully be enough for the first header410 s->max_framesize= 1024; // should hopefully be enough for the first header
288 s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);411 tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,
412 s->max_framesize);
413 if (!tmp_ptr) {
414 av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n");
415 return AVERROR(ENOMEM);
416 }
417 s->bitstream = tmp_ptr;
289 }418 }
290 419
420 /* append current packet data to bitstream buffer */
291 if(1 && s->max_framesize){//FIXME truncated421 if(1 && s->max_framesize){//FIXME truncated
292 buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);422 buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
293 input_buf_size= buf_size;423 input_buf_size= buf_size;
294 424
295 if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){425 if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
296 // printf("memmove\n");
297 memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);426 memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
298 s->bitstream_index=0;427 s->bitstream_index=0;
299 }428 }
300 memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);429 if (buf)
430 memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);
301 buf= &s->bitstream[s->bitstream_index];431 buf= &s->bitstream[s->bitstream_index];
302 buf_size += s->bitstream_size;432 buf_size += s->bitstream_size;
303 s->bitstream_size= buf_size;433 s->bitstream_size= buf_size;
304 434
305 if(buf_size < s->max_framesize){435 /* do not decode until buffer has at least max_framesize bytes or
436 the end of the file has been reached */
437 if (buf_size < s->max_framesize && avpkt->data) {
306 *data_size = 0;438 *data_size = 0;
307 return input_buf_size;439 return input_buf_size;
308 }440 }
309 }441 }
442 /* init and position bitstream reader */
310 init_get_bits(&s->gb, buf, buf_size*8);443 init_get_bits(&s->gb, buf, buf_size*8);
311 skip_bits(&s->gb, s->bitindex);444 skip_bits(&s->gb, s->bitindex);
312 if (!s->blocksize)
313 {
314 int maxnlpc = 0;
315 /* shorten signature */
316 if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) {
317 av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
318 return -1;
319 }
320 445
321 s->lpcqoffset = 0;446 /* process header or next subblock */
322 s->blocksize = DEFAULT_BLOCK_SIZE;447 if (!s->got_header) {
323 s->channels = 1;448 if ((ret = read_header(s)) < 0)
324 s->nmean = -1;449 return ret;
325 s->version = get_bits(&s->gb, 8);450 *data_size = 0;
326 s->internal_ftype = get_uint(s, TYPESIZE);451 goto finish_frame;
452 }
327 453
328 s->channels = get_uint(s, CHANSIZE);454 /* if quit command was read previously, don't decode anything */
329 if (s->channels > MAX_CHANNELS) {455 if (s->got_quit_command) {
330 av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);456 *data_size = 0;
331 return -1;457 return avpkt->size;
332 }458 }
333 459
334 /* get blocksize if version > 0 */460 s->cur_chan = 0;
335 if (s->version > 0) {461 while (s->cur_chan < s->channels) {
336 int skip_bytes;462 int cmd;
337 s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));463 int len;
338 maxnlpc = get_uint(s, LPCQSIZE);
339 s->nmean = get_uint(s, 0);
340 464
341 skip_bytes = get_uint(s, NSKIPSIZE);465 if (get_bits_left(&s->gb) < 3+FNSIZE) {
342 for (i=0; i<skip_bytes; i++) {466 *data_size = 0;
343 skip_bits(&s->gb, 8);467 break;
344 }
345 }468 }
346 s->nwrap = FFMAX(NWRAP, maxnlpc);
347
348 if (allocate_buffers(s))
349 return -1;
350 469
351 init_offset(s);470 cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);
352
353 if (s->version > 1)
354 s->lpcqoffset = V2LPCQOFFSET;
355 471
356 if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {472 if (cmd > FN_VERBATIM) {
357 av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");473 av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
358 return -1;474 *data_size = 0;
475 break;
359 }476 }
360 477
361 s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);478 if (!is_audio_command[cmd]) {
362 if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {479 /* process non-audio command */
363 av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);480 switch (cmd) {
364 return -1;481 case FN_VERBATIM:
365 }482 len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
483 while (len--) {
484 get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
485 }
486 break;
487 case FN_BITSHIFT:
488 s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
489 break;
490 case FN_BLOCKSIZE: {
491 int blocksize = get_uint(s, av_log2(s->blocksize));
492 if (blocksize > s->blocksize) {
493 av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
494 return AVERROR_PATCHWELCOME;
495 }
496 if (!blocksize || blocksize > MAX_BLOCKSIZE) {
497 av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
498 "block size: %d\n", blocksize);
499 return AVERROR(EINVAL);
500 }
501 s->blocksize = blocksize;
502 break;
503 }
504 case FN_QUIT:
505 s->got_quit_command = 1;
506 break;
507 }
508 if (cmd == FN_BLOCKSIZE || cmd == FN_QUIT) {
509 *data_size = 0;
510 break;
511 }
512 } else {
513 /* process audio command */
514 int residual_size = 0;
515 int channel = s->cur_chan;
516 int32_t coffset;
517
518 /* get Rice code for residual decoding */
519 if (cmd != FN_ZERO) {
520 residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
521 /* this is a hack as version 0 differed in defintion of get_sr_golomb_shorten */
522 if (s->version == 0)
523 residual_size--;
524 }
366 525
367 for (i=0; i<s->header_size; i++)526 /* calculate sample offset using means from previous blocks */
368 s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);527 if (s->nmean == 0)
528 coffset = s->offset[channel][0];
529 else {
530 int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
531 for (i=0; i<s->nmean; i++)
532 sum += s->offset[channel][i];
533 coffset = sum / s->nmean;
534 if (s->version >= 2)
535 coffset >>= FFMIN(1, s->bitshift);
536 }
369 537
370 if (decode_wave_header(avctx, s->header, s->header_size) < 0)538 /* decode samples for this channel */
371 return -1;539 if (cmd == FN_ZERO) {
540 for (i=0; i<s->blocksize; i++)
541 s->decoded[channel][i] = 0;
542 } else {
543 if ((ret = decode_subframe_lpc(s, cmd, channel, residual_size, coffset)) < 0)
544 return ret;
545 }
372 546
373 s->cur_chan = 0;547 /* update means with info from the current block */
374 s->bitshift = 0;548 if (s->nmean > 0) {
375 }549 int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
376 else550 for (i=0; i<s->blocksize; i++)
377 {551 sum += s->decoded[channel][i];
378 int cmd;
379 int len;
380 cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);
381 switch (cmd) {
382 case FN_ZERO:
383 case FN_DIFF0:
384 case FN_DIFF1:
385 case FN_DIFF2:
386 case FN_DIFF3:
387 case FN_QLPC:
388 {
389 int residual_size = 0;
390 int channel = s->cur_chan;
391 int32_t coffset;
392 if (cmd != FN_ZERO) {
393 residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
394 /* this is a hack as version 0 differed in defintion of get_sr_golomb_shorten */
395 if (s->version == 0)
396 residual_size--;
397 }
398 552
399 if (s->nmean == 0)553 for (i=1; i<s->nmean; i++)
400 coffset = s->offset[channel][0];554 s->offset[channel][i-1] = s->offset[channel][i];
401 else {
402 int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
403 for (i=0; i<s->nmean; i++)
404 sum += s->offset[channel][i];
405 coffset = sum / s->nmean;
406 if (s->version >= 2)
407 coffset >>= FFMIN(1, s->bitshift);
408 }
409 switch (cmd) {
410 case FN_ZERO:
411 for (i=0; i<s->blocksize; i++)
412 s->decoded[channel][i] = 0;
413 break;
414 case FN_DIFF0:
415 for (i=0; i<s->blocksize; i++)
416 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + coffset;
417 break;
418 case FN_DIFF1:
419 for (i=0; i<s->blocksize; i++)
420 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + s->decoded[channel][i - 1];
421 break;
422 case FN_DIFF2:
423 for (i=0; i<s->blocksize; i++)
424 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 2*s->decoded[channel][i-1]
425 - s->decoded[channel][i-2];
426 break;
427 case FN_DIFF3:
428 for (i=0; i<s->blocksize; i++)
429 s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 3*s->decoded[channel][i-1]
430 - 3*s->decoded[channel][i-2]
431 + s->decoded[channel][i-3];
432 break;
433 case FN_QLPC:
434 {
435 int pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
436 if (pred_order > s->nwrap) {
437 av_log(avctx, AV_LOG_ERROR,
438 "invalid pred_order %d\n",
439 pred_order);
440 return -1;
441 }
442 for (i=0; i<pred_order; i++)
443 s->decoded[channel][i - pred_order] -= coffset;
444 decode_subframe_lpc(s, channel, residual_size, pred_order);
445 if (coffset != 0)
446 for (i=0; i < s->blocksize; i++)
447 s->decoded[channel][i] += coffset;
448 }
449 }
450 if (s->nmean > 0) {
451 int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
452 for (i=0; i<s->blocksize; i++)
453 sum += s->decoded[channel][i];
454
455 for (i=1; i<s->nmean; i++)
456 s->offset[channel][i-1] = s->offset[channel][i];
457
458 if (s->version < 2)
459 s->offset[channel][s->nmean - 1] = sum / s->blocksize;
460 else
461 s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift;
462 }
463 for (i=-s->nwrap; i<0; i++)
464 s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
465 555
466 fix_bitshift(s, s->decoded[channel]);556 if (s->version < 2)
557 s->offset[channel][s->nmean - 1] = sum / s->blocksize;
558 else
559 s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift;
560 }
467 561
468 s->cur_chan++;562 /* copy wrap samples for use with next block */
469 if (s->cur_chan == s->channels) {563 for (i=-s->nwrap; i<0; i++)
470 samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);564 s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
471 s->cur_chan = 0;565
472 goto frame_done;566 /* shift samples to add in unused zero bits which were removed
473 }567 during encoding */
474 }568 fix_bitshift(s, s->decoded[channel]);
475 break;569
476 case FN_VERBATIM:570 /* if this is the last channel in the block, output the samples */
477 len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);571 s->cur_chan++;
478 while (len--) {572 if (s->cur_chan == s->channels) {
479 get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);573 int out_size = s->blocksize * s->channels *
480 }574 av_get_bytes_per_sample(avctx->sample_fmt);
481 break;575 if (*data_size < out_size) {
482 case FN_BITSHIFT:576 av_log(avctx, AV_LOG_ERROR, "Output buffer is too small\n");
483 s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);577 return AVERROR(EINVAL);
484 break;
485 case FN_BLOCKSIZE: {
486 int blocksize = get_uint(s, av_log2(s->blocksize));
487 if (blocksize > s->blocksize) {
488 av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
489 return AVERROR_PATCHWELCOME;
490 }578 }
491 s->blocksize = blocksize;579 samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
492 break;580 *data_size = out_size;
493 }581 }
494 case FN_QUIT:
495 *data_size = 0;
496 return buf_size;
497 default:
498 av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
499 return -1;
500 }582 }
501 }583 }
502frame_done:584 if (s->cur_chan < s->channels)
503 *data_size = (int8_t *)samples - (int8_t *)data;585 *data_size = 0;
504 586
505 // s->last_blocksize = s->blocksize;587finish_frame:
506 s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);588 s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
507 i= (get_bits_count(&s->gb))/8;589 i= (get_bits_count(&s->gb))/8;
508 if (i > buf_size) {590 if (i > buf_size) {
@@ -542,5 +624,6 @@ AVCodec ff_shorten_decoder = { · 33 unmodified lines
542 .init = shorten_decode_init,624 .init = shorten_decode_init,
543 .close = shorten_decode_close,625 .close = shorten_decode_close,
544 .decode = shorten_decode_frame,626 .decode = shorten_decode_frame,
627 .capabilities = CODEC_CAP_DELAY,
545 .long_name= NULL_IF_CONFIG_SMALL("Shorten"),628 .long_name= NULL_IF_CONFIG_SMALL("Shorten"),
546};629};
libavcodec/svq1enc.c+2−2
@@ -461,7 +461,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane · 460 unmodified lines
461 s->rd_total += score[best];461 s->rd_total += score[best];
462 462
463 for(i=5; i>=0; i--){463 for(i=5; i>=0; i--){
464 ff_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]);464 avpriv_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]);
465 }465 }
466 if(best==0){466 if(best==0){
467 s->dsp.put_pixels_tab[0][0](decoded, temp, stride, 16);467 s->dsp.put_pixels_tab[0][0](decoded, temp, stride, 16);
@@ -540,7 +540,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, · 72 unmodified lines
540 return -1;540 return -1;
541 }541 }
542 542
543// align_put_bits(&s->pb);543// avpriv_align_put_bits(&s->pb);
544 while(put_bits_count(&s->pb) & 31)544 while(put_bits_count(&s->pb) & 31)
545 put_bits(&s->pb, 1, 0);545 put_bits(&s->pb, 1, 0);
546 546
libavcodec/utils.c+1−1
@@ -1363,7 +1363,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) · 1362 unmodified lines
1363 return 0;1363 return 0;
1364}1364}
1365 1365
1366unsigned int ff_toupper4(unsigned int x)1366unsigned int avpriv_toupper4(unsigned int x)
1367{1367{
1368 return toupper( x &0xFF)1368 return toupper( x &0xFF)
1369 + (toupper((x>>8 )&0xFF)<<8 )1369 + (toupper((x>>8 )&0xFF)<<8 )
libavcodec/vcr1.c+1−1
@@ -132,7 +132,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, · 131 unmodified lines
132 132
133 emms_c();133 emms_c();
134 134
135 align_put_bits(&a->pb);135 avpriv_align_put_bits(&a->pb);
136 while(get_bit_count(&a->pb)&31)136 while(get_bit_count(&a->pb)&31)
137 put_bits(&a->pb, 8, 0);137 put_bits(&a->pb, 8, 0);
138 138
libavcodec/version.h+4−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#define AVCODEC_VERSION_H21#define AVCODEC_VERSION_H
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5323#define LIBAVCODEC_VERSION_MAJOR 53
24#define LIBAVCODEC_VERSION_MINOR 2224#define LIBAVCODEC_VERSION_MINOR 23
25#define LIBAVCODEC_VERSION_MICRO 025#define LIBAVCODEC_VERSION_MICRO 0
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -98,5 +98,8 @@ · 70 unmodified lines
98#ifndef FF_API_MJPEG_GLOBAL_OPTS98#ifndef FF_API_MJPEG_GLOBAL_OPTS
99#define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)99#define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
100#endif100#endif
101#ifndef FF_API_GET_ALPHA_INFO
102#define FF_API_GET_ALPHA_INFO (LIBAVCODEC_VERSION_MAJOR < 54)
103#endif
101 104
102#endif /* AVCODEC_VERSION_H */105#endif /* AVCODEC_VERSION_H */
libavcodec/vorbisdec.c+1−1
@@ -991,7 +991,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) · 990 unmodified lines
991 return -1;991 return -1;
992 }992 }
993 993
994 if (ff_split_xiph_headers(headers, headers_len, 30, header_start, header_len) < 0) {994 if (avpriv_split_xiph_headers(headers, headers_len, 30, header_start, header_len) < 0) {
995 av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n");995 av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n");
996 return -1;996 return -1;
997 }997 }
libavcodec/vp3.c+1−1
@@ -2276,7 +2276,7 @@ static av_cold int theora_decode_init(AVCodecContext *avctx) · 2275 unmodified lines
2276 return -1;2276 return -1;
2277 }2277 }
2278 2278
2279 if (ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,2279 if (avpriv_split_xiph_headers(avctx->extradata, avctx->extradata_size,
2280 42, header_start, header_len) < 0) {2280 42, header_start, header_len) < 0) {
2281 av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");2281 av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
2282 return -1;2282 return -1;
libavcodec/wmaenc.c+2−2
@@ -311,7 +311,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], · 310 unmodified lines
311 put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]);311 put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]);
312 }312 }
313 if (s->version == 1 && s->nb_channels >= 2) {313 if (s->version == 1 && s->nb_channels >= 2) {
314 align_put_bits(&s->pb);314 avpriv_align_put_bits(&s->pb);
315 }315 }
316 }316 }
317 return 0;317 return 0;
@@ -327,7 +327,7 @@ static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], · 9 unmodified lines
327 return INT_MAX;327 return INT_MAX;
328 }328 }
329 329
330 align_put_bits(&s->pb);330 avpriv_align_put_bits(&s->pb);
331 331
332 return put_bits_count(&s->pb)/8 - s->block_align;332 return put_bits_count(&s->pb)/8 - s->block_align;
333}333}
libavcodec/wmaprodec.c+2−2
@@ -1446,14 +1446,14 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, · 1445 unmodified lines
1446 1446
1447 s->num_saved_bits += len;1447 s->num_saved_bits += len;
1448 if (!append) {1448 if (!append) {
1449 ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),1449 avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),
1450 s->num_saved_bits);1450 s->num_saved_bits);
1451 } else {1451 } else {
1452 int align = 8 - (get_bits_count(gb) & 7);1452 int align = 8 - (get_bits_count(gb) & 7);
1453 align = FFMIN(align, len);1453 align = FFMIN(align, len);
1454 put_bits(&s->pb, align, get_bits(gb, align));1454 put_bits(&s->pb, align, get_bits(gb, align));
1455 len -= align;1455 len -= align;
1456 ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);1456 avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);
1457 }1457 }
1458 skip_bits_long(gb, len);1458 skip_bits_long(gb, len);
1459 1459
libavcodec/wmavoice.c+2−2
@@ -1872,7 +1872,7 @@ static int parse_packet_header(WMAVoiceContext *s) · 1871 unmodified lines
1872 * @param size size of the source data, in bytes1872 * @param size size of the source data, in bytes
1873 * @param gb bit I/O context specifying the current position in the source.1873 * @param gb bit I/O context specifying the current position in the source.
1874 * data. This function might use this to align the bit position to1874 * data. This function might use this to align the bit position to
1875 * a whole-byte boundary before calling #ff_copy_bits() on aligned1875 * a whole-byte boundary before calling #avpriv_copy_bits() on aligned
1876 * source data1876 * source data
1877 * @param nbits the amount of bits to copy from source to target1877 * @param nbits the amount of bits to copy from source to target
1878 *1878 *
@@ -1893,7 +1893,7 @@ static void copy_bits(PutBitContext *pb, · 14 unmodified lines
1893 rmn_bits &= 7; rmn_bytes >>= 3;1893 rmn_bits &= 7; rmn_bytes >>= 3;
1894 if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)1894 if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)
1895 put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));1895 put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));
1896 ff_copy_bits(pb, data + size - rmn_bytes,1896 avpriv_copy_bits(pb, data + size - rmn_bytes,
1897 FFMIN(nbits - rmn_bits, rmn_bytes << 3));1897 FFMIN(nbits - rmn_bits, rmn_bytes << 3));
1898}1898}
1899 1899
libavcodec/x86/ac3dsp_mmx.c+1−1
@@ -50,9 +50,9 @@ extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_c · 49 unmodified lines
50 50
51av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)51av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
52{52{
53#if HAVE_YASM
53 int mm_flags = av_get_cpu_flags();54 int mm_flags = av_get_cpu_flags();
54 55
55#if HAVE_YASM
56 if (mm_flags & AV_CPU_FLAG_MMX) {56 if (mm_flags & AV_CPU_FLAG_MMX) {
57 c->ac3_exponent_min = ff_ac3_exponent_min_mmx;57 c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
58 c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;58 c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
libavcodec/x86/h264_intrapred_init.c+1−1
@@ -169,9 +169,9 @@ void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int s · 168 unmodified lines
169 169
170void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)170void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
171{171{
172#if HAVE_YASM
172 int mm_flags = av_get_cpu_flags();173 int mm_flags = av_get_cpu_flags();
173 174
174#if HAVE_YASM
175 if (bit_depth == 8) {175 if (bit_depth == 8) {
176 if (mm_flags & AV_CPU_FLAG_MMX) {176 if (mm_flags & AV_CPU_FLAG_MMX) {
177 h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx;177 h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx;
libavcodec/x86/proresdsp-init.c+2−2
@@ -52,6 +52,6 @@ void ff_proresdsp_x86_init(ProresDSPContext *dsp, AVCodecContext *avctx) · 51 unmodified lines
52 dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;52 dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
53 dsp->idct_put = ff_prores_idct_put_10_avx;53 dsp->idct_put = ff_prores_idct_put_10_avx;
54 }54 }
55#endif55#endif /* HAVE_AVX */
56#endif56#endif /* ARCH_X86_64 && HAVE_YASM */
57}57}
libavcodec/x86/vp8dsp-init.c+1−1
@@ -283,9 +283,9 @@ DECLARE_LOOP_FILTER(sse4) · 282 unmodified lines
283 283
284av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)284av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
285{285{
286#if HAVE_YASM
286 int mm_flags = av_get_cpu_flags();287 int mm_flags = av_get_cpu_flags();
287 288
288#if HAVE_YASM
289 if (mm_flags & AV_CPU_FLAG_MMX) {289 if (mm_flags & AV_CPU_FLAG_MMX) {
290 c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;290 c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
291 c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;291 c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
libavcodec/xiph.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include "libavutil/intreadwrite.h"21#include "libavutil/intreadwrite.h"
22#include "xiph.h"22#include "xiph.h"
23 23
24int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,24int avpriv_split_xiph_headers(uint8_t *extradata, int extradata_size,
25 int first_header_size, uint8_t *header_start[3],25 int first_header_size, uint8_t *header_start[3],
26 int header_len[3])26 int header_len[3])
27{27{
libavcodec/xiph.h+3−3
@@ -36,8 +36,8 @@ · 35 unmodified lines
36 * @param[out] header_len The sizes of each of the three headers.36 * @param[out] header_len The sizes of each of the three headers.
37 * @return On error a negative value is returned, on success zero.37 * @return On error a negative value is returned, on success zero.
38 */38 */
39int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,39int avpriv_split_xiph_headers(uint8_t *extradata, int extradata_size,
40 int first_header_size, uint8_t *header_start[3],40 int first_header_size, uint8_t *header_start[3],
41 int header_len[3]);41 int header_len[3]);
42 42
43#endif /* AVCODEC_XIPH_H */43#endif /* AVCODEC_XIPH_H */
libavcodec/xsubenc.c+2−2
@@ -90,7 +90,7 @@ static int xsub_encode_rle(PutBitContext *pb, const uint8_t *bitmap, · 89 unmodified lines
90 if (color != PADDING_COLOR && (PADDING + (w&1)))90 if (color != PADDING_COLOR && (PADDING + (w&1)))
91 put_xsub_rle(pb, PADDING + (w&1), PADDING_COLOR);91 put_xsub_rle(pb, PADDING + (w&1), PADDING_COLOR);
92 92
93 align_put_bits(pb);93 avpriv_align_put_bits(pb);
94 94
95 bitmap += linesize;95 bitmap += linesize;
96 }96 }
@@ -194,7 +194,7 @@ static int xsub_encode(AVCodecContext *avctx, unsigned char *buf, · 97 unmodified lines
194 // Enforce total height to be be multiple of 2194 // Enforce total height to be be multiple of 2
195 if (h->rects[0]->h & 1) {195 if (h->rects[0]->h & 1) {
196 put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);196 put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
197 align_put_bits(&pb);197 avpriv_align_put_bits(&pb);
198 }198 }
199 199
200 flush_put_bits(&pb);200 flush_put_bits(&pb);
libavdevice/dv1394.c+3−3
@@ -86,7 +86,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap · 85 unmodified lines
86{86{
87 struct dv1394_data *dv = context->priv_data;87 struct dv1394_data *dv = context->priv_data;
88 88
89 dv->dv_demux = dv_init_demux(context);89 dv->dv_demux = avpriv_dv_init_demux(context);
90 if (!dv->dv_demux)90 if (!dv->dv_demux)
91 goto failed;91 goto failed;
92 92
@@ -124,7 +124,7 @@ static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt) · 31 unmodified lines
124 struct dv1394_data *dv = context->priv_data;124 struct dv1394_data *dv = context->priv_data;
125 int size;125 int size;
126 126
127 size = dv_get_packet(dv->dv_demux, pkt);127 size = avpriv_dv_get_packet(dv->dv_demux, pkt);
128 if (size > 0)128 if (size > 0)
129 return size;129 return size;
130 130
@@ -186,7 +186,7 @@ restart_poll: · 55 unmodified lines
186 av_dlog(context, "index %d, avail %d, done %d\n", dv->index, dv->avail,186 av_dlog(context, "index %d, avail %d, done %d\n", dv->index, dv->avail,
187 dv->done);187 dv->done);
188 188
189 size = dv_produce_packet(dv->dv_demux, pkt,189 size = avpriv_dv_produce_packet(dv->dv_demux, pkt,
190 dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),190 dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
191 DV1394_PAL_FRAME_SIZE, -1);191 DV1394_PAL_FRAME_SIZE, -1);
192 dv->index = (dv->index + 1) % DV1394_RING_FRAMES;192 dv->index = (dv->index + 1) % DV1394_RING_FRAMES;
libavdevice/libcdio.c+1−1
@@ -98,7 +98,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) · 97 unmodified lines
98 for (i = 0; i < s->drive->tracks; i++) {98 for (i = 0; i < s->drive->tracks; i++) {
99 char title[16];99 char title[16];
100 snprintf(title, sizeof(title), "track %02d", s->drive->disc_toc[i].bTrack);100 snprintf(title, sizeof(title), "track %02d", s->drive->disc_toc[i].bTrack);
101 ff_new_chapter(ctx, i, st->time_base, s->drive->disc_toc[i].dwStartSector,101 avpriv_new_chapter(ctx, i, st->time_base, s->drive->disc_toc[i].dwStartSector,
102 s->drive->disc_toc[i+1].dwStartSector, title);102 s->drive->disc_toc[i+1].dwStartSector, title);
103 }103 }
104 104
libavformat/ac3dec.c+1−1
@@ -41,7 +41,7 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) · 40 unmodified lines
41 41
42 for(frames = 0; buf2 < end; frames++) {42 for(frames = 0; buf2 < end; frames++) {
43 init_get_bits(&gbc, buf2, 54);43 init_get_bits(&gbc, buf2, 54);
44 if(ff_ac3_parse_header(&gbc, &hdr) < 0)44 if(avpriv_ac3_parse_header(&gbc, &hdr) < 0)
45 break;45 break;
46 if(buf2 + hdr.frame_size > end ||46 if(buf2 + hdr.frame_size > end ||
47 av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))47 av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
libavformat/adtsenc.c+2−2
@@ -35,7 +35,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf · 34 unmodified lines
35 int off;35 int off;
36 36
37 init_get_bits(&gb, buf, size * 8);37 init_get_bits(&gb, buf, size * 8);
38 off = ff_mpeg4audio_get_config(&m4ac, buf, size);38 off = avpriv_mpeg4audio_get_config(&m4ac, buf, size);
39 if (off < 0)39 if (off < 0)
40 return off;40 return off;
41 skip_bits_long(&gb, off);41 skip_bits_long(&gb, off);
@@ -67,7 +67,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf · 25 unmodified lines
67 init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);67 init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
68 68
69 put_bits(&pb, 3, 5); //ID_PCE69 put_bits(&pb, 3, 5); //ID_PCE
70 adts->pce_size = (ff_copy_pce_data(&pb, &gb) + 3) / 8;70 adts->pce_size = (avpriv_copy_pce_data(&pb, &gb) + 3) / 8;
71 flush_put_bits(&pb);71 flush_put_bits(&pb);
72 }72 }
73 73
libavformat/asfdec.c+1−1
@@ -569,7 +569,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) · 568 unmodified lines
569 name_len = avio_rl32(pb); // name length569 name_len = avio_rl32(pb); // name length
570 if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)570 if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
571 avio_skip(pb, name_len - ret);571 avio_skip(pb, name_len - ret);
572 ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );572 avpriv_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
573 }573 }
574 574
575 return 0;575 return 0;
libavformat/avidec.c+3−3
@@ -490,7 +490,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 489 unmodified lines
490 av_freep(&s->streams[0]);490 av_freep(&s->streams[0]);
491 s->nb_streams = 0;491 s->nb_streams = 0;
492 if (CONFIG_DV_DEMUXER) {492 if (CONFIG_DV_DEMUXER) {
493 avi->dv_demux = dv_init_demux(s);493 avi->dv_demux = avpriv_dv_init_demux(s);
494 if (!avi->dv_demux)494 if (!avi->dv_demux)
495 goto fail;495 goto fail;
496 }496 }
@@ -1012,7 +1012,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) · 515 unmodified lines
1012 void* dstr;1012 void* dstr;
1013 1013
1014 if (CONFIG_DV_DEMUXER && avi->dv_demux) {1014 if (CONFIG_DV_DEMUXER && avi->dv_demux) {
1015 int size = dv_get_packet(avi->dv_demux, pkt);1015 int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
1016 if (size >= 0)1016 if (size >= 0)
1017 return size;1017 return size;
1018 }1018 }
@@ -1115,7 +1115,7 @@ resync: · 96 unmodified lines
1115 1115
1116 if (CONFIG_DV_DEMUXER && avi->dv_demux) {1116 if (CONFIG_DV_DEMUXER && avi->dv_demux) {
1117 dstr = pkt->destruct;1117 dstr = pkt->destruct;
1118 size = dv_produce_packet(avi->dv_demux, pkt,1118 size = avpriv_dv_produce_packet(avi->dv_demux, pkt,
1119 pkt->data, pkt->size, pkt->pos);1119 pkt->data, pkt->size, pkt->pos);
1120 pkt->destruct = dstr;1120 pkt->destruct = dstr;
1121 pkt->flags |= AV_PKT_FLAG_KEY;1121 pkt->flags |= AV_PKT_FLAG_KEY;
libavformat/dv.c+9−9
@@ -270,7 +270,7 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame) · 269 unmodified lines
270 * The following 3 functions constitute our interface to the world270 * The following 3 functions constitute our interface to the world
271 */271 */
272 272
273DVDemuxContext* dv_init_demux(AVFormatContext *s)273DVDemuxContext* avpriv_dv_init_demux(AVFormatContext *s)
274{274{
275 DVDemuxContext *c;275 DVDemuxContext *c;
276 276
@@ -299,7 +299,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) · 22 unmodified lines
299 return c;299 return c;
300}300}
301 301
302int dv_get_packet(DVDemuxContext *c, AVPacket *pkt)302int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
303{303{
304 int size = -1;304 int size = -1;
305 int i;305 int i;
@@ -316,14 +316,14 @@ int dv_get_packet(DVDemuxContext *c, AVPacket *pkt) · 10 unmodified lines
316 return size;316 return size;
317}317}
318 318
319int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,319int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
320 uint8_t* buf, int buf_size, int64_t pos)320 uint8_t* buf, int buf_size, int64_t pos)
321{321{
322 int size, i;322 int size, i;
323 uint8_t *ppcm[4] = {0};323 uint8_t *ppcm[4] = {0};
324 324
325 if (buf_size < DV_PROFILE_BYTES ||325 if (buf_size < DV_PROFILE_BYTES ||
326 !(c->sys = ff_dv_frame_profile(c->sys, buf, buf_size)) ||326 !(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) ||
327 buf_size < c->sys->frame_size) {327 buf_size < c->sys->frame_size) {
328 return -1; /* Broken frame, or not enough data */328 return -1; /* Broken frame, or not enough data */
329 }329 }
@@ -371,7 +371,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, · 41 unmodified lines
371 int64_t timestamp, int flags)371 int64_t timestamp, int flags)
372{372{
373 // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)373 // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
374 const DVprofile* sys = ff_dv_codec_profile(c->vst->codec);374 const DVprofile* sys = avpriv_dv_codec_profile(c->vst->codec);
375 int64_t offset;375 int64_t offset;
376 int64_t size = avio_size(s->pb) - s->data_offset;376 int64_t size = avio_size(s->pb) - s->data_offset;
377 int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;377 int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
@@ -409,7 +409,7 @@ static int dv_read_header(AVFormatContext *s, · 31 unmodified lines
409 unsigned state, marker_pos = 0;409 unsigned state, marker_pos = 0;
410 RawDVContext *c = s->priv_data;410 RawDVContext *c = s->priv_data;
411 411
412 c->dv_demux = dv_init_demux(s);412 c->dv_demux = avpriv_dv_init_demux(s);
413 if (!c->dv_demux)413 if (!c->dv_demux)
414 return -1;414 return -1;
415 415
@@ -434,7 +434,7 @@ static int dv_read_header(AVFormatContext *s, · 18 unmodified lines
434 avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)434 avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
435 return AVERROR(EIO);435 return AVERROR(EIO);
436 436
437 c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES);437 c->dv_demux->sys = avpriv_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES);
438 if (!c->dv_demux->sys) {438 if (!c->dv_demux->sys) {
439 av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");439 av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
440 return -1;440 return -1;
@@ -452,7 +452,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 11 unmodified lines
452 int size;452 int size;
453 RawDVContext *c = s->priv_data;453 RawDVContext *c = s->priv_data;
454 454
455 size = dv_get_packet(c->dv_demux, pkt);455 size = avpriv_dv_get_packet(c->dv_demux, pkt);
456 456
457 if (size < 0) {457 if (size < 0) {
458 int64_t pos = avio_tell(s->pb);458 int64_t pos = avio_tell(s->pb);
@@ -462,7 +462,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 3 unmodified lines
462 if (avio_read(s->pb, c->buf, size) <= 0)462 if (avio_read(s->pb, c->buf, size) <= 0)
463 return AVERROR(EIO);463 return AVERROR(EIO);
464 464
465 size = dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos);465 size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos);
466 }466 }
467 467
468 return size;468 return size;
libavformat/dv.h+3−3
@@ -31,9 +31,9 @@ · 30 unmodified lines
31#include "avformat.h"31#include "avformat.h"
32 32
33typedef struct DVDemuxContext DVDemuxContext;33typedef struct DVDemuxContext DVDemuxContext;
34DVDemuxContext* dv_init_demux(AVFormatContext* s);34DVDemuxContext* avpriv_dv_init_demux(AVFormatContext* s);
35int dv_get_packet(DVDemuxContext*, AVPacket *);35int avpriv_dv_get_packet(DVDemuxContext*, AVPacket *);
36int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t);36int avpriv_dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t);
37void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);37void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
38 38
39typedef struct DVMuxContext DVMuxContext;39typedef struct DVMuxContext DVMuxContext;
libavformat/dvenc.c+1−1
@@ -320,7 +320,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) · 319 unmodified lines
320 c->ast[i]->codec->channels != 2))320 c->ast[i]->codec->channels != 2))
321 goto bail_out;321 goto bail_out;
322 }322 }
323 c->sys = ff_dv_codec_profile(vst->codec);323 c->sys = avpriv_dv_codec_profile(vst->codec);
324 if (!c->sys)324 if (!c->sys)
325 goto bail_out;325 goto bail_out;
326 326
libavformat/ffmetadec.c+1−1
@@ -75,7 +75,7 @@ static AVChapter *read_chapter(AVFormatContext *s) · 74 unmodified lines
75 end = AV_NOPTS_VALUE;75 end = AV_NOPTS_VALUE;
76 }76 }
77 77
78 return ff_new_chapter(s, s->nb_chapters, tb, start, end, NULL);78 return avpriv_new_chapter(s, s->nb_chapters, tb, start, end, NULL);
79}79}
80 80
81static uint8_t *unescape(uint8_t *buf, int size)81static uint8_t *unescape(uint8_t *buf, int size)
libavformat/flacdec.c+2−2
@@ -48,7 +48,7 @@ static int flac_read_header(AVFormatContext *s, · 47 unmodified lines
48 /* process metadata blocks */48 /* process metadata blocks */
49 while (!url_feof(s->pb) && !metadata_last) {49 while (!url_feof(s->pb) && !metadata_last) {
50 avio_read(s->pb, header, 4);50 avio_read(s->pb, header, 4);
51 ff_flac_parse_block_header(header, &metadata_last, &metadata_type,51 avpriv_flac_parse_block_header(header, &metadata_last, &metadata_type,
52 &metadata_size);52 &metadata_size);
53 switch (metadata_type) {53 switch (metadata_type) {
54 /* allocate and read metadata block for supported types */54 /* allocate and read metadata block for supported types */
@@ -87,7 +87,7 @@ static int flac_read_header(AVFormatContext *s, · 32 unmodified lines
87 buffer = NULL;87 buffer = NULL;
88 88
89 /* get codec params from STREAMINFO header */89 /* get codec params from STREAMINFO header */
90 ff_flac_parse_streaminfo(st->codec, &si, st->codec->extradata);90 avpriv_flac_parse_streaminfo(st->codec, &si, st->codec->extradata);
91 91
92 /* set time base and duration */92 /* set time base and duration */
93 if (si.samplerate > 0) {93 if (si.samplerate > 0) {
libavformat/flacenc.c+1−1
@@ -94,7 +94,7 @@ static int flac_write_trailer(struct AVFormatContext *s) · 93 unmodified lines
94 enum FLACExtradataFormat format;94 enum FLACExtradataFormat format;
95 int64_t file_size;95 int64_t file_size;
96 96
97 if (!ff_flac_is_extradata_valid(s->streams[0]->codec, &format, &streaminfo))97 if (!avpriv_flac_is_extradata_valid(s->streams[0]->codec, &format, &streaminfo))
98 return -1;98 return -1;
99 99
100 if (pb->seekable) {100 if (pb->seekable) {
libavformat/flacenc_header.c+1−1
@@ -34,7 +34,7 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, · 33 unmodified lines
34 enum FLACExtradataFormat format;34 enum FLACExtradataFormat format;
35 35
36 header[4] = last_block ? 0x80 : 0x00;36 header[4] = last_block ? 0x80 : 0x00;
37 if (!ff_flac_is_extradata_valid(codec, &format, &streaminfo))37 if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo))
38 return -1;38 return -1;
39 39
40 /* write "fLaC" stream marker and first metadata block header if needed */40 /* write "fLaC" stream marker and first metadata block header if needed */
libavformat/flvdec.c+1−1
@@ -542,7 +542,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 541 unmodified lines
542 return ret;542 return ret;
543 if (st->codec->codec_id == CODEC_ID_AAC) {543 if (st->codec->codec_id == CODEC_ID_AAC) {
544 MPEG4AudioConfig cfg;544 MPEG4AudioConfig cfg;
545 ff_mpeg4audio_get_config(&cfg, st->codec->extradata,545 avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
546 st->codec->extradata_size);546 st->codec->extradata_size);
547 st->codec->channels = cfg.channels;547 st->codec->channels = cfg.channels;
548 if (cfg.ext_sample_rate)548 if (cfg.ext_sample_rate)
libavformat/flvenc.c+15−13
@@ -61,7 +61,7 @@ typedef struct FLVContext { · 60 unmodified lines
61 int64_t filesize_offset;61 int64_t filesize_offset;
62 int64_t duration;62 int64_t duration;
63 int delay; ///< first dts delay for AVC63 int delay; ///< first dts delay for AVC
64 int64_t last_video_ts;64 int64_t last_ts;
65} FLVContext;65} FLVContext;
66 66
67static int get_audio_flags(AVCodecContext *enc){67static int get_audio_flags(AVCodecContext *enc){
@@ -78,11 +78,6 @@ static int get_audio_flags(AVCodecContext *enc){ · 10 unmodified lines
78 av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");78 av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
79 return -1;79 return -1;
80 }80 }
81 if (enc->frame_size / 320 > 8) {
82 av_log(enc, AV_LOG_WARNING, "Warning: Speex stream has more than "
83 "8 frames per packet. Adobe Flash "
84 "Player cannot handle this!\n");
85 }
86 return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;81 return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
87 } else {82 } else {
88 switch (enc->sample_rate) {83 switch (enc->sample_rate) {
@@ -223,7 +218,7 @@ static int flv_write_header(AVFormatContext *s) · 134 unmodified lines
223 }218 }
224 }219 }
225 220
226 flv->last_video_ts = -1;221 flv->last_ts = -1;
227 222
228 /* write meta_tag */223 /* write meta_tag */
229 avio_w8(pb, 18); // tag type META224 avio_w8(pb, 18); // tag type META
@@ -368,7 +363,7 @@ static int flv_write_trailer(AVFormatContext *s) · 138 unmodified lines
368 AVCodecContext *enc = s->streams[i]->codec;363 AVCodecContext *enc = s->streams[i]->codec;
369 if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&364 if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&
370 (enc->codec_id == CODEC_ID_H264 || enc->codec_id == CODEC_ID_MPEG4)) {365 (enc->codec_id == CODEC_ID_H264 || enc->codec_id == CODEC_ID_MPEG4)) {
371 put_avc_eos_tag(pb, flv->last_video_ts);366 put_avc_eos_tag(pb, flv->last_ts);
372 }367 }
373 }368 }
374 369
@@ -434,19 +429,26 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 59 unmodified lines
434 if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)429 if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
435 return -1;430 return -1;
436 }431 }
437 if (!flv->delay && pkt->dts < 0)
438 flv->delay = -pkt->dts;
439 } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&432 } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
440 (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {433 (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
441 av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");434 av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
442 return -1;435 return -1;
443 }436 }
437 if (!flv->delay && pkt->dts < 0)
438 flv->delay = -pkt->dts;
444 439
445 ts = pkt->dts + flv->delay; // add delay to force positive dts440 ts = pkt->dts + flv->delay; // add delay to force positive dts
446 if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {441
447 if (flv->last_video_ts < ts)442 /* check Speex packet duration */
448 flv->last_video_ts = ts;443 if (enc->codec_id == CODEC_ID_SPEEX && ts - flv->last_ts > 160) {
444 av_log(s, AV_LOG_WARNING, "Warning: Speex stream has more than "
445 "8 frames per packet. Adobe Flash "
446 "Player cannot handle this!\n");
449 }447 }
448
449 if (flv->last_ts < ts)
450 flv->last_ts = ts;
451
450 avio_wb24(pb,size + flags_size);452 avio_wb24(pb,size + flags_size);
451 avio_wb24(pb,ts);453 avio_wb24(pb,ts);
452 avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_454 avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
libavformat/gxf.c+2−2
@@ -185,9 +185,9 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info · 184 unmodified lines
185 * @return fps as AVRational, or 0 / 0 if unknown185 * @return fps as AVRational, or 0 / 0 if unknown
186 */186 */
187static AVRational fps_tag2avr(int32_t fps) {187static AVRational fps_tag2avr(int32_t fps) {
188 extern const AVRational ff_frame_rate_tab[];188 extern const AVRational avpriv_frame_rate_tab[];
189 if (fps < 1 || fps > 9) fps = 9;189 if (fps < 1 || fps > 9) fps = 9;
190 return ff_frame_rate_tab[9 - fps]; // values have opposite order190 return avpriv_frame_rate_tab[9 - fps]; // values have opposite order
191}191}
192 192
193/**193/**
libavformat/internal.h+2−2
@@ -223,8 +223,8 @@ int ff_add_index_entry(AVIndexEntry **index_entries, · 222 unmodified lines
223 *223 *
224 * @return AVChapter or NULL on error224 * @return AVChapter or NULL on error
225 */225 */
226AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,226AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
227 int64_t start, int64_t end, const char *title);227 int64_t start, int64_t end, const char *title);
228 228
229/**229/**
230 * Ensure the index uses less memory than the maximum specified in230 * Ensure the index uses less memory than the maximum specified in
libavformat/isom.c+2−2
@@ -433,11 +433,11 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext · 432 unmodified lines
433 st->codec->extradata_size = len;433 st->codec->extradata_size = len;
434 if (st->codec->codec_id == CODEC_ID_AAC) {434 if (st->codec->codec_id == CODEC_ID_AAC) {
435 MPEG4AudioConfig cfg;435 MPEG4AudioConfig cfg;
436 ff_mpeg4audio_get_config(&cfg, st->codec->extradata,436 avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
437 st->codec->extradata_size);437 st->codec->extradata_size);
438 st->codec->channels = cfg.channels;438 st->codec->channels = cfg.channels;
439 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4439 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
440 st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];440 st->codec->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index];
441 else if (cfg.ext_sample_rate)441 else if (cfg.ext_sample_rate)
442 st->codec->sample_rate = cfg.ext_sample_rate;442 st->codec->sample_rate = cfg.ext_sample_rate;
443 else443 else
libavformat/latmenc.c+5−5
@@ -55,7 +55,7 @@ static int latm_decode_extradata(LATMContext *ctx, uint8_t *buf, int size) · 54 unmodified lines
55 MPEG4AudioConfig m4ac;55 MPEG4AudioConfig m4ac;
56 56
57 init_get_bits(&gb, buf, size * 8);57 init_get_bits(&gb, buf, size * 8);
58 ctx->off = ff_mpeg4audio_get_config(&m4ac, buf, size);58 ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size);
59 if (ctx->off < 0)59 if (ctx->off < 0)
60 return ctx->off;60 return ctx->off;
61 skip_bits_long(&gb, ctx->off);61 skip_bits_long(&gb, ctx->off);
@@ -110,12 +110,12 @@ static int latm_write_frame_header(AVFormatContext *s, PutBitContext *bs) · 48 unmodified lines
110 /* AudioSpecificConfig */110 /* AudioSpecificConfig */
111 if (ctx->object_type == AOT_ALS) {111 if (ctx->object_type == AOT_ALS) {
112 header_size = avctx->extradata_size-(ctx->off + 7) >> 3;112 header_size = avctx->extradata_size-(ctx->off + 7) >> 3;
113 ff_copy_bits(bs, &avctx->extradata[ctx->off], header_size);113 avpriv_copy_bits(bs, &avctx->extradata[ctx->off], header_size);
114 } else {114 } else {
115 ff_copy_bits(bs, avctx->extradata, ctx->off + 3);115 avpriv_copy_bits(bs, avctx->extradata, ctx->off + 3);
116 116
117 if (!ctx->channel_conf) {117 if (!ctx->channel_conf) {
118 ff_copy_pce_data(bs, &gb);118 avpriv_copy_pce_data(bs, &gb);
119 }119 }
120 }120 }
121 121
@@ -168,7 +168,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) · 46 unmodified lines
168 for (i = 0; i < pkt->size; i++)168 for (i = 0; i < pkt->size; i++)
169 put_bits(&bs, 8, pkt->data[i]);169 put_bits(&bs, 8, pkt->data[i]);
170 170
171 align_put_bits(&bs);171 avpriv_align_put_bits(&bs);
172 flush_put_bits(&bs);172 flush_put_bits(&bs);
173 173
174 len = put_bits_count(&bs) >> 3;174 len = put_bits_count(&bs) >> 3;
libavformat/libavformat.v+21−5
@@ -1,7 +1,23 @@
1LIBAVFORMAT_$MAJOR {1LIBAVFORMAT_$MAJOR {
2 global: *;2 global: av*;
3 local:3 #FIXME those are for avserver
4 ff_*_demuxer;4 ff_inet_aton;
5 ff_*_muxer;5 ff_socket_nonblock;
6 ff_*_protocol;6 ffm_set_write_index;
7 ffm_read_write_index;
8 ffm_write_write_index;
9 ff_rtsp_parse_line;
10 ff_rtp_get_local_rtp_port;
11 ff_rtp_get_local_rtcp_port;
12 ffio_open_dyn_packet_buf;
13 url_open;
14 url_close;
15 url_write;
16 url_get_max_packet_size;
17 #those are deprecated, remove on next bump
18 find_info_tag;
19 parse_date;
20 dump_format;
21 url_*;
22 local: *;
7};23};
libavformat/matroskadec.c+3−3
@@ -1303,8 +1303,8 @@ static int matroska_aac_sri(int samplerate) · 1302 unmodified lines
1303{1303{
1304 int sri;1304 int sri;
1305 1305
1306 for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++)1306 for (sri=0; sri<FF_ARRAY_ELEMS(avpriv_mpeg4audio_sample_rates); sri++)
1307 if (ff_mpeg4audio_sample_rates[sri] == samplerate)1307 if (avpriv_mpeg4audio_sample_rates[sri] == samplerate)
1308 break;1308 break;
1309 return sri;1309 return sri;
1310}1310}
@@ -1668,7 +1668,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 357 unmodified lines
1668 if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid1668 if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
1669 && (max_start==0 || chapters[i].start > max_start)) {1669 && (max_start==0 || chapters[i].start > max_start)) {
1670 chapters[i].chapter =1670 chapters[i].chapter =
1671 ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},1671 avpriv_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
1672 chapters[i].start, chapters[i].end,1672 chapters[i].start, chapters[i].end,
1673 chapters[i].title);1673 chapters[i].title);
1674 av_dict_set(&chapters[i].chapter->metadata,1674 av_dict_set(&chapters[i].chapter->metadata,
libavformat/matroskaenc.c+2−2
@@ -423,7 +423,7 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex · 422 unmodified lines
423 else423 else
424 first_header_size = 42;424 first_header_size = 42;
425 425
426 if (ff_split_xiph_headers(codec->extradata, codec->extradata_size,426 if (avpriv_split_xiph_headers(codec->extradata, codec->extradata_size,
427 first_header_size, header_start, header_len) < 0) {427 first_header_size, header_start, header_len) < 0) {
428 av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n");428 av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n");
429 return -1;429 return -1;
@@ -443,7 +443,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int · 13 unmodified lines
443{443{
444 MPEG4AudioConfig mp4ac;444 MPEG4AudioConfig mp4ac;
445 445
446 if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) {446 if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) {
447 av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");447 av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");
448 return;448 return;
449 }449 }
libavformat/mov.c+5−5
@@ -289,7 +289,7 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 288 unmodified lines
289 289
290 avio_read(pb, str, str_len);290 avio_read(pb, str, str_len);
291 str[str_len] = 0;291 str[str_len] = 0;
292 ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);292 avpriv_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
293 }293 }
294 return 0;294 return 0;
295}295}
@@ -1291,7 +1291,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 995 unmodified lines
1291#if CONFIG_DV_DEMUXER1291#if CONFIG_DV_DEMUXER
1292 case CODEC_ID_DVAUDIO:1292 case CODEC_ID_DVAUDIO:
1293 c->dv_fctx = avformat_alloc_context();1293 c->dv_fctx = avformat_alloc_context();
1294 c->dv_demux = dv_init_demux(c->dv_fctx);1294 c->dv_demux = avpriv_dv_init_demux(c->dv_fctx);
1295 if (!c->dv_demux) {1295 if (!c->dv_demux) {
1296 av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");1296 av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");
1297 return -1;1297 return -1;
@@ -2484,7 +2484,7 @@ static void mov_read_chapters(AVFormatContext *s) · 1186 unmodified lines
2484 }2484 }
2485 }2485 }
2486 2486
2487 ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title);2487 avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title);
2488 av_freep(&title);2488 av_freep(&title);
2489 }2489 }
2490finish:2490finish:
@@ -2592,10 +2592,10 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) · 101 unmodified lines
2592 }2592 }
2593#if CONFIG_DV_DEMUXER2593#if CONFIG_DV_DEMUXER
2594 if (mov->dv_demux && sc->dv_audio_container) {2594 if (mov->dv_demux && sc->dv_audio_container) {
2595 dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);2595 avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
2596 av_free(pkt->data);2596 av_free(pkt->data);
2597 pkt->size = 0;2597 pkt->size = 0;
2598 ret = dv_get_packet(mov->dv_demux, pkt);2598 ret = avpriv_dv_get_packet(mov->dv_demux, pkt);
2599 if (ret < 0)2599 if (ret < 0)
2600 return ret;2600 return ret;
2601 }2601 }
libavformat/mp3dec.c+2−2
@@ -51,7 +51,7 @@ static int mp3_read_probe(AVProbeData *p) · 50 unmodified lines
51 51
52 for(frames = 0; buf2 < end; frames++) {52 for(frames = 0; buf2 < end; frames++) {
53 header = AV_RB32(buf2);53 header = AV_RB32(buf2);
54 fsize = ff_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);54 fsize = avpriv_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
55 if(fsize < 0)55 if(fsize < 0)
56 break;56 break;
57 buf2 += fsize;57 buf2 += fsize;
@@ -86,7 +86,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 28 unmodified lines
86 if(ff_mpa_check_header(v) < 0)86 if(ff_mpa_check_header(v) < 0)
87 return -1;87 return -1;
88 88
89 if (ff_mpegaudio_decode_header(&c, v) == 0)89 if (avpriv_mpegaudio_decode_header(&c, v) == 0)
90 vbrtag_size = c.frame_size;90 vbrtag_size = c.frame_size;
91 if(c.layer != 3)91 if(c.layer != 3)
92 return -1;92 return -1;
libavformat/mp3enc.c+4−4
@@ -235,12 +235,12 @@ static int mp3_write_xing(AVFormatContext *s) · 234 unmodified lines
235 int srate_idx, i, channels;235 int srate_idx, i, channels;
236 int needed;236 int needed;
237 237
238 for (i = 0; i < FF_ARRAY_ELEMS(ff_mpa_freq_tab); i++)238 for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++)
239 if (ff_mpa_freq_tab[i] == codec->sample_rate) {239 if (avpriv_mpa_freq_tab[i] == codec->sample_rate) {
240 srate_idx = i;240 srate_idx = i;
241 break;241 break;
242 }242 }
243 if (i == FF_ARRAY_ELEMS(ff_mpa_freq_tab)) {243 if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
244 av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n");244 av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n");
245 return -1;245 return -1;
246 }246 }
@@ -263,7 +263,7 @@ static int mp3_write_xing(AVFormatContext *s) · 16 unmodified lines
263 263
264 mask = (bitrate_idx << 4) << 8;264 mask = (bitrate_idx << 4) << 8;
265 header |= mask;265 header |= mask;
266 ff_mpegaudio_decode_header(&c, header);266 avpriv_mpegaudio_decode_header(&c, header);
267 xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];267 xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];
268 needed = 4 // header268 needed = 4 // header
269 + xing_offset269 + xing_offset
libavformat/mpegtsenc.c+1−1
@@ -979,7 +979,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) · 978 unmodified lines
979 }979 }
980 980
981 do {981 do {
982 p = ff_find_start_code(p, buf_end, &state);982 p = avpriv_mpv_find_start_code(p, buf_end, &state);
983 //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);983 //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);
984 } while (p < buf_end && (state & 0x1f) != 9 &&984 } while (p < buf_end && (state & 0x1f) != 9 &&
985 (state & 0x1f) != 5 && (state & 0x1f) != 1);985 (state & 0x1f) != 5 && (state & 0x1f) != 1);
libavformat/nutdec.c+1−1
@@ -416,7 +416,7 @@ static int decode_info_header(NUTContext *nut){ · 415 unmodified lines
416 416
417 if(chapter_id && !stream_id_plus1){417 if(chapter_id && !stream_id_plus1){
418 int64_t start= chapter_start / nut->time_base_count;418 int64_t start= chapter_start / nut->time_base_count;
419 chapter= ff_new_chapter(s, chapter_id,419 chapter= avpriv_new_chapter(s, chapter_id,
420 nut->time_base[chapter_start % nut->time_base_count],420 nut->time_base[chapter_start % nut->time_base_count],
421 start, start + chapter_len, NULL);421 start, start + chapter_len, NULL);
422 metadata = &chapter->metadata;422 metadata = &chapter->metadata;
libavformat/nutenc.c+2−2
@@ -59,10 +59,10 @@ static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint · 58 unmodified lines
59 else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;59 else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;
60 else sample_rate_index=1;60 else sample_rate_index=1;
61 61
62 sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);62 sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
63 63
64 for(bitrate_index=2; bitrate_index<30; bitrate_index++){64 for(bitrate_index=2; bitrate_index<30; bitrate_index++){
65 frame_size = ff_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1];65 frame_size = avpriv_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1];
66 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);66 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
67 67
68 if(frame_size == size)68 if(frame_size == size)
libavformat/oggenc.c+2−2
@@ -274,7 +274,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, · 273 unmodified lines
274 uint8_t *streaminfo;274 uint8_t *streaminfo;
275 uint8_t *p;275 uint8_t *p;
276 276
277 if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))277 if (!avpriv_flac_is_extradata_valid(avctx, &format, &streaminfo))
278 return -1;278 return -1;
279 279
280 // first packet: STREAMINFO280 // first packet: STREAMINFO
@@ -397,7 +397,7 @@ static int ogg_write_header(AVFormatContext *s) · 116 unmodified lines
397 int header_type = st->codec->codec_id == CODEC_ID_VORBIS ? 3 : 0x81;397 int header_type = st->codec->codec_id == CODEC_ID_VORBIS ? 3 : 0x81;
398 int framing_bit = st->codec->codec_id == CODEC_ID_VORBIS ? 1 : 0;398 int framing_bit = st->codec->codec_id == CODEC_ID_VORBIS ? 1 : 0;
399 399
400 if (ff_split_xiph_headers(st->codec->extradata, st->codec->extradata_size,400 if (avpriv_split_xiph_headers(st->codec->extradata, st->codec->extradata_size,
401 st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,401 st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,
402 oggstream->header, oggstream->header_len) < 0) {402 oggstream->header, oggstream->header_len) < 0) {
403 av_log(s, AV_LOG_ERROR, "Extradata corrupted\n");403 av_log(s, AV_LOG_ERROR, "Extradata corrupted\n");
libavformat/oggparsedirac.c+1−1
@@ -36,7 +36,7 @@ static int dirac_header(AVFormatContext *s, int idx) · 35 unmodified lines
36 return 0;36 return 0;
37 37
38 init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);38 init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
39 if (ff_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)39 if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
40 return -1;40 return -1;
41 41
42 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;42 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
libavformat/oggparseflac.c+1−1
@@ -55,7 +55,7 @@ flac_header (AVFormatContext * s, int idx) · 54 unmodified lines
55 if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)55 if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)
56 return -1;56 return -1;
57 57
58 ff_flac_parse_streaminfo(st->codec, &si, streaminfo_start);58 avpriv_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
59 59
60 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;60 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
61 st->codec->codec_id = CODEC_ID_FLAC;61 st->codec->codec_id = CODEC_ID_FLAC;
libavformat/oggparsespeex.c+9−11
@@ -31,6 +31,7 @@ · 30 unmodified lines
31#include "oggdec.h"31#include "oggdec.h"
32 32
33struct speex_params {33struct speex_params {
34 int packet_size;
34 int final_packet_duration;35 int final_packet_duration;
35 int seq;36 int seq;
36};37};
@@ -58,14 +59,10 @@ static int speex_header(AVFormatContext *s, int idx) { · 21 unmodified lines
58 st->codec->sample_rate = AV_RL32(p + 36);59 st->codec->sample_rate = AV_RL32(p + 36);
59 st->codec->channels = AV_RL32(p + 48);60 st->codec->channels = AV_RL32(p + 48);
60 61
61 /* We treat the whole Speex packet as a single frame everywhere Speex62 spxp->packet_size = AV_RL32(p + 56);
62 is handled in FFmpeg. This avoids the complexities of splitting63 frames_per_packet = AV_RL32(p + 64);
63 and joining individual Speex frames, which are not always
64 byte-aligned. */
65 st->codec->frame_size = AV_RL32(p + 56);
66 frames_per_packet = AV_RL32(p + 64);
67 if (frames_per_packet)64 if (frames_per_packet)
68 st->codec->frame_size *= frames_per_packet;65 spxp->packet_size *= frames_per_packet;
69 66
70 st->codec->extradata_size = os->psize;67 st->codec->extradata_size = os->psize;
71 st->codec->extradata = av_malloc(st->codec->extradata_size68 st->codec->extradata = av_malloc(st->codec->extradata_size
@@ -95,7 +92,7 @@ static int speex_packet(AVFormatContext *s, int idx) · 23 unmodified lines
95 struct ogg *ogg = s->priv_data;92 struct ogg *ogg = s->priv_data;
96 struct ogg_stream *os = ogg->streams + idx;93 struct ogg_stream *os = ogg->streams + idx;
97 struct speex_params *spxp = os->private;94 struct speex_params *spxp = os->private;
98 int packet_size = s->streams[idx]->codec->frame_size;95 int packet_size = spxp->packet_size;
99 96
100 if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&97 if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&
101 os->granule > 0) {98 os->granule > 0) {
@@ -108,9 +105,10 @@ static int speex_packet(AVFormatContext *s, int idx) · 6 unmodified lines
108 105
109 if (!os->lastpts && os->granule > 0)106 if (!os->lastpts && os->granule > 0)
110 /* first packet */107 /* first packet */
111 os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1);108 os->lastpts = os->lastdts = os->granule - packet_size *
112 else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&109 ogg_page_packets(os);
113 spxp->final_packet_duration)110 if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
111 spxp->final_packet_duration)
114 /* final packet */112 /* final packet */
115 os->pduration = spxp->final_packet_duration;113 os->pduration = spxp->final_packet_duration;
116 else114 else
libavformat/oggparsevorbis.c+1−1
@@ -45,7 +45,7 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) · 44 unmodified lines
45 if (sscanf(val, "%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)45 if (sscanf(val, "%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
46 return 0;46 return 0;
47 47
48 ff_new_chapter(as, cnum, (AVRational){1,1000},48 avpriv_new_chapter(as, cnum, (AVRational){1,1000},
49 ms + 1000*(s + 60*(m + 60*h)),49 ms + 1000*(s + 60*(m + 60*h)),
50 AV_NOPTS_VALUE, NULL);50 AV_NOPTS_VALUE, NULL);
51 av_free(val);51 av_free(val);
libavformat/rtpenc_mpv.c+1−1
@@ -56,7 +56,7 @@ void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size) · 55 unmodified lines
56 r1 = buf1;56 r1 = buf1;
57 while (1) {57 while (1) {
58 start_code = -1;58 start_code = -1;
59 r = ff_find_start_code(r1, end, &start_code);59 r = avpriv_mpv_find_start_code(r1, end, &start_code);
60 if((start_code & 0xFFFFFF00) == 0x100) {60 if((start_code & 0xFFFFFF00) == 0x100) {
61 /* New start code found */61 /* New start code found */
62 if (start_code == 0x100) {62 if (start_code == 0x100) {
libavformat/sdp.c+2−2
@@ -252,7 +252,7 @@ static char *xiph_extradata2config(AVCodecContext *c) · 251 unmodified lines
252 return NULL;252 return NULL;
253 }253 }
254 254
255 if (ff_split_xiph_headers(c->extradata, c->extradata_size,255 if (avpriv_split_xiph_headers(c->extradata, c->extradata_size,
256 first_header_size, header_start,256 first_header_size, header_start,
257 header_len) < 0) {257 header_len) < 0) {
258 av_log(c, AV_LOG_ERROR, "Extradata corrupt.\n");258 av_log(c, AV_LOG_ERROR, "Extradata corrupt.\n");
@@ -342,7 +342,7 @@ static char *latm_context2config(AVCodecContext *c) · 83 unmodified lines
342 char *config;342 char *config;
343 343
344 for (rate_index = 0; rate_index < 16; rate_index++)344 for (rate_index = 0; rate_index < 16; rate_index++)
345 if (ff_mpeg4audio_sample_rates[rate_index] == c->sample_rate)345 if (avpriv_mpeg4audio_sample_rates[rate_index] == c->sample_rate)
346 break;346 break;
347 if (rate_index == 16) {347 if (rate_index == 16) {
348 av_log(c, AV_LOG_ERROR, "Unsupported sample rate\n");348 av_log(c, AV_LOG_ERROR, "Unsupported sample rate\n");
libavformat/spdifdec.c+1−1
@@ -57,7 +57,7 @@ static int spdif_get_offset_and_codec(AVFormatContext *s, · 56 unmodified lines
57 break;57 break;
58 case IEC61937_MPEG2_AAC:58 case IEC61937_MPEG2_AAC:
59 init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);59 init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
60 if (ff_aac_parse_header(&gbc, &aac_hdr)) {60 if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {
61 if (s) /* be silent during a probe */61 if (s) /* be silent during a probe */
62 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");62 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");
63 return AVERROR_INVALIDDATA;63 return AVERROR_INVALIDDATA;
libavformat/spdifenc.c+1−1
@@ -349,7 +349,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt) · 348 unmodified lines
349 int ret;349 int ret;
350 350
351 init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);351 init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
352 ret = ff_aac_parse_header(&gbc, &hdr);352 ret = avpriv_aac_parse_header(&gbc, &hdr);
353 if (ret < 0) {353 if (ret < 0) {
354 av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");354 av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
355 return AVERROR_INVALIDDATA;355 return AVERROR_INVALIDDATA;
libavformat/utils.c+3−4
@@ -2143,7 +2143,6 @@ static int has_codec_parameters(AVCodecContext *avctx) · 2142 unmodified lines
2143 avctx->codec_id == CODEC_ID_MP1 ||2143 avctx->codec_id == CODEC_ID_MP1 ||
2144 avctx->codec_id == CODEC_ID_MP2 ||2144 avctx->codec_id == CODEC_ID_MP2 ||
2145 avctx->codec_id == CODEC_ID_MP3 ||2145 avctx->codec_id == CODEC_ID_MP3 ||
2146 avctx->codec_id == CODEC_ID_SPEEX ||
2147 avctx->codec_id == CODEC_ID_CELT))2146 avctx->codec_id == CODEC_ID_CELT))
2148 return 0;2147 return 0;
2149 break;2148 break;
@@ -2224,7 +2223,7 @@ enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) · 74 unmodified lines
2224 return tags[i].id;2223 return tags[i].id;
2225 }2224 }
2226 for(i=0; tags[i].id != CODEC_ID_NONE; i++) {2225 for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
2227 if (ff_toupper4(tag) == ff_toupper4(tags[i].tag))2226 if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag))
2228 return tags[i].id;2227 return tags[i].id;
2229 }2228 }
2230 return CODEC_ID_NONE;2229 return CODEC_ID_NONE;
@@ -2845,7 +2844,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) · 614 unmodified lines
2845 return program;2844 return program;
2846}2845}
2847 2846
2848AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)2847AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
2849{2848{
2850 AVChapter *chapter = NULL;2849 AVChapter *chapter = NULL;
2851 int i;2850 int i;
@@ -2969,7 +2968,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st) · 117 unmodified lines
2969 for (n = 0; s->oformat->codec_tag[n]; n++) {2968 for (n = 0; s->oformat->codec_tag[n]; n++) {
2970 avctag = s->oformat->codec_tag[n];2969 avctag = s->oformat->codec_tag[n];
2971 while (avctag->id != CODEC_ID_NONE) {2970 while (avctag->id != CODEC_ID_NONE) {
2972 if (ff_toupper4(avctag->tag) == ff_toupper4(st->codec->codec_tag)) {2971 if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) {
2973 id = avctag->id;2972 id = avctag->id;
2974 if (id == st->codec->codec_id)2973 if (id == st->codec->codec_id)
2975 return 1;2974 return 1;
tests/ref/fate/lossless-shortenaudio+1−1
@@ -1 +1 @@
19949141c405524f37ef1058b1ef4114b1da93c50961443b88fce416ae61c8ca8a

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t