aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-15 21:03:03 +0200
committerMax Kellermann <max@duempel.org>2011-09-15 21:23:48 +0200
commit9aa91e0f171d63015a70b0f74335333bb4735763 (patch)
tree891756dfd69325b218c30c8e001d873ebb3d7f03 /src
parent5aabee89967cf367e4128eedd60c8916459042c7 (diff)
downloadmpd-9aa91e0f171d63015a70b0f74335333bb4735763.tar.gz
mpd-9aa91e0f171d63015a70b0f74335333bb4735763.tar.xz
mpd-9aa91e0f171d63015a70b0f74335333bb4735763.zip
decoder/ffmpeg: move formula to time_from_ffmpeg()
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_decoder_plugin.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c
index 9e8f2c00d..484796fe3 100644
--- a/src/decoder/ffmpeg_decoder_plugin.c
+++ b/src/decoder/ffmpeg_decoder_plugin.c
@@ -214,6 +214,15 @@ align16(void *p, size_t *length_p)
return (char *)p + add;
}
+G_GNUC_CONST
+static double
+time_from_ffmpeg(int64_t t, const AVRational time_base)
+{
+ assert(t != (int64_t)AV_NOPTS_VALUE);
+
+ return av_rescale_q(t, time_base, (AVRational){1, 1});
+}
+
static enum decoder_command
ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
const AVPacket *packet,
@@ -222,8 +231,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
{
if (packet->pts != (int64_t)AV_NOPTS_VALUE)
decoder_timestamp(decoder,
- av_rescale_q(packet->pts, *time_base,
- (AVRational){1, 1}));
+ time_from_ffmpeg(packet->pts, *time_base));
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0)
AVPacket packet2 = *packet;