aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-01 02:44:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-01 02:54:24 +0100
commit9d76cf0b18976487d71e39bbdc1b53755e366535 (patch)
treed71801d63301c89e4c860eb2dee38b47348cd5b7
parent0275b75a7e705ef5a6bd6610f1450671f78000b6 (diff)
parentc8f0e88b205208da0e74f9345d4c4eb6d725774b (diff)
downloadffmpeg-9d76cf0b18976487d71e39bbdc1b53755e366535.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: rtpdec: Templatize the code for different g726 bitrate variants rv40: move loop filter to rv34dsp context lavf: make av_set_pts_info private. rtpdec: Add support for G726 audio rtpdec: Add an init function that can do custom codec context initialization avconv: make copy_tb on by default. matroskadec: don't set codec timebase. rmdec: don't set codec timebase. avconv: compute next_pts from input packet duration when possible. lavf: estimate frame duration from r_frame_rate. avconv: update InputStream.pts in the streamcopy case. Conflicts: avconv.c libavdevice/alsa-audio-dec.c libavdevice/bktr.c libavdevice/fbdev.c libavdevice/libdc1394.c libavdevice/oss_audio.c libavdevice/v4l.c libavdevice/v4l2.c libavdevice/vfwcap.c libavdevice/x11grab.c libavformat/au.c libavformat/eacdata.c libavformat/flvdec.c libavformat/mpegts.c libavformat/mxfenc.c libavformat/rtpdec_g726.c libavformat/wtv.c libavformat/xmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--avconv.c35
-rw-r--r--ffmpeg.c9
-rw-r--r--libavcodec/rv34dsp.h7
-rw-r--r--libavcodec/rv40.c158
-rw-r--r--libavcodec/rv40data.h14
-rw-r--r--libavcodec/rv40dsp.c161
-rw-r--r--libavdevice/alsa-audio-dec.c3
-rw-r--r--libavdevice/bktr.c3
-rw-r--r--libavdevice/fbdev.c3
-rw-r--r--libavdevice/jack_audio.c3
-rw-r--r--libavdevice/libcdio.c2
-rw-r--r--libavdevice/libdc1394.c3
-rw-r--r--libavdevice/oss_audio.c3
-rw-r--r--libavdevice/pulse.c3
-rw-r--r--libavdevice/sndio_dec.c3
-rw-r--r--libavdevice/v4l.c3
-rw-r--r--libavdevice/v4l2.c3
-rw-r--r--libavdevice/vfwcap.c3
-rw-r--r--libavdevice/x11grab.c3
-rw-r--r--libavformat/4xm.c5
-rw-r--r--libavformat/aacdec.c3
-rw-r--r--libavformat/adxdec.c3
-rw-r--r--libavformat/aiffdec.c3
-rw-r--r--libavformat/aiffenc.c3
-rw-r--r--libavformat/amr.c3
-rw-r--r--libavformat/anm.c3
-rw-r--r--libavformat/ape.c3
-rw-r--r--libavformat/asfdec.c3
-rw-r--r--libavformat/asfenc.c3
-rw-r--r--libavformat/assdec.c2
-rw-r--r--libavformat/au.c3
-rw-r--r--libavformat/avformat.h12
-rw-r--r--libavformat/avidec.c5
-rw-r--r--libavformat/avienc.c3
-rw-r--r--libavformat/avisynth.c3
-rw-r--r--libavformat/bethsoftvid.c3
-rw-r--r--libavformat/bfi.c5
-rw-r--r--libavformat/bink.c5
-rw-r--r--libavformat/bmv.c5
-rw-r--r--libavformat/c93.c3
-rw-r--r--libavformat/cafdec.c3
-rw-r--r--libavformat/cdg.c3
-rw-r--r--libavformat/dfa.c3
-rw-r--r--libavformat/dsicin.c5
-rw-r--r--libavformat/dv.c5
-rw-r--r--libavformat/dxa.c3
-rw-r--r--libavformat/eacdata.c3
-rw-r--r--libavformat/electronicarts.c3
-rw-r--r--libavformat/ffmdec.c3
-rw-r--r--libavformat/ffmenc.c3
-rw-r--r--libavformat/filmstripdec.c3
-rw-r--r--libavformat/flacdec.c3
-rw-r--r--libavformat/flic.c11
-rw-r--r--libavformat/flvdec.c3
-rw-r--r--libavformat/flvenc.c2
-rw-r--r--libavformat/gsmdec.c3
-rw-r--r--libavformat/gxf.c2
-rw-r--r--libavformat/gxfenc.c5
-rw-r--r--libavformat/idcin.c5
-rw-r--r--libavformat/idroqdec.c5
-rw-r--r--libavformat/iff.c3
-rw-r--r--libavformat/img2.c2
-rw-r--r--libavformat/internal.h13
-rw-r--r--libavformat/ipmovie.c5
-rw-r--r--libavformat/iss.c3
-rw-r--r--libavformat/iv8.c3
-rw-r--r--libavformat/ivfdec.c3
-rw-r--r--libavformat/jvdec.c5
-rw-r--r--libavformat/libnut.c5
-rw-r--r--libavformat/lmlm4.c3
-rw-r--r--libavformat/lxfdec.c7
-rw-r--r--libavformat/matroskadec.c6
-rw-r--r--libavformat/matroskaenc.c3
-rw-r--r--libavformat/mm.c5
-rw-r--r--libavformat/mmf.c5
-rw-r--r--libavformat/mov.c3
-rw-r--r--libavformat/movenc.c2
-rw-r--r--libavformat/mp3dec.c3
-rw-r--r--libavformat/mpc.c3
-rw-r--r--libavformat/mpc8.c3
-rw-r--r--libavformat/mpegenc.c3
-rw-r--r--libavformat/mpegts.c8
-rw-r--r--libavformat/mpegtsenc.c2
-rw-r--r--libavformat/msnwc_tcp.c3
-rw-r--r--libavformat/mtv.c5
-rw-r--r--libavformat/mvi.c5
-rw-r--r--libavformat/mxfdec.c2
-rw-r--r--libavformat/mxfenc.c4
-rw-r--r--libavformat/mxg.c5
-rw-r--r--libavformat/ncdec.c3
-rw-r--r--libavformat/nsvdec.c5
-rw-r--r--libavformat/nutdec.c2
-rw-r--r--libavformat/nutenc.c2
-rw-r--r--libavformat/nuv.c5
-rw-r--r--libavformat/oggdec.c2
-rw-r--r--libavformat/oggenc.c4
-rw-r--r--libavformat/oggparsecelt.c3
-rw-r--r--libavformat/oggparsedirac.c5
-rw-r--r--libavformat/oggparseflac.c3
-rw-r--r--libavformat/oggparseogm.c5
-rw-r--r--libavformat/oggparseskeleton.c3
-rw-r--r--libavformat/oggparsespeex.c3
-rw-r--r--libavformat/oggparsetheora.c3
-rw-r--r--libavformat/oggparsevorbis.c2
-rw-r--r--libavformat/oma.c5
-rw-r--r--libavformat/psxstr.c5
-rw-r--r--libavformat/pva.c5
-rw-r--r--libavformat/r3d.c5
-rw-r--r--libavformat/rawdec.c7
-rw-r--r--libavformat/rl2.c5
-rw-r--r--libavformat/rmdec.c8
-rw-r--r--libavformat/rpl.c5
-rw-r--r--libavformat/rsodec.c2
-rw-r--r--libavformat/rtpdec.h1
-rw-r--r--libavformat/rtpdec_asf.c3
-rw-r--r--libavformat/rtpdec_g726.c92
-rw-r--r--libavformat/rtpdec_qt.c3
-rw-r--r--libavformat/rtpenc.c6
-rw-r--r--libavformat/rtsp.c12
-rw-r--r--libavformat/segafilm.c3
-rw-r--r--libavformat/sierravmd.c7
-rw-r--r--libavformat/siff.c5
-rw-r--r--libavformat/smacker.c5
-rw-r--r--libavformat/sol.c3
-rw-r--r--libavformat/soxdec.c3
-rw-r--r--libavformat/srtdec.c2
-rw-r--r--libavformat/swfdec.c6
-rw-r--r--libavformat/thp.c5
-rw-r--r--libavformat/tiertexseq.c5
-rw-r--r--libavformat/tmv.c5
-rw-r--r--libavformat/tta.c3
-rw-r--r--libavformat/tty.c3
-rw-r--r--libavformat/utils.c15
-rw-r--r--libavformat/vc1test.c5
-rw-r--r--libavformat/vc1testenc.c3
-rw-r--r--libavformat/version.h3
-rw-r--r--libavformat/vqf.c3
-rw-r--r--libavformat/wav.c7
-rw-r--r--libavformat/wc3movie.c5
-rw-r--r--libavformat/westwood.c7
-rw-r--r--libavformat/wv.c3
-rw-r--r--libavformat/xa.c3
-rw-r--r--libavformat/xmv.c5
-rw-r--r--libavformat/xwma.c3
-rw-r--r--libavformat/yop.c3
-rw-r--r--libavformat/yuv4mpeg.c3
146 files changed, 570 insertions, 468 deletions
diff --git a/avconv.c b/avconv.c
index adf12f7951..9c94134943 100644
--- a/avconv.c
+++ b/avconv.c
@@ -129,7 +129,7 @@ static int video_sync_method= -1;
static int audio_sync_method= 0;
static float audio_drift_threshold= 0.1;
static int copy_ts= 0;
-static int copy_tb= 0;
+static int copy_tb = 1;
static int opt_shortest = 0;
static char *vstats_filename;
static FILE *vstats_file;
@@ -1823,7 +1823,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
return ret;
}
ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp;
- if (ist->st->codec->time_base.num != 0) {
+ if (pkt->duration)
+ ist->next_pts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
+ else if (ist->st->codec->time_base.num != 0) {
int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 :
ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
@@ -1986,6 +1988,7 @@ static int output_packet(InputStream *ist,
/* handle stream copy */
if (!ist->decoding_needed) {
rate_emu_sleep(ist);
+ ist->pts = ist->next_pts;
switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
@@ -2132,25 +2135,15 @@ static int transcode_init(OutputFile *output_files,
return AVERROR(ENOMEM);
}
memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
- codec->extradata_size= icodec->extradata_size;
-
- codec->time_base = ist->st->time_base;
- if(!strcmp(oc->oformat->name, "avi")) {
- if (!copy_tb &&
- av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) &&
- av_q2d(ist->st->time_base) < 1.0/500){
- codec->time_base = icodec->time_base;
- codec->time_base.num *= icodec->ticks_per_frame;
- codec->time_base.den *= 2;
- }
- } else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS)) {
- if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
- codec->time_base = icodec->time_base;
- codec->time_base.num *= icodec->ticks_per_frame;
- }
- }
- av_reduce(&codec->time_base.num, &codec->time_base.den,
- codec->time_base.num, codec->time_base.den, INT_MAX);
+
+ codec->extradata_size = icodec->extradata_size;
+ if (!copy_tb) {
+ codec->time_base = icodec->time_base;
+ codec->time_base.num *= icodec->ticks_per_frame;
+ av_reduce(&codec->time_base.num, &codec->time_base.den,
+ codec->time_base.num, codec->time_base.den, INT_MAX);
+ } else
+ codec->time_base = ist->st->time_base;
switch(codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
diff --git a/ffmpeg.c b/ffmpeg.c
index f69d53fe1e..b33506a09a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1841,7 +1841,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
pkt->dts = *pkt_dts;
*pkt_pts = AV_NOPTS_VALUE;
- if(*pkt_dts != AV_NOPTS_VALUE && ist->st->codec->time_base.num != 0) {
+ if (*pkt_dts != AV_NOPTS_VALUE && pkt->duration) {
+ *pkt_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
+ } else if(*pkt_dts != AV_NOPTS_VALUE && ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
*pkt_dts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
@@ -1864,7 +1866,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
if(decoded_frame->best_effort_timestamp != AV_NOPTS_VALUE)
ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp;
- if (ist->st->codec->time_base.num != 0) {
+ if (pkt->duration)
+ ist->next_pts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
+ else if (ist->st->codec->time_base.num != 0) {
int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 :
ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
@@ -2042,6 +2046,7 @@ static int output_packet(InputStream *ist,
/* handle stream copy */
if (!ist->decoding_needed) {
rate_emu_sleep(ist);
+ ist->pts = ist->next_pts;
switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
diff --git a/libavcodec/rv34dsp.h b/libavcodec/rv34dsp.h
index a2ab5f232b..4ade05060f 100644
--- a/libavcodec/rv34dsp.h
+++ b/libavcodec/rv34dsp.h
@@ -36,6 +36,11 @@ typedef void (*rv40_weight_func)(uint8_t *dst/*align width (8 or 16)*/,
typedef void (*rv34_inv_transform_func)(DCTELEM *block);
+typedef void (*rv40_loop_filter_func)(uint8_t *src, int stride, int dmode,
+ int lim_q1, int lim_p1, int alpha,
+ int beta, int beta2, int chroma,
+ int edge);
+
typedef struct RV34DSPContext {
qpel_mc_func put_pixels_tab[4][16];
qpel_mc_func avg_pixels_tab[4][16];
@@ -43,6 +48,8 @@ typedef struct RV34DSPContext {
h264_chroma_mc_func avg_chroma_pixels_tab[3];
rv40_weight_func rv40_weight_pixels_tab[2];
rv34_inv_transform_func rv34_inv_transform_tab[2];
+ rv40_loop_filter_func rv40_h_loop_filter;
+ rv40_loop_filter_func rv40_v_loop_filter;
} RV34DSPContext;
void ff_rv30dsp_init(RV34DSPContext *c, DSPContext* dsp);
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index 0222983087..8dd78f1fb8 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -274,148 +274,6 @@ static int rv40_decode_mb_info(RV34DecContext *r)
return 0;
}
-#define CLIP_SYMM(a, b) av_clip(a, -(b), b)
-/**
- * weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1
- */
-static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
- const int filter_p1, const int filter_q1,
- const int alpha, const int beta,
- const int lim_p0q0,
- const int lim_q1, const int lim_p1,
- const int diff_p1p0, const int diff_q1q0,
- const int diff_p1p2, const int diff_q1q2)
-{
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- int t, u, diff;
-
- t = src[0*step] - src[-1*step];
- if(!t)
- return;
- u = (alpha * FFABS(t)) >> 7;
- if(u > 3 - (filter_p1 && filter_q1))
- return;
-
- t <<= 2;
- if(filter_p1 && filter_q1)
- t += src[-2*step] - src[1*step];
- diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0);
- src[-1*step] = cm[src[-1*step] + diff];
- src[ 0*step] = cm[src[ 0*step] - diff];
- if(FFABS(diff_p1p2) <= beta && filter_p1){
- t = (diff_p1p0 + diff_p1p2 - diff) >> 1;
- src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)];
- }
- if(FFABS(diff_q1q2) <= beta && filter_q1){
- t = (diff_q1q0 + diff_q1q2 + diff) >> 1;
- src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)];
- }
-}
-
-static av_always_inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
- const int stride, const int dmode,
- const int lim_q1, const int lim_p1,
- const int alpha,
- const int beta, const int beta2,
- const int chroma, const int edge)
-{
- int diff_p1p0[4], diff_q1q0[4], diff_p1p2[4], diff_q1q2[4];
- int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;
- uint8_t *ptr;
- int flag_strong0 = 1, flag_strong1 = 1;
- int filter_p1, filter_q1;
- int i;
- int lims;
-
- for(i = 0, ptr = src; i < 4; i++, ptr += stride){
- diff_p1p0[i] = ptr[-2*step] - ptr[-1*step];
- diff_q1q0[i] = ptr[ 1*step] - ptr[ 0*step];
- sum_p1p0 += diff_p1p0[i];
- sum_q1q0 += diff_q1q0[i];
- }
- filter_p1 = FFABS(sum_p1p0) < (beta<<2);
- filter_q1 = FFABS(sum_q1q0) < (beta<<2);
- if(!filter_p1 && !filter_q1)
- return;
-
- for(i = 0, ptr = src; i < 4; i++, ptr += stride){
- diff_p1p2[i] = ptr[-2*step] - ptr[-3*step];
- diff_q1q2[i] = ptr[ 1*step] - ptr[ 2*step];
- sum_p1p2 += diff_p1p2[i];
- sum_q1q2 += diff_q1q2[i];
- }
-
- if(edge){
- flag_strong0 = filter_p1 && (FFABS(sum_p1p2) < beta2);
- flag_strong1 = filter_q1 && (FFABS(sum_q1q2) < beta2);
- }else{
- flag_strong0 = flag_strong1 = 0;
- }
-
- lims = filter_p1 + filter_q1 + ((lim_q1 + lim_p1) >> 1) + 1;
- if(flag_strong0 && flag_strong1){ /* strong filtering */
- for(i = 0; i < 4; i++, src += stride){
- int sflag, p0, q0, p1, q1;
- int t = src[0*step] - src[-1*step];
-
- if(!t) continue;
- sflag = (alpha * FFABS(t)) >> 7;
- if(sflag > 1) continue;
-
- p0 = (25*src[-3*step] + 26*src[-2*step]
- + 26*src[-1*step]
- + 26*src[ 0*step] + 25*src[ 1*step] + rv40_dither_l[dmode + i]) >> 7;
- q0 = (25*src[-2*step] + 26*src[-1*step]
- + 26*src[ 0*step]
- + 26*src[ 1*step] + 25*src[ 2*step] + rv40_dither_r[dmode + i]) >> 7;
- if(sflag){
- p0 = av_clip(p0, src[-1*step] - lims, src[-1*step] + lims);
- q0 = av_clip(q0, src[ 0*step] - lims, src[ 0*step] + lims);
- }
- p1 = (25*src[-4*step] + 26*src[-3*step]
- + 26*src[-2*step]
- + 26*p0 + 25*src[ 0*step] + rv40_dither_l[dmode + i]) >> 7;
- q1 = (25*src[-1*step] + 26*q0
- + 26*src[ 1*step]
- + 26*src[ 2*step] + 25*src[ 3*step] + rv40_dither_r[dmode + i]) >> 7;
- if(sflag){
- p1 = av_clip(p1, src[-2*step] - lims, src[-2*step] + lims);
- q1 = av_clip(q1, src[ 1*step] - lims, src[ 1*step] + lims);
- }
- src[-2*step] = p1;
- src[-1*step] = p0;
- src[ 0*step] = q0;
- src[ 1*step] = q1;
- if(!chroma){
- src[-3*step] = (25*src[-1*step] + 26*src[-2*step] + 51*src[-3*step] + 26*src[-4*step] + 64) >> 7;
- src[ 2*step] = (25*src[ 0*step] + 26*src[ 1*step] + 51*src[ 2*step] + 26*src[ 3*step] + 64) >> 7;
- }
- }
- }else if(filter_p1 && filter_q1){
- for(i = 0; i < 4; i++, src += stride)
- rv40_weak_loop_filter(src, step, 1, 1, alpha, beta, lims, lim_q1, lim_p1,
- diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
- }else{
- for(i = 0; i < 4; i++, src += stride)
- rv40_weak_loop_filter(src, step, filter_p1, filter_q1,
- alpha, beta, lims>>1, lim_q1>>1, lim_p1>>1,
- diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
- }
-}
-
-static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode,
- int lim_q1, int lim_p1,
- int alpha, int beta, int beta2, int chroma, int edge){
- rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1,
- alpha, beta, beta2, chroma, edge);
-}
-static void rv40_h_loop_filter(uint8_t *src, int stride, int dmode,
- int lim_q1, int lim_p1,
- int alpha, int beta, int beta2, int chroma, int edge){
- rv40_adaptive_loop_filter(src, stride, 1, dmode, lim_q1, lim_p1,
- alpha, beta, beta2, chroma, edge);
-}
-
enum RV40BlockPos{
POS_CUR,
POS_TOP,
@@ -575,7 +433,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
// if bottom block is coded then we can filter its top edge
// (or bottom edge of this block, which is the same)
if(y_h_deblock & (MASK_BOTTOM << ij)){
- rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
+ r->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0,
clip_cur,
alpha, beta, betaY, 0, 0);
@@ -586,14 +444,14 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
else
clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
- rv40_v_loop_filter(Y, s->linesize, dither,
+ r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 0);
}
// filter top edge of the current macroblock when filtering strength is high
if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
- rv40_h_loop_filter(Y, s->linesize, dither,
+ r->rdsp.rv40_h_loop_filter(Y, s->linesize, dither,
clip_cur,
mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
alpha, beta, betaY, 0, 1);
@@ -601,7 +459,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
// filter left block edge in edge mode (with high filtering strength)
if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
- rv40_v_loop_filter(Y, s->linesize, dither,
+ r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 1);
@@ -616,7 +474,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
if(c_h_deblock[k] & (MASK_CUR << (ij+2))){
int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0;
- rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
+ r->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
clip_bot,
clip_cur,
alpha, beta, betaC, 1, 0);
@@ -626,21 +484,21 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
else
clip_left = c_to_deblock[k] & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
- rv40_v_loop_filter(C, s->uvlinesize, j*8,
+ r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 0);
}
if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0;
- rv40_h_loop_filter(C, s->uvlinesize, i*8,
+ r->rdsp.rv40_h_loop_filter(C, s->uvlinesize, i*8,
clip_cur,
clip_top,
alpha, beta, betaC, 1, 1);
}
if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
- rv40_v_loop_filter(C, s->uvlinesize, j*8,
+ r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 1);
diff --git a/libavcodec/rv40data.h b/libavcodec/rv40data.h
index 436afa84e2..36f9f919bd 100644
--- a/libavcodec/rv40data.h
+++ b/libavcodec/rv40data.h
@@ -68,20 +68,6 @@ static const uint8_t rv40_luma_dc_quant[2][32] = {
* @name Coefficients used by the RV40 loop filter
* @{
*/
-/**
- * dither values for deblocking filter - left/top values
- */
-static const uint8_t rv40_dither_l[16] = {
- 0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
- 0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
-};
-/**
- * dither values for deblocking filter - right/bottom values
- */
-static const uint8_t rv40_dither_r[16] = {
- 0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
- 0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
-};
/** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
static const uint8_t rv40_alpha_tab[32] = {
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index b879643ba1..11b7fae481 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -294,6 +294,164 @@ static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src
RV40_WEIGHT_FUNC(16)
RV40_WEIGHT_FUNC(8)
+/**
+ * dither values for deblocking filter - left/top values
+ */
+static const uint8_t rv40_dither_l[16] = {
+ 0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
+ 0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
+};
+
+/**
+ * dither values for deblocking filter - right/bottom values
+ */
+static const uint8_t rv40_dither_r[16] = {
+ 0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
+ 0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
+};
+
+#define CLIP_SYMM(a, b) av_clip(a, -(b), b)
+/**
+ * weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1
+ */
+static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
+ const int filter_p1, const int filter_q1,
+ const int alpha, const int beta,
+ const int lim_p0q0,
+ const int lim_q1, const int lim_p1,
+ const int diff_p1p0, const int diff_q1q0,
+ const int diff_p1p2, const int diff_q1q2)
+{
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+ int t, u, diff;
+
+ t = src[0*step] - src[-1*step];
+ if(!t)
+ return;
+ u = (alpha * FFABS(t)) >> 7;
+ if(u > 3 - (filter_p1 && filter_q1))
+ return;
+
+ t <<= 2;
+ if(filter_p1 && filter_q1)
+ t += src[-2*step] - src[1*step];
+ diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0);
+ src[-1*step] = cm[src[-1*step] + diff];
+ src[ 0*step] = cm[src[ 0*step] - diff];
+ if(FFABS(diff_p1p2) <= beta && filter_p1){
+ t = (diff_p1p0 + diff_p1p2 - diff) >> 1;
+ src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)];
+ }
+ if(FFABS(diff_q1q2) <= beta && filter_q1){
+ t = (diff_q1q0 + diff_q1q2 + diff) >> 1;
+ src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)];
+ }
+}
+
+static av_always_inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
+ const int stride, const int dmode,
+ const int lim_q1, const int lim_p1,
+ const int alpha,
+ const int beta, const int beta2,
+ const int chroma, const int edge)
+{
+ int diff_p1p0[4], diff_q1q0[4], diff_p1p2[4], diff_q1q2[4];
+ int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;
+ uint8_t *ptr;
+ int flag_strong0 = 1, flag_strong1 = 1;
+ int filter_p1, filter_q1;
+ int i;
+ int lims;
+
+ for(i = 0, ptr = src; i < 4; i++, ptr += stride){
+ diff_p1p0[i] = ptr[-2*step] - ptr[-1*step];
+ diff_q1q0[i] = ptr[ 1*step] - ptr[ 0*step];
+ sum_p1p0 += diff_p1p0[i];
+ sum_q1q0 += diff_q1q0[i];
+ }
+ filter_p1 = FFABS(sum_p1p0) < (beta<<2);
+ filter_q1 = FFABS(sum_q1q0) < (beta<<2);
+ if(!filter_p1 && !filter_q1)
+ return;
+
+ for(i = 0, ptr = src; i < 4; i++, ptr += stride){
+ diff_p1p2[i] = ptr[-2*step] - ptr[-3*step];
+ diff_q1q2[i] = ptr[ 1*step] - ptr[ 2*step];
+ sum_p1p2 += diff_p1p2[i];
+ sum_q1q2 += diff_q1q2[i];
+ }
+
+ if(edge){
+ flag_strong0 = filter_p1 && (FFABS(sum_p1p2) < beta2);
+ flag_strong1 = filter_q1 && (FFABS(sum_q1q2) < beta2);
+ }else{
+ flag_strong0 = flag_strong1 = 0;
+ }
+
+ lims = filter_p1 + filter_q1 + ((lim_q1 + lim_p1) >> 1) + 1;
+ if(flag_strong0 && flag_strong1){ /* strong filtering */
+ for(i = 0; i < 4; i++, src += stride){
+ int sflag, p0, q0, p1, q1;
+ int t = src[0*step] - src[-1*step];
+
+ if(!t) continue;
+ sflag = (alpha * FFABS(t)) >> 7;
+ if(sflag > 1) continue;
+
+ p0 = (25*src[-3*step] + 26*src[-2*step]
+ + 26*src[-1*step]
+ + 26*src[ 0*step] + 25*src[ 1*step] + rv40_dither_l[dmode + i]) >> 7;
+ q0 = (25*src[-2*step] + 26*src[-1*step]
+ + 26*src[ 0*step]
+ + 26*src[ 1*step] + 25*src[ 2*step] + rv40_dither_r[dmode + i]) >> 7;
+ if(sflag){
+ p0 = av_clip(p0, src[-1*step] - lims, src[-1*step] + lims);
+ q0 = av_clip(q0, src[ 0*step] - lims, src[ 0*step] + lims);
+ }
+ p1 = (25*src[-4*step] + 26*src[-3*step]
+ + 26*src[-2*step]
+ + 26*p0 + 25*src[ 0*step] + rv40_dither_l[dmode + i]) >> 7;
+ q1 = (25*src[-1*step] + 26*q0
+ + 26*src[ 1*step]
+ + 26*src[ 2*step] + 25*src[ 3*step] + rv40_dither_r[dmode + i]) >> 7;
+ if(sflag){
+ p1 = av_clip(p1, src[-2*step] - lims, src[-2*step] + lims);
+ q1 = av_clip(q1, src[ 1*step] - lims, src[ 1*step] + lims);
+ }
+ src[-2*step] = p1;
+ src[-1*step] = p0;
+ src[ 0*step] = q0;
+ src[ 1*step] = q1;
+ if(!chroma){
+ src[-3*step] = (25*src[-1*step] + 26*src[-2*step] + 51*src[-3*step] + 26*src[-4*step] + 64) >> 7;
+ src[ 2*step] = (25*src[ 0*step] + 26*src[ 1*step] + 51*src[ 2*step] + 26*src[ 3*step] + 64) >> 7;
+ }
+ }
+ }else if(filter_p1 && filter_q1){
+ for(i = 0; i < 4; i++, src += stride)
+ rv40_weak_loop_filter(src, step, 1, 1, alpha, beta, lims, lim_q1, lim_p1,
+ diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
+ }else{
+ for(i = 0; i < 4; i++, src += stride)
+ rv40_weak_loop_filter(src, step, filter_p1, filter_q1,
+ alpha, beta, lims>>1, lim_q1>>1, lim_p1>>1,
+ diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
+ }
+}
+
+static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode,
+ int lim_q1, int lim_p1,
+ int alpha, int beta, int beta2, int chroma, int edge){
+ rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1,
+ alpha, beta, beta2, chroma, edge);
+}
+static void rv40_h_loop_filter(uint8_t *src, int stride, int dmode,
+ int lim_q1, int lim_p1,
+ int alpha, int beta, int beta2, int chroma, int edge){
+ rv40_adaptive_loop_filter(src, stride, 1, dmode, lim_q1, lim_p1,
+ alpha, beta, beta2, chroma, edge);
+}
+
av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
ff_rv34dsp_init(c, dsp);
@@ -371,6 +529,9 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->rv40_weight_pixels_tab[0] = rv40_weight_func_16;
c->rv40_weight_pixels_tab[1] = rv40_weight_func_8;
+ c->rv40_h_loop_filter = rv40_h_loop_filter;
+ c->rv40_v_loop_filter = rv40_v_loop_filter;
+
if (HAVE_MMX)
ff_rv40dsp_init_x86(c, dsp);
}
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index bd00b1535b..bb9d233a4e 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -46,6 +46,7 @@
*/
#include <alsa/asoundlib.h>
+#include "libavformat/internal.h"
#include "libavutil/opt.h"
#include "libavutil/mathematics.h"
@@ -80,7 +81,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
st->codec->codec_id = codec_id;
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
o = 2 * M_PI * s->period_size / s->sample_rate * 1.5; // bandwidth: 1.5Hz
s->timefilter = ff_timefilter_new(1000000.0 / s->sample_rate,
sqrt(2 * o), o * o);
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 72f0cc272e..6e3970128f 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -24,6 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavformat/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
@@ -275,7 +276,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = AVERROR(ENOMEM);
goto out;
}
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
s->width = width;
s->height = height;
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index fdd946d598..ee5ecee89d 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -43,6 +43,7 @@
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "avdevice.h"
+#include "libavformat/internal.h"
struct rgb_pixfmt_map_entry {
int bits_per_pixel;
@@ -110,7 +111,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
if (!(st = avformat_new_stream(avctx, NULL)))
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
/* NONBLOCK is ignored by the fbdev driver, only set for consistency */
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c
index 42499d363b..b1077c4ebe 100644
--- a/libavdevice/jack_audio.c
+++ b/libavdevice/jack_audio.c
@@ -29,6 +29,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
#include "timefilter.h"
#include "avdevice.h"
@@ -245,7 +246,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
stream->codec->sample_rate = self->sample_rate;
stream->codec->channels = self->nports;
- av_set_pts_info(stream, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(stream, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
}
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index dbd593dde5..a84918fe92 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -93,7 +93,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
st->duration = s->drive->audio_last_sector - s->drive->audio_first_sector;
else if (s->drive->tracks)
st->duration = s->drive->disc_toc[s->drive->tracks].dwStartSector;
- av_set_pts_info(st, 64, CDIO_CD_FRAMESIZE_RAW, 2*st->codec->channels*st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, CDIO_CD_FRAMESIZE_RAW, 2*st->codec->channels*st->codec->sample_rate);
for (i = 0; i < s->drive->tracks; i++) {
char title[16];
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 2f3a373114..754f8bf8c1 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -22,6 +22,7 @@
*/
#include "config.h"
+#include "libavformat/internal.h"
#include "libavutil/log.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
@@ -256,7 +257,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
vst = avformat_new_stream(c, NULL);
if (!vst)
goto out_camera;
- av_set_pts_info(vst, 64, 1, 1000);
+ avpriv_set_pts_info(vst, 64, 1, 1000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_RAWVIDEO;
vst->codec->time_base.den = final_frame_rate;
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 4432376037..e3ab926704 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -40,6 +40,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "avdevice.h"
+#include "libavformat/internal.h"
#define AUDIO_BLOCK_SIZE 4096
@@ -225,7 +226,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
}
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index 0b60651d08..1c4b3c1dc9 100644
--- a/libavdevice/pulse.c
+++ b/libavdevice/pulse.c
@@ -31,6 +31,7 @@
#include <pulse/error.h>
#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
#include "libavutil/opt.h"
#define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE)
@@ -108,7 +109,7 @@ static av_cold int pulse_read_header(AVFormatContext *s,
st->codec->codec_id = codec_id;
st->codec->sample_rate = pd->sample_rate;
st->codec->channels = pd->channels;
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
pd->pts = AV_NOPTS_VALUE;
pd->frame_duration = (pd->frame_size * 1000000LL * 8) /
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 6d6184c32b..ff3d5c160c 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -23,6 +23,7 @@
#include <sndio.h>
#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
#include "libavutil/opt.h"
#include "sndio_common.h"
@@ -48,7 +49,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
}
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index bbb58fbded..4b0e7198d6 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -29,6 +29,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
+#include "libavformat/internal.h"
#include "libavcodec/dsputil.h"
#include <unistd.h>
#include <fcntl.h>
@@ -100,7 +101,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
video_fd = open(s1->filename, O_RDWR);
if (video_fd < 0) {
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 07d3cb445d..dc54c4a205 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -32,6 +32,7 @@
#undef __STRICT_ANSI__ //workaround due to broken kernel headers
#include "config.h"
+#include "libavformat/internal.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -590,7 +591,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
res = AVERROR(ENOMEM);
goto out;
}
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
if (s->video_size && (res = av_parse_video_size(&s->width, &s->height, s->video_size)) < 0) {
av_log(s1, AV_LOG_ERROR, "Could not parse video size '%s'.\n", s->video_size);
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 09330dea46..9a525ea27a 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavformat/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
@@ -399,7 +400,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_freep(&bi);
- av_set_pts_info(st, 32, 1, 1000);
+ avpriv_set_pts_info(st, 32, 1, 1000);
ctx->mutex = CreateMutex(NULL, 0, NULL);
if(!ctx->mutex) {
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 2ecf88c2d5..15036b849e 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -36,6 +36,7 @@
*/
#include "config.h"
+#include "libavformat/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
@@ -199,7 +200,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = AVERROR(ENOMEM);
goto out;
}
- av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
screen = DefaultScreen(dpy);
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 3bb8bbdbdc..03ce4ca056 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -30,6 +30,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
#define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
#define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
@@ -146,7 +147,7 @@ static int fourxm_read_header(AVFormatContext *s,
ret= AVERROR(ENOMEM);
goto fail;
}
- av_set_pts_info(st, 60, 1, fourxm->fps);
+ avpriv_set_pts_info(st, 60, 1, fourxm->fps);
fourxm->video_stream_index = st->index;
@@ -206,7 +207,7 @@ static int fourxm_read_header(AVFormatContext *s,
}
st->id = current_track;
- av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
+ avpriv_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
fourxm->tracks[current_track].stream_index = st->index;
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 7df11bf95c..5c5f06cd58 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "rawdec.h"
#include "id3v1.h"
@@ -77,7 +78,7 @@ static int adts_aac_read_header(AVFormatContext *s,
ff_id3v1_read(s);
//LCM of all possible ADTS sample rates
- av_set_pts_info(st, 64, 1, 28224000);
+ avpriv_set_pts_info(st, 64, 1, 28224000);
return 0;
}
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index eff26982ea..dca9748301 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "libavcodec/adx.h"
#include "avformat.h"
+#include "internal.h"
#define BLOCK_SIZE 18
#define BLOCK_SAMPLES 32
@@ -95,7 +96,7 @@ static int adx_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = s->iformat->value;
- av_set_pts_info(st, 64, BLOCK_SAMPLES, avctx->sample_rate);
+ avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, avctx->sample_rate);
return 0;
}
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index eee9a1c483..66f8eefc75 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -22,6 +22,7 @@
#include "libavutil/intfloat_readwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "pcm.h"
#include "aiff.h"
#include "isom.h"
@@ -275,7 +276,7 @@ static int aiff_read_header(AVFormatContext *s,
got_sound:
/* Now positioned, get the sound data start and end */
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
st->start_time = 0;
st->duration = st->codec->frame_size ?
st->nb_frames * st->codec->frame_size : st->nb_frames;
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 3b2fc38160..9a4f41b3f3 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -21,6 +21,7 @@
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "aiff.h"
#include "avio_internal.h"
#include "isom.h"
@@ -103,7 +104,7 @@ static int aiff_write_header(AVFormatContext *s)
avio_wb32(pb, 0); /* Data offset */
avio_wb32(pb, 0); /* Block-size (block align) */
- av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
+ avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
/* Data is starting here */
avio_flush(pb);
diff --git a/libavformat/amr.c b/libavformat/amr.c
index c2c56cc8c2..7b566a2729 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -26,6 +26,7 @@ Only mono files are supported.
*/
#include "avformat.h"
+#include "internal.h"
static const char AMR_header [] = "#!AMR\n";
static const char AMRWB_header [] = "#!AMR-WB\n";
@@ -111,7 +112,7 @@ static int amr_read_header(AVFormatContext *s,
}
st->codec->channels = 1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
diff --git a/libavformat/anm.c b/libavformat/anm.c
index 99864f6b54..812bc285c3 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
typedef struct {
int base_record;
@@ -128,7 +129,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 32); /* record_types */
st->nb_frames = avio_rl32(pb);
- av_set_pts_info(st, 64, 1, avio_rl16(pb));
+ avpriv_set_pts_info(st, 64, 1, avio_rl16(pb));
avio_skip(pb, 58);
/* color cycling and palette data */
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 93c22af6a2..72fca5dd46 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "apetag.h"
/* The earliest and latest file formats supported by this library */
@@ -330,7 +331,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
st->nb_frames = ape->totalframes;
st->start_time = 0;
st->duration = total_blocks / MAC_SUBFRAME_SIZE;
- av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);
+ avpriv_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);
st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
st->codec->extradata_size = APE_EXTRADATA_SIZE;
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 54d87bf8ab..167ab03e8c 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -28,6 +28,7 @@
#include "libavutil/mathematics.h"
#include "libavcodec/mpegaudio.h"
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "riff.h"
#include "asf.h"
@@ -227,7 +228,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+ avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
asf_st = av_mallocz(sizeof(ASFStream));
if (!asf_st)
return AVERROR(ENOMEM);
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 0b084c0322..a287ac55ad 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "asf.h"
#include "avio_internal.h"
@@ -321,7 +322,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
for(n=0;n<s->nb_streams;n++) {
enc = s->streams[n]->codec;
- av_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
+ avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
bit_rate += enc->bit_rate;
}
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index 4f1126cc0e..78cb6d93e1 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -86,7 +86,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
- av_set_pts_info(st, 64, 1, 100);
+ avpriv_set_pts_info(st, 64, 1, 100);
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id= CODEC_ID_SSA;
diff --git a/libavformat/au.c b/libavformat/au.c
index 610880d842..3dfb3be004 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -28,6 +28,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "pcm.h"
#include "riff.h"
@@ -166,7 +167,7 @@ static int au_read_header(AVFormatContext *s,
st->codec->sample_rate = rate;
if (data_size != AU_UNKNOWN_SIZE)
st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * bps);
- av_set_pts_info(st, 64, 1, rate);
+ avpriv_set_pts_info(st, 64, 1, rate);
return 0;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 752645e2c5..5151823517 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1632,18 +1632,14 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
AVProgram *av_new_program(AVFormatContext *s, int id);
+#if FF_API_SET_PTS_INFO
/**
- * Set the pts for a given stream. If the new values would be invalid
- * (<= 0), it leaves the AVStream unchanged.
- *
- * @param s stream
- * @param pts_wrap_bits number of bits effectively used by the pts
- * (used for wrap control, 33 is the value for MPEG)
- * @param pts_num numerator to convert to seconds (MPEG: 1)
- * @param pts_den denominator to convert to seconds (MPEG: 90000)
+ * @deprecated this function is not supposed to be called outside of lavf
*/
+attribute_deprecated
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
unsigned int pts_num, unsigned int pts_den);
+#endif
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index fd91c99b1c..116099ad6b 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -26,6 +26,7 @@
#include "libavutil/dict.h"
#include "libavutil/avstring.h"
#include "avformat.h"
+#include "internal.h"
#include "avi.h"
#include "dv.h"
#include "riff.h"
@@ -530,7 +531,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->scale = 1;
}
}
- av_set_pts_info(st, 64, ast->scale, ast->rate);
+ avpriv_set_pts_info(st, 64, ast->scale, ast->rate);
ast->cum_len=avio_rl32(pb); /* start */
st->nb_frames = avio_rl32(pb);
@@ -817,7 +818,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
*st->codec = *ast->sub_ctx->streams[0]->codec;
ast->sub_ctx->streams[0]->codec->extradata = NULL;
time_base = ast->sub_ctx->streams[0]->time_base;
- av_set_pts_info(st, 64, time_base.num, time_base.den);
+ avpriv_set_pts_info(st, 64, time_base.num, time_base.den);
}
ast->sub_buffer = pkt->data;
memset(pkt, 0, sizeof(*pkt));
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 583305073f..091d4cbb1e 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "internal.h"
#include "avi.h"
#include "avio_internal.h"
#include "riff.h"
@@ -256,7 +257,7 @@ static int avi_write_header(AVFormatContext *s)
avio_wl32(pb, au_scale); /* scale */
avio_wl32(pb, au_byterate); /* rate */
- av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
+ avpriv_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
avio_wl32(pb, 0); /* start */
avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index b3f4a41a39..17ff5a88a3 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include <windows.h>
@@ -145,7 +146,7 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->stream_codec_tag = stream->info.fccHandler;
- av_set_pts_info(st, 64, info.dwScale, info.dwRate);
+ avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate);
st->start_time = stream->info.dwStart;
}
}
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 384ac0144d..0a24ce51c0 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "libavcodec/bethsoftvideo.h"
typedef struct BVID_DemuxContext
@@ -73,7 +74,7 @@ static int vid_read_header(AVFormatContext *s,
stream = avformat_new_stream(s, NULL);
if (!stream)
return AVERROR(ENOMEM);
- av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
+ avpriv_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
stream->codec->width = avio_rl16(pb);
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index c6371049c6..3886d4bedd 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -28,6 +28,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
typedef struct BFIContext {
int nframes;
@@ -86,7 +87,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
astream->codec->sample_rate = avio_rl32(pb);
/* Set up the video codec... */
- av_set_pts_info(vstream, 32, 1, fps);
+ avpriv_set_pts_info(vstream, 32, 1, fps);
vstream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vstream->codec->codec_id = CODEC_ID_BFI;
vstream->codec->pix_fmt = PIX_FMT_PAL8;
@@ -99,7 +100,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
astream->codec->bit_rate =
astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
avio_seek(pb, chunk_header - 3, SEEK_SET);
- av_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
+ avpriv_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
return 0;
}
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 844498e6f8..beceffd88d 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -30,6 +30,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
enum BinkAudFlags {
BINK_AUD_16BITS = 0x4000, ///< prefer 16-bit output
@@ -109,7 +110,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
return AVERROR(EIO);
}
- av_set_pts_info(vst, 64, fps_den, fps_num);
+ avpriv_set_pts_info(vst, 64, fps_den, fps_num);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_BINKVIDEO;
@@ -136,7 +137,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_tag = 0;
ast->codec->sample_rate = avio_rl16(pb);
- av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+ avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
flags = avio_rl16(pb);
ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
diff --git a/libavformat/bmv.c b/libavformat/bmv.c
index fb41712868..1077efa573 100644
--- a/libavformat/bmv.c
+++ b/libavformat/bmv.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
enum BMVFlags {
BMV_NOP = 0,
@@ -50,7 +51,7 @@ static int bmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->width = 640;
st->codec->height = 429;
st->codec->pix_fmt = PIX_FMT_PAL8;
- av_set_pts_info(st, 16, 1, 12);
+ avpriv_set_pts_info(st, 16, 1, 12);
ast = avformat_new_stream(s, 0);
if (!ast)
return AVERROR(ENOMEM);
@@ -58,7 +59,7 @@ static int bmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->codec->codec_id = CODEC_ID_BMV_AUDIO;
ast->codec->channels = 2;
ast->codec->sample_rate = 22050;
- av_set_pts_info(ast, 16, 1, 22050);
+ avpriv_set_pts_info(ast, 16, 1, 22050);
c->get_next = 1;
c->audio_pos = 0;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index 0f4be89545..b9f38a7dea 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "voc.h"
#include "libavutil/intreadwrite.h"
@@ -89,7 +90,7 @@ static int read_header(AVFormatContext *s,
video->codec->height = 192;
/* 4:3 320x200 with 8 empty lines */
video->sample_aspect_ratio = (AVRational) { 5, 6 };
- av_set_pts_info(video, 64, 2, 25);
+ avpriv_set_pts_info(video, 64, 2, 25);
video->nb_frames = framecount;
video->duration = framecount;
video->start_time = 0;
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index f4df75c7be..89b2bd3883 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -26,6 +26,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "isom.h"
#include "libavutil/intreadwrite.h"
@@ -303,7 +304,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
}
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
st->start_time = 0;
/* position the stream at the start of data */
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 444c1fa27a..09ba87b060 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#define CDG_PACKET_SIZE 24
#define CDG_COMMAND 0x09
@@ -38,7 +39,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->codec_id = CODEC_ID_CDGRAPHICS;
/// 75 sectors/sec * 4 packets/sector = 300 packets/sec
- av_set_pts_info(vst, 32, 1, 300);
+ avpriv_set_pts_info(vst, 32, 1, 300);
ret = avio_size(s->pb);
if (ret > 0)
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index a109a2d2b7..25084ef76d 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
static int dfa_probe(AVProbeData *p)
{
@@ -58,7 +59,7 @@ static int dfa_read_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "Zero FPS reported, defaulting to 10\n");
mspf = 100;
}
- av_set_pts_info(st, 24, mspf, 1000);
+ avpriv_set_pts_info(st, 24, mspf, 1000);
avio_skip(pb, 128 - 16); // padding
st->duration = frames;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index ab098dc017..20b1d02f36 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
typedef struct CinFileHeader {
@@ -111,7 +112,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, 12);
+ avpriv_set_pts_info(st, 32, 1, 12);
cin->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_DSICINVIDEO;
@@ -124,7 +125,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, 22050);
+ avpriv_set_pts_info(st, 32, 1, 22050);
cin->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_DSICINAUDIO;
diff --git a/libavformat/dv.c b/libavformat/dv.c
index f69be87755..e571f39799 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -30,6 +30,7 @@
*/
#include <time.h>
#include "avformat.h"
+#include "internal.h"
#include "libavcodec/dvdata.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
@@ -214,7 +215,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
c->ast[i] = avformat_new_stream(c->fctx, NULL);
if (!c->ast[i])
break;
- av_set_pts_info(c->ast[i], 64, 1, 30000);
+ avpriv_set_pts_info(c->ast[i], 64, 1, 30000);
c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
@@ -244,7 +245,7 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
if (c->sys) {
avctx = c->vst->codec;
- av_set_pts_info(c->vst, 64, c->sys->time_base.num,
+ avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num,
c->sys->time_base.den);
avctx->time_base= c->sys->time_base;
if (!avctx->width){
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 65a61159bc..54bea27246 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#define DXA_EXTRA_SIZE 9
@@ -127,7 +128,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->width = w;
st->codec->height = h;
av_reduce(&den, &num, den, num, (1UL<<31)-1);
- av_set_pts_info(st, 33, num, den);
+ avpriv_set_pts_info(st, 33, num, den);
/* flags & 0x80 means that image is interlaced,
* flags & 0x40 means that image has double height
* either way set true height
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index adf48c6a19..2311f0bcd1 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -29,6 +29,7 @@
*/
#include "avformat.h"
+#include "internal.h"
typedef struct {
unsigned int channels;
@@ -76,7 +77,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->channel_layout = channel_layout;
st->codec->sample_rate = sample_rate;
st->codec->sample_fmt = AV_SAMPLE_FMT_S16;
- av_set_pts_info(st, 64, 1, sample_rate);
+ avpriv_set_pts_info(st, 64, 1, sample_rate);
cdata->audio_pts = 0;
return 0;
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 0508a06cc4..802352a852 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -27,6 +27,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
#define SEAD_TAG MKTAG('S', 'E', 'A', 'D') /* Sxxx header */
@@ -440,7 +441,7 @@ static int ea_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, ea->sample_rate);
+ avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ea->audio_codec;
st->codec->codec_tag = 0; /* no tag */
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index b8cf119cb3..86e31cc0af 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "ffm.h"
#if CONFIG_FFSERVER
#include <unistd.h>
@@ -299,7 +300,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
goto fail;
- av_set_pts_info(st, 64, 1, 1000000);
+ avpriv_set_pts_info(st, 64, 1, 1000000);
codec = st->codec;
/* generic info */
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index 99d2e98dbf..1f65cac017 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "ffm.h"
static void flush_packet(AVFormatContext *s)
@@ -107,7 +108,7 @@ static int ffm_write_header(AVFormatContext *s)
/* list of streams */
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
- av_set_pts_info(st, 64, 1, 1000000);
+ avpriv_set_pts_info(st, 64, 1, 1000000);
codec = st->codec;
/* generic info */
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 8aa8ee0dee..24033388d8 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define RAND_TAG MKBETAG('R','a','n','d')
@@ -67,7 +68,7 @@ static int read_header(AVFormatContext *s,
st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb);
film->leading = avio_rb16(pb);
- av_set_pts_info(st, 64, 1, avio_rb16(pb));
+ avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));
avio_seek(pb, 0, SEEK_SET);
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index a5a32131a7..8f855bb02d 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -21,6 +21,7 @@
#include "libavcodec/flac.h"
#include "avformat.h"
+#include "internal.h"
#include "rawdec.h"
#include "oggdec.h"
#include "vorbiscomment.h"
@@ -91,7 +92,7 @@ static int flac_read_header(AVFormatContext *s,
/* set time base and duration */
if (si.samplerate > 0) {
- av_set_pts_info(st, 64, 1, si.samplerate);
+ avpriv_set_pts_info(st, 64, 1, si.samplerate);
if (si.samples > 0)
st->duration = si.samples;
}
diff --git a/libavformat/flic.c b/libavformat/flic.c
index f4c1a1b9fa..89652a20f6 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -34,6 +34,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/audioconvert.h"
#include "avformat.h"
+#include "internal.h"
#define FLIC_FILE_MAGIC_1 0xAF11
#define FLIC_FILE_MAGIC_2 0xAF12
@@ -167,10 +168,10 @@ static int flic_read_header(AVFormatContext *s,
/* Since the header information is incorrect we have to figure out the
* framerate using block_align and the fact that the audio is 22050 Hz.
* We usually have two cases: 2205 -> 10 fps and 1470 -> 15 fps */
- av_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE);
- av_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE);
+ avpriv_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE);
+ avpriv_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE);
} else if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) {
- av_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
+ avpriv_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
/* rewind the stream since the first chunk is at offset 12 */
avio_seek(pb, 12, SEEK_SET);
@@ -182,10 +183,10 @@ static int flic_read_header(AVFormatContext *s,
memcpy(st->codec->extradata, header, 12);
} else if (magic_number == FLIC_FILE_MAGIC_1) {
- av_set_pts_info(st, 64, speed, 70);
+ avpriv_set_pts_info(st, 64, speed, 70);
} else if ((magic_number == FLIC_FILE_MAGIC_2) ||
(magic_number == FLIC_FILE_MAGIC_3)) {
- av_set_pts_info(st, 64, speed, 1000);
+ avpriv_set_pts_info(st, 64, speed, 1000);
} else {
av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n");
return AVERROR_INVALIDDATA;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 1095f95b7b..4bca6a6580 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -31,6 +31,7 @@
#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "flv.h"
@@ -365,7 +366,7 @@ static AVStream *create_stream(AVFormatContext *s, int stream_type){
st->codec->codec_id = CODEC_ID_NONE; // Going to rely on copy for now
av_log(s, AV_LOG_DEBUG, "Data stream created\n");
}
- av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+ avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
return st;
}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 3ec612fa5b..2a223eeeb3 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -202,7 +202,7 @@ static int flv_write_header(AVFormatContext *s)
if(get_audio_flags(enc)<0)
return -1;
}
- av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
+ avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
sc = av_mallocz(sizeof(FLVStreamContext));
if (!sc)
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 8c73c7b447..23608873c1 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -22,6 +22,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
+#include "internal.h"
#define GSM_BLOCK_SIZE 33
#define GSM_BLOCK_SAMPLES 160
@@ -67,7 +68,7 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->block_align = GSM_BLOCK_SIZE;
st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
- av_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE);
+ avpriv_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE);
return 0;
}
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 6b6407f0b7..95a8142a98 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -406,7 +406,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
main_timebase = (AVRational){1001, 60000};
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
- av_set_pts_info(st, 32, main_timebase.num, main_timebase.den);
+ avpriv_set_pts_info(st, 32, main_timebase.num, main_timebase.den);
}
return 0;
}
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 3d56eba287..a274d8e290 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -22,6 +22,7 @@
#include "libavutil/intfloat_readwrite.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
#include "gxf.h"
#include "riff.h"
#include "audiointerleave.h"
@@ -677,7 +678,7 @@ static int gxf_write_header(AVFormatContext *s)
}
sc->track_type = 2;
sc->sample_rate = st->codec->sample_rate;
- av_set_pts_info(st, 64, 1, sc->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, sc->sample_rate);
sc->sample_size = 16;
sc->frame_rate_index = -2;
sc->lines_index = -2;
@@ -707,7 +708,7 @@ static int gxf_write_header(AVFormatContext *s)
"gxf muxer only accepts PAL or NTSC resolutions currently\n");
return -1;
}
- av_set_pts_info(st, 64, gxf->time_base.num, gxf->time_base.den);
+ avpriv_set_pts_info(st, 64, gxf->time_base.num, gxf->time_base.den);
if (gxf_find_lines_index(st) < 0)
sc->lines_index = -1;
sc->sample_size = st->codec->bit_rate;
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 9d28043572..0cca69f088 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -70,6 +70,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define HUFFMAN_TABLE_SIZE (64 * 1024)
#define IDCIN_FPS 14
@@ -156,7 +157,7 @@ static int idcin_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, IDCIN_FPS);
+ avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
idcin->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_IDCIN;
@@ -177,7 +178,7 @@ static int idcin_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, IDCIN_FPS);
+ avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
idcin->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_tag = 1;
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 63ba5917a5..eb11c69adb 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define RoQ_MAGIC_NUMBER 0x1084
#define RoQ_CHUNK_PREAMBLE_SIZE 8
@@ -87,7 +88,7 @@ static int roq_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 63, 1, framerate);
+ avpriv_set_pts_info(st, 63, 1, framerate);
roq->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ROQ;
@@ -169,7 +170,7 @@ static int roq_read_packet(AVFormatContext *s,
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
+ avpriv_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
roq->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ROQ_DPCM;
diff --git a/libavformat/iff.c b/libavformat/iff.c
index a816af580b..ebc1c35ba5 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -32,6 +32,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#define ID_8SVX MKTAG('8','S','V','X')
#define ID_VHDR MKTAG('V','H','D','R')
@@ -238,7 +239,7 @@ static int iff_read_header(AVFormatContext *s,
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- av_set_pts_info(st, 32, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
switch (iff->svx8_compression) {
case COMP_NONE:
diff --git a/libavformat/img2.c b/libavformat/img2.c
index f53f327000..18dde559c4 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -255,7 +255,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->need_parsing = AVSTREAM_PARSE_FULL;
}
- av_set_pts_info(st, 60, framerate.den, framerate.num);
+ avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
if (width && height) {
st->codec->width = width;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index f15940cf4e..c3be0df380 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -285,4 +285,17 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index,
int flags, int64_t *ts_ret,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
+/**
+ * Set the pts for a given stream. If the new values would be invalid
+ * (<= 0), it leaves the AVStream unchanged.
+ *
+ * @param s stream
+ * @param pts_wrap_bits number of bits effectively used by the pts
+ * (used for wrap control, 33 is the value for MPEG)
+ * @param pts_num numerator to convert to seconds (MPEG: 1)
+ * @param pts_den denominator to convert to seconds (MPEG: 90000)
+ */
+void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
+ unsigned int pts_num, unsigned int pts_den);
+
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 562b19a29c..9b42ee2948 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -34,6 +34,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define CHUNK_PREAMBLE_SIZE 4
#define OPCODE_PREAMBLE_SIZE 4
@@ -562,7 +563,7 @@ static int ipmovie_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 63, 1, 1000000);
+ avpriv_set_pts_info(st, 63, 1, 1000000);
ipmovie->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
@@ -575,7 +576,7 @@ static int ipmovie_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
+ avpriv_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
ipmovie->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ipmovie->audio_type;
diff --git a/libavformat/iss.c b/libavformat/iss.c
index 4b6314d5b9..2bae3c1d7b 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -27,6 +27,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "libavutil/avstring.h"
#define ISS_SIG "IMA_ADPCM_Sound"
@@ -101,7 +102,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate
* st->codec->bits_per_coded_sample;
st->codec->block_align = iss->packet_size;
- av_set_pts_info(st, 32, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
return 0;
}
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index 1db4c0325a..b1b40929a3 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -19,6 +19,7 @@
*/
#include "avformat.h"
+#include "internal.h"
static int probe(AVProbeData *p)
@@ -47,7 +48,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(st, 64, 1, 90000);
+ avpriv_set_pts_info(st, 64, 1, 90000);
return 0;
diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index cc7687e4da..bc837a2b90 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -19,6 +19,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "libavutil/intreadwrite.h"
@@ -61,7 +62,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR_INVALIDDATA;
}
- av_set_pts_info(st, 64, time_base.num, time_base.den);
+ avpriv_set_pts_info(st, 64, time_base.num, time_base.den);
return 0;
}
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 7e1a6ce7b4..212cd8aae7 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -27,6 +27,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define JV_PREAMBLE_SIZE 5
@@ -81,7 +82,7 @@ static int read_header(AVFormatContext *s,
vst->codec->height = avio_rl16(pb);
vst->nb_frames =
ast->nb_index_entries = avio_rl16(pb);
- av_set_pts_info(vst, 64, avio_rl16(pb), 1000);
+ avpriv_set_pts_info(vst, 64, avio_rl16(pb), 1000);
avio_skip(pb, 4);
@@ -90,7 +91,7 @@ static int read_header(AVFormatContext *s,
ast->codec->codec_tag = 0; /* no fourcc */
ast->codec->sample_rate = avio_rl16(pb);
ast->codec->channels = 1;
- av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+ avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
avio_skip(pb, 10);
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 7628abdfb8..eafe8165e2 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -26,6 +26,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include <libnut.h>
@@ -92,7 +93,7 @@ static int nut_write_header(AVFormatContext * avf) {
for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF;
ff_parse_specific_params(codec, &num, &ssize, &denom);
- av_set_pts_info(avf->streams[i], 60, denom, num);
+ avpriv_set_pts_info(avf->streams[i], 60, denom, num);
s[i].time_base.num = denom;
s[i].time_base.den = num;
@@ -226,7 +227,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size);
}
- av_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den);
+ avpriv_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den);
st->start_time = 0;
st->duration = s[i].max_pts;
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index 96007aa472..865cb2da90 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define LMLM4_I_FRAME 0x00
#define LMLM4_P_FRAME 0x01
@@ -65,7 +66,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
- av_set_pts_info(st, 64, 1001, 30000);
+ avpriv_set_pts_info(st, 64, 1001, 30000);
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 855e625284..7952dadfbb 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#define LXF_PACKET_HEADER_SIZE 60
@@ -174,14 +175,14 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
//use audio packet size to determine video standard
//for NTSC we have one 8008-sample audio frame per five video frames
if (samples == LXF_SAMPLERATE * 5005 / 30000) {
- av_set_pts_info(s->streams[0], 64, 1001, 30000);
+ avpriv_set_pts_info(s->streams[0], 64, 1001, 30000);
} else {
//assume PAL, but warn if we don't have 1920 samples
if (samples != LXF_SAMPLERATE / 25)
av_log(s, AV_LOG_WARNING,
"video doesn't seem to be PAL or NTSC. guessing PAL\n");
- av_set_pts_info(s->streams[0], 64, 1, 25);
+ avpriv_set_pts_info(s->streams[0], 64, 1, 25);
}
//TODO: warning if track mask != (1 << channels) - 1?
@@ -250,7 +251,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->sample_rate = LXF_SAMPLERATE;
st->codec->channels = lxf->channels;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
}
if (format == 1) {
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index b47f4de8d4..1ceea51d99 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1554,7 +1554,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (track->time_scale < 0.01)
track->time_scale = 1.0;
- av_set_pts_info(st, 64, matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts in ns */
+ avpriv_set_pts_info(st, 64, matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts in ns */
st->codec->codec_id = codec_id;
st->start_time = 0;
@@ -1567,10 +1567,6 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (track->flag_forced)
st->disposition |= AV_DISPOSITION_FORCED;
- if (track->default_duration)
- av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
- track->default_duration, 1000000000, 30000);
-
if (!st->codec->extradata) {
if(extradata){
st->codec->extradata = extradata;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f22e084449..332d1ca572 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "isom.h"
#include "matroska.h"
@@ -672,7 +673,7 @@ static int mkv_write_tracks(AVFormatContext *s)
end_ebml_master(pb, track);
// ms precision is the de-facto standard timescale for mkv files
- av_set_pts_info(st, 64, 1, 1000);
+ avpriv_set_pts_info(st, 64, 1, 1000);
}
end_ebml_master(pb, tracks);
return 0;
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 3ad47418fc..8bb933babe 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -33,6 +33,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define MM_PREAMBLE_SIZE 6
@@ -113,7 +114,7 @@ static int read_header(AVFormatContext *s,
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = width;
st->codec->height = height;
- av_set_pts_info(st, 64, 1, frame_rate);
+ avpriv_set_pts_info(st, 64, 1, frame_rate);
/* audio stream */
if (length == MM_HEADER_LEN_AV) {
@@ -125,7 +126,7 @@ static int read_header(AVFormatContext *s,
st->codec->codec_id = CODEC_ID_PCM_U8;
st->codec->channels = 1;
st->codec->sample_rate = 8000;
- av_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
+ avpriv_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
}
mm->audio_pts = 0;
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 956f567203..facf8f1278 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "pcm.h"
#include "riff.h"
@@ -100,7 +101,7 @@ static int mmf_write_header(AVFormatContext *s)
mmf->awapos = ff_start_tag(pb, "Awa\x01");
- av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
+ avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
avio_flush(pb);
@@ -252,7 +253,7 @@ static int mmf_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 763e985f8f..e527f2489d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -31,6 +31,7 @@
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "riff.h"
#include "isom.h"
@@ -1895,7 +1896,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->time_scale = 1;
}
- av_set_pts_info(st, 64, 1, sc->time_scale);
+ avpriv_set_pts_info(st, 64, 1, sc->time_scale);
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
!st->codec->frame_size && sc->stts_count == 1) {
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bea5c050b8..8aac2a32e0 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2297,7 +2297,7 @@ static int mov_write_header(AVFormatContext *s)
if (!track->height)
track->height = st->codec->height;
- av_set_pts_info(st, 64, 1, track->timescale);
+ avpriv_set_pts_info(st, 64, 1, track->timescale);
}
if(mov->reserved_moov_size){
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 56311a5953..aa48787835 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -24,6 +24,7 @@
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
#include "id3v2.h"
#include "id3v1.h"
#include "libavcodec/mpegaudiodecheader.h"
@@ -147,7 +148,7 @@ static int mp3_read_header(AVFormatContext *s,
st->start_time = 0;
// lcm of all mp3 sample rates
- av_set_pts_info(st, 64, 1, 14112000);
+ avpriv_set_pts_info(st, 64, 1, 14112000);
off = avio_tell(s->pb);
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 87d2abe1b5..c05b88a7cf 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -21,6 +21,7 @@
#include "libavcodec/get_bits.h"
#include "avformat.h"
+#include "internal.h"
#include "apetag.h"
#include "id3v1.h"
#include "libavutil/dict.h"
@@ -96,7 +97,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
avio_read(s->pb, st->codec->extradata, 16);
st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
- av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
/* scan for seekpoints */
st->start_time = 0;
st->duration = c->fcount;
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 22e2adcb1c..01c1cc725b 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -22,6 +22,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/unary.h"
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
/// Two-byte MPC tag
@@ -235,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
- av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
size -= avio_tell(pb) - pos;
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 9e19a3d5e4..01ee004f45 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -25,6 +25,7 @@
#include "libavutil/opt.h"
#include "libavcodec/put_bits.h"
#include "avformat.h"
+#include "internal.h"
#include "mpeg.h"
#define MAX_PAYLOAD_SIZE 4096
@@ -336,7 +337,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
goto fail;
st->priv_data = stream;
- av_set_pts_info(st, 64, 1, 90000);
+ avpriv_set_pts_info(st, 64, 1, 90000);
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d3f8a8a783..8d026fd372 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -602,7 +602,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
{
int old_codec_type= st->codec->codec_type;
int old_codec_id = st->codec->codec_id;
- av_set_pts_info(st, 33, 1, 90000);
+ avpriv_set_pts_info(st, 33, 1, 90000);
st->priv_data = pes;
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id = CODEC_ID_NONE;
@@ -638,7 +638,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
}
sub_st->id = pes->pid;
- av_set_pts_info(sub_st, 33, 1, 90000);
+ avpriv_set_pts_info(sub_st, 33, 1, 90000);
sub_st->priv_data = sub_pes;
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
sub_st->codec->codec_id = CODEC_ID_AC3;
@@ -762,7 +762,7 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf
if (cts != AV_NOPTS_VALUE)
pes->pts = cts;
- av_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);
+ avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);
return (get_bits_count(&gb) + 7) >> 3;
}
@@ -1970,7 +1970,7 @@ static int mpegts_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
- av_set_pts_info(st, 60, 1, 27000000);
+ avpriv_set_pts_info(st, 60, 1, 27000000);
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id = CODEC_ID_MPEG2TS;
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index abdbb5d1d1..fe423fbc11 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -514,7 +514,7 @@ static int mpegts_write_header(AVFormatContext *s)
/* assign pids to each stream */
for(i = 0;i < s->nb_streams; i++) {
st = s->streams[i];
- av_set_pts_info(st, 33, 1, 90000);
+ avpriv_set_pts_info(st, 33, 1, 90000);
ts_st = av_mallocz(sizeof(MpegTSWriteStream));
if (!ts_st)
goto fail;
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index b394b8779b..1e6fd0b6f5 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -20,6 +20,7 @@
#include "libavcodec/bytestream.h"
#include "avformat.h"
+#include "internal.h"
#define HEADER_SIZE 24
@@ -84,7 +85,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
codec->codec_id = CODEC_ID_MIMIC;
codec->codec_tag = MKTAG('M', 'L', '2', '0');
- av_set_pts_info(st, 32, 1, 1000);
+ avpriv_set_pts_info(st, 32, 1, 1000);
/* Some files start with "connected\r\n\r\n".
* So skip until we find the first byte of struct size */
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index 966e9bb8b0..00da9a1e49 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -27,6 +27,7 @@
#include "libavutil/bswap.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define MTV_ASUBCHUNK_DATA_SIZE 500
#define MTV_HEADER_SIZE 512
@@ -120,7 +121,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, mtv->video_fps);
+ avpriv_set_pts_info(st, 64, 1, mtv->video_fps);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->pix_fmt = PIX_FMT_RGB565;
@@ -136,7 +137,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, AUDIO_SAMPLING_RATE);
+ avpriv_set_pts_info(st, 64, 1, AUDIO_SAMPLING_RATE);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP3;
st->codec->bit_rate = mtv->audio_br;
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 8586d10e07..70a9b66919 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#define MVI_FRAC_BITS 10
@@ -76,14 +77,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR_INVALIDDATA;
}
- av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+ avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = CODEC_ID_PCM_U8;
ast->codec->channels = 1;
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate * 8;
- av_set_pts_info(vst, 64, msecs_per_frame, 1000000);
+ avpriv_set_pts_info(vst, 64, msecs_per_frame, 1000000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_MOTIONPIXELS;
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9bf4183298..571b7ef9f2 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1127,7 +1127,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
if (st->duration == -1)
st->duration = AV_NOPTS_VALUE;
st->start_time = component->start_position;
- av_set_pts_info(st, 64, material_track->edit_rate.num, material_track->edit_rate.den);
+ avpriv_set_pts_info(st, 64, material_track->edit_rate.num, material_track->edit_rate.den);
if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {
av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n");
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index ce71ed2e51..0b62a5a851 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1428,7 +1428,7 @@ static int mxf_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "unsupported video frame rate\n");
return -1;
}
- av_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
+ avpriv_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
if (mxf->tc.str) {
mxf->tc.rate.num = mxf->time_base.den;
mxf->tc.rate.den = mxf->time_base.num;
@@ -1462,7 +1462,7 @@ static int mxf_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "only 48khz is implemented\n");
return -1;
}
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
if (s->oformat == &ff_mxf_d10_muxer) {
if (st->index != 1) {
av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index 04991b3530..b249f67a63 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavcodec/mjpeg.h"
#include "avformat.h"
+#include "internal.h"
#include "avio.h"
#define DEFAULT_PACKET_SIZE 1024
@@ -47,7 +48,7 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
video_st->codec->codec_id = CODEC_ID_MXPEG;
- av_set_pts_info(video_st, 64, 1, 1000000);
+ avpriv_set_pts_info(video_st, 64, 1, 1000000);
audio_st = avformat_new_stream(s, NULL);
if (!audio_st)
@@ -58,7 +59,7 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
audio_st->codec->sample_rate = 8000;
audio_st->codec->bits_per_coded_sample = 8;
audio_st->codec->block_align = 1;
- av_set_pts_info(audio_st, 64, 1, 1000000);
+ avpriv_set_pts_info(audio_st, 64, 1, 1000000);
mxg->soi_ptr = mxg->buffer_ptr = mxg->buffer = 0;
mxg->buffer_size = 0;
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index 3430035f3f..cf95c631bd 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define NC_VIDEO_FLAG 0x1A5
@@ -54,7 +55,7 @@ static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_id = CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(st, 64, 1, 100);
+ avpriv_set_pts_info(st, 64, 1, 100);
return 0;
}
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 5de7512f99..6e1d268e68 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -21,6 +21,7 @@
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
@@ -454,7 +455,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = vheight;
st->codec->bits_per_coded_sample = 24; /* depth XXX */
- av_set_pts_info(st, 64, framerate.den, framerate.num);
+ avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
st->start_time = 0;
st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den);
@@ -486,7 +487,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
st->need_parsing = AVSTREAM_PARSE_FULL; /* for PCM we will read a chunk later and put correct info */
/* set timebase to common denominator of ms and framerate */
- av_set_pts_info(st, 64, 1, framerate.num*1000);
+ avpriv_set_pts_info(st, 64, 1, framerate.num*1000);
st->start_time = 0;
st->duration = (int64_t)nsv->duration * framerate.num;
#endif
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 0bfa1d0ca2..5dd687c55d 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){
return -1;
}
stc->time_base= &nut->time_base[stc->time_base_id];
- av_set_pts_info(s->streams[stream_id], 63, stc->time_base->num, stc->time_base->den);
+ avpriv_set_pts_info(s->streams[stream_id], 63, stc->time_base->num, stc->time_base->den);
return 0;
}
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 3c963debd6..c753fc25ba 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -604,7 +604,7 @@ static int nut_write_header(AVFormatContext *s){
AVRational time_base;
ff_parse_specific_params(st->codec, &time_base.den, &ssize, &time_base.num);
- av_set_pts_info(st, 64, time_base.num, time_base.den);
+ avpriv_set_pts_info(st, 64, time_base.num, time_base.den);
for(j=0; j<nut->time_base_count; j++){
if(!memcmp(&time_base, &nut->time_base[j], sizeof(AVRational))){
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index caf85b0ef8..349ff0c35d 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
typedef struct {
@@ -163,7 +164,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
vst->codec->bits_per_coded_sample = 10;
vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000);
vst->r_frame_rate = av_d2q(fps, 60000);
- av_set_pts_info(vst, 32, 1, 1000);
+ avpriv_set_pts_info(vst, 32, 1, 1000);
} else
ctx->v_id = -1;
@@ -179,7 +180,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
ast->codec->bit_rate = 2 * 2 * 44100 * 8;
ast->codec->block_align = 2 * 2;
ast->codec->bits_per_coded_sample = 16;
- av_set_pts_info(ast, 32, 1, 1000);
+ avpriv_set_pts_info(ast, 32, 1, 1000);
} else
ctx->a_id = -1;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index d453ae6775..1602580348 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -177,7 +177,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
return AVERROR(ENOMEM);
st->id = idx;
- av_set_pts_info(st, 64, 1, 1000000);
+ avpriv_set_pts_info(st, 64, 1, 1000000);
}
return idx;
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 53350719fa..ac6eb8737d 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -343,9 +343,9 @@ static int ogg_write_header(AVFormatContext *s)
unsigned serial_num = i;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
- av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
if (st->codec->codec_id != CODEC_ID_VORBIS &&
st->codec->codec_id != CODEC_ID_THEORA &&
st->codec->codec_id != CODEC_ID_SPEEX &&
diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c
index 982d3d7ea5..fc5891b091 100644
--- a/libavformat/oggparsecelt.c
+++ b/libavformat/oggparsecelt.c
@@ -23,6 +23,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
struct oggcelt_private {
@@ -70,7 +71,7 @@ static int celt_header(AVFormatContext *s, int idx)
st->codec->extradata = extradata;
st->codec->extradata_size = 2 * sizeof(uint32_t);
if (sample_rate)
- av_set_pts_info(st, 64, 1, sample_rate);
+ avpriv_set_pts_info(st, 64, 1, sample_rate);
priv->extra_headers_left = 1 + extra_headers;
av_free(os->private);
os->private = priv;
diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
index 524736a416..abcf4fb15c 100644
--- a/libavformat/oggparsedirac.c
+++ b/libavformat/oggparsedirac.c
@@ -21,6 +21,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/dirac.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
static int dirac_header(AVFormatContext *s, int idx)
@@ -42,7 +43,7 @@ static int dirac_header(AVFormatContext *s, int idx)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_DIRAC;
// dirac in ogg always stores timestamps as though the video were interlaced
- av_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den);
return 1;
}
@@ -79,7 +80,7 @@ static int old_dirac_header(AVFormatContext *s, int idx)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_DIRAC;
- av_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8));
+ avpriv_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8));
return 1;
}
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 87239c6a53..015a376755 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -22,6 +22,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/flac.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
#define OGG_FLAC_METADATA_TYPE_STREAMINFO 0x7F
@@ -65,7 +66,7 @@ flac_header (AVFormatContext * s, int idx)
memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
} else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4);
}
diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index 9526c3acc1..0a8a7c6bd4 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -27,6 +27,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
#include "riff.h"
@@ -81,13 +82,13 @@ ogm_header(AVFormatContext *s, int idx)
st->codec->height = bytestream_get_le32(&p);
st->codec->time_base.den = spu * 10000000;
st->codec->time_base.num = time_unit;
- av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
} else {
st->codec->channels = bytestream_get_le16(&p);
p += 2; /* block_align */
st->codec->bit_rate = bytestream_get_le32(&p) * 8;
st->codec->sample_rate = spu * 10000000 / time_unit;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
}
} else if (*p == 3) {
if (os->psize > 8)
diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c
index e318e9e718..8ae753b8ca 100644
--- a/libavformat/oggparseskeleton.c
+++ b/libavformat/oggparseskeleton.c
@@ -20,6 +20,7 @@
#include "libavcodec/bytestream.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
static int skeleton_header(AVFormatContext *s, int idx)
@@ -62,7 +63,7 @@ static int skeleton_header(AVFormatContext *s, int idx)
if (start_den) {
int base_den;
av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX);
- av_set_pts_info(st, 64, 1, base_den);
+ avpriv_set_pts_info(st, 64, 1, base_den);
os->lastpts =
st->start_time = start_time;
}
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index bbeeb20d60..435ed0cedf 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -28,6 +28,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
struct speex_params {
@@ -69,7 +70,7 @@ static int speex_header(AVFormatContext *s, int idx) {
+ FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(st->codec->extradata, p, st->codec->extradata_size);
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
} else
ff_vorbis_comment(s, &st->metadata, p, os->psize);
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index d02781f2fa..993db3ee55 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -26,6 +26,7 @@
#include "libavutil/bswap.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
+#include "internal.h"
#include "oggdec.h"
struct theora_params {
@@ -91,7 +92,7 @@ theora_header (AVFormatContext * s, int idx)
st->codec->time_base.num = 1;
st->codec->time_base.den = 25;
}
- av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 8a406976b5..ba9b348456 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -254,7 +254,7 @@ vorbis_header (AVFormatContext * s, int idx)
if (srate > 0) {
st->codec->sample_rate = srate;
- av_set_pts_info(st, 64, 1, srate);
+ avpriv_set_pts_info(st, 64, 1, srate);
}
} else if (os->buf[os->pstart] == 3) {
if (os->psize > 8 &&
diff --git a/libavformat/oma.c b/libavformat/oma.c
index eeb920553a..79aae454e5 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -41,6 +41,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/des.h"
#include "pcm.h"
@@ -343,14 +344,14 @@ static int oma_read_header(AVFormatContext *s,
AV_WL16(&edata[10], 1); // always 1
// AV_WL16(&edata[12], 0); // always 0
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
break;
case OMA_CODECID_ATRAC3P:
st->codec->channels = (codec_params >> 10) & 7;
framesize = ((codec_params & 0x3FF) * 8) + 8;
st->codec->sample_rate = srate_tab[(codec_params >> 13) & 7]*100;
st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
av_log(s, AV_LOG_ERROR, "Unsupported codec ATRAC3+!\n");
break;
case OMA_CODECID_MP3:
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 675a4b11df..2013a73b0f 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -31,6 +31,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
#define CDXA_TAG MKTAG('C', 'D', 'X', 'A')
@@ -199,7 +200,7 @@ static int str_read_packet(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, 15);
+ avpriv_set_pts_info(st, 64, 1, 15);
str->channels[channel].video_stream_index = st->index;
@@ -258,7 +259,7 @@ static int str_read_packet(AVFormatContext *s,
// st->codec->bit_rate = 0; //FIXME;
st->codec->block_align = 128;
- av_set_pts_info(st, 64, 128, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 128, st->codec->sample_rate);
}
pkt = ret_pkt;
if (av_new_packet(pkt, 2304))
diff --git a/libavformat/pva.c b/libavformat/pva.c
index 7e8fa8eb73..9ba690d73e 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "mpeg.h"
#define PVA_MAX_PAYLOAD_LENGTH 0x17f8
@@ -61,7 +62,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
st->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(st, 32, 1, 90000);
+ avpriv_set_pts_info(st, 32, 1, 90000);
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
if (!(st = avformat_new_stream(s, NULL)))
@@ -69,7 +70,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP2;
st->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(st, 33, 1, 90000);
+ avpriv_set_pts_info(st, 33, 1, 90000);
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
/* the parameters will be extracted from the compressed bitstream */
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 75fc4a4c96..874c361406 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -25,6 +25,7 @@
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
typedef struct {
unsigned video_offsets_count;
@@ -70,7 +71,7 @@ static int r3d_read_red1(AVFormatContext *s)
av_dlog(s, "unknown1 %d\n", tmp);
tmp = avio_rb32(s->pb);
- av_set_pts_info(st, 32, 1, tmp);
+ avpriv_set_pts_info(st, 32, 1, tmp);
tmp = avio_rb32(s->pb); // filenum
av_dlog(s, "filenum %d\n", tmp);
@@ -95,7 +96,7 @@ static int r3d_read_red1(AVFormatContext *s)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = CODEC_ID_PCM_S32BE;
ast->codec->channels = tmp;
- av_set_pts_info(ast, 32, 1, st->time_base.den);
+ avpriv_set_pts_info(ast, 32, 1, st->time_base.den);
}
avio_read(s->pb, filename, 257);
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 2b76985338..7d77df1199 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -21,6 +21,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "rawdec.h"
#include "libavutil/opt.h"
@@ -68,7 +69,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
assert(st->codec->bits_per_coded_sample > 0);
st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
break;
}
case AVMEDIA_TYPE_VIDEO: {
@@ -90,7 +91,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
goto fail;
}
- av_set_pts_info(st, 64, framerate.den, framerate.num);
+ avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
st->codec->width = width;
st->codec->height = height;
st->codec->pix_fmt = pix_fmt;
@@ -166,7 +167,7 @@ int ff_raw_video_read_header(AVFormatContext *s,
}
st->codec->time_base = (AVRational){framerate.den, framerate.num};
- av_set_pts_info(st, 64, 1, 1200000);
+ avpriv_set_pts_info(st, 64, 1, 1200000);
fail:
return ret;
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 743250a922..530e0dfb9a 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -35,6 +35,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette
@@ -153,10 +154,10 @@ static av_cold int rl2_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample;
st->codec->block_align = st->codec->channels *
st->codec->bits_per_coded_sample / 8;
- av_set_pts_info(st,32,1,rate);
+ avpriv_set_pts_info(st,32,1,rate);
}
- av_set_pts_info(s->streams[0], 32, pts_num, pts_den);
+ avpriv_set_pts_info(s->streams[0], 32, pts_num, pts_den);
chunk_size = av_malloc(frame_count * sizeof(uint32_t));
audio_size = av_malloc(frame_count * sizeof(uint32_t));
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 4dd93de68a..5b9bfb869a 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -23,6 +23,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
#include "rm.h"
@@ -302,7 +303,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
int64_t codec_pos;
int ret;
- av_set_pts_info(st, 64, 1, 1000);
+ avpriv_set_pts_info(st, 64, 1, 1000);
codec_pos = avio_tell(pb);
v = avio_rb32(pb);
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
@@ -333,10 +334,9 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
return ret;
- av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
+ av_reduce(&st->r_frame_rate.den, &st->r_frame_rate.num,
0x10000, fps, (1 << 30) - 1);
- st->avg_frame_rate.num = st->codec->time_base.den;
- st->avg_frame_rate.den = st->codec->time_base.num;
+ st->avg_frame_rate = st->r_frame_rate;
}
skip:
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index b8214e3604..d9b043355f 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -22,6 +22,7 @@
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include <stdlib.h>
#define RPL_SIGNATURE "ARMovie\x0A"
@@ -149,7 +150,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->bits_per_coded_sample = read_line_and_int(pb, &error); // video bits per sample
error |= read_line(pb, line, sizeof(line)); // video frames per second
fps = read_fps(line, &error);
- av_set_pts_info(vst, 32, fps.den, fps.num);
+ avpriv_set_pts_info(vst, 32, fps.den, fps.num);
// Figure out the video codec
switch (vst->codec->codec_tag) {
@@ -226,7 +227,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
"RPL audio format %i not supported yet!\n",
audio_format);
}
- av_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
+ avpriv_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
} else {
for (i = 0; i < 3; i++)
error |= read_line(pb, line, sizeof(line));
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index 0888eca217..dade0239da 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -65,7 +65,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->channels = 1;
st->codec->sample_rate = rate;
- av_set_pts_info(st, 64, 1, rate);
+ avpriv_set_pts_info(st, 64, 1, rate);
return 0;
}
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index eb468be9e5..db44443479 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -122,6 +122,7 @@ struct RTPDynamicProtocolHandler_s {
* require any custom depacketization code. */
// may be null
+ int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data); ///< Initialize dynamic protocol handler, called after the full rtpmap line is parsed
int (*parse_sdp_a_line) (AVFormatContext *s,
int st_index,
PayloadContext *priv_data,
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index b481c37c82..f08045f89d 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -33,6 +33,7 @@
#include "rtsp.h"
#include "asf.h"
#include "avio_internal.h"
+#include "internal.h"
/**
* From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not
@@ -141,7 +142,7 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
*rt->asf_ctx->streams[i]->codec;
rt->asf_ctx->streams[i]->codec->extradata_size = 0;
rt->asf_ctx->streams[i]->codec->extradata = NULL;
- av_set_pts_info(s->streams[stream_index], 32, 1, 1000);
+ avpriv_set_pts_info(s->streams[stream_index], 32, 1, 1000);
}
}
}
diff --git a/libavformat/rtpdec_g726.c b/libavformat/rtpdec_g726.c
index cde832b21a..35ca9061fd 100644
--- a/libavformat/rtpdec_g726.c
+++ b/libavformat/rtpdec_g726.c
@@ -21,74 +21,28 @@
#include "avformat.h"
#include "rtpdec_formats.h"
-static int g726_16_parse_sdp_line(AVFormatContext *s, int st_index,
- PayloadContext *data, const char *line)
-{
- AVStream *stream = s->streams[st_index];
- AVCodecContext *codec = stream->codec;
-
- codec->bit_rate = 16000;
-
- return 0;
+#define RTP_G726_HANDLER(bitrate) \
+static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadContext *data) \
+{ \
+ AVStream *stream = s->streams[st_index]; \
+ AVCodecContext *codec = stream->codec; \
+\
+ codec->bit_rate = bitrate*1000; \
+ if (codec->sample_rate) \
+ codec->bits_per_coded_sample = \
+ av_clip((codec->bit_rate + codec->sample_rate/2) / codec->sample_rate, 2, 5); \
+\
+ return 0; \
+} \
+\
+RTPDynamicProtocolHandler ff_g726_ ## bitrate ## _dynamic_handler = { \
+ .enc_name = "G726-" #bitrate, \
+ .codec_type = AVMEDIA_TYPE_AUDIO, \
+ .codec_id = CODEC_ID_ADPCM_G726, \
+ .init = g726_ ## bitrate ## _init, \
}
-static int g726_24_parse_sdp_line(AVFormatContext *s, int st_index,
- PayloadContext *data, const char *line)
-{
- AVStream *stream = s->streams[st_index];
- AVCodecContext *codec = stream->codec;
-
- codec->bit_rate = 24000;
-
- return 0;
-}
-
-static int g726_32_parse_sdp_line(AVFormatContext *s, int st_index,
- PayloadContext *data, const char *line)
-{
- AVStream *stream = s->streams[st_index];
- AVCodecContext *codec = stream->codec;
-
- codec->bit_rate = 32000;
-
- return 0;
-}
-
-static int g726_40_parse_sdp_line(AVFormatContext *s, int st_index,
- PayloadContext *data, const char *line)
-{
- AVStream *stream = s->streams[st_index];
- AVCodecContext *codec = stream->codec;
-
- codec->bit_rate = 40000;
-
- return 0;
-}
-
-RTPDynamicProtocolHandler ff_g726_16_dynamic_handler = {
- .enc_name = "G726-16",
- .codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_ADPCM_G726,
- .parse_sdp_a_line = g726_16_parse_sdp_line,
-};
-
-RTPDynamicProtocolHandler ff_g726_24_dynamic_handler = {
- .enc_name = "G726-24",
- .codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_ADPCM_G726,
- .parse_sdp_a_line = g726_24_parse_sdp_line,
-};
-
-RTPDynamicProtocolHandler ff_g726_32_dynamic_handler = {
- .enc_name = "G726-32",
- .codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_ADPCM_G726,
- .parse_sdp_a_line = g726_32_parse_sdp_line,
-};
-
-RTPDynamicProtocolHandler ff_g726_40_dynamic_handler = {
- .enc_name = "G726-40",
- .codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_ADPCM_G726,
- .parse_sdp_a_line = g726_40_parse_sdp_line,
-};
+RTP_G726_HANDLER(16);
+RTP_G726_HANDLER(24);
+RTP_G726_HANDLER(32);
+RTP_G726_HANDLER(40);
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index fd63aa7d43..33cb3dab4e 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -26,6 +26,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "rtp.h"
#include "rtpdec.h"
@@ -110,7 +111,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
(st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
tag != MKTAG('s','o','u','n')))
return AVERROR_INVALIDDATA;
- av_set_pts_info(st, 32, 1, avio_rb32(&pb));
+ avpriv_set_pts_info(st, 32, 1, avio_rb32(&pb));
if (pos + data_len > len)
return AVERROR_INVALIDDATA;
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 83f728bc37..73ac76fae7 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -130,7 +130,7 @@ static int rtp_write_header(AVFormatContext *s1)
}
}
- av_set_pts_info(st, 32, 1, 90000);
+ avpriv_set_pts_info(st, 32, 1, 90000);
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
case CODEC_ID_MP3:
@@ -166,7 +166,7 @@ static int rtp_write_header(AVFormatContext *s1)
case CODEC_ID_ADPCM_G722:
/* Due to a historical error, the clock rate for G722 in RTP is
* 8000, even if the sample rate is 16000. See RFC 3551. */
- av_set_pts_info(st, 32, 1, 8000);
+ avpriv_set_pts_info(st, 32, 1, 8000);
break;
case CODEC_ID_AMR_NB:
case CODEC_ID_AMR_WB:
@@ -190,7 +190,7 @@ static int rtp_write_header(AVFormatContext *s1)
default:
defaultcase:
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- av_set_pts_info(st, 32, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
}
s->buf_ptr = s->buf;
break;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 18ec8a5edc..24be912045 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -228,7 +228,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;
if (i > 0) {
codec->sample_rate = i;
- av_set_pts_info(st, 32, 1, codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1, codec->sample_rate);
get_word_sep(buf, sizeof(buf), "/", &p);
i = atoi(buf);
if (i > 0)
@@ -246,11 +246,14 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
case AVMEDIA_TYPE_VIDEO:
av_log(s, AV_LOG_DEBUG, "video codec set to: %s\n", c_name);
if (i > 0)
- av_set_pts_info(st, 32, 1, i);
+ avpriv_set_pts_info(st, 32, 1, i);
break;
default:
break;
}
+ if (rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->init)
+ rtsp_st->dynamic_handler->init(s, st->index,
+ rtsp_st->dynamic_protocol_context);
return 0;
}
@@ -382,11 +385,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
ff_rtp_get_codec_info(st->codec, rtsp_st->sdp_payload_type);
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
st->codec->sample_rate > 0)
- av_set_pts_info(st, 32, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
/* Even static payload types may need a custom depacketizer */
handler = ff_rtp_handler_find_by_id(
rtsp_st->sdp_payload_type, st->codec->codec_type);
init_rtp_handler(handler, rtsp_st, st->codec);
+ if (handler && handler->init)
+ handler->init(s, st->index,
+ rtsp_st->dynamic_protocol_context);
}
}
/* put a default control url */
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 8a49bef1dc..17b118a91c 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define FILM_TAG MKBETAG('F', 'I', 'L', 'M')
#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
@@ -197,7 +198,7 @@ static int film_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
for(i=0; i<s->nb_streams; i++)
- av_set_pts_info(s->streams[i], 33, 1, film->base_clock);
+ avpriv_set_pts_info(s->streams[i], 33, 1, film->base_clock);
audio_frame_counter = 0;
for (i = 0; i < film->sample_count; i++) {
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index e1367c29ae..faf97b2d6a 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define VMD_HEADER_SIZE 0x0330
#define BYTES_PER_FRAME_RECORD 16
@@ -107,7 +108,7 @@ static int vmd_read_header(AVFormatContext *s,
vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
- av_set_pts_info(vst, 33, 1, 10);
+ avpriv_set_pts_info(vst, 33, 1, 10);
vmd->video_stream_index = vst->index;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = vmd->is_indeo3 ? CODEC_ID_INDEO3 : CODEC_ID_VMDVIDEO;
@@ -148,8 +149,8 @@ static int vmd_read_header(AVFormatContext *s,
num = st->codec->block_align;
den = st->codec->sample_rate * st->codec->channels;
av_reduce(&den, &num, den, num, (1UL<<31)-1);
- av_set_pts_info(vst, 33, num, den);
- av_set_pts_info(st, 33, num, den);
+ avpriv_set_pts_info(vst, 33, num, den);
+ avpriv_set_pts_info(st, 33, num, den);
}
toc_offset = AV_RL32(&vmd->vmd_header[812]);
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 77cbc66804..a8d63ee1c0 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
enum SIFFTags{
TAG_SIFF = MKTAG('S', 'I', 'F', 'F'),
@@ -80,7 +81,7 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
ast->codec->bits_per_coded_sample = c->bits;
ast->codec->sample_rate = c->rate;
ast->codec->frame_size = c->block_align;
- av_set_pts_info(ast, 16, 1, c->rate);
+ avpriv_set_pts_info(ast, 16, 1, c->rate);
return 0;
}
@@ -124,7 +125,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
st->codec->width = width;
st->codec->height = height;
st->codec->pix_fmt = PIX_FMT_PAL8;
- av_set_pts_info(st, 16, 1, 12);
+ avpriv_set_pts_info(st, 16, 1, 12);
c->cur_frame = 0;
c->has_video = 1;
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 3ffb65eee0..b3de8c7690 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -26,6 +26,7 @@
#include "libavutil/bswap.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define SMACKER_PAL 0x01
#define SMACKER_FLAG_RING_FRAME 0x01
@@ -171,7 +172,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
smk->pts_inc *= 100;
tbase = 100000;
av_reduce(&tbase, &smk->pts_inc, tbase, smk->pts_inc, (1UL<<31)-1);
- av_set_pts_info(st, 33, smk->pts_inc, tbase);
+ avpriv_set_pts_info(st, 33, smk->pts_inc, tbase);
st->duration = smk->frames;
/* handle possible audio streams */
for(i = 0; i < 7; i++) {
@@ -195,7 +196,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast[i]->codec->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8;
if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == CODEC_ID_PCM_U8)
ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
- av_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
+ avpriv_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
* ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8);
}
}
diff --git a/libavformat/sol.c b/libavformat/sol.c
index 7faa4e78b8..f9adeaddc7 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "pcm.h"
/* if we don't know the size in advance */
@@ -117,7 +118,7 @@ static int sol_read_header(AVFormatContext *s,
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
- av_set_pts_info(st, 64, 1, rate);
+ avpriv_set_pts_info(st, 64, 1, rate);
return 0;
}
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index dac4bedfb3..45607ec666 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -33,6 +33,7 @@
#include "libavutil/intfloat_readwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "pcm.h"
#include "sox.h"
@@ -117,7 +118,7 @@ static int sox_read_header(AVFormatContext *s,
st->codec->block_align = st->codec->bits_per_coded_sample *
st->codec->channels / 8;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 2828cc7af3..84e885d21e 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -45,7 +45,7 @@ static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return -1;
- av_set_pts_info(st, 64, 1, 1000);
+ avpriv_set_pts_info(st, 64, 1, 1000);
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = CODEC_ID_SRT;
return 0;
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 175e40ee19..c0b2e1759b 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -112,7 +112,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
vst->id = ch_id;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
- av_set_pts_info(vst, 16, 256, swf->frame_rate);
+ avpriv_set_pts_info(vst, 16, 256, swf->frame_rate);
vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
len -= 8;
} else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) {
@@ -141,7 +141,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
ast->codec->sample_rate = 5512;
else
ast->codec->sample_rate = 11025 << (sample_rate_code-1);
- av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+ avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
len -= 4;
} else if (tag == TAG_VIDEOFRAME) {
int ch_id = avio_rl16(pb);
@@ -185,7 +185,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_MJPEG;
- av_set_pts_info(vst, 64, 256, swf->frame_rate);
+ avpriv_set_pts_info(vst, 64, 256, swf->frame_rate);
vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
st = vst;
}
diff --git a/libavformat/thp.c b/libavformat/thp.c
index e2aba3bc32..96f9ba115c 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
+#include "internal.h"
typedef struct ThpDemuxContext {
int version;
@@ -100,7 +101,7 @@ static int thp_read_header(AVFormatContext *s,
/* The denominator and numerator are switched because 1/fps
is required. */
- av_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
+ avpriv_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_THP;
st->codec->codec_tag = 0; /* no fourcc */
@@ -127,7 +128,7 @@ static int thp_read_header(AVFormatContext *s,
st->codec->channels = avio_rb32(pb); /* numChannels. */
st->codec->sample_rate = avio_rb32(pb); /* Frequency. */
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
thp->audio_stream_index = st->index;
thp->has_audio = 1;
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index dfed70ceae..4e845d777c 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -25,6 +25,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#define SEQ_FRAME_SIZE 6144
#define SEQ_FRAME_W 256
@@ -210,7 +211,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, SEQ_FRAME_RATE);
+ avpriv_set_pts_info(st, 32, 1, SEQ_FRAME_RATE);
seq->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_TIERTEXSEQVIDEO;
@@ -223,7 +224,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE);
+ avpriv_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE);
seq->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_PCM_S16BE;
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 03d6e08f0e..7f7a136a53 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -28,6 +28,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
enum {
TMV_PADDING = 0x01,
@@ -115,7 +116,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate *
ast->codec->bits_per_coded_sample;
- av_set_pts_info(ast, 32, 1, ast->codec->sample_rate);
+ avpriv_set_pts_info(ast, 32, 1, ast->codec->sample_rate);
fps.num = ast->codec->sample_rate * ast->codec->channels;
fps.den = tmv->audio_chunk_size;
@@ -126,7 +127,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->pix_fmt = PIX_FMT_PAL8;
vst->codec->width = char_cols * 8;
vst->codec->height = char_rows * 8;
- av_set_pts_info(vst, 32, fps.den, fps.num);
+ avpriv_set_pts_info(vst, 32, fps.den, fps.num);
if (features & TMV_PADDING)
tmv->padding =
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 470ee2bf1a..af9476ecc0 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -21,6 +21,7 @@
#include "libavcodec/get_bits.h"
#include "avformat.h"
+#include "internal.h"
#include "id3v1.h"
#include "libavutil/dict.h"
@@ -81,7 +82,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, samplerate);
+ avpriv_set_pts_info(st, 64, 1, samplerate);
st->start_time = 0;
st->duration = datalen;
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 5c9fee7908..6780c50216 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -31,6 +31,7 @@
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avformat.h"
+#include "internal.h"
#include "sauce.h"
typedef struct {
@@ -97,7 +98,7 @@ static int read_header(AVFormatContext *avctx,
}
st->codec->width = width;
st->codec->height = height;
- av_set_pts_info(st, 60, framerate.den, framerate.num);
+ avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
/* simulate tty display speed */
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 13d7928818..0ac6860444 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -869,7 +869,10 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
*pden = 0;
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- if(st->time_base.num*1000LL > st->time_base.den){
+ if (st->r_frame_rate.num && !pc) {
+ *pnum = st->r_frame_rate.den;
+ *pden = st->r_frame_rate.num;
+ } else if(st->time_base.num*1000LL > st->time_base.den) {
*pnum = st->time_base.num;
*pden = st->time_base.den;
}else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){
@@ -2851,7 +2854,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
st->probe_packets = MAX_PROBE_PACKETS;
/* default pts setting is MPEG-like */
- av_set_pts_info(st, 33, 1, 90000);
+ avpriv_set_pts_info(st, 33, 1, 90000);
st->last_IP_pts = AV_NOPTS_VALUE;
for(i=0; i<MAX_REORDER_DELAY+1; i++)
st->pts_buffer[i]= AV_NOPTS_VALUE;
@@ -3964,9 +3967,17 @@ int ff_hex_to_data(uint8_t *data, const char *p)
return len;
}
+#if FF_API_SET_PTS_INFO
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
unsigned int pts_num, unsigned int pts_den)
{
+ avpriv_set_pts_info(s, pts_wrap_bits, pts_num, pts_den);
+}
+#endif
+
+void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
+ unsigned int pts_num, unsigned int pts_den)
+{
AVRational new_tb;
if(av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)){
if(new_tb.num != pts_num)
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index ed72119188..b6d9fb9e30 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -28,6 +28,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define VC1_EXTRADATA_SIZE 4
@@ -71,13 +72,13 @@ static int vc1t_read_header(AVFormatContext *s,
avio_skip(pb, 8);
fps = avio_rl32(pb);
if(fps == 0xFFFFFFFF)
- av_set_pts_info(st, 32, 1, 1000);
+ avpriv_set_pts_info(st, 32, 1, 1000);
else{
if (!fps) {
av_log(s, AV_LOG_ERROR, "Zero FPS specified, defaulting to 1 FPS\n");
fps = 1;
}
- av_set_pts_info(st, 24, 1, fps);
+ avpriv_set_pts_info(st, 24, 1, fps);
st->duration = frames;
}
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index 20580fb3cf..b1ed43d62e 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "internal.h"
typedef struct RCVContext {
int frames;
@@ -47,7 +48,7 @@ static int vc1test_write_header(AVFormatContext *s)
avio_wl32(pb, s->streams[0]->r_frame_rate.den);
else
avio_wl32(pb, 0xFFFFFFFF); //variable framerate
- av_set_pts_info(s->streams[0], 32, 1, 1000);
+ avpriv_set_pts_info(s->streams[0], 32, 1, 1000);
return 0;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index c98ff60399..087fab960f 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -116,5 +116,8 @@
#ifndef FF_API_OLD_INTERRUPT_CB
#define FF_API_OLD_INTERRUPT_CB (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_SET_PTS_INFO
+#define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif /* AVFORMAT_VERSION_H */
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index b05eb05249..778509b737 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
@@ -192,7 +193,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
/* put first 12 bytes of COMM chunk in extradata */
if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE)))
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 20dd4c9f71..053c855fd4 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -29,6 +29,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
+#include "internal.h"
#include "avio_internal.h"
#include "pcm.h"
#include "riff.h"
@@ -137,7 +138,7 @@ static int wav_write_header(AVFormatContext *s)
if (wav->write_bext)
bwf_write_bext_chunk(s);
- av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
+ avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
wav->maxpts = wav->last_duration = 0;
wav->minpts = INT64_MAX;
@@ -288,7 +289,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)
return ret;
(*st)->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
+ avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
return 0;
}
@@ -751,7 +752,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->need_parsing = AVSTREAM_PARSE_FULL;
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
size = find_guid(pb, guid_data);
if (size < 0) {
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 9190a1a035..4d800cd322 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -30,6 +30,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#define FORM_TAG MKTAG('F', 'O', 'R', 'M')
#define MOVE_TAG MKTAG('M', 'O', 'V', 'E')
@@ -166,7 +167,7 @@ static int wc3_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
+ avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_XAN_WC3;
@@ -177,7 +178,7 @@ static int wc3_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
+ avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index 95aba13354..d39c4c695e 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -35,6 +35,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define AUD_HEADER_SIZE 12
#define AUD_CHUNK_PREAMBLE_SIZE 8
@@ -147,7 +148,7 @@ static int wsaud_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
+ avpriv_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = wsaud->audio_type;
st->codec->codec_tag = 0; /* no tag */
@@ -224,7 +225,7 @@ static int wsvqa_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
+ avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
wsvqa->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_WS_VQA;
@@ -250,7 +251,7 @@ static int wsvqa_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
- av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
+ avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (AV_RL16(&header[0]) == 1)
st->codec->codec_id = CODEC_ID_WESTWOOD_SND1;
diff --git a/libavformat/wv.c b/libavformat/wv.c
index 72c8df0f24..33f69d8a1f 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -23,6 +23,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "apetag.h"
#include "id3v1.h"
@@ -229,7 +230,7 @@ static int wv_read_header(AVFormatContext *s,
st->codec->channel_layout = wc->chmask;
st->codec->sample_rate = wc->rate;
st->codec->bits_per_coded_sample = wc->bpp;
- av_set_pts_info(st, 64, 1, wc->rate);
+ avpriv_set_pts_info(st, 64, 1, wc->rate);
st->start_time = 0;
st->duration = wc->samples;
diff --git a/libavformat/xa.c b/libavformat/xa.c
index dd7811dd91..8432ea6b99 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#define XA00_TAG MKTAG('X', 'A', 0, 0)
#define XAI0_TAG MKTAG('X', 'A', 'I', 0)
@@ -86,7 +87,7 @@ static int xa_read_header(AVFormatContext *s,
st->codec->block_align = avio_rl16(pb);
st->codec->bits_per_coded_sample = avio_rl16(pb);
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index aeafcb6904..f01e0aa77b 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -30,6 +30,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
/** The min size of an XMV header. */
@@ -151,7 +152,7 @@ static int xmv_read_header(AVFormatContext *s,
if (!vst)
return AVERROR(ENOMEM);
- av_set_pts_info(vst, 32, 1, 1000);
+ avpriv_set_pts_info(vst, 32, 1, 1000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_WMV2;
@@ -215,7 +216,7 @@ static int xmv_read_header(AVFormatContext *s,
ast->codec->bit_rate = packet->bit_rate;
ast->codec->block_align = 36 * packet->channels;
- av_set_pts_info(ast, 32, packet->block_samples, packet->sample_rate);
+ avpriv_set_pts_info(ast, 32, packet->block_samples, packet->sample_rate);
packet->stream_index = ast->index;
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 94208abc47..a4e53fa2d2 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -22,6 +22,7 @@
#include <inttypes.h>
#include "avformat.h"
+#include "internal.h"
#include "riff.h"
/*
@@ -115,7 +116,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* set the sample rate */
- av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
/* parse the remaining RIFF chunks */
for (;;) {
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 8cadf125a2..dac49d4dd2 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
typedef struct yop_dec_context {
AVPacket video_packet;
@@ -105,7 +106,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_seek(pb, 2048, SEEK_SET);
- av_set_pts_info(video_stream, 32, 1, frame_rate);
+ avpriv_set_pts_info(video_stream, 32, 1, frame_rate);
return 0;
}
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 97d2261a93..6db51968e7 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "internal.h"
#define Y4M_MAGIC "YUV4MPEG2"
#define Y4M_FRAME_MAGIC "FRAME"
@@ -339,7 +340,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->width = width;
st->codec->height = height;
av_reduce(&raten, &rated, raten, rated, (1UL<<31)-1);
- av_set_pts_info(st, 64, rated, raten);
+ avpriv_set_pts_info(st, 64, rated, raten);
st->codec->pix_fmt = pix_fmt;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;