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
6666 - libutvideo wrapper (--enable-libutvideo)
6767 - aevalsrc audio source added
6868 - Ut Video decoder
69+- Speex encoding via libspeex
6970
7071
7172 version 0.8:
configure+1−1
@@ -182,7 +182,7 @@ External library support: · 181 unmodified lines
182182 --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
183183 --enable-librtmp enable RTMP[E] support via librtmp [no]
184184 --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]
186186 --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
187187 --enable-libtheora enable Theora encoding via libtheora [no]
188188 --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
702702 SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
703703 SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
704704 SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
705+SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h
705706
706707 TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow
707708 TESTPROGS-$(HAVE_MMX) += motion
libavcodec/aac_adtstoasc_bsf.c+2−2
@@ -55,7 +55,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, · 54 unmodified lines
5555 if (show_bits(&gb, 12) != 0xfff)
5656 return 0;
5757
58− if (ff_aac_parse_header(&gb, &hdr) < 0) {
58+ if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
5959 av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
6060 return -1;
6161 }
@@ -78,7 +78,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, · 16 unmodified lines
7878 return -1;
7979 }
8080 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;
8282 flush_put_bits(&pb);
8383 buf_size -= get_bits_count(&gb)/8;
8484 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
4040 tmp.u64 = av_be2ne64(state);
4141 init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);
4242
43− if ((size = ff_aac_parse_header(&bits, &hdr)) < 0)
43+ if ((size = avpriv_aac_parse_header(&bits, &hdr)) < 0)
4444 return 0;
4545 *need_next_header = 0;
4646 *new_frame_start = 1;
libavcodec/aacadtsdec.c+3−3
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include "get_bits.h"
2727 #include "mpeg4audio.h"
2828
29−int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
29+int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
3030 {
3131 int size, rdb, ch, sr;
3232 int aot, crc_abs;
@@ -39,7 +39,7 @@ int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) · 6 unmodified lines
3939 crc_abs = get_bits1(gbc); /* protection_absent */
4040 aot = get_bits(gbc, 2); /* profile_objecttype */
4141 sr = get_bits(gbc, 4); /* sample_frequency_index */
42− if(!ff_mpeg4audio_sample_rates[sr])
42+ if(!avpriv_mpeg4audio_sample_rates[sr])
4343 return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
4444 skip_bits1(gbc); /* private_bit */
4545 ch = get_bits(gbc, 3); /* channel_configuration */
@@ -62,7 +62,7 @@ int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) · 16 unmodified lines
6262 hdr->crc_absent = crc_abs;
6363 hdr->num_aac_frames = rdb + 1;
6464 hdr->sampling_index = sr;
65− hdr->sample_rate = ff_mpeg4audio_sample_rates[sr];
65+ hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr];
6666 hdr->samples = (rdb + 1) * 1024;
6767 hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples;
6868
libavcodec/aacadtsdec.h+1−1
@@ -49,6 +49,6 @@ typedef struct { · 48 unmodified lines
4949 * -2 if the version element is invalid, -3 if the sample rate
5050 * element is invalid, or -4 if the bit rate element is invalid.
5151 */
52−int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
52+int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
5353
5454 #endif /* AVCODEC_AACADTSDEC_H */
libavcodec/aacdec.c+2−2
@@ -472,7 +472,7 @@ static int decode_audio_specific_config(AACContext *ac, · 471 unmodified lines
472472
473473 init_get_bits(&gb, data, data_size * 8);
474474
475− if ((i = ff_mpeg4audio_get_config(m4ac, data, asclen/8)) < 0)
475+ if ((i = avpriv_mpeg4audio_get_config(m4ac, data, asclen/8)) < 0)
476476 return -1;
477477 if (m4ac->sampling_index > 12) {
478478 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
20772077 int size;
20782078 AACADTSHeaderInfo hdr_info;
20792079
2080− size = ff_aac_parse_header(gb, &hdr_info);
2080+ size = avpriv_aac_parse_header(gb, &hdr_info);
20812081 if (size > 0) {
20822082 if (hdr_info.chan_config) {
20832083 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
180180 avctx->frame_size = 1024;
181181
182182 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])
184184 break;
185185 if (i == 16) {
186186 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
491491 put_bits(&s->pb, 8, namelen - 16);
492492 put_bits(&s->pb, 4, 0); //extension type - filler
493493 padbits = 8 - (put_bits_count(&s->pb) & 7);
494− align_put_bits(&s->pb);
494+ avpriv_align_put_bits(&s->pb);
495495 for (i = 0; i < namelen - 2; i++)
496496 put_bits(&s->pb, 8, name[i]);
497497 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
3535 };
3636
3737
38−int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
38+int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
3939 {
4040 int frame_size_code;
4141
@@ -141,7 +141,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, · 99 unmodified lines
141141 GetBitContext gbc;
142142
143143 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);
145145
146146 if(err < 0)
147147 return 0;
libavcodec/ac3_parser.h+1−1
@@ -36,6 +36,6 @@ · 35 unmodified lines
3636 * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
3737 * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
3838 */
39−int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
39+int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
4040
4141 #endif /* AVCODEC_AC3_PARSER_H */
libavcodec/ac3dec.c+1−1
@@ -261,7 +261,7 @@ static int parse_frame_header(AC3DecodeContext *s) · 260 unmodified lines
261261 AC3HeaderInfo hdr;
262262 int err;
263263
264− err = ff_ac3_parse_header(&s->gbc, &hdr);
264+ err = avpriv_ac3_parse_header(&s->gbc, &hdr);
265265 if(err)
266266 return err;
267267
libavcodec/alsdec.c+1−1
@@ -289,7 +289,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx) · 288 unmodified lines
289289
290290 init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
291291
292− config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata,
292+ config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,
293293 avctx->extradata_size);
294294
295295 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
497497 }
498498 emms_c();
499499
500− align_put_bits(&a->pb);
500+ avpriv_align_put_bits(&a->pb);
501501 while(put_bits_count(&a->pb)&31)
502502 put_bits(&a->pb, 8, 0);
503503
libavcodec/avcodec.h+16−4
@@ -210,8 +210,10 @@ enum CodecID { · 209 unmodified lines
210210 CODEC_ID_DFA,
211211 CODEC_ID_WMV3IMAGE,
212212 CODEC_ID_VC1IMAGE,
213+#if LIBAVCODEC_VERSION_MAJOR == 53
213214 CODEC_ID_8SVX_RAW,
214215 CODEC_ID_G2M,
216+#endif
215217 CODEC_ID_UTVIDEO_DEPRECATED,
216218 CODEC_ID_UTVIDEO = 0x800,
217219
@@ -676,8 +678,10 @@ typedef struct RcOverride{ · 458 unmodified lines
676678 /* Codec can export data for HW decoding (XvMC). */
677679 #define CODEC_CAP_HWACCEL 0x0010
678680 /**
679− * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data.
680− * If this is not set, the codec is guaranteed to never be fed with NULL data.
681+ * Codec has a nonzero delay and needs to be fed with avpkt->data=NULL,
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.
681685 */
682686 #define CODEC_CAP_DELAY 0x0020
683687 /**
@@ -3608,6 +3612,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma · 2924 unmodified lines
36083612 enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
36093613 enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
36103614
3615+#if FF_API_GET_ALPHA_INFO
36113616 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
36123617 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
36133618
@@ -3615,8 +3620,10 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum · 1 unmodified line
36153620 * Tell if an image really has transparent alpha values.
36163621 * @return ored mask of FF_ALPHA_xxx constants
36173622 */
3623+attribute_deprecated
36183624 int img_get_alpha_info(const AVPicture *src,
36193625 enum PixelFormat pix_fmt, int width, int height);
3626+#endif
36203627
36213628 /* deinterlace a picture */
36223629 /* deinterlace - if not supported return -1 */
@@ -3940,6 +3947,10 @@ int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) · 317 unmodified lines
39403947 * samples should be 16 byte aligned unless the CPU doesn't need it
39413948 * (AltiVec and SSE do).
39423949 *
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+ *
39433954 * @param avctx the codec context
39443955 * @param[out] samples the output buffer, sample type in avctx->sample_fmt
39453956 * @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
39733984 *
39743985 * In practice, avpkt->data should have 4 byte alignment at minimum.
39753986 *
3976− * @note Some codecs have a delay between input and output, these need to be
3977− * fed with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames.
3987+ * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
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.
39783990 *
39793991 * @param avctx the codec context
39803992 * @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
4141 24,
4242 };
4343
44−void align_put_bits(PutBitContext *s)
44+void avpriv_align_put_bits(PutBitContext *s)
4545 {
4646 put_bits(s,s->bit_left & 7,0);
4747 }
@@ -56,7 +56,7 @@ void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) · 8 unmodified lines
5656 put_bits(pb, 8, 0);
5757 }
5858
59−void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
59+void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
6060 {
6161 int words= length>>4;
6262 int bits= length&15;
libavcodec/cavsdec.c+3−3
@@ -625,8 +625,8 @@ static int decode_seq_header(AVSContext *h) { · 624 unmodified lines
625625 s->low_delay = get_bits1(&s->gb);
626626 h->mb_width = (s->width + 15) >> 4;
627627 h->mb_height = (s->height + 15) >> 4;
628− h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num;
629− h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den;
628+ h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num;
629+ h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den;
630630 h->s.avctx->width = s->width;
631631 h->s.avctx->height = s->height;
632632 if(!h->top_qp)
@@ -664,7 +664,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, · 31 unmodified lines
664664 buf_ptr = buf;
665665 buf_end = buf + buf_size;
666666 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);
668668 if((stc & 0xFFFFFE00) || buf_ptr == buf_end)
669669 return FFMAX(0, buf_ptr - buf - s->parse_context.last_index);
670670 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
105105
106106 emms_c();
107107
108− align_put_bits(&a->pb);
108+ avpriv_align_put_bits(&a->pb);
109109 while(get_bit_count(&a->pb)&31)
110110 put_bits(&a->pb, 8, 0);
111111
libavcodec/dirac.c+2−2
@@ -145,7 +145,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, · 144 unmodified lines
145145 }
146146 if (source->frame_rate_index > 0) {
147147 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];
149149 else
150150 frame_rate = dirac_frame_rate[source->frame_rate_index-9];
151151 }
@@ -242,7 +242,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, · 90 unmodified lines
242242 return 0;
243243 }
244244
245−int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
245+int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
246246 dirac_source_params *source)
247247 {
248248 unsigned version_major;
libavcodec/dirac.h+2−2
@@ -51,7 +51,7 @@ typedef struct { · 50 unmodified lines
5151 uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]
5252 } dirac_source_params;
5353
54−int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
55− dirac_source_params *source);
54+int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
55+ dirac_source_params *source);
5656
5757 #endif /* AVCODEC_DIRAC_H */
libavcodec/dv.c+3−3
@@ -349,7 +349,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx) · 348 unmodified lines
349349
350350 static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
351351 {
352− if (!ff_dv_codec_profile(avctx)) {
352+ if (!avpriv_dv_codec_profile(avctx)) {
353353 av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
354354 avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
355355 return -1;
@@ -1072,7 +1072,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, · 716 unmodified lines
10721072 const uint8_t* vsc_pack;
10731073 int apt, is16_9;
10741074
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);
10761076 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
10771077 av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
10781078 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
12461246 {
12471247 DVVideoContext *s = c->priv_data;
12481248
1249− s->sys = ff_dv_codec_profile(c);
1249+ s->sys = avpriv_dv_codec_profile(c);
12501250 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))
12511251 return -1;
12521252
libavcodec/dvdata.c+4−4
@@ -246,7 +246,7 @@ static const DVprofile dv_profiles[] = { · 245 unmodified lines
246246 }
247247 };
248248
249−const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
249+const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
250250 const uint8_t* frame, unsigned buf_size)
251251 {
252252 int i, dsf, stype;
@@ -276,13 +276,13 @@ const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sy · 23 unmodified lines
276276 return NULL;
277277 }
278278
279−const DVprofile* ff_dv_frame_profile(const DVprofile *sys,
279+const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
280280 const uint8_t* frame, unsigned buf_size)
281281 {
282− return ff_dv_frame_profile2(NULL, sys, frame, buf_size);
282+ return avpriv_dv_frame_profile2(NULL, sys, frame, buf_size);
283283 }
284284
285−const DVprofile* ff_dv_codec_profile(AVCodecContext* codec)
285+const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec)
286286 {
287287 int i;
288288
libavcodec/dvdata.h+3−3
@@ -274,11 +274,11 @@ enum dv_pack_type { · 273 unmodified lines
274274 */
275275 #define DV_MAX_BPM 8
276276
277−const DVprofile* ff_dv_frame_profile(const DVprofile *sys,
277+const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
278278 const uint8_t* frame, unsigned buf_size);
279−const DVprofile* ff_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
279+const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
280280 const uint8_t* frame, unsigned buf_size);
281−const DVprofile* ff_dv_codec_profile(AVCodecContext* codec);
281+const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
282282
283283 static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
284284 uint8_t seq_num, uint8_t dif_num,
libavcodec/flac.h+7−7
@@ -95,8 +95,8 @@ typedef struct FLACFrameInfo { · 94 unmodified lines
9595 * @param[out] s where parsed information is stored
9696 * @param[in] buffer pointer to start of 34-byte streaminfo data
9797 */
98−void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
99− const uint8_t *buffer);
98+void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
99+ const uint8_t *buffer);
100100
101101 /**
102102 * Validate the FLAC extradata.
@@ -105,9 +105,9 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, · 2 unmodified lines
105105 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.
106106 * @return 1 if valid, 0 if not valid.
107107 */
108−int ff_flac_is_extradata_valid(AVCodecContext *avctx,
109− enum FLACExtradataFormat *format,
110− uint8_t **streaminfo_start);
108+int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
109+ enum FLACExtradataFormat *format,
110+ uint8_t **streaminfo_start);
111111
112112 /**
113113 * Parse the metadata block parameters from the header.
@@ -116,8 +116,8 @@ int ff_flac_is_extradata_valid(AVCodecContext *avctx, · 2 unmodified lines
116116 * @param[out] type metadata block type
117117 * @param[out] size metadata block size
118118 */
119−void ff_flac_parse_block_header(const uint8_t *block_header,
120− int *last, int *type, int *size);
119+void avpriv_flac_parse_block_header(const uint8_t *block_header,
120+ int *last, int *type, int *size);
121121
122122 /**
123123 * 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
6363
6464 static void allocate_buffers(FLACContext *s);
6565
66−int ff_flac_is_extradata_valid(AVCodecContext *avctx,
66+int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
6767 enum FLACExtradataFormat *format,
6868 uint8_t **streaminfo_start)
6969 {
@@ -104,11 +104,11 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) · 34 unmodified lines
104104 if (!avctx->extradata)
105105 return 0;
106106
107− if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
107+ if (!avpriv_flac_is_extradata_valid(avctx, &format, &streaminfo))
108108 return -1;
109109
110110 /* 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);
112112 if (s->bps > 16)
113113 avctx->sample_fmt = AV_SAMPLE_FMT_S32;
114114 else
@@ -140,7 +140,7 @@ static void allocate_buffers(FLACContext *s) · 25 unmodified lines
140140 }
141141 }
142142
143−void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
143+void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
144144 const uint8_t *buffer)
145145 {
146146 GetBitContext gb;
@@ -174,7 +174,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, · 27 unmodified lines
174174 dump_headers(avctx, s);
175175 }
176176
177−void ff_flac_parse_block_header(const uint8_t *block_header,
177+void avpriv_flac_parse_block_header(const uint8_t *block_header,
178178 int *last, int *type, int *size)
179179 {
180180 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
201201 /* need more data */
202202 return 0;
203203 }
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);
205205 if (metadata_type != FLAC_METADATA_TYPE_STREAMINFO ||
206206 metadata_size != FLAC_STREAMINFO_SIZE) {
207207 return AVERROR_INVALIDDATA;
208208 }
209− ff_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);
209+ avpriv_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);
210210 allocate_buffers(s);
211211 s->got_streaminfo = 1;
212212
@@ -228,7 +228,7 @@ static int get_metadata_size(const uint8_t *buf, int buf_size) · 15 unmodified lines
228228 do {
229229 if (buf_end - buf < 4)
230230 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);
232232 buf += 4;
233233 if (buf_end - buf < metadata_size) {
234234 /* 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
2525 {
2626 int format;
2727
28− align_put_bits(&s->pb);
28+ avpriv_align_put_bits(&s->pb);
2929
3030 put_bits(&s->pb, 17, 1);
3131 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
5353 H261Context * h = (H261Context *) s;
5454 int format, temp_ref;
5555
56− align_put_bits(&s->pb);
56+ avpriv_align_put_bits(&s->pb);
5757
5858 /* Update the pointer to last GOB */
5959 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
153153
154154 for(;;) {
155155 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);
157157 if(buf >= buf_end)
158158 break;
159159 --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
747747 return 0;
748748 }
749749
750+#if FF_API_GET_ALPHA_INFO
750751 /* NOTE: we scan all the pixels to have an exact information */
751752 static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
752753 {
@@ -793,6 +794,7 @@ int img_get_alpha_info(const AVPicture *src, · 40 unmodified lines
793794 }
794795 return ret;
795796 }
797+#endif
796798
797799 #if !(HAVE_MMX && HAVE_YASM)
798800 /* 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
5353 */
5454 int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
5555
56−unsigned int ff_toupper4(unsigned int x);
56+unsigned int avpriv_toupper4(unsigned int x);
5757
5858 /**
5959 * 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
126126 coded_frame_rate= 1800000;
127127 coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
128128
129− align_put_bits(&s->pb);
129+ avpriv_align_put_bits(&s->pb);
130130
131131 /* Update the pointer to last GOB */
132132 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
357357 put_bits(&pb, 8, v);
358358 }
359359 }
360− align_put_bits(&pb);
360+ avpriv_align_put_bits(&pb);
361361 av_free(buf2);
362362
363363 /* End of image */
libavcodec/libavcodec.v+6−7
@@ -1,9 +1,8 @@
11 LIBAVCODEC_$MAJOR {
2− global: *;
3− local:
4− ff_*_bsf;
5− ff_*_decoder;
6− ff_*_encoder;
7− ff_*_hwaccel;
8− ff_*_parser;
2+ global: av*;
3+ audio_resample;
4+ audio_resample_close;
5+ #deprecated, remove after next bump
6+ img_get_alpha_info;
7+ local: *;
98 };
libavcodec/libspeexenc.c+266−120
@@ -1,5 +1,7 @@
11 /*
2− * Copyright (c) 2009 by Xuggle Incorporated. All rights reserved.
2+ * Copyright (C) 2009 Justin Ruggles
3+ * Copyright (c) 2009 Xuggle Incorporated
4+ *
35 * This file is part of FFmpeg.
46 *
57 * FFmpeg is free software; you can redistribute it and/or
@@ -16,163 +18,307 @@ · 10 unmodified lines
1618 * License along with FFmpeg; if not, write to the Free Software
1719 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1820 */
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+
2067 #include <speex/speex.h>
2168 #include <speex/speex_header.h>
2269 #include <speex/speex_stereo.h>
70+#include "libavutil/mathematics.h"
71+#include "libavutil/opt.h"
72+#include "avcodec.h"
73+#include "internal.h"
2374
2475 typedef struct {
25− SpeexBits bits;
26− void *enc_state;
27− SpeexHeader header;
76+ AVClass *class; ///< AVClass for private options
77+ SpeexBits bits; ///< libspeex bitwriter context
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)
2887 } LibSpeexEncContext;
2988
89+static 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+}
30120
31−static av_cold int libspeex_encode_init(AVCodecContext *avctx)
121+static av_cold int encode_init(AVCodecContext *avctx)
32122 {
33− LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;
123+ LibSpeexEncContext *s = avctx->priv_data;
34124 const SpeexMode *mode;
125+ uint8_t *header_data;
126+ int header_size;
127+ int32_t complexity;
35128
36− if ((avctx->sample_fmt != SAMPLE_FMT_S16 && avctx->sample_fmt != SAMPLE_FMT_FLT) ||
37− avctx->sample_rate <= 0 ||
38− avctx->channels <= 0 ||
39− avctx->channels > 2)
40− {
41− av_log(avctx, AV_LOG_ERROR, "Unsupported sample format, rate, or channels for speex");
42− return -1;
129+ /* channels */
130+ if (avctx->channels < 1 || avctx->channels > 2) {
131+ av_log(avctx, AV_LOG_ERROR, "Invalid channels (%d). Only stereo and "
132+ "mono are supported\n", avctx->channels);
133+ return AVERROR(EINVAL);
43134 }
44135
45− if (avctx->sample_rate <= 8000)
46− mode = &speex_nb_mode;
47− else if (avctx->sample_rate <= 16000)
48− mode = &speex_wb_mode;
49− else
50− mode = &speex_uwb_mode;
136+ /* sample rate and encoding mode */
137+ switch (avctx->sample_rate) {
138+ case 8000: mode = &speex_nb_mode; break;
139+ case 16000: mode = &speex_wb_mode; break;
140+ case 32000: mode = &speex_uwb_mode; break;
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+ }
51146
52− speex_bits_init(&s->bits);
147+ /* initialize libspeex */
53148 s->enc_state = speex_encoder_init(mode);
54− if (!s->enc_state)
55− {
56− av_log(avctx, AV_LOG_ERROR, "could not initialize speex encoder");
149+ if (!s->enc_state) {
150+ av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex\n");
57151 return -1;
58152 }
153+ speex_init_header(&s->header, avctx->sample_rate, avctx->channels, mode);
59154
60− // initialize the header
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.
155+ /* rate control method and parameters */
67156 if (avctx->flags & CODEC_FLAG_QSCALE) {
68− spx_int32_t quality = 0;
69− // Map global_quality's mpeg 1/2/4 scale into Speex's 0-10 scale
70− if (avctx->global_quality > FF_LAMBDA_MAX)
71− quality = 0; // lowest possible quality
72− else
73− quality = (spx_int32_t)((FF_LAMBDA_MAX-avctx->global_quality)*10.0/FF_LAMBDA_MAX);
74− speex_encoder_ctl(s->enc_state, SPEEX_SET_QUALITY, &quality);
157+ /* VBR */
158+ s->header.vbr = 1;
159+ speex_encoder_ctl(s->enc_state, SPEEX_SET_VBR, &s->header.vbr);
160+ s->vbr_quality = av_clipf(avctx->global_quality / (float)FF_QP2LAMBDA,
161+ 0.0f, 10.0f);
162+ speex_encoder_ctl(s->enc_state, SPEEX_SET_VBR_QUALITY, &s->vbr_quality);
75163 } else {
76− // default to CBR
77− if (avctx->bit_rate > 0)
78− speex_encoder_ctl(s->enc_state, SPEEX_SET_BITRATE, &avctx->bit_rate);
79− // otherwise just take the default quality setting
164+ s->header.bitrate = avctx->bit_rate;
165+ if (avctx->bit_rate > 0) {
166+ /* CBR or ABR by bitrate */
167+ 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);
80188 }
81− // reset the bit-rate to the actual bit rate speex will use
82− speex_encoder_ctl(s->enc_state, SPEEX_GET_BITRATE, &s->header.bitrate);
83− avctx->bit_rate = s->header.bitrate;
84−
85− // get the actual sample rate
86− speex_encoder_ctl(s->enc_state, SPEEX_GET_SAMPLING_RATE, &s->header.rate);
87− avctx->sample_rate = s->header.rate;
88−
89− // get the frame-size. To align with FLV, we're going to put 2 frames
90− // per packet. If someone can tell me how to make this configurable
91− // from the avcodec contents, I'll mod this so it's not hard-coded.
92− // but without this, FLV files with speex data won't play correctly
93− // in flash player 10.
94− speex_encoder_ctl(s->enc_state, SPEEX_GET_FRAME_SIZE, &s->header.frame_size);
95− s->header.frames_per_packet = 2; // Need for FLV container support
96− avctx->frame_size = s->header.frame_size*s->header.frames_per_packet;
97−
98− // and we'll put a speex header packet into extradata so that muxers
99− // can use it.
100− avctx->extradata = speex_header_to_packet(&s->header, &avctx->extradata_size);
189+
190+ /* set encoding complexity */
191+ if (avctx->compression_level > FF_COMPRESSION_DEFAULT) {
192+ complexity = av_clip(avctx->compression_level, 0, 10);
193+ speex_encoder_ctl(s->enc_state, SPEEX_SET_COMPLEXITY, &complexity);
194+ }
195+ speex_encoder_ctl(s->enc_state, SPEEX_GET_COMPLEXITY, &complexity);
196+ avctx->compression_level = complexity;
197+
198+ /* set packet size */
199+ avctx->frame_size = s->header.frame_size;
200+ s->header.frames_per_packet = s->frames_per_packet;
201+
202+ /* set encoding delay */
203+ speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &s->lookahead);
204+ s->sample_count = -s->lookahead;
205+
206+ /* create header packet bytes from header struct */
207+ /* note: libspeex allocates the memory for header_data, which is freed
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);
101230 return 0;
102231 }
103232
104−static av_cold int libspeex_encode_frame(
105− AVCodecContext *avctx, uint8_t *frame,
106− int buf_size, void *data)
233+static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
234+ void *data)
107235 {
108− LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;
109− int i = 0;
110−
111− if (!data)
112− // nothing to flush
113− return 0;
114−
115− speex_bits_reset(&s->bits);
116− for(i = 0; i < s->header.frames_per_packet; i++)
117− {
118− if (avctx->sample_fmt == SAMPLE_FMT_FLT)
119− {
120− if (avctx->channels == 2) {
121− speex_encode_stereo(
122− (float*)data+i*s->header.frame_size,
123− s->header.frame_size,
124− &s->bits);
125− }
126− speex_encode(s->enc_state,
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);
236+ LibSpeexEncContext *s = avctx->priv_data;
237+ int16_t *samples = data;
238+ int sample_count = s->sample_count;
239+
240+ if (data) {
241+ /* encode Speex frame */
242+ if (avctx->channels == 2)
243+ speex_encode_stereo_int(samples, s->header.frame_size, &s->bits);
244+ speex_encode_int(s->enc_state, samples, &s->bits);
245+ s->pkt_frame_count++;
246+ s->sample_count += avctx->frame_size;
247+ } else {
248+ /* handle end-of-stream */
249+ if (!s->pkt_frame_count)
250+ return 0;
251+ /* add extra terminator codes for unused frames in last packet */
252+ while (s->pkt_frame_count < s->frames_per_packet) {
253+ speex_bits_pack(&s->bits, 15, 5);
254+ s->pkt_frame_count++;
137255 }
138256 }
139− // put in a terminator so this will fit in a OGG or FLV packet
140− speex_bits_insert_terminator(&s->bits);
141257
142− if (buf_size >= speex_bits_nbytes(&s->bits)) {
143− return speex_bits_write(&s->bits, frame, buf_size);
144− } else {
145− av_log(avctx, AV_LOG_ERROR, "output buffer too small");
146− return -1;
258+ /* write output if all frames for the packet have been encoded */
259+ if (s->pkt_frame_count == s->frames_per_packet) {
260+ s->pkt_frame_count = 0;
261+ avctx->coded_frame->pts =
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+ }
147272 }
273+ return 0;
148274 }
149275
150−static av_cold int libspeex_encode_close(AVCodecContext *avctx)
276+static av_cold int encode_close(AVCodecContext *avctx)
151277 {
152− LibSpeexEncContext *s = (LibSpeexEncContext*)avctx->priv_data;
278+ LibSpeexEncContext *s = avctx->priv_data;
153279
154280 speex_bits_destroy(&s->bits);
155281 speex_encoder_destroy(s->enc_state);
156− s->enc_state = 0;
157− if (avctx->extradata)
158− speex_header_free(avctx->extradata);
159− avctx->extradata = 0;
160− avctx->extradata_size = 0;
282+
283+ av_freep(&avctx->coded_frame);
284+ av_freep(&avctx->extradata);
161285
162286 return 0;
163287 }
164288
289+#define OFFSET(x) offsetof(LibSpeexEncContext, x)
290+#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
291+static 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+
298+static const AVClass class = {
299+ .class_name = "libspeex",
300+ .item_name = av_default_item_name,
301+ .option = options,
302+ .version = LIBAVUTIL_VERSION_INT,
303+};
304+
305+static const AVCodecDefault defaults[] = {
306+ { "b", "0" },
307+ { "compression_level", "3" },
308+ { NULL },
309+};
310+
165311 AVCodec ff_libspeex_encoder = {
166− "libspeex",
167− AVMEDIA_TYPE_AUDIO,
168− CODEC_ID_SPEEX,
169− sizeof(LibSpeexEncContext),
170− libspeex_encode_init,
171− libspeex_encode_frame,
172− libspeex_encode_close,
173− 0,
174− .capabilities = CODEC_CAP_DELAY,
175− .supported_samplerates = (const int[]){8000, 16000, 32000, 0},
176− .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},
177− .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex Encoder"),
312+ .name = "libspeex",
313+ .type = AVMEDIA_TYPE_AUDIO,
314+ .id = CODEC_ID_SPEEX,
315+ .priv_data_size = sizeof(LibSpeexEncContext),
316+ .init = encode_init,
317+ .encode = encode_frame,
318+ .close = encode_close,
319+ .capabilities = CODEC_CAP_DELAY,
320+ .sample_fmts = (const enum SampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
321+ .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
322+ .priv_class = &class,
323+ .defaults = defaults,
178324 };
libavcodec/libvo-aacenc.c+1−1
@@ -63,7 +63,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 62 unmodified lines
6363 }
6464
6565 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])
6767 break;
6868 if (index == 16) {
6969 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
5050 lsf = sample_rate < (24000+32000)/2;
5151 mpeg25 = sample_rate < (12000+16000)/2;
5252 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 off
53+ sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
5454
5555 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];
5757 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
5858 if(frame_size == buf_size + 4)
5959 break;
libavcodec/mpeg12.c+8−8
@@ -1290,8 +1290,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1289 unmodified lines
12901290 assert((avctx->sub_id == 1) == (avctx->codec_id == CODEC_ID_MPEG1VIDEO));
12911291 if (avctx->codec_id == CODEC_ID_MPEG1VIDEO) {
12921292 //MPEG-1 fps
1293− avctx->time_base.den = ff_frame_rate_tab[s->frame_rate_index].num;
1294− avctx->time_base.num = ff_frame_rate_tab[s->frame_rate_index].den;
1293+ avctx->time_base.den = avpriv_frame_rate_tab[s->frame_rate_index].num;
1294+ avctx->time_base.num = avpriv_frame_rate_tab[s->frame_rate_index].den;
12951295 //MPEG-1 aspect
12961296 avctx->sample_aspect_ratio = av_d2q(1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);
12971297 avctx->ticks_per_frame=1;
@@ -1299,8 +1299,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1 unmodified line
12991299 //MPEG-2 fps
13001300 av_reduce(&s->avctx->time_base.den,
13011301 &s->avctx->time_base.num,
1302− ff_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,
1302+ avpriv_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,
1303+ avpriv_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
13041304 1 << 30);
13051305 avctx->ticks_per_frame = 2;
13061306 //MPEG-2 aspect
@@ -1732,7 +1732,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y, · 425 unmodified lines
17321732 if (avctx->hwaccel) {
17331733 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
17341734 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);
17361736 if (buf_end < *buf + buf_size)
17371737 buf_end -= 4;
17381738 s->mb_y = mb_y;
@@ -1923,7 +1923,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg) · 184 unmodified lines
19231923 return 0;
19241924
19251925 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);
19271927 mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
19281928 if (s->picture_structure == PICT_BOTTOM_FIELD)
19291929 mb_y++;
@@ -2217,7 +2217,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, · 287 unmodified lines
22172217 }
22182218 state++;
22192219 } 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;
22212221 if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {
22222222 i++;
22232223 pc->frame_start_found = 4;
@@ -2308,7 +2308,7 @@ static int decode_chunks(AVCodecContext *avctx, · 84 unmodified lines
23082308 for (;;) {
23092309 /* find next start code */
23102310 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);
23122312 if (start_code > 0x1ff) {
23132313 if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
23142314 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
305305 { 0xc, 10 },
306306 };
307307
308−const AVRational ff_frame_rate_tab[] = {
308+const AVRational avpriv_frame_rate_tab[] = {
309309 { 0, 0},
310310 {24000, 1001},
311311 { 24, 1},
libavcodec/mpeg12data.h+1−1
@@ -48,7 +48,7 @@ extern const uint8_t ff_mpeg12_mbPatTable[64][2]; · 47 unmodified lines
4848
4949 extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2];
5050
51−extern const AVRational ff_frame_rate_tab[];
51+extern const AVRational avpriv_frame_rate_tab[];
5252
5353 extern const float ff_mpeg1_aspect[16];
5454 extern 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
121121 int64_t d;
122122
123123 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;
125125 int64_t n1= 1001LL*s->avctx->time_base.den;
126126 if(s->avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && i>=9) break;
127127
@@ -200,7 +200,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 72 unmodified lines
200200
201201 static void put_header(MpegEncContext *s, int header)
202202 {
203− align_put_bits(&s->pb);
203+ avpriv_align_put_bits(&s->pb);
204204 put_bits(&s->pb, 16, header>>16);
205205 put_sbits(&s->pb, 16, header);
206206 }
@@ -219,7 +219,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) · 12 unmodified lines
219219 if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)
220220
221221 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];
223223
224224 /* mpeg1 header repeated every gop */
225225 put_header(s, SEQ_START_CODE);
@@ -978,7 +978,7 @@ AVCodec ff_mpeg1video_encoder = { · 752 unmodified lines
978978 .init = encode_init,
979979 .encode = MPV_encode_picture,
980980 .close = MPV_encode_end,
981− .supported_framerates= ff_frame_rate_tab+1,
981+ .supported_framerates= avpriv_frame_rate_tab+1,
982982 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
983983 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
984984 .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
@@ -993,7 +993,7 @@ AVCodec ff_mpeg2video_encoder = { · 8 unmodified lines
993993 .init = encode_init,
994994 .encode = MPV_encode_picture,
995995 .close = MPV_encode_end,
996− .supported_framerates= ff_frame_rate_tab+1,
996+ .supported_framerates= avpriv_frame_rate_tab+1,
997997 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
998998 .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
999999 .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
5252 return 0;
5353 }
5454
55−const int ff_mpeg4audio_sample_rates[16] = {
55+const int avpriv_mpeg4audio_sample_rates[16] = {
5656 96000, 88200, 64000, 48000, 44100, 32000,
5757 24000, 22050, 16000, 12000, 11025, 8000, 7350
5858 };
@@ -73,10 +73,10 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) · 14 unmodified lines
7373 {
7474 *index = get_bits(gb, 4);
7575 return *index == 0x0f ? get_bits(gb, 24) :
76− ff_mpeg4audio_sample_rates[*index];
76+ avpriv_mpeg4audio_sample_rates[*index];
7777 }
7878
79−int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)
79+int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)
8080 {
8181 GetBitContext gb;
8282 int specific_config_bitindex;
@@ -151,7 +151,7 @@ static av_always_inline unsigned int copy_bits(PutBitContext *pb, · 68 unmodified lines
151151 return el;
152152 }
153153
154−int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb)
154+int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb)
155155 {
156156 int five_bit_ch, four_bit_ch, comment_size, bits;
157157 int offset = put_bits_count(pb);
@@ -173,7 +173,7 @@ int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb) · 15 unmodified lines
173173 copy_bits(pb, gb, 16);
174174 if (bits)
175175 copy_bits(pb, gb, bits);
176− align_put_bits(pb);
176+ avpriv_align_put_bits(pb);
177177 align_get_bits(gb);
178178 comment_size = copy_bits(pb, gb, 8);
179179 for (; comment_size > 0; comment_size--)
libavcodec/mpeg4audio.h+3−3
@@ -40,7 +40,7 @@ typedef struct { · 39 unmodified lines
4040 int ps; ///< -1 implicit, 1 presence
4141 } MPEG4AudioConfig;
4242
43−extern const int ff_mpeg4audio_sample_rates[16];
43+extern const int avpriv_mpeg4audio_sample_rates[16];
4444 extern const uint8_t ff_mpeg4audio_channels[8];
4545 /**
4646 * Parse MPEG-4 systems extradata to retrieve audio configuration.
@@ -49,7 +49,7 @@ extern const uint8_t ff_mpeg4audio_channels[8]; · 2 unmodified lines
4949 * @param[in] buf_size Extradata size.
5050 * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata.
5151 */
52−int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size);
52+int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size);
5353
5454 enum AudioObjectType {
5555 AOT_NULL,
@@ -101,6 +101,6 @@ enum AudioObjectType { · 45 unmodified lines
101101 #define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
102102 ///<marker and the comment
103103
104−int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
104+int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
105105
106106 #endif /* AVCODEC_MPEG4AUDIO_H */
libavcodec/mpeg4videoenc.c+2−2
@@ -1268,8 +1268,8 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s) · 1267 unmodified lines
12681268 flush_put_bits(&s->tex_pb);
12691269
12701270 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);
1272− ff_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
1271+ avpriv_copy_bits(&s->pb, s->pb2.buf , pb2_len);
1272+ avpriv_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
12731273 s->last_bits= put_bits_count(&s->pb);
12741274 }
12751275
libavcodec/mpegaudio_parser.c+1−1
@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, · 63 unmodified lines
6464
6565 state= (state<<8) + buf[i++];
6666
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);
6868 if (ret < 4) {
6969 if(i > 4)
7070 s->header_count= -2;
libavcodec/mpegaudiodata.c+2−2
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #include "mpegaudiodata.h"
2828
2929
30−const uint16_t ff_mpa_bitrate_tab[2][3][15] = {
30+const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
3131 { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
3232 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
3333 {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
3737 }
3838 };
3939
40−const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 };
40+const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
4141
4242 /*******************************************************/
4343 /* half mpeg encoding window (full precision) */
libavcodec/mpegaudiodata.h+2−2
@@ -32,8 +32,8 @@ · 31 unmodified lines
3232 #define MODE_EXT_MS_STEREO 2
3333 #define MODE_EXT_I_STEREO 1
3434
35−extern const uint16_t ff_mpa_bitrate_tab[2][3][15];
36−extern const uint16_t ff_mpa_freq_tab[3];
35+extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
36+extern const uint16_t avpriv_mpa_freq_tab[3];
3737 extern const int32_t ff_mpa_enwindow[257];
3838 extern const int ff_mpa_sblimit_table[5];
3939 extern 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
17891789 return -1;
17901790 }
17911791
1792− if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
1792+ if (avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
17931793 /* free format: prepare to compute frame size */
17941794 s->frame_size = -1;
17951795 return -1;
@@ -1862,7 +1862,7 @@ static int decode_frame_adu(AVCodecContext * avctx, · 66 unmodified lines
18621862 return buf_size;
18631863 }
18641864
1865− ff_mpegaudio_decode_header((MPADecodeHeader *)s, header);
1865+ avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header);
18661866 /* update codec info */
18671867 avctx->sample_rate = s->sample_rate;
18681868 avctx->channels = s->nb_channels;
@@ -1923,7 +1923,7 @@ static int decode_init_mp3on4(AVCodecContext * avctx) · 54 unmodified lines
19231923 return -1;
19241924 }
19251925
1926− ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
1926+ avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
19271927 if (!cfg.chan_config || cfg.chan_config > 7) {
19281928 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
19291929 return -1;
@@ -2015,7 +2015,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, · 85 unmodified lines
20152015 if (ff_mpa_check_header(header) < 0) // Bad header, discard block
20162016 break;
20172017
2018− ff_mpegaudio_decode_header((MPADecodeHeader *)m, header);
2018+ avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
20192019 out_size += mp_decode_frame(m, outptr, buf, fsize);
20202020 buf += fsize;
20212021 len -= fsize;
libavcodec/mpegaudiodecheader.c+5−5
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 #include "mpegaudiodecheader.h"
3232
3333
34−int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
34+int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
3535 {
3636 int sample_rate, frame_size, mpeg25, padding;
3737 int sample_rate_index, bitrate_index;
@@ -46,7 +46,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 8 unmodified lines
4646 s->layer = 4 - ((header >> 17) & 3);
4747 /* extract frequency */
4848 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);
5050 sample_rate_index += 3 * (s->lsf + mpeg25);
5151 s->sample_rate_index = sample_rate_index;
5252 s->error_protection = ((header >> 16) & 1) ^ 1;
@@ -67,7 +67,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 14 unmodified lines
6767 s->nb_channels = 2;
6868
6969 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];
7171 s->bit_rate = frame_size * 1000;
7272 switch(s->layer) {
7373 case 1:
@@ -109,14 +109,14 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) · 35 unmodified lines
109109 return 0;
110110 }
111111
112−int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
112+int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
113113 {
114114 MPADecodeHeader s1, *s = &s1;
115115
116116 if (ff_mpa_check_header(head) != 0)
117117 return -1;
118118
119− if (ff_mpegaudio_decode_header(s, head) != 0) {
119+ if (avpriv_mpegaudio_decode_header(s, head) != 0) {
120120 return -1;
121121 }
122122
libavcodec/mpegaudiodecheader.h+2−2
@@ -50,11 +50,11 @@ typedef struct MPADecodeHeader { · 49 unmodified lines
5050 /* header decoding. MUST check the header before because no
5151 consistency check is done there. Return 1 if free format found and
5252 that the frame size must be computed externally */
53−int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
53+int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
5454
5555 /* useful helper to get mpeg audio stream infos. Return -1 if error in
5656 header, otherwise the coded frame size in bytes */
57−int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
57+int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
5858
5959 /* fast header check for resync */
6060 static 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
8484 /* encoding freq */
8585 s->lsf = 0;
8686 for(i=0;i<3;i++) {
87− if (ff_mpa_freq_tab[i] == freq)
87+ if (avpriv_mpa_freq_tab[i] == freq)
8888 break;
89− if ((ff_mpa_freq_tab[i] / 2) == freq) {
89+ if ((avpriv_mpa_freq_tab[i] / 2) == freq) {
9090 s->lsf = 1;
9191 break;
9292 }
@@ -99,7 +99,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) · 6 unmodified lines
9999
100100 /* encoding bitrate & frequency */
101101 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)
103103 break;
104104 }
105105 if (i == 15){
libavcodec/mpegvideo.c+3−4
@@ -122,7 +122,7 @@ const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = { · 121 unmodified lines
122122 PIX_FMT_NONE
123123 };
124124
125−const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
125+const uint8_t *avpriv_mpv_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
126126 int i;
127127
128128 assert(p<=end);
@@ -645,9 +645,8 @@ av_cold int MPV_common_init(MpegEncContext *s) · 516 unmodified lines
645645 yc_size = y_size + 2 * c_size;
646646
647647 /* convert fourcc to upper case */
648− s->codec_tag = ff_toupper4(s->avctx->codec_tag);
649−
650− s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag);
648+ s->codec_tag = avpriv_toupper4(s->avctx->codec_tag);
649+ s->stream_codec_tag = avpriv_toupper4(s->avctx->stream_codec_tag);
651650
652651 s->avctx->coded_frame= (AVFrame*)&s->current_picture;
653652
libavcodec/mpegvideo.h+1−1
@@ -725,7 +725,7 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); · 724 unmodified lines
725725 int MPV_lowest_referenced_row(MpegEncContext *s, int dir);
726726 void MPV_report_decode_progress(MpegEncContext *s);
727727 int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
728−const uint8_t *ff_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
728+const uint8_t *avpriv_mpv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
729729 void ff_set_qscale(MpegEncContext * s, int qscale);
730730
731731 void 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
20512051 ff_mjpeg_encode_stuffing(&s->pb);
20522052 }
20532053
2054− align_put_bits(&s->pb);
2054+ avpriv_align_put_bits(&s->pb);
20552055 flush_put_bits(&s->pb);
20562056
20572057 if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame)
@@ -2492,18 +2492,18 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 434 unmodified lines
24922492
24932493 pb_bits_count= put_bits_count(&s->pb);
24942494 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);
24962496 s->pb= backup_s.pb;
24972497
24982498 if(s->data_partitioning){
24992499 pb2_bits_count= put_bits_count(&s->pb2);
25002500 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);
25022502 s->pb2= backup_s.pb2;
25032503
25042504 tex_pb_bits_count= put_bits_count(&s->tex_pb);
25052505 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);
25072507 s->tex_pb= backup_s.tex_pb;
25082508 }
25092509 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
27262726
27272727 assert(put_bits_count(&src->pb) % 8 ==0);
27282728 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));
27302730 flush_put_bits(&dst->pb);
27312731 }
27322732
libavcodec/mpegvideo_parser.c+3−3
@@ -40,7 +40,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 39 unmodified lines
4040
4141 while (buf < buf_end) {
4242 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);
4444 bytes_left = buf_end - buf;
4545 switch(start_code) {
4646 case PICTURE_START_CODE:
@@ -57,8 +57,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 10 unmodified lines
5757 did_set_size=1;
5858 }
5959 frame_rate_index = buf[3] & 0xf;
60− pc->frame_rate.den = avctx->time_base.den = ff_frame_rate_tab[frame_rate_index].num;
61− pc->frame_rate.num = avctx->time_base.num = ff_frame_rate_tab[frame_rate_index].den;
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 = avpriv_frame_rate_tab[frame_rate_index].den;
6262 avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
6363 avctx->codec_id = CODEC_ID_MPEG1VIDEO;
6464 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
351351 {
352352 find_best_tables(s);
353353
354− align_put_bits(&s->pb);
354+ avpriv_align_put_bits(&s->pb);
355355 put_bits(&s->pb, 2, s->pict_type - 1);
356356
357357 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
9797 }
9898
9999 #ifdef BITSTREAM_WRITER_LE
100−#define align_put_bits align_put_bits_unsupported_here
100+#define avpriv_align_put_bits align_put_bits_unsupported_here
101101 #define ff_put_string ff_put_string_unsupported_here
102−#define ff_copy_bits ff_copy_bits_unsupported_here
102+#define avpriv_copy_bits avpriv_copy_bits_unsupported_here
103103 #else
104104 /**
105105 * Pad the bitstream with zeros up to the next byte boundary.
106106 */
107−void align_put_bits(PutBitContext *s);
107+void avpriv_align_put_bits(PutBitContext *s);
108108
109109 /**
110110 * 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
118118 *
119119 * @param length the number of bits of src to copy
120120 */
121−void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
121+void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
122122 #endif
123123
124124 /**
libavcodec/rv10enc.c+1−1
@@ -32,7 +32,7 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number) · 31 unmodified lines
3232 {
3333 int full_frame= 0;
3434
35− align_put_bits(&s->pb);
35+ avpriv_align_put_bits(&s->pb);
3636
3737 put_bits(&s->pb, 1, 1); /* marker */
3838
libavcodec/shorten.c+297−214
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828
2929 #include <limits.h>
3030 #include "avcodec.h"
31+#include "bytestream.h"
3132 #include "get_bits.h"
3233 #include "golomb.h"
3334
@@ -69,6 +70,9 @@ · 35 unmodified lines
6970 #define FN_ZERO 8
7071 #define FN_VERBATIM 9
7172
73+/** indicates if the FN_* command is audio or non-audio */
74+static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
75+
7276 #define VERBATIM_CKSIZE_SIZE 5
7377 #define VERBATIM_BYTE_SIZE 8
7478 #define CANONICAL_HEADER_SIZE 44
@@ -98,6 +102,8 @@ typedef struct ShortenContext { · 23 unmodified lines
98102 int blocksize;
99103 int bitindex;
100104 int32_t lpcqoffset;
105+ int got_header;
106+ int got_quit_command;
101107 } ShortenContext;
102108
103109 static av_cold int shorten_decode_init(AVCodecContext * avctx)
@@ -113,6 +119,7 @@ static int allocate_buffers(ShortenContext *s) · 9 unmodified lines
113119 {
114120 int i, chan;
115121 int *coeffs;
122+ void *tmp_ptr;
116123
117124 for (chan=0; chan<s->channels; chan++) {
118125 if(FFMAX(1, s->nmean) >= UINT_MAX/sizeof(int32_t)){
@@ -124,9 +131,15 @@ static int allocate_buffers(ShortenContext *s) · 5 unmodified lines
124131 return -1;
125132 }
126133
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;
128138
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;
130143 for (i=0; i<s->nwrap; i++)
131144 s->decoded[chan][i] = 0;
132145 s->decoded[chan] += s->nwrap;
@@ -181,47 +194,37 @@ static void init_offset(ShortenContext *s) · 48 unmodified lines
181194 s->offset[chan][i] = mean;
182195 }
183196
184−static inline int get_le32(GetBitContext *gb)
185−{
186− return av_bswap32(get_bits_long(gb, 32));
187−}
188−
189−static inline short get_le16(GetBitContext *gb)
190−{
191− return av_bswap16(get_bits_long(gb, 16));
192−}
193−
194−static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header_size)
197+static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
198+ int header_size)
195199 {
196− GetBitContext hb;
197200 int len;
198201 short wave_format;
199202
200− init_get_bits(&hb, header, header_size*8);
201− if (get_le32(&hb) != MKTAG('R','I','F','F')) {
203+
204+ if (bytestream_get_le32(&header) != MKTAG('R','I','F','F')) {
202205 av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
203206 return -1;
204207 }
205208
206− skip_bits_long(&hb, 32); /* chunk_size */
209+ header += 4; /* chunk size */;
207210
208− if (get_le32(&hb) != MKTAG('W','A','V','E')) {
211+ if (bytestream_get_le32(&header) != MKTAG('W','A','V','E')) {
209212 av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");
210213 return -1;
211214 }
212215
213− while (get_le32(&hb) != MKTAG('f','m','t',' ')) {
214− len = get_le32(&hb);
215− skip_bits(&hb, 8*len);
216+ while (bytestream_get_le32(&header) != MKTAG('f','m','t',' ')) {
217+ len = bytestream_get_le32(&header);
218+ header += len;
216219 }
217− len = get_le32(&hb);
220+ len = bytestream_get_le32(&header);
218221
219222 if (len < 16) {
220223 av_log(avctx, AV_LOG_ERROR, "fmt chunk was too short\n");
221224 return -1;
222225 }
223226
224− wave_format = get_le16(&hb);
227+ wave_format = bytestream_get_le16(&header);
225228
226229 switch (wave_format) {
227230 case WAVE_FORMAT_PCM:
@@ -231,11 +234,11 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header · 3 unmodified lines
231234 return -1;
232235 }
233236
234− avctx->channels = get_le16(&hb);
235− avctx->sample_rate = get_le32(&hb);
236− avctx->bit_rate = get_le32(&hb) * 8;
237− avctx->block_align = get_le16(&hb);
238− avctx->bits_per_coded_sample = get_le16(&hb);
237+ header += 2; // skip channels (already got from shorten header)
238+ avctx->sample_rate = bytestream_get_le32(&header);
239+ header += 4; // skip bit rate (represents original uncompressed bit rate)
240+ header += 2; // skip block align (not needed)
241+ avctx->bits_per_coded_sample = bytestream_get_le16(&header);
239242
240243 if (avctx->bits_per_coded_sample != 16) {
241244 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
253256 int i, chan;
254257 for (i=0; i<blocksize; i++)
255258 for (chan=0; chan < nchan; chan++)
256− *samples++ = FFMIN(buffer[chan][i], 32768);
259+ *samples++ = av_clip_int16(buffer[chan][i]);
257260 return samples;
258261 }
259262
260−static void decode_subframe_lpc(ShortenContext *s, int channel, int residual_size, int pred_order)
263+static const int fixed_coeffs[3][3] = {
264+ { 1, 0, 0 },
265+ { 2, -1, 0 },
266+ { 3, -3, 1 }
267+};
268+
269+static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
270+ int residual_size, int32_t coffset)
261271 {
262− int sum, i, j;
263− int *coeffs = s->coeffs;
272+ int pred_order, sum, qshift, init_sum, i, j;
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+ }
264294
265− for (i=0; i<pred_order; i++)
266− coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT);
295+ /* subtract offset from previous samples to use in prediction */
296+ if (command == FN_QLPC && coffset)
297+ for (i = -pred_order; i < 0; i++)
298+ s->decoded[channel][i] -= coffset;
267299
300+ /* decode residual and do LPC prediction */
301+ init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset;
268302 for (i=0; i < s->blocksize; i++) {
269− sum = s->lpcqoffset;
303+ sum = init_sum;
270304 for (j=0; j<pred_order; j++)
271305 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);
273307 }
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;
274315 }
275316
317+static 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+}
276395
277396 static int shorten_decode_frame(AVCodecContext *avctx,
278397 void *data, int *data_size,
@@ -283,226 +402,189 @@ static int shorten_decode_frame(AVCodecContext *avctx, · 4 unmodified lines
283402 ShortenContext *s = avctx->priv_data;
284403 int i, input_buf_size = 0;
285404 int16_t *samples = data;
405+ int ret;
406+
407+ /* allocate internal bitstream buffer */
286408 if(s->max_framesize == 0){
409+ void *tmp_ptr;
287410 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;
289418 }
290419
420+ /* append current packet data to bitstream buffer */
291421 if(1 && s->max_framesize){//FIXME truncated
292422 buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
293423 input_buf_size= buf_size;
294424
295425 if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
296− // printf("memmove\n");
297426 memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
298427 s->bitstream_index=0;
299428 }
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);
301431 buf= &s->bitstream[s->bitstream_index];
302432 buf_size += s->bitstream_size;
303433 s->bitstream_size= buf_size;
304434
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) {
306438 *data_size = 0;
307439 return input_buf_size;
308440 }
309441 }
442+ /* init and position bitstream reader */
310443 init_get_bits(&s->gb, buf, buf_size*8);
311444 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− }
320445
321− s->lpcqoffset = 0;
322− s->blocksize = DEFAULT_BLOCK_SIZE;
323− s->channels = 1;
324− s->nmean = -1;
325− s->version = get_bits(&s->gb, 8);
326− s->internal_ftype = get_uint(s, TYPESIZE);
446+ /* process header or next subblock */
447+ if (!s->got_header) {
448+ if ((ret = read_header(s)) < 0)
449+ return ret;
450+ *data_size = 0;
451+ goto finish_frame;
452+ }
327453
328− s->channels = get_uint(s, CHANSIZE);
329− if (s->channels > MAX_CHANNELS) {
330− av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
331− return -1;
332− }
454+ /* if quit command was read previously, don't decode anything */
455+ if (s->got_quit_command) {
456+ *data_size = 0;
457+ return avpkt->size;
458+ }
333459
334− /* get blocksize if version > 0 */
335− if (s->version > 0) {
336− int skip_bytes;
337− s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
338− maxnlpc = get_uint(s, LPCQSIZE);
339− s->nmean = get_uint(s, 0);
460+ s->cur_chan = 0;
461+ while (s->cur_chan < s->channels) {
462+ int cmd;
463+ int len;
340464
341− skip_bytes = get_uint(s, NSKIPSIZE);
342− for (i=0; i<skip_bytes; i++) {
343− skip_bits(&s->gb, 8);
344− }
465+ if (get_bits_left(&s->gb) < 3+FNSIZE) {
466+ *data_size = 0;
467+ break;
345468 }
346− s->nwrap = FFMAX(NWRAP, maxnlpc);
347−
348− if (allocate_buffers(s))
349− return -1;
350469
351− init_offset(s);
352−
353− if (s->version > 1)
354− s->lpcqoffset = V2LPCQOFFSET;
470+ cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);
355471
356− if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {
357− av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");
358− return -1;
472+ if (cmd > FN_VERBATIM) {
473+ av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
474+ *data_size = 0;
475+ break;
359476 }
360477
361− s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
362− if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {
363− av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);
364− return -1;
365− }
478+ if (!is_audio_command[cmd]) {
479+ /* process non-audio command */
480+ switch (cmd) {
481+ case FN_VERBATIM:
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+ }
366525
367− for (i=0; i<s->header_size; i++)
368− s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
526+ /* calculate sample offset using means from previous blocks */
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+ }
369537
370− if (decode_wave_header(avctx, s->header, s->header_size) < 0)
371− return -1;
538+ /* decode samples for this channel */
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+ }
372546
373− s->cur_chan = 0;
374− s->bitshift = 0;
375− }
376− else
377− {
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− }
547+ /* update means with info from the current block */
548+ if (s->nmean > 0) {
549+ int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
550+ for (i=0; i<s->blocksize; i++)
551+ sum += s->decoded[channel][i];
398552
399− if (s->nmean == 0)
400− coffset = s->offset[channel][0];
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];
553+ for (i=1; i<s->nmean; i++)
554+ s->offset[channel][i-1] = s->offset[channel][i];
465555
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+ }
467561
468− s->cur_chan++;
469− if (s->cur_chan == s->channels) {
470− samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
471− s->cur_chan = 0;
472− goto frame_done;
473− }
474− }
475− break;
476− case FN_VERBATIM:
477− len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
478− while (len--) {
479− get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
480− }
481− break;
482− case FN_BITSHIFT:
483− s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
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;
562+ /* copy wrap samples for use with next block */
563+ for (i=-s->nwrap; i<0; i++)
564+ s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
565+
566+ /* shift samples to add in unused zero bits which were removed
567+ during encoding */
568+ fix_bitshift(s, s->decoded[channel]);
569+
570+ /* if this is the last channel in the block, output the samples */
571+ s->cur_chan++;
572+ if (s->cur_chan == s->channels) {
573+ int out_size = s->blocksize * s->channels *
574+ av_get_bytes_per_sample(avctx->sample_fmt);
575+ if (*data_size < out_size) {
576+ av_log(avctx, AV_LOG_ERROR, "Output buffer is too small\n");
577+ return AVERROR(EINVAL);
490578 }
491− s->blocksize = blocksize;
492− break;
579+ samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
580+ *data_size = out_size;
493581 }
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;
500582 }
501583 }
502−frame_done:
503− *data_size = (int8_t *)samples - (int8_t *)data;
584+ if (s->cur_chan < s->channels)
585+ *data_size = 0;
504586
505− // s->last_blocksize = s->blocksize;
587+finish_frame:
506588 s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
507589 i= (get_bits_count(&s->gb))/8;
508590 if (i > buf_size) {
@@ -542,5 +624,6 @@ AVCodec ff_shorten_decoder = { · 33 unmodified lines
542624 .init = shorten_decode_init,
543625 .close = shorten_decode_close,
544626 .decode = shorten_decode_frame,
627+ .capabilities = CODEC_CAP_DELAY,
545628 .long_name= NULL_IF_CONFIG_SMALL("Shorten"),
546629 };
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
461461 s->rd_total += score[best];
462462
463463 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]);
465465 }
466466 if(best==0){
467467 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
540540 return -1;
541541 }
542542
543−// align_put_bits(&s->pb);
543+// avpriv_align_put_bits(&s->pb);
544544 while(put_bits_count(&s->pb) & 31)
545545 put_bits(&s->pb, 1, 0);
546546
libavcodec/utils.c+1−1
@@ -1363,7 +1363,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) · 1362 unmodified lines
13631363 return 0;
13641364 }
13651365
1366−unsigned int ff_toupper4(unsigned int x)
1366+unsigned int avpriv_toupper4(unsigned int x)
13671367 {
13681368 return toupper( x &0xFF)
13691369 + (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
132132
133133 emms_c();
134134
135− align_put_bits(&a->pb);
135+ avpriv_align_put_bits(&a->pb);
136136 while(get_bit_count(&a->pb)&31)
137137 put_bits(&a->pb, 8, 0);
138138
libavcodec/version.h+4−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
24−#define LIBAVCODEC_VERSION_MINOR 22
24+#define LIBAVCODEC_VERSION_MINOR 23
2525 #define LIBAVCODEC_VERSION_MICRO 0
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -98,5 +98,8 @@ · 70 unmodified lines
9898 #ifndef FF_API_MJPEG_GLOBAL_OPTS
9999 #define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
100100 #endif
101+#ifndef FF_API_GET_ALPHA_INFO
102+#define FF_API_GET_ALPHA_INFO (LIBAVCODEC_VERSION_MAJOR < 54)
103+#endif
101104
102105 #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
991991 return -1;
992992 }
993993
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) {
995995 av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n");
996996 return -1;
997997 }
libavcodec/vp3.c+1−1
@@ -2276,7 +2276,7 @@ static av_cold int theora_decode_init(AVCodecContext *avctx) · 2275 unmodified lines
22762276 return -1;
22772277 }
22782278
2279− if (ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,
2279+ if (avpriv_split_xiph_headers(avctx->extradata, avctx->extradata_size,
22802280 42, header_start, header_len) < 0) {
22812281 av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
22822282 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
311311 put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]);
312312 }
313313 if (s->version == 1 && s->nb_channels >= 2) {
314− align_put_bits(&s->pb);
314+ avpriv_align_put_bits(&s->pb);
315315 }
316316 }
317317 return 0;
@@ -327,7 +327,7 @@ static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], · 9 unmodified lines
327327 return INT_MAX;
328328 }
329329
330− align_put_bits(&s->pb);
330+ avpriv_align_put_bits(&s->pb);
331331
332332 return put_bits_count(&s->pb)/8 - s->block_align;
333333 }
libavcodec/wmaprodec.c+2−2
@@ -1446,14 +1446,14 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, · 1445 unmodified lines
14461446
14471447 s->num_saved_bits += len;
14481448 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),
14501450 s->num_saved_bits);
14511451 } else {
14521452 int align = 8 - (get_bits_count(gb) & 7);
14531453 align = FFMIN(align, len);
14541454 put_bits(&s->pb, align, get_bits(gb, align));
14551455 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);
14571457 }
14581458 skip_bits_long(gb, len);
14591459
libavcodec/wmavoice.c+2−2
@@ -1872,7 +1872,7 @@ static int parse_packet_header(WMAVoiceContext *s) · 1871 unmodified lines
18721872 * @param size size of the source data, in bytes
18731873 * @param gb bit I/O context specifying the current position in the source.
18741874 * data. This function might use this to align the bit position to
1875− * a whole-byte boundary before calling #ff_copy_bits() on aligned
1875+ * a whole-byte boundary before calling #avpriv_copy_bits() on aligned
18761876 * source data
18771877 * @param nbits the amount of bits to copy from source to target
18781878 *
@@ -1893,7 +1893,7 @@ static void copy_bits(PutBitContext *pb, · 14 unmodified lines
18931893 rmn_bits &= 7; rmn_bytes >>= 3;
18941894 if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)
18951895 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,
18971897 FFMIN(nbits - rmn_bits, rmn_bytes << 3));
18981898 }
18991899
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
5050
5151 av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
5252 {
53+#if HAVE_YASM
5354 int mm_flags = av_get_cpu_flags();
5455
55−#if HAVE_YASM
5656 if (mm_flags & AV_CPU_FLAG_MMX) {
5757 c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
5858 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
169169
170170 void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
171171 {
172+#if HAVE_YASM
172173 int mm_flags = av_get_cpu_flags();
173174
174−#if HAVE_YASM
175175 if (bit_depth == 8) {
176176 if (mm_flags & AV_CPU_FLAG_MMX) {
177177 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
5252 dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
5353 dsp->idct_put = ff_prores_idct_put_10_avx;
5454 }
55−#endif
56−#endif
55+#endif /* HAVE_AVX */
56+#endif /* ARCH_X86_64 && HAVE_YASM */
5757 }
libavcodec/x86/vp8dsp-init.c+1−1
@@ -283,9 +283,9 @@ DECLARE_LOOP_FILTER(sse4) · 282 unmodified lines
283283
284284 av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
285285 {
286+#if HAVE_YASM
286287 int mm_flags = av_get_cpu_flags();
287288
288−#if HAVE_YASM
289289 if (mm_flags & AV_CPU_FLAG_MMX) {
290290 c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
291291 c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
libavcodec/xiph.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include "libavutil/intreadwrite.h"
2222 #include "xiph.h"
2323
24−int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,
24+int avpriv_split_xiph_headers(uint8_t *extradata, int extradata_size,
2525 int first_header_size, uint8_t *header_start[3],
2626 int header_len[3])
2727 {
libavcodec/xiph.h+3−3
@@ -36,8 +36,8 @@ · 35 unmodified lines
3636 * @param[out] header_len The sizes of each of the three headers.
3737 * @return On error a negative value is returned, on success zero.
3838 */
39−int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,
40− int first_header_size, uint8_t *header_start[3],
41− int header_len[3]);
39+int avpriv_split_xiph_headers(uint8_t *extradata, int extradata_size,
40+ int first_header_size, uint8_t *header_start[3],
41+ int header_len[3]);
4242
4343 #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
9090 if (color != PADDING_COLOR && (PADDING + (w&1)))
9191 put_xsub_rle(pb, PADDING + (w&1), PADDING_COLOR);
9292
93− align_put_bits(pb);
93+ avpriv_align_put_bits(pb);
9494
9595 bitmap += linesize;
9696 }
@@ -194,7 +194,7 @@ static int xsub_encode(AVCodecContext *avctx, unsigned char *buf, · 97 unmodified lines
194194 // Enforce total height to be be multiple of 2
195195 if (h->rects[0]->h & 1) {
196196 put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
197− align_put_bits(&pb);
197+ avpriv_align_put_bits(&pb);
198198 }
199199
200200 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
8686 {
8787 struct dv1394_data *dv = context->priv_data;
8888
89− dv->dv_demux = dv_init_demux(context);
89+ dv->dv_demux = avpriv_dv_init_demux(context);
9090 if (!dv->dv_demux)
9191 goto failed;
9292
@@ -124,7 +124,7 @@ static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt) · 31 unmodified lines
124124 struct dv1394_data *dv = context->priv_data;
125125 int size;
126126
127− size = dv_get_packet(dv->dv_demux, pkt);
127+ size = avpriv_dv_get_packet(dv->dv_demux, pkt);
128128 if (size > 0)
129129 return size;
130130
@@ -186,7 +186,7 @@ restart_poll: · 55 unmodified lines
186186 av_dlog(context, "index %d, avail %d, done %d\n", dv->index, dv->avail,
187187 dv->done);
188188
189− size = dv_produce_packet(dv->dv_demux, pkt,
189+ size = avpriv_dv_produce_packet(dv->dv_demux, pkt,
190190 dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
191191 DV1394_PAL_FRAME_SIZE, -1);
192192 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
9898 for (i = 0; i < s->drive->tracks; i++) {
9999 char title[16];
100100 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,
102102 s->drive->disc_toc[i+1].dwStartSector, title);
103103 }
104104
libavformat/ac3dec.c+1−1
@@ -41,7 +41,7 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) · 40 unmodified lines
4141
4242 for(frames = 0; buf2 < end; frames++) {
4343 init_get_bits(&gbc, buf2, 54);
44− if(ff_ac3_parse_header(&gbc, &hdr) < 0)
44+ if(avpriv_ac3_parse_header(&gbc, &hdr) < 0)
4545 break;
4646 if(buf2 + hdr.frame_size > end ||
4747 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
3535 int off;
3636
3737 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);
3939 if (off < 0)
4040 return off;
4141 skip_bits_long(&gb, off);
@@ -67,7 +67,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf · 25 unmodified lines
6767 init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
6868
6969 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;
7171 flush_put_bits(&pb);
7272 }
7373
libavformat/asfdec.c+1−1
@@ -569,7 +569,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) · 568 unmodified lines
569569 name_len = avio_rl32(pb); // name length
570570 if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
571571 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 );
573573 }
574574
575575 return 0;
libavformat/avidec.c+3−3
@@ -490,7 +490,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 489 unmodified lines
490490 av_freep(&s->streams[0]);
491491 s->nb_streams = 0;
492492 if (CONFIG_DV_DEMUXER) {
493− avi->dv_demux = dv_init_demux(s);
493+ avi->dv_demux = avpriv_dv_init_demux(s);
494494 if (!avi->dv_demux)
495495 goto fail;
496496 }
@@ -1012,7 +1012,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) · 515 unmodified lines
10121012 void* dstr;
10131013
10141014 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);
10161016 if (size >= 0)
10171017 return size;
10181018 }
@@ -1115,7 +1115,7 @@ resync: · 96 unmodified lines
11151115
11161116 if (CONFIG_DV_DEMUXER && avi->dv_demux) {
11171117 dstr = pkt->destruct;
1118− size = dv_produce_packet(avi->dv_demux, pkt,
1118+ size = avpriv_dv_produce_packet(avi->dv_demux, pkt,
11191119 pkt->data, pkt->size, pkt->pos);
11201120 pkt->destruct = dstr;
11211121 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
270270 * The following 3 functions constitute our interface to the world
271271 */
272272
273−DVDemuxContext* dv_init_demux(AVFormatContext *s)
273+DVDemuxContext* avpriv_dv_init_demux(AVFormatContext *s)
274274 {
275275 DVDemuxContext *c;
276276
@@ -299,7 +299,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) · 22 unmodified lines
299299 return c;
300300 }
301301
302−int dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
302+int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
303303 {
304304 int size = -1;
305305 int i;
@@ -316,14 +316,14 @@ int dv_get_packet(DVDemuxContext *c, AVPacket *pkt) · 10 unmodified lines
316316 return size;
317317 }
318318
319−int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
319+int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
320320 uint8_t* buf, int buf_size, int64_t pos)
321321 {
322322 int size, i;
323323 uint8_t *ppcm[4] = {0};
324324
325325 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)) ||
327327 buf_size < c->sys->frame_size) {
328328 return -1; /* Broken frame, or not enough data */
329329 }
@@ -371,7 +371,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, · 41 unmodified lines
371371 int64_t timestamp, int flags)
372372 {
373373 // 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);
375375 int64_t offset;
376376 int64_t size = avio_size(s->pb) - s->data_offset;
377377 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
409409 unsigned state, marker_pos = 0;
410410 RawDVContext *c = s->priv_data;
411411
412− c->dv_demux = dv_init_demux(s);
412+ c->dv_demux = avpriv_dv_init_demux(s);
413413 if (!c->dv_demux)
414414 return -1;
415415
@@ -434,7 +434,7 @@ static int dv_read_header(AVFormatContext *s, · 18 unmodified lines
434434 avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
435435 return AVERROR(EIO);
436436
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);
438438 if (!c->dv_demux->sys) {
439439 av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
440440 return -1;
@@ -452,7 +452,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 11 unmodified lines
452452 int size;
453453 RawDVContext *c = s->priv_data;
454454
455− size = dv_get_packet(c->dv_demux, pkt);
455+ size = avpriv_dv_get_packet(c->dv_demux, pkt);
456456
457457 if (size < 0) {
458458 int64_t pos = avio_tell(s->pb);
@@ -462,7 +462,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 3 unmodified lines
462462 if (avio_read(s->pb, c->buf, size) <= 0)
463463 return AVERROR(EIO);
464464
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);
466466 }
467467
468468 return size;
libavformat/dv.h+3−3
@@ -31,9 +31,9 @@ · 30 unmodified lines
3131 #include "avformat.h"
3232
3333 typedef struct DVDemuxContext DVDemuxContext;
34−DVDemuxContext* dv_init_demux(AVFormatContext* s);
35−int dv_get_packet(DVDemuxContext*, AVPacket *);
36−int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t);
34+DVDemuxContext* avpriv_dv_init_demux(AVFormatContext* s);
35+int avpriv_dv_get_packet(DVDemuxContext*, AVPacket *);
36+int avpriv_dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t);
3737 void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
3838
3939 typedef struct DVMuxContext DVMuxContext;
libavformat/dvenc.c+1−1
@@ -320,7 +320,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) · 319 unmodified lines
320320 c->ast[i]->codec->channels != 2))
321321 goto bail_out;
322322 }
323− c->sys = ff_dv_codec_profile(vst->codec);
323+ c->sys = avpriv_dv_codec_profile(vst->codec);
324324 if (!c->sys)
325325 goto bail_out;
326326
libavformat/ffmetadec.c+1−1
@@ -75,7 +75,7 @@ static AVChapter *read_chapter(AVFormatContext *s) · 74 unmodified lines
7575 end = AV_NOPTS_VALUE;
7676 }
7777
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);
7979 }
8080
8181 static 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
4848 /* process metadata blocks */
4949 while (!url_feof(s->pb) && !metadata_last) {
5050 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,
5252 &metadata_size);
5353 switch (metadata_type) {
5454 /* allocate and read metadata block for supported types */
@@ -87,7 +87,7 @@ static int flac_read_header(AVFormatContext *s, · 32 unmodified lines
8787 buffer = NULL;
8888
8989 /* 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);
9191
9292 /* set time base and duration */
9393 if (si.samplerate > 0) {
libavformat/flacenc.c+1−1
@@ -94,7 +94,7 @@ static int flac_write_trailer(struct AVFormatContext *s) · 93 unmodified lines
9494 enum FLACExtradataFormat format;
9595 int64_t file_size;
9696
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))
9898 return -1;
9999
100100 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
3434 enum FLACExtradataFormat format;
3535
3636 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))
3838 return -1;
3939
4040 /* 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
542542 return ret;
543543 if (st->codec->codec_id == CODEC_ID_AAC) {
544544 MPEG4AudioConfig cfg;
545− ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
545+ avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
546546 st->codec->extradata_size);
547547 st->codec->channels = cfg.channels;
548548 if (cfg.ext_sample_rate)
libavformat/flvenc.c+15−13
@@ -61,7 +61,7 @@ typedef struct FLVContext { · 60 unmodified lines
6161 int64_t filesize_offset;
6262 int64_t duration;
6363 int delay; ///< first dts delay for AVC
64− int64_t last_video_ts;
64+ int64_t last_ts;
6565 } FLVContext;
6666
6767 static int get_audio_flags(AVCodecContext *enc){
@@ -78,11 +78,6 @@ static int get_audio_flags(AVCodecContext *enc){ · 10 unmodified lines
7878 av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
7979 return -1;
8080 }
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− }
8681 return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
8782 } else {
8883 switch (enc->sample_rate) {
@@ -223,7 +218,7 @@ static int flv_write_header(AVFormatContext *s) · 134 unmodified lines
223218 }
224219 }
225220
226− flv->last_video_ts = -1;
221+ flv->last_ts = -1;
227222
228223 /* write meta_tag */
229224 avio_w8(pb, 18); // tag type META
@@ -368,7 +363,7 @@ static int flv_write_trailer(AVFormatContext *s) · 138 unmodified lines
368363 AVCodecContext *enc = s->streams[i]->codec;
369364 if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&
370365 (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);
372367 }
373368 }
374369
@@ -434,19 +429,26 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 59 unmodified lines
434429 if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
435430 return -1;
436431 }
437− if (!flv->delay && pkt->dts < 0)
438− flv->delay = -pkt->dts;
439432 } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
440433 (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
441434 av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
442435 return -1;
443436 }
437+ if (!flv->delay && pkt->dts < 0)
438+ flv->delay = -pkt->dts;
444439
445440 ts = pkt->dts + flv->delay; // add delay to force positive dts
446− if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
447− if (flv->last_video_ts < ts)
448− flv->last_video_ts = ts;
441+
442+ /* check Speex packet duration */
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");
449447 }
448+
449+ if (flv->last_ts < ts)
450+ flv->last_ts = ts;
451+
450452 avio_wb24(pb,size + flags_size);
451453 avio_wb24(pb,ts);
452454 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
185185 * @return fps as AVRational, or 0 / 0 if unknown
186186 */
187187 static AVRational fps_tag2avr(int32_t fps) {
188− extern const AVRational ff_frame_rate_tab[];
188+ extern const AVRational avpriv_frame_rate_tab[];
189189 if (fps < 1 || fps > 9) fps = 9;
190− return ff_frame_rate_tab[9 - fps]; // values have opposite order
190+ return avpriv_frame_rate_tab[9 - fps]; // values have opposite order
191191 }
192192
193193 /**
libavformat/internal.h+2−2
@@ -223,8 +223,8 @@ int ff_add_index_entry(AVIndexEntry **index_entries, · 222 unmodified lines
223223 *
224224 * @return AVChapter or NULL on error
225225 */
226−AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
227− int64_t start, int64_t end, const char *title);
226+AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
227+ int64_t start, int64_t end, const char *title);
228228
229229 /**
230230 * 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
433433 st->codec->extradata_size = len;
434434 if (st->codec->codec_id == CODEC_ID_AAC) {
435435 MPEG4AudioConfig cfg;
436− ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
436+ avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
437437 st->codec->extradata_size);
438438 st->codec->channels = cfg.channels;
439439 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];
441441 else if (cfg.ext_sample_rate)
442442 st->codec->sample_rate = cfg.ext_sample_rate;
443443 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
5555 MPEG4AudioConfig m4ac;
5656
5757 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);
5959 if (ctx->off < 0)
6060 return ctx->off;
6161 skip_bits_long(&gb, ctx->off);
@@ -110,12 +110,12 @@ static int latm_write_frame_header(AVFormatContext *s, PutBitContext *bs) · 48 unmodified lines
110110 /* AudioSpecificConfig */
111111 if (ctx->object_type == AOT_ALS) {
112112 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);
114114 } else {
115− ff_copy_bits(bs, avctx->extradata, ctx->off + 3);
115+ avpriv_copy_bits(bs, avctx->extradata, ctx->off + 3);
116116
117117 if (!ctx->channel_conf) {
118− ff_copy_pce_data(bs, &gb);
118+ avpriv_copy_pce_data(bs, &gb);
119119 }
120120 }
121121
@@ -168,7 +168,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) · 46 unmodified lines
168168 for (i = 0; i < pkt->size; i++)
169169 put_bits(&bs, 8, pkt->data[i]);
170170
171− align_put_bits(&bs);
171+ avpriv_align_put_bits(&bs);
172172 flush_put_bits(&bs);
173173
174174 len = put_bits_count(&bs) >> 3;
libavformat/libavformat.v+21−5
@@ -1,7 +1,23 @@
11 LIBAVFORMAT_$MAJOR {
2− global: *;
3− local:
4− ff_*_demuxer;
5− ff_*_muxer;
6− ff_*_protocol;
2+ global: av*;
3+ #FIXME those are for avserver
4+ ff_inet_aton;
5+ ff_socket_nonblock;
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: *;
723 };
libavformat/matroskadec.c+3−3
@@ -1303,8 +1303,8 @@ static int matroska_aac_sri(int samplerate) · 1302 unmodified lines
13031303 {
13041304 int sri;
13051305
1306− for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++)
1307− if (ff_mpeg4audio_sample_rates[sri] == samplerate)
1306+ for (sri=0; sri<FF_ARRAY_ELEMS(avpriv_mpeg4audio_sample_rates); sri++)
1307+ if (avpriv_mpeg4audio_sample_rates[sri] == samplerate)
13081308 break;
13091309 return sri;
13101310 }
@@ -1668,7 +1668,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 357 unmodified lines
16681668 if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
16691669 && (max_start==0 || chapters[i].start > max_start)) {
16701670 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},
16721672 chapters[i].start, chapters[i].end,
16731673 chapters[i].title);
16741674 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
423423 else
424424 first_header_size = 42;
425425
426− if (ff_split_xiph_headers(codec->extradata, codec->extradata_size,
426+ if (avpriv_split_xiph_headers(codec->extradata, codec->extradata_size,
427427 first_header_size, header_start, header_len) < 0) {
428428 av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n");
429429 return -1;
@@ -443,7 +443,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int · 13 unmodified lines
443443 {
444444 MPEG4AudioConfig mp4ac;
445445
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) {
447447 av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");
448448 return;
449449 }
libavformat/mov.c+5−5
@@ -289,7 +289,7 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 288 unmodified lines
289289
290290 avio_read(pb, str, str_len);
291291 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);
293293 }
294294 return 0;
295295 }
@@ -1291,7 +1291,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 995 unmodified lines
12911291 #if CONFIG_DV_DEMUXER
12921292 case CODEC_ID_DVAUDIO:
12931293 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);
12951295 if (!c->dv_demux) {
12961296 av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");
12971297 return -1;
@@ -2484,7 +2484,7 @@ static void mov_read_chapters(AVFormatContext *s) · 1186 unmodified lines
24842484 }
24852485 }
24862486
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);
24882488 av_freep(&title);
24892489 }
24902490 finish:
@@ -2592,10 +2592,10 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) · 101 unmodified lines
25922592 }
25932593 #if CONFIG_DV_DEMUXER
25942594 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);
25962596 av_free(pkt->data);
25972597 pkt->size = 0;
2598− ret = dv_get_packet(mov->dv_demux, pkt);
2598+ ret = avpriv_dv_get_packet(mov->dv_demux, pkt);
25992599 if (ret < 0)
26002600 return ret;
26012601 }
libavformat/mp3dec.c+2−2
@@ -51,7 +51,7 @@ static int mp3_read_probe(AVProbeData *p) · 50 unmodified lines
5151
5252 for(frames = 0; buf2 < end; frames++) {
5353 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);
5555 if(fsize < 0)
5656 break;
5757 buf2 += fsize;
@@ -86,7 +86,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 28 unmodified lines
8686 if(ff_mpa_check_header(v) < 0)
8787 return -1;
8888
89− if (ff_mpegaudio_decode_header(&c, v) == 0)
89+ if (avpriv_mpegaudio_decode_header(&c, v) == 0)
9090 vbrtag_size = c.frame_size;
9191 if(c.layer != 3)
9292 return -1;
libavformat/mp3enc.c+4−4
@@ -235,12 +235,12 @@ static int mp3_write_xing(AVFormatContext *s) · 234 unmodified lines
235235 int srate_idx, i, channels;
236236 int needed;
237237
238− for (i = 0; i < FF_ARRAY_ELEMS(ff_mpa_freq_tab); i++)
239− if (ff_mpa_freq_tab[i] == codec->sample_rate) {
238+ for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++)
239+ if (avpriv_mpa_freq_tab[i] == codec->sample_rate) {
240240 srate_idx = i;
241241 break;
242242 }
243− if (i == FF_ARRAY_ELEMS(ff_mpa_freq_tab)) {
243+ if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
244244 av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n");
245245 return -1;
246246 }
@@ -263,7 +263,7 @@ static int mp3_write_xing(AVFormatContext *s) · 16 unmodified lines
263263
264264 mask = (bitrate_idx << 4) << 8;
265265 header |= mask;
266− ff_mpegaudio_decode_header(&c, header);
266+ avpriv_mpegaudio_decode_header(&c, header);
267267 xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];
268268 needed = 4 // header
269269 + xing_offset
libavformat/mpegtsenc.c+1−1
@@ -979,7 +979,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) · 978 unmodified lines
979979 }
980980
981981 do {
982− p = ff_find_start_code(p, buf_end, &state);
982+ p = avpriv_mpv_find_start_code(p, buf_end, &state);
983983 //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);
984984 } while (p < buf_end && (state & 0x1f) != 9 &&
985985 (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
416416
417417 if(chapter_id && !stream_id_plus1){
418418 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,
420420 nut->time_base[chapter_start % nut->time_base_count],
421421 start, start + chapter_len, NULL);
422422 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
5959 else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;
6060 else sample_rate_index=1;
6161
62− sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
62+ sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
6363
6464 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];
6666 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
6767
6868 if(frame_size == size)
libavformat/oggenc.c+2−2
@@ -274,7 +274,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, · 273 unmodified lines
274274 uint8_t *streaminfo;
275275 uint8_t *p;
276276
277− if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
277+ if (!avpriv_flac_is_extradata_valid(avctx, &format, &streaminfo))
278278 return -1;
279279
280280 // first packet: STREAMINFO
@@ -397,7 +397,7 @@ static int ogg_write_header(AVFormatContext *s) · 116 unmodified lines
397397 int header_type = st->codec->codec_id == CODEC_ID_VORBIS ? 3 : 0x81;
398398 int framing_bit = st->codec->codec_id == CODEC_ID_VORBIS ? 1 : 0;
399399
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,
401401 st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,
402402 oggstream->header, oggstream->header_len) < 0) {
403403 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
3636 return 0;
3737
3838 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)
4040 return -1;
4141
4242 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
5555 if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)
5656 return -1;
5757
58− ff_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
58+ avpriv_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
5959
6060 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
6161 st->codec->codec_id = CODEC_ID_FLAC;
libavformat/oggparsespeex.c+9−11
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include "oggdec.h"
3232
3333 struct speex_params {
34+ int packet_size;
3435 int final_packet_duration;
3536 int seq;
3637 };
@@ -58,14 +59,10 @@ static int speex_header(AVFormatContext *s, int idx) { · 21 unmodified lines
5859 st->codec->sample_rate = AV_RL32(p + 36);
5960 st->codec->channels = AV_RL32(p + 48);
6061
61− /* We treat the whole Speex packet as a single frame everywhere Speex
62− is handled in FFmpeg. This avoids the complexities of splitting
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);
62+ spxp->packet_size = AV_RL32(p + 56);
63+ frames_per_packet = AV_RL32(p + 64);
6764 if (frames_per_packet)
68− st->codec->frame_size *= frames_per_packet;
65+ spxp->packet_size *= frames_per_packet;
6966
7067 st->codec->extradata_size = os->psize;
7168 st->codec->extradata = av_malloc(st->codec->extradata_size
@@ -95,7 +92,7 @@ static int speex_packet(AVFormatContext *s, int idx) · 23 unmodified lines
9592 struct ogg *ogg = s->priv_data;
9693 struct ogg_stream *os = ogg->streams + idx;
9794 struct speex_params *spxp = os->private;
98− int packet_size = s->streams[idx]->codec->frame_size;
95+ int packet_size = spxp->packet_size;
9996
10097 if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&
10198 os->granule > 0) {
@@ -108,9 +105,10 @@ static int speex_packet(AVFormatContext *s, int idx) · 6 unmodified lines
108105
109106 if (!os->lastpts && os->granule > 0)
110107 /* first packet */
111− os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1);
112− else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
113− spxp->final_packet_duration)
108+ os->lastpts = os->lastdts = os->granule - packet_size *
109+ ogg_page_packets(os);
110+ if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
111+ spxp->final_packet_duration)
114112 /* final packet */
115113 os->pduration = spxp->final_packet_duration;
116114 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
4545 if (sscanf(val, "%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
4646 return 0;
4747
48− ff_new_chapter(as, cnum, (AVRational){1,1000},
48+ avpriv_new_chapter(as, cnum, (AVRational){1,1000},
4949 ms + 1000*(s + 60*(m + 60*h)),
5050 AV_NOPTS_VALUE, NULL);
5151 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
5656 r1 = buf1;
5757 while (1) {
5858 start_code = -1;
59− r = ff_find_start_code(r1, end, &start_code);
59+ r = avpriv_mpv_find_start_code(r1, end, &start_code);
6060 if((start_code & 0xFFFFFF00) == 0x100) {
6161 /* New start code found */
6262 if (start_code == 0x100) {
libavformat/sdp.c+2−2
@@ -252,7 +252,7 @@ static char *xiph_extradata2config(AVCodecContext *c) · 251 unmodified lines
252252 return NULL;
253253 }
254254
255− if (ff_split_xiph_headers(c->extradata, c->extradata_size,
255+ if (avpriv_split_xiph_headers(c->extradata, c->extradata_size,
256256 first_header_size, header_start,
257257 header_len) < 0) {
258258 av_log(c, AV_LOG_ERROR, "Extradata corrupt.\n");
@@ -342,7 +342,7 @@ static char *latm_context2config(AVCodecContext *c) · 83 unmodified lines
342342 char *config;
343343
344344 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)
346346 break;
347347 if (rate_index == 16) {
348348 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
5757 break;
5858 case IEC61937_MPEG2_AAC:
5959 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)) {
6161 if (s) /* be silent during a probe */
6262 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");
6363 return AVERROR_INVALIDDATA;
libavformat/spdifenc.c+1−1
@@ -349,7 +349,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt) · 348 unmodified lines
349349 int ret;
350350
351351 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);
353353 if (ret < 0) {
354354 av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
355355 return AVERROR_INVALIDDATA;
libavformat/utils.c+3−4
@@ -2143,7 +2143,6 @@ static int has_codec_parameters(AVCodecContext *avctx) · 2142 unmodified lines
21432143 avctx->codec_id == CODEC_ID_MP1 ||
21442144 avctx->codec_id == CODEC_ID_MP2 ||
21452145 avctx->codec_id == CODEC_ID_MP3 ||
2146− avctx->codec_id == CODEC_ID_SPEEX ||
21472146 avctx->codec_id == CODEC_ID_CELT))
21482147 return 0;
21492148 break;
@@ -2224,7 +2223,7 @@ enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) · 74 unmodified lines
22242223 return tags[i].id;
22252224 }
22262225 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))
22282227 return tags[i].id;
22292228 }
22302229 return CODEC_ID_NONE;
@@ -2845,7 +2844,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) · 614 unmodified lines
28452844 return program;
28462845 }
28472846
2848−AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
2847+AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
28492848 {
28502849 AVChapter *chapter = NULL;
28512850 int i;
@@ -2969,7 +2968,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st) · 117 unmodified lines
29692968 for (n = 0; s->oformat->codec_tag[n]; n++) {
29702969 avctag = s->oformat->codec_tag[n];
29712970 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)) {
29732972 id = avctag->id;
29742973 if (id == st->codec->codec_id)
29752974 return 1;
tests/ref/fate/lossless-shortenaudio+1−1
@@ -1 +1 @@
1−9949141c405524f37ef1058b1ef4114b
1+da93c50961443b88fce416ae61c8ca8a

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