1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-27 10:50:53 +00:00

ad_lavc: add codec_timebase hack too

vd_lavc.c had this, and soon I'll need it in ad_lavc.c too. For now it's
unused.
This commit is contained in:
wm4 2016-03-24 16:39:15 +01:00
parent b34befbab8
commit f0febc35eb

View File

@ -45,6 +45,7 @@ struct priv {
uint32_t skip_samples, trim_samples; uint32_t skip_samples, trim_samples;
bool preroll_done; bool preroll_done;
double next_pts; double next_pts;
AVRational codec_timebase;
}; };
static void uninit(struct dec_audio *da); static void uninit(struct dec_audio *da);
@ -84,6 +85,8 @@ static int init(struct dec_audio *da, const char *decoder)
struct priv *ctx = talloc_zero(NULL, struct priv); struct priv *ctx = talloc_zero(NULL, struct priv);
da->priv = ctx; da->priv = ctx;
ctx->codec_timebase = (AVRational){0};
ctx->force_channel_map = c->force_channels; ctx->force_channel_map = c->force_channels;
lavc_codec = avcodec_find_decoder_by_name(decoder); lavc_codec = avcodec_find_decoder_by_name(decoder);
@ -185,7 +188,7 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
int in_len = mpkt ? mpkt->len : 0; int in_len = mpkt ? mpkt->len : 0;
AVPacket pkt; AVPacket pkt;
mp_set_av_packet(&pkt, mpkt, NULL); mp_set_av_packet(&pkt, mpkt, &priv->codec_timebase);
int got_frame = 0; int got_frame = 0;
av_frame_unref(priv->avframe); av_frame_unref(priv->avframe);
@ -212,7 +215,7 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
if (!got_frame) if (!got_frame)
return 0; return 0;
double out_pts = mp_pts_from_av(priv->avframe->pkt_pts, NULL); double out_pts = mp_pts_from_av(priv->avframe->pkt_pts, &priv->codec_timebase);
struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe); struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe);
if (!mpframe) if (!mpframe)