* 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>tags/n0.9
| @@ -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: | |||
| @@ -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) / | |||
| @@ -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); | |||
| @@ -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); | |||
| @@ -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] = { | |||
| @@ -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); | |||
| } | |||
| @@ -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); | |||
| @@ -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; | |||
| @@ -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) | |||
| @@ -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; | |||
| } | |||
| @@ -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]; | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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) / | |||
| @@ -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; | |||
| } | |||
| @@ -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) { | |||
| @@ -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); | |||
| @@ -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) { | |||
| @@ -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); | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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); | |||
| @@ -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; | |||
| } | |||
| @@ -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 */ | |||
| @@ -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; | |||
| @@ -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); | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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 | |||
| @@ -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)); | |||
| @@ -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 */ | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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); | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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 */ | |||
| @@ -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) | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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){ | |||
| @@ -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 | |||
| @@ -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; | |||
| @@ -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 */ | |||
| @@ -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 */ | |||
| @@ -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 */ | |||
| @@ -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); | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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) | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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: | |||
| @@ -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; | |||
| @@ -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 */ | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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); | |||
| @@ -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; | |||
| @@ -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); | |||
| @@ -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) { | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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) { | |||
| @@ -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){ | |||
| @@ -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); | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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: | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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 */ | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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"); | |||
| @@ -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"); | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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 | |||
| @@ -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; | |||
| } | |||
| @@ -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))){ | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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 && | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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); | |||
| } | |||
| @@ -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) | |||