1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-21 15:27:00 +00:00

command: make bitrate properties work correctly for external tracks

This commit is contained in:
wm4 2015-10-23 14:58:01 +02:00
parent 955c6843b6
commit 56fefde7e2

View File

@ -3087,11 +3087,16 @@ static int mp_property_packet_bitrate(void *ctx, struct m_property *prop,
int type = (uintptr_t)prop->priv & ~0x100;
bool old = (uintptr_t)prop->priv & 0x100;
if (!mpctx->demuxer)
struct demuxer *demuxer = NULL;
if (mpctx->current_track[0][type])
demuxer = mpctx->current_track[0][type]->demuxer;
if (!demuxer)
demuxer = mpctx->demuxer;
if (!demuxer)
return M_PROPERTY_UNAVAILABLE;
double r[STREAM_TYPE_COUNT];
if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_BITRATE_STATS, &r) < 1)
if (demux_control(demuxer, DEMUXER_CTRL_GET_BITRATE_STATS, &r) < 1)
return M_PROPERTY_UNAVAILABLE;
if (r[type] < 0)
return M_PROPERTY_UNAVAILABLE;