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

DVD support is now optional

This commit is contained in:
Klaus Schmidinger 2001-08-06 16:19:20 +02:00
parent 81cf0719fe
commit c19ad04a21
9 changed files with 101 additions and 26 deletions

14
INSTALL
View File

@ -15,12 +15,16 @@ If you have the DVB driver source in a different location
you will have to change the definition of DVBDIR in the
Makefile.
VDR also needs the package 'libdvdread' in order to replay DVDs.
This package is expected to be located in the directory ../DVD (seen
from the VDR directory). Adjust the definition of DVDDIR in the
Makefile if necessary.
If you want to use your DVD drive you will need to compile VDR with
This program requires the card driver version 0.9.0 or higher
make DVD=1
to activate DVD support. VDR then also needs the package 'libdvdread'
in order to replay DVDs. This package is expected to be located in the
directory ../DVD (seen from the VDR directory). Adjust the definition
of DVDDIR in the Makefile if necessary.
VDR requires the card driver version 0.9.0 or higher
to work properly. You need to load the dvb.o module *without* option
'outstream=0' (previous versions of VDR required this option to have
the driver supply the data in AV_PES format; as of version 0.70 VDR

View File

@ -4,14 +4,22 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Makefile 1.23 2001/08/03 13:10:52 kls Exp $
# $Id: Makefile 1.24 2001/08/06 16:13:42 kls Exp $
DVBDIR = ../DVB
DVDDIR = ../DVD
AC3DIR = ./ac3dec
INCLUDES = -I$(DVBDIR)/ost/include -I$(DVDDIR)/libdvdread
LIBDIRS = -L$(DVDDIR)/libdvdread/dvdread/.libs
INCLUDES = -I$(DVBDIR)/ost/include
ifdef DVD
INCLUDES += -I$(DVDDIR)/libdvdread
LIBDIRS += -L$(DVDDIR)/libdvdread/dvdread/.libs
DEFINES += -DDVDSUPPORT
DEFINES += -D_LARGEFILE64_SOURCE # needed by libdvdread
AC3LIB = $(AC3DIR)/libac3.a
DVDLIB = -ldvdread
endif
OBJS = config.o dvbapi.o dvbosd.o dvd.o eit.o font.o i18n.o interface.o menu.o osd.o\
recording.o remote.o remux.o ringbuffer.o svdrp.o thread.o tools.o vdr.o\
@ -20,8 +28,6 @@ OBJS = config.o dvbapi.o dvbosd.o dvd.o eit.o font.o i18n.o interface.o menu.o o
OSDFONT = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
FIXFONT = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
DEFINES += -D_LARGEFILE64_SOURCE
ifndef REMOTE
REMOTE = KBD
endif
@ -70,8 +76,8 @@ videodir.o : videodir.c tools.h videodir.h
# The main program:
vdr: $(OBJS) $(AC3DIR)/libac3.a
g++ -g -O2 $(OBJS) -lncurses -ljpeg -lpthread $(LIBDIRS) -ldvdread $(AC3DIR)/libac3.a -o vdr
vdr: $(OBJS) $(AC3LIB)
g++ -g -O2 $(OBJS) -lncurses -ljpeg -lpthread $(LIBDIRS) $(DVDLIB) $(AC3LIB) -o vdr
# The font files:
@ -89,7 +95,7 @@ genfontfile: genfontfile.o
# The ac3dec library:
$(AC3DIR)/libac3.a:
$(AC3LIB):
make -C $(AC3DIR) all
# Housekeeping:

View File

@ -5,8 +5,9 @@
* how to reach the author.
*
* 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.99 2001/08/05 15:46:21 kls Exp $
* $Id: dvbapi.c 1.100 2001/08/06 16:19:20 kls Exp $
*/
//#define DVDDEBUG 1
@ -27,9 +28,11 @@ extern "C" {
#include <sys/time.h>
#include <unistd.h>
#ifdef DVDSUPPORT
extern "C" {
#include "ac3dec/ac3.h"
}
#endif //DVDSUPPORT
#include "config.h"
#include "recording.h"
@ -1124,6 +1127,7 @@ bool cReplayBuffer::NextFile(uchar FileNumber, int FileOffset)
return replayFile >= 0;
}
#ifdef DVDSUPPORT
// --- cDVDplayBuffer --------------------------------------------------------
class cDVDplayBuffer : public cPlayBuffer {
@ -1651,7 +1655,7 @@ void cDVDplayBuffer::Input(void)
// dsyslog(LOG_INF, "DVD: new cyclestate: %d, pktcnt: %d, cur: %d", cyclestate, pktcnt, cur_output_size);
}
dsyslog(LOG_INFO, "output thread ended (pid=%d)", getpid());
dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid());
}
#define NO_PICTURE 0
@ -2004,6 +2008,7 @@ void cDVDplayBuffer::GetIndex(int &Current, int &Total, bool SnapToIFrame)
{
Current = Total = -1;
}
#endif //DVDSUPPORT
// --- cTransferBuffer -------------------------------------------------------
@ -3332,6 +3337,7 @@ bool cDvbApi::StartReplay(const char *FileName)
return false;
}
#ifdef DVDSUPPORT
bool cDvbApi::StartDVDplay(cDVD *dvd, int TitleID)
{
if (Recording()) {
@ -3359,6 +3365,7 @@ bool cDvbApi::StartDVDplay(cDVD *dvd, int TitleID)
}
return false;
}
#endif //DVDSUPPORT
void cDvbApi::StopReplay(void)
{

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.h 1.43 2001/08/02 14:50:48 kls Exp $
* $Id: dvbapi.h 1.44 2001/08/05 15:57:45 kls Exp $
*/
#ifndef __DVBAPI_H
@ -28,7 +28,9 @@
#include <stdio.h>
#include "dvbosd.h"
#ifdef DVDSUPPORT
#include "dvd.h"
#endif //DVDSUPPORT
#include "eit.h"
#include "thread.h"
@ -48,7 +50,9 @@ class cChannel;
class cRecordBuffer;
class cPlayBuffer;
class cReplayBuffer;
#ifdef DVDSUPPORT
class cDVDplayBuffer;
#endif //DVDSUPPORT
class cTransferBuffer;
class cCuttingBuffer;
@ -64,7 +68,9 @@ public:
class cDvbApi {
friend class cRecordBuffer;
friend class cReplayBuffer;
#ifdef DVDSUPPORT
friend class cDVDplayBuffer;
#endif //DVDSUPPORT
friend class cTransferBuffer;
private:
int videoDev;
@ -243,8 +249,10 @@ public:
// Starts replaying the given file.
// If there is already a replay session active, it will be stopped
// and the new file will be played back.
#ifdef DVDSUPPORT
bool StartDVDplay(cDVD *dvd, int TitleID);//XXX dvd parameter necessary???
// Starts replaying the given TitleID on the DVD.
#endif //DVDSUPPORT
void StopReplay(void);
// Stops the current replay session (if any).
void Pause(void);

11
dvd.c
View File

@ -6,11 +6,13 @@
*
* Initially written by Andreas Schultz <aschultz@warp10.net>
*
* $Id: dvd.c 1.2 2001/08/05 15:00:45 kls Exp $
* $Id: dvd.c 1.3 2001/08/06 16:07:44 kls Exp $
*/
//XXX //#define DVDDEBUG 1
//XXX //#define DEBUG_BUFFER 1
#ifdef DVDSUPPORT
//#define DVDSUPPORTDEBUG 1
//#define DEBUG_BUFFER 1
#include <fcntl.h>
#include <linux/cdrom.h>
@ -92,7 +94,7 @@ void cDVD::Open(void)
void cDVD::Close(void)
{
#ifdef DVDDEBUG
#ifdef DVDSUPPORTDEBUG
dsyslog(LOG_INFO, "DVD: cDVD::Close(%p): vts: %p, vmg: %p, title: %p, dvd: %p", this, vts_file, vmg_file, title, dvd);
#endif
if (vts_file)
@ -143,3 +145,4 @@ dvd_file_t *cDVD::openTitle(int Title, dvd_read_domain_t domain)
return title;
}
#endif //DVDSUPPORT

6
dvd.h
View File

@ -6,12 +6,14 @@
*
* Initially written by Andreas Schultz <aschultz@warp10.net>
*
* $Id: dvd.h 1.2 2001/08/05 15:00:23 kls Exp $
* $Id: dvd.h 1.3 2001/08/05 16:00:57 kls Exp $
*/
#ifndef __DVD_H
#define __DVD_H
#ifdef DVDSUPPORT
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
@ -46,4 +48,6 @@ public:
static cDVD *getDVD(void);
};
#endif //DVDSUPPORT
#endif //__DVD_H

24
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.94 2001/08/05 15:11:35 kls Exp $
* $Id: menu.c 1.95 2001/08/05 16:09:41 kls Exp $
*/
#include "menu.h"
@ -1590,6 +1590,7 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
return state;
}
#ifdef DVDSUPPORT
// --- cMenuDVDItem ----------------------------------------------------------
class cMenuDVDItem : public cOsdItem {
@ -1661,6 +1662,7 @@ eOSState cMenuDVD::ProcessKey(eKeys Key)
}
return state;
}
#endif //DVDSUPPORT
// --- cMenuSetup ------------------------------------------------------------
@ -1794,8 +1796,10 @@ cMenuMain::cMenuMain(bool Replaying)
Add(new cOsdItem(hk(tr("Channels")), osChannels));
Add(new cOsdItem(hk(tr("Timers")), osTimers));
Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
#ifdef DVDSUPPORT
if (cDVD::DriveExists())
Add(new cOsdItem(hk(tr("DVD")), osDVD));
#endif //DVDSUPPORT
Add(new cOsdItem(hk(tr("Setup")), osSetup));
if (Commands.Count())
Add(new cOsdItem(hk(tr("Commands")), osCommands));
@ -1810,7 +1814,13 @@ cMenuMain::cMenuMain(bool Replaying)
}
if (cVideoCutter::Active())
Add(new cOsdItem(hk(tr(" Cancel editing")), osCancelEdit));
SetHelp(tr("Record"), cDvbApi::PrimaryDvbApi->CanToggleAudioTrack() ? tr("Language") : NULL, cDVD::DiscOk() ? tr("Eject DVD") : NULL, cReplayControl::LastReplayed() ? tr("Resume") : NULL);
const char *DVDbutton =
#ifdef DVDSUPPORT
cDVD::DiscOk() ? tr("Eject DVD") : NULL;
#else
NULL;
#endif //DVDSUPPORT
SetHelp(tr("Record"), cDvbApi::PrimaryDvbApi->CanToggleAudioTrack() ? tr("Language") : NULL, DVDbutton, cReplayControl::LastReplayed() ? tr("Resume") : NULL);
Display();
lastActivity = time(NULL);
SetHasHotkeys();
@ -1836,7 +1846,9 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
case osChannels: return AddSubMenu(new cMenuChannels);
case osTimers: return AddSubMenu(new cMenuTimers);
case osRecordings: return AddSubMenu(new cMenuRecordings);
#ifdef DVDSUPPORT
case osDVD: return AddSubMenu(new cMenuDVD);
#endif //DVDSUPPORT
case osSetup: return AddSubMenu(new cMenuSetup);
case osCommands: return AddSubMenu(new cMenuCommands);
case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) {
@ -1865,6 +1877,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
}
}
break;
#ifdef DVDSUPPORT
case kYellow: if (!HasSubMenu()) {
if (cDVD::DiscOk()) {
cDVD::Eject();
@ -1872,6 +1885,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
}
}
break;
#endif //DVDSUPPORT
case kBlue: if (!HasSubMenu())
state = osReplay;
break;
@ -2231,8 +2245,10 @@ void cProgressBar::Mark(int x, bool Start, bool Current)
char *cReplayControl::fileName = NULL;
char *cReplayControl::title = NULL;
#ifdef DVDSUPPORT
cDVD *cReplayControl::dvd = NULL;//XXX
int cReplayControl::titleid = 0;//XXX
#endif //DVDSUPPORT
cReplayControl::cReplayControl(void)
{
@ -2244,8 +2260,10 @@ cReplayControl::cReplayControl(void)
marks.Load(fileName);
dvbApi->StartReplay(fileName);
}
#ifdef DVDSUPPORT
else if (dvd)
dvbApi->StartDVDplay(dvd, titleid);//XXX
#endif //DVDSUPPORT
}
cReplayControl::~cReplayControl()
@ -2262,12 +2280,14 @@ void cReplayControl::SetRecording(const char *FileName, const char *Title)
title = Title ? strdup(Title) : NULL;
}
#ifdef DVDSUPPORT
void cReplayControl::SetDVD(cDVD *DVD, int Title)//XXX
{
SetRecording(NULL, NULL);
dvd = DVD;
titleid = Title;
}
#endif //DVDSUPPORT
const char *cReplayControl::LastReplayed(void)
{

11
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.21 2001/08/02 14:53:29 kls Exp $
* $Id: menu.h 1.22 2001/08/05 16:04:58 kls Exp $
*/
#ifndef _MENU_H
@ -13,6 +13,9 @@
#define _GNU_SOURCE
#include "dvbapi.h"
#ifdef DVDSUPPORT
#include "dvd.h"
#endif //DVDSUPPORT
#include "osd.h"
#include "recording.h"
@ -41,6 +44,7 @@ public:
virtual eOSState ProcessKey(eKeys Key);
};
#ifdef DVDSUPPORT
class cMenuDVD : public cOsdMenu {
private:
cDVD *dvd;//XXX member really necessary???
@ -50,6 +54,7 @@ public:
cMenuDVD(void);
virtual eOSState ProcessKey(eKeys Key);
};
#endif //DVDSUPPORT
class cMenuRecordings : public cOsdMenu {
private:
@ -100,8 +105,10 @@ private:
void Show(int Seconds = 0);
void Hide(void);
static char *fileName;
#ifdef DVDSUPPORT
static cDVD *dvd;//XXX member really necessary???
static int titleid;//XXX
#endif //DVDSUPPORT
static char *title;
bool ShowProgress(bool Initial);
void MarkToggle(void);
@ -115,7 +122,9 @@ public:
virtual eOSState ProcessKey(eKeys Key);
bool Visible(void) { return visible; }
static void SetRecording(const char *FileName, const char *Title);
#ifdef DVDSUPPORT
static void SetDVD(cDVD *DVD, int Title);//XXX
#endif //DVDSUPPORT
static const char *LastReplayed(void);
static void ClearLastReplayed(const char *FileName);
};

18
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.60 2001/08/05 12:58:12 kls Exp $
* $Id: vdr.c 1.61 2001/08/05 16:15:51 kls Exp $
*/
#include <getopt.h>
@ -31,7 +31,9 @@
#include <unistd.h>
#include "config.h"
#include "dvbapi.h"
#ifdef DVDSUPPORT
#include "dvd.h"
#endif //DVDSUPPORT
#include "i18n.h"
#include "interface.h"
#include "menu.h"
@ -134,7 +136,11 @@ int main(int argc, char *argv[])
"Report bugs to <vdr-bugs@cadsoft.de>\n",
DEFAULTSVDRPPORT,
VideoDirectory,
#ifdef DVDSUPPORT
cDVD::DeviceName(),
#else
"no DVD support",
#endif //DVDSUPPORT
DEFAULTWATCHDOG
);
return 0;
@ -162,11 +168,17 @@ int main(int argc, char *argv[])
while (optarg && *optarg && optarg[strlen(optarg) - 1] == '/')
optarg[strlen(optarg) - 1] = 0;
break;
case 'V': cDVD::SetDeviceName(optarg);
case 'V':
#ifdef DVDSUPPORT
cDVD::SetDeviceName(optarg);
if (!cDVD::DriveExists()) {
fprintf(stderr, "vdr: DVD drive not found: %s\n", optarg);
return 2;
}
#else
fprintf(stderr, "vdr: DVD support has not been compiled in!");
return 2;
#endif //DVDSUPPORT
break;
case 'w': if (isnumber(optarg)) {
int t = atoi(optarg);
@ -334,10 +346,12 @@ int main(int argc, char *argv[])
DELETENULL(ReplayControl);
ReplayControl = new cReplayControl;
break;
#ifdef DVDSUPPORT
case osDVD: DELETENULL(Menu);
DELETENULL(ReplayControl);
Menu = new cMenuDVD;
break;
#endif //DVDSUPPORT
case osStopReplay:
DELETENULL(*Interact);
DELETENULL(ReplayControl);