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