History

avformat/imf: refactor to use ff_rescale_interval()

Pierre-Anthony Lemieux committed 4 years ago

Commit f409c781 parent 8744b101 file · +6 −14Browse files

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/imfdec.c+6−14
@@ -904,14 +904,6 @@ static int imf_probe(const AVProbeData *p) · 903 unmodified lines
904 return AVPROBE_SCORE_MAX;904 return AVPROBE_SCORE_MAX;
905}905}
906 906
907static void rescale_interval(AVRational tb_in, AVRational tb_out,
908 int64_t *min_ts, int64_t *ts, int64_t *max_ts)
909{
910 *ts = av_rescale_q(*ts, tb_in, tb_out);
911 *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
912 *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
913}
914
915static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb)907static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb)
916{908{
917 int dst_num;909 int dst_num;
@@ -937,13 +929,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, · 19 unmodified lines
937 929
938 /* rescale timestamps to Composition edit units */930 /* rescale timestamps to Composition edit units */
939 if (stream_index < 0)931 if (stream_index < 0)
940 rescale_interval(AV_TIME_BASE_Q,932 ff_rescale_interval(AV_TIME_BASE_Q,
941 av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),933 av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
942 &min_ts, &ts, &max_ts);934 &min_ts, &ts, &max_ts);
943 else935 else
944 rescale_interval(s->streams[stream_index]->time_base,936 ff_rescale_interval(s->streams[stream_index]->time_base,
945 av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),937 av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
946 &min_ts, &ts, &max_ts);938 &min_ts, &ts, &max_ts);
947 939
948 /* requested timestamp bounds are too close */940 /* requested timestamp bounds are too close */
949 if (max_ts < min_ts)941 if (max_ts < min_ts)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t