diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | dvbapi.c | 25 | ||||
-rw-r--r-- | dvd.c | 23 | ||||
-rw-r--r-- | dvd.h | 11 |
4 files changed, 36 insertions, 24 deletions
@@ -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). @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz <aschultz@warp10.net> * based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * - * $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) @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz <aschultz@warp10.net> * - * $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 <unistd.h> #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 @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz <aschultz@warp10.net> * - * $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 <dvdread/nav_read.h> #include <dvdread/nav_print.h> +#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 |