summaryrefslogtreecommitdiff
path: root/omxdevice.c
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2014-09-28 15:01:44 +0200
committerThomas Reufer <thomas@reufer.ch>2014-09-28 15:01:44 +0200
commit5a73a92a76ad61062495b37df63cc174de44092c (patch)
tree58a4f5e4036f9f73db3f94e1ad4fa9b54869b595 /omxdevice.c
parentf15d6ed1587112728dba4412091cfff53a60f7d0 (diff)
downloadvdr-plugin-rpihddevice-5a73a92a76ad61062495b37df63cc174de44092c.tar.gz
vdr-plugin-rpihddevice-5a73a92a76ad61062495b37df63cc174de44092c.tar.bz2
skip audio substream header for PES recordings with AC3 audio track
Diffstat (limited to 'omxdevice.c')
-rw-r--r--omxdevice.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/omxdevice.c b/omxdevice.c
index 23a6475..0a01a9c 100644
--- a/omxdevice.c
+++ b/omxdevice.c
@@ -254,10 +254,25 @@ int cOmxDevice::PlayAudio(const uchar *Data, int Length, uchar Id)
if (Transferring() && pts)
UpdateLatency(pts);
+ int ret = Length;
+ int length = Length - PesPayloadOffset(Data);
+
// ignore packets with invalid payload offset
- int ret = (Length - PesPayloadOffset(Data) < 0) ||
- m_audio->WriteData(Data + PesPayloadOffset(Data),
- Length - PesPayloadOffset(Data), pts) ? Length : 0;
+ if (length > 0)
+ {
+ const uchar *data = Data + PesPayloadOffset(Data);
+
+ // remove audio substream header as seen in PES recordings with AC3
+ // audio track (0x80: AC3, 0x88: DTS, 0xA0: LPCM)
+ if ((data[0] == 0x80 || data[0] == 0x88 || data[0] == 0xa0)
+ && data[0] == Id)
+ {
+ data += 4;
+ length -= 4;
+ }
+ if (!m_audio->WriteData(data, length, pts))
+ ret = 0;
+ }
m_mutex->Unlock();
return ret;