From b1f79f797bec0b21c2afab3cceb8c96db5e955dd Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 3 Apr 2018 21:41:49 +0300 Subject: [PATCH] Select a correct audio/dolby track. --- codec.h | 3 ++- vaapidevice.cpp | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/codec.h b/codec.h index 55c19e78..6091393a 100644 --- a/codec.h +++ b/codec.h @@ -117,5 +117,6 @@ extern int device_read_audio_data(void *opaque, unsigned char *data, int size); /// Set buffering mode for callback from codec extern void device_set_mode(int mode); - /// Get Videotype from vdr for codec + /// Get Video/Audiotype from vdr for codec extern int device_get_vtype(); +extern int device_get_atype(); diff --git a/vaapidevice.cpp b/vaapidevice.cpp index 8ffaec02..bf89dd5a 100644 --- a/vaapidevice.cpp +++ b/vaapidevice.cpp @@ -2123,10 +2123,16 @@ int cVaapiDevice::DeviceGetVtype() int cVaapiDevice::DeviceGetAtype() { - if (!cDevice::IsPlayingVideo()) - return -1; + eTrackType track = GetCurrentAudioTrack(); + + if (IS_AUDIO_TRACK(track)) { + return PatPmtParser()->Atype(int(track - ttAudioFirst)); + } + else if (IS_DOLBY_TRACK(track)) { + return PatPmtParser()->Dtype(int(track - ttDolbyFirst)); + } - return PatPmtParser()->Atype(0); // FIXME: is this always the stream that is being played + return -1; } void cVaapiDevice::DeviceSetMode(int mode) @@ -2252,6 +2258,15 @@ extern "C" int device_get_vtype() return MyDevice->DeviceGetVtype(); } +extern "C" int device_get_atype() +{ + if (!MyDevice) { + return 0; + } + + return MyDevice->DeviceGetAtype(); +} + /** ** Call rgb to jpeg for C Plugin. */