116 if (!
s->prev_inpkt || !
s->prev_outpkt || !
s->cur_pkt)
147 if (
s->time_base.num > 0 &&
s->time_base.den > 0) {
148 ctx->time_base_out =
s->time_base;
150 }
else if (
s->time_base.num || !
s->time_base.den) {
151 av_log(
ctx,
AV_LOG_ERROR,
"Invalid value %d/%d specified for output timebase\n",
s->time_base.num,
s->time_base.den);
161 s->var_values[
VAR_SR] =
ctx->par_in->sample_rate;
163 if (
s->user_outtb &&
s->prescale)
171#define PRESCALED(x) ( s->prescale ? av_rescale_q(x, ctx->time_base_in, ctx->time_base_out) : x )
176 int64_t new_ts, new_pts, new_dts, new_duration;
180 if (ret < 0 && (ret !=
AVERROR_EOF || !
s->cur_pkt->data))
183 if (!
s->cur_pkt->data) {
194 s->var_values[
VAR_N] =
s->frame_number++;
196 s->var_values[
VAR_POS] =
s->cur_pkt->pos;
236 if (
s->user_outtb && !
s->prescale) {
244 pkt->duration = new_duration;
268 s->duration_expr =
NULL;
271#define OFFSET(x) offsetof(SetTSContext, x)
272#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_SUBTITLE_PARAM|AV_OPT_FLAG_BSF_PARAM)
285 .class_name =
"setts_bsf",
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
const FFBitStreamFilter ff_setts_bsf
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
int(* init)(AVBSFContext *ctx)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
simple arithmetic expression evaluator
static const FLOAT prescale[64]
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
static const char *const var_names[]
static int setts_init(AVBSFContext *ctx)
static const AVClass setts_class
static int setts_filter(AVBSFContext *ctx, AVPacket *pkt)
static void setts_close(AVBSFContext *bsf)
The bitstream filter state.
void * priv_data
Opaque filter-specific private data.
Describe the class of an AVClass context structure.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
double var_values[VAR_VARS_NB]
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static void ts_str(char buffer[60], int64_t ts, AVRational base)