2000-02-19 13:36:48 +01:00
|
|
|
/*
|
|
|
|
* dvbapi.h: Interface to the DVB driver
|
|
|
|
*
|
2000-04-24 09:46:05 +02:00
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
2000-02-19 13:36:48 +01:00
|
|
|
* how to reach the author.
|
|
|
|
*
|
2000-10-03 11:26:10 +02:00
|
|
|
* $Id: dvbapi.h 1.18 2000/10/03 11:26:10 kls Exp $
|
2000-02-19 13:36:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DVBAPI_H
|
|
|
|
#define __DVBAPI_H
|
|
|
|
|
2000-03-11 11:22:37 +01:00
|
|
|
// FIXME: these should be defined in ../DVB/driver/dvb.h!!!
|
2000-04-15 17:38:11 +02:00
|
|
|
typedef unsigned int __u32;
|
|
|
|
typedef unsigned short __u16;
|
|
|
|
typedef unsigned char __u8;
|
2000-02-19 13:36:48 +01:00
|
|
|
|
2000-07-15 12:39:20 +02:00
|
|
|
#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
|
2000-03-11 11:22:37 +01:00
|
|
|
#include <ncurses.h>
|
|
|
|
#endif
|
2000-04-15 17:38:11 +02:00
|
|
|
#include <stdio.h>
|
2000-09-03 11:40:00 +02:00
|
|
|
#include <dvb.h>
|
2000-10-03 10:34:48 +02:00
|
|
|
#include "dvbosd.h"
|
2000-03-11 11:22:37 +01:00
|
|
|
|
2000-09-17 13:47:06 +02:00
|
|
|
// Overlay facilities
|
|
|
|
#define MAXCLIPRECTS 100
|
|
|
|
typedef struct CRect {
|
|
|
|
signed short x, y, width, height;
|
|
|
|
};
|
|
|
|
|
2000-04-22 13:51:48 +02:00
|
|
|
#define MenuLines 15
|
|
|
|
#define MenuColumns 40
|
|
|
|
|
2000-10-03 11:26:10 +02:00
|
|
|
class cResumeFile {
|
|
|
|
private:
|
|
|
|
char *fileName;
|
|
|
|
public:
|
|
|
|
cResumeFile(const char *FileName);
|
|
|
|
~cResumeFile();
|
|
|
|
int Read(void);
|
|
|
|
bool Save(int Index);
|
|
|
|
};
|
|
|
|
|
2000-04-15 17:38:11 +02:00
|
|
|
class cDvbApi {
|
2000-03-11 11:22:37 +01:00
|
|
|
private:
|
2000-04-15 17:38:11 +02:00
|
|
|
int videoDev;
|
2000-05-01 16:29:46 +02:00
|
|
|
cDvbApi(const char *FileName);
|
2000-02-19 13:36:48 +01:00
|
|
|
public:
|
2000-04-15 17:38:11 +02:00
|
|
|
~cDvbApi();
|
|
|
|
|
2000-05-01 16:29:46 +02:00
|
|
|
#define MAXDVBAPI 2
|
|
|
|
static int NumDvbApis;
|
|
|
|
private:
|
|
|
|
static cDvbApi *dvbApi[MAXDVBAPI];
|
|
|
|
public:
|
|
|
|
static cDvbApi *PrimaryDvbApi;
|
2000-09-10 10:51:58 +02:00
|
|
|
static bool SetPrimaryDvbApi(int n);
|
|
|
|
// Sets the primary DVB device to 'n' (which must be in the range
|
|
|
|
// 1...NumDvbApis) and returns true if this was possible.
|
2000-05-01 16:29:46 +02:00
|
|
|
static cDvbApi *GetDvbApi(int Ca = 0);
|
2000-09-10 10:51:58 +02:00
|
|
|
// Selects a free DVB device, starting with the highest device number
|
|
|
|
// (but avoiding, if possible, the PrimaryDvbApi).
|
|
|
|
// If Ca is not 0, the device with the given number will be returned
|
2000-05-01 16:29:46 +02:00
|
|
|
// if it is not currently recording.
|
|
|
|
int Index(void);
|
|
|
|
// Returns the index of this DvbApi.
|
|
|
|
static bool Init(void);
|
|
|
|
// Initializes the DVB API and probes for existing DVB devices.
|
|
|
|
// Must be called before accessing any DVB functions.
|
|
|
|
static void Cleanup(void);
|
|
|
|
// Closes down all DVB devices.
|
|
|
|
// Must be called at the end of the program.
|
|
|
|
|
2000-09-17 11:53:35 +02:00
|
|
|
// Image Grab facilities
|
|
|
|
|
|
|
|
bool GrabImage(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
|
|
|
|
|
2000-09-17 13:47:06 +02:00
|
|
|
// Overlay facilities
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool ovlStat, ovlGeoSet, ovlFbSet;
|
|
|
|
int ovlSizeX, ovlSizeY, ovlPosX, ovlPosY, ovlBpp, ovlPalette, ovlClips, ovlClipCount;
|
|
|
|
int ovlFbSizeX, ovlFbSizeY;
|
|
|
|
__u16 ovlBrightness, ovlColour, ovlHue, ovlContrast;
|
|
|
|
struct video_clip ovlClipRects[MAXCLIPRECTS];
|
|
|
|
public:
|
|
|
|
bool OvlF(int SizeX, int SizeY, int FbAddr, int Bpp, int Palette);
|
|
|
|
bool OvlG(int SizeX, int SizeY, int PosX, int PosY);
|
|
|
|
bool OvlC(int ClipCount, CRect *Cr);
|
|
|
|
bool OvlP(__u16 Brightness, __u16 Color, __u16 Hue, __u16 Contrast);
|
|
|
|
bool OvlO(bool Value);
|
|
|
|
|
2000-04-15 17:38:11 +02:00
|
|
|
// On Screen Display facilities
|
2000-02-19 13:36:48 +01:00
|
|
|
|
2000-03-11 11:22:37 +01:00
|
|
|
private:
|
|
|
|
enum { charWidth = 12, // average character width
|
|
|
|
lineHeight = 27 // smallest text height
|
|
|
|
};
|
|
|
|
#ifdef DEBUG_OSD
|
|
|
|
WINDOW *window;
|
|
|
|
enum { MaxColorPairs = 16 };
|
|
|
|
int colorPairs[MaxColorPairs];
|
|
|
|
void SetColor(eDvbColor colorFg, eDvbColor colorBg = clrBackground);
|
2000-10-03 10:34:48 +02:00
|
|
|
#else
|
|
|
|
cDvbOsd *osd;
|
2000-03-11 11:22:37 +01:00
|
|
|
#endif
|
|
|
|
int cols, rows;
|
2000-04-15 17:38:11 +02:00
|
|
|
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
|
2000-03-11 11:22:37 +01:00
|
|
|
public:
|
2000-04-23 15:38:16 +02:00
|
|
|
void Open(int w, int h);
|
2000-03-11 11:22:37 +01:00
|
|
|
void Close(void);
|
|
|
|
void Clear(void);
|
|
|
|
void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground);
|
|
|
|
void ClrEol(int x, int y, eDvbColor color = clrBackground);
|
|
|
|
void Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground);
|
2000-10-03 10:34:48 +02:00
|
|
|
void Flush(void);
|
2000-04-15 17:38:11 +02:00
|
|
|
|
2000-04-23 15:38:16 +02:00
|
|
|
// Progress Display facilities
|
|
|
|
|
|
|
|
private:
|
2000-05-27 14:07:17 +02:00
|
|
|
int lastProgress, lastTotal;
|
2000-04-23 15:38:16 +02:00
|
|
|
char *replayTitle;
|
|
|
|
public:
|
2000-04-24 15:32:11 +02:00
|
|
|
bool ShowProgress(bool Initial = false);
|
2000-04-23 15:38:16 +02:00
|
|
|
|
2000-04-15 17:38:11 +02:00
|
|
|
// Channel facilities
|
|
|
|
|
|
|
|
bool SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr);
|
|
|
|
|
|
|
|
// Record/Replay facilities
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum { dvbStop = 1, // let's not have 0 as a command
|
2000-07-30 16:14:22 +02:00
|
|
|
dvbPause,
|
|
|
|
dvbPlay,
|
|
|
|
dvbForward,
|
|
|
|
dvbBackward,
|
2000-04-15 17:38:11 +02:00
|
|
|
dvbSkip,
|
2000-04-23 15:38:16 +02:00
|
|
|
dvbGetIndex,
|
2000-04-15 17:38:11 +02:00
|
|
|
};
|
|
|
|
pid_t pidRecord, pidReplay;
|
|
|
|
int fromRecord, toRecord;
|
|
|
|
int fromReplay, toReplay;
|
|
|
|
void SetReplayMode(int Mode);
|
|
|
|
public:
|
|
|
|
bool Recording(void);
|
|
|
|
// Returns true if we are currently recording.
|
|
|
|
bool Replaying(void);
|
|
|
|
// Returns true if we are currently replaying.
|
|
|
|
bool StartRecord(const char *FileName);
|
|
|
|
// Starts recording the current channel into the given file.
|
|
|
|
// In order to be able to record longer movies,
|
|
|
|
// a numerical suffix will be appended to the file name. The inital
|
|
|
|
// value of that suffix will be larger than any existing file under
|
|
|
|
// the given name, thus allowing an interrupted recording to continue
|
|
|
|
// gracefully.
|
|
|
|
// Returns true if recording was started successfully.
|
|
|
|
// If there is already a recording session active, false will be
|
|
|
|
// returned.
|
|
|
|
void StopRecord(void);
|
|
|
|
// Stops the current recording session (if any).
|
2000-04-23 15:38:16 +02:00
|
|
|
bool StartReplay(const char *FileName, const char *Title = NULL);
|
2000-04-15 17:38:11 +02:00
|
|
|
// 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.
|
2000-04-23 15:38:16 +02:00
|
|
|
// If provided Title will be used in the progress display.
|
2000-07-30 16:14:22 +02:00
|
|
|
void Stop(void);
|
2000-04-15 17:38:11 +02:00
|
|
|
// Stops the current replay session (if any).
|
2000-07-30 16:14:22 +02:00
|
|
|
void Pause(void);
|
2000-04-15 17:38:11 +02:00
|
|
|
// Pauses the current replay session, or resumes a paused session.
|
2000-07-30 16:14:22 +02:00
|
|
|
void Play(void);
|
|
|
|
// Resumes normal replay mode.
|
|
|
|
void Forward(void);
|
2000-04-15 17:38:11 +02:00
|
|
|
// Runs the current replay session forward at a higher speed.
|
2000-07-30 16:14:22 +02:00
|
|
|
void Backward(void);
|
2000-04-15 17:38:11 +02:00
|
|
|
// Runs the current replay session backwards at a higher speed.
|
|
|
|
void Skip(int Seconds);
|
|
|
|
// Skips the given number of seconds in the current replay session.
|
|
|
|
// The sign of 'Seconds' determines the direction in which to skip.
|
|
|
|
// Use a very large negative value to go all the way back to the
|
|
|
|
// beginning of the recording.
|
2000-04-23 15:38:16 +02:00
|
|
|
bool GetIndex(int *Current, int *Total = NULL);
|
2000-03-11 11:22:37 +01:00
|
|
|
};
|
2000-05-01 16:29:46 +02:00
|
|
|
|
2000-02-19 13:36:48 +01:00
|
|
|
#endif //__DVBAPI_H
|