summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/av_common.c8
-rw-r--r--mpvcore/av_common.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/mpvcore/av_common.c b/mpvcore/av_common.c
index 3e3caa8f0d..d233071c23 100644
--- a/mpvcore/av_common.c
+++ b/mpvcore/av_common.c
@@ -91,12 +91,10 @@ void mp_set_av_packet(AVPacket *dst, struct demux_packet *mpkt)
// Return the pts/dts from a frame returned by libavcodec. Note that this
// assumes libavcodec was fed a packet setup with mp_set_av_packet()! If not,
// the timestamps might contain garbage.
-// Normally, this returns the pts. If the pts is unknown, return dts instead.
-double mp_get_av_frame_pkt_pdts(AVFrame *frame)
+void mp_get_av_frame_pkt_ts(AVFrame *frame, double *out_pts, double *out_dts)
{
- double pts = (union pts){.i = frame->pkt_pts}.d;
- double dts = (union pts){.i = frame->pkt_dts}.d;
- return pts == MP_NOPTS_VALUE ? dts : pts;
+ *out_pts = (union pts){.i = frame->pkt_pts}.d;
+ *out_dts = (union pts){.i = frame->pkt_dts}.d;
}
void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type)
diff --git a/mpvcore/av_common.h b/mpvcore/av_common.h
index 683570971d..103185329c 100644
--- a/mpvcore/av_common.h
+++ b/mpvcore/av_common.h
@@ -26,7 +26,7 @@ struct demux_packet;
void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st);
void mp_set_av_packet(AVPacket *dst, struct demux_packet *mpkt);
-double mp_get_av_frame_pkt_pdts(AVFrame *frame);
+void mp_get_av_frame_pkt_ts(AVFrame *frame, double *out_pts, double *out_dts);
void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type);
int mp_codec_to_av_codec_id(const char *codec);
const char *mp_codec_from_av_codec_id(int codec_id);