You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/utils: Move avpriv_set_pts_info() to avformat.c
It is an essential auxiliary function for both demuxing and muxing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -663,6 +663,32 @@ AVRational av_stream_get_codec_timebase(const AVStream *st)
|
|||||||
return cffstream(st)->avctx->time_base;
|
return cffstream(st)->avctx->time_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
|
||||||
|
unsigned int pts_num, unsigned int pts_den)
|
||||||
|
{
|
||||||
|
FFStream *const sti = ffstream(st);
|
||||||
|
AVRational new_tb;
|
||||||
|
if (av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)) {
|
||||||
|
if (new_tb.num != pts_num)
|
||||||
|
av_log(NULL, AV_LOG_DEBUG,
|
||||||
|
"st:%d removing common factor %d from timebase\n",
|
||||||
|
st->index, pts_num / new_tb.num);
|
||||||
|
} else
|
||||||
|
av_log(NULL, AV_LOG_WARNING,
|
||||||
|
"st:%d has too large timebase, reducing\n", st->index);
|
||||||
|
|
||||||
|
if (new_tb.num <= 0 || new_tb.den <= 0) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
|
"Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
|
||||||
|
new_tb.num, new_tb.den,
|
||||||
|
st->index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
st->time_base = new_tb;
|
||||||
|
sti->avctx->pkt_timebase = new_tb;
|
||||||
|
st->pts_wrap_bits = pts_wrap_bits;
|
||||||
|
}
|
||||||
|
|
||||||
const AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
|
const AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
|
||||||
enum AVCodecID codec_id)
|
enum AVCodecID codec_id)
|
||||||
{
|
{
|
||||||
|
@@ -530,32 +530,6 @@ int ff_hex_to_data(uint8_t *data, const char *p)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
|
|
||||||
unsigned int pts_num, unsigned int pts_den)
|
|
||||||
{
|
|
||||||
FFStream *const sti = ffstream(st);
|
|
||||||
AVRational new_tb;
|
|
||||||
if (av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)) {
|
|
||||||
if (new_tb.num != pts_num)
|
|
||||||
av_log(NULL, AV_LOG_DEBUG,
|
|
||||||
"st:%d removing common factor %d from timebase\n",
|
|
||||||
st->index, pts_num / new_tb.num);
|
|
||||||
} else
|
|
||||||
av_log(NULL, AV_LOG_WARNING,
|
|
||||||
"st:%d has too large timebase, reducing\n", st->index);
|
|
||||||
|
|
||||||
if (new_tb.num <= 0 || new_tb.den <= 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR,
|
|
||||||
"Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
|
|
||||||
new_tb.num, new_tb.den,
|
|
||||||
st->index);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
st->time_base = new_tb;
|
|
||||||
sti->avctx->pkt_timebase = new_tb;
|
|
||||||
st->pts_wrap_bits = pts_wrap_bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
|
void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
|
||||||
void *context)
|
void *context)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user