From f131c8c79dfe9a36a5e332f5c27f5685028ccbc3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 10 Nov 2001 13:41:22 +0100 Subject: Added MPEG audio support for DVD --- HISTORY | 1 + dvbapi.c | 25 +++---------------------- dvd.c | 23 ++++++++++++++++++++++- dvd.h | 11 ++++++++++- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/HISTORY b/HISTORY index a1e79e9a..0628970f 100644 --- a/HISTORY +++ b/HISTORY @@ -871,3 +871,4 @@ Video Disk Recorder Revision History - Changed version numbering scheme. - Fixed several channel definitions in 'channels.conf' (thanks to Thilo Wunderlich). +- Added MPEG audio support for DVD (thanks to Andreas Schultz). diff --git a/dvbapi.c b/dvbapi.c index f72782b4..12ff9486 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.137 2001/11/04 12:05:36 kls Exp $ + * $Id: dvbapi.c 1.138 2001/11/10 13:35:22 kls Exp $ */ //#define DVDDEBUG 1 @@ -1348,9 +1348,6 @@ bool cReplayBuffer::NextFile(uchar FileNumber, int FileOffset) #define cOUTPACK 5 #define cOUTFRAMES 6 -#define aAC3 0x80 -#define aLPCM 0xA0 - // --- cAC3toPCM ------------------------------------------------------------- class cAC3toPCM { @@ -1574,28 +1571,12 @@ cDVDplayBuffer::~cDVDplayBuffer() unsigned int cDVDplayBuffer::getAudioStream(unsigned int StreamId) { - unsigned int trackID; - - if ((cyclestate < cOPENCHAPTER) || (StreamId > 7)) + if (cyclestate < cOPENCHAPTER || StreamId > 7) return 0; if (!(cur_pgc->audio_control[StreamId] & 0x8000)) return 0; int track = (cur_pgc->audio_control[StreamId] >> 8) & 0x07; - switch (vts_file->vtsi_mat->vts_audio_attr[track].audio_format) { - case 0: // ac3 - trackID = aAC3; - break; - case 2: // mpeg1 - case 3: // mpeg2ext - case 4: // lpcm - case 6: // dts - trackID = aLPCM; - break; - default: esyslog(LOG_ERR, "ERROR: unknown Audio stream info"); - return 0; - } - trackID |= track; - return trackID; + return dvd->getAudioTrack(track) | track; } void cDVDplayBuffer::ToggleAudioTrack(void) diff --git a/dvd.c b/dvd.c index 841e998b..e061b141 100644 --- a/dvd.c +++ b/dvd.c @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz * - * $Id: dvd.c 1.3 2001/08/06 16:07:44 kls Exp $ + * $Id: dvd.c 1.4 2001/11/10 13:38:50 kls Exp $ */ #ifdef DVDSUPPORT @@ -21,6 +21,7 @@ #include #include "dvd.h" +#include "tools.h" // --- cDVD ---------------------------------------------------------------------------- @@ -145,4 +146,24 @@ dvd_file_t *cDVD::openTitle(int Title, dvd_read_domain_t domain) return title; } +int cDVD::getAudioTrack(int stream) +{ + if (getVTS()) { + switch (getVTS()->vtsi_mat->vts_audio_attr[stream].audio_format) { + case 0: // ac3 + return aAC3; + case 2: // mpeg1 + case 3: // mpeg2ext + return aMPEG; + case 4: // lpcm + return aLPCM; + case 6: // dts + return aDTS; + default: + esyslog(LOG_ERR, "ERROR: unknown Audio stream info"); + } + } + return 0; +} + #endif //DVDSUPPORT diff --git a/dvd.h b/dvd.h index 68fc1d38..5ac14548 100644 --- a/dvd.h +++ b/dvd.h @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz * - * $Id: dvd.h 1.3 2001/08/05 16:00:57 kls Exp $ + * $Id: dvd.h 1.4 2001/11/10 13:38:25 kls Exp $ */ #ifndef __DVD_H @@ -21,6 +21,11 @@ #include #include +#define aAC3 0x80 +#define aDTS 0x88 +#define aLPCM 0xA0 +#define aMPEG 0xC0 + class cDVD { private: static cDVD *dvdInstance; @@ -44,8 +49,12 @@ public: bool isValid(void) { return (dvd != NULL); } ifo_handle_t *openVMG(void); ifo_handle_t *openVTS(int TitleSet); + ifo_handle_t *getVTS() { return vts_file; } dvd_file_t *openTitle(int Title, dvd_read_domain_t domain); static cDVD *getDVD(void); + int getAudioNrOfTracks() { return getVTS() ? getVTS()->vtsi_mat->nr_of_vts_audio_streams : 0; } + int getAudioLanguage(int stream) { return getVTS() ? getVTS()->vtsi_mat->vts_audio_attr[stream].lang_code : 0; } + int getAudioTrack(int stream); }; #endif //DVDSUPPORT -- cgit v1.2.3