1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added MPEG audio support for DVD

This commit is contained in:
Klaus Schmidinger 2001-11-10 13:41:22 +01:00
parent 8d7c343a92
commit f131c8c79d
4 changed files with 36 additions and 24 deletions

View File

@ -871,3 +871,4 @@ Video Disk Recorder Revision History
- Changed version numbering scheme. - Changed version numbering scheme.
- Fixed several channel definitions in 'channels.conf' (thanks to Thilo - Fixed several channel definitions in 'channels.conf' (thanks to Thilo
Wunderlich). Wunderlich).
- Added MPEG audio support for DVD (thanks to Andreas Schultz).

View File

@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net> * DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * 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 //#define DVDDEBUG 1
@ -1348,9 +1348,6 @@ bool cReplayBuffer::NextFile(uchar FileNumber, int FileOffset)
#define cOUTPACK 5 #define cOUTPACK 5
#define cOUTFRAMES 6 #define cOUTFRAMES 6
#define aAC3 0x80
#define aLPCM 0xA0
// --- cAC3toPCM ------------------------------------------------------------- // --- cAC3toPCM -------------------------------------------------------------
class cAC3toPCM { class cAC3toPCM {
@ -1574,28 +1571,12 @@ cDVDplayBuffer::~cDVDplayBuffer()
unsigned int cDVDplayBuffer::getAudioStream(unsigned int StreamId) unsigned int cDVDplayBuffer::getAudioStream(unsigned int StreamId)
{ {
unsigned int trackID; if (cyclestate < cOPENCHAPTER || StreamId > 7)
if ((cyclestate < cOPENCHAPTER) || (StreamId > 7))
return 0; return 0;
if (!(cur_pgc->audio_control[StreamId] & 0x8000)) if (!(cur_pgc->audio_control[StreamId] & 0x8000))
return 0; return 0;
int track = (cur_pgc->audio_control[StreamId] >> 8) & 0x07; int track = (cur_pgc->audio_control[StreamId] >> 8) & 0x07;
switch (vts_file->vtsi_mat->vts_audio_attr[track].audio_format) { return dvd->getAudioTrack(track) | track;
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;
} }
void cDVDplayBuffer::ToggleAudioTrack(void) void cDVDplayBuffer::ToggleAudioTrack(void)

23
dvd.c
View File

@ -6,7 +6,7 @@
* *
* Initially written by Andreas Schultz <aschultz@warp10.net> * 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 #ifdef DVDSUPPORT
@ -21,6 +21,7 @@
#include <unistd.h> #include <unistd.h>
#include "dvd.h" #include "dvd.h"
#include "tools.h"
// --- cDVD ---------------------------------------------------------------------------- // --- cDVD ----------------------------------------------------------------------------
@ -145,4 +146,24 @@ dvd_file_t *cDVD::openTitle(int Title, dvd_read_domain_t domain)
return title; 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 #endif //DVDSUPPORT

11
dvd.h
View File

@ -6,7 +6,7 @@
* *
* Initially written by Andreas Schultz <aschultz@warp10.net> * 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 #ifndef __DVD_H
@ -21,6 +21,11 @@
#include <dvdread/nav_read.h> #include <dvdread/nav_read.h>
#include <dvdread/nav_print.h> #include <dvdread/nav_print.h>
#define aAC3 0x80
#define aDTS 0x88
#define aLPCM 0xA0
#define aMPEG 0xC0
class cDVD { class cDVD {
private: private:
static cDVD *dvdInstance; static cDVD *dvdInstance;
@ -44,8 +49,12 @@ public:
bool isValid(void) { return (dvd != NULL); } bool isValid(void) { return (dvd != NULL); }
ifo_handle_t *openVMG(void); ifo_handle_t *openVMG(void);
ifo_handle_t *openVTS(int TitleSet); ifo_handle_t *openVTS(int TitleSet);
ifo_handle_t *getVTS() { return vts_file; }
dvd_file_t *openTitle(int Title, dvd_read_domain_t domain); dvd_file_t *openTitle(int Title, dvd_read_domain_t domain);
static cDVD *getDVD(void); 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 #endif //DVDSUPPORT