From 735093b8faef4f667e6a6c65f7290858286816e3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 15 Apr 2000 17:38:11 +0200 Subject: Implemented actual record/replay; support for CICAM --- dvbapi.h | 121 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 55 deletions(-) (limited to 'dvbapi.h') diff --git a/dvbapi.h b/dvbapi.h index 2e8406ee..3c447cf1 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,20 +4,21 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.2 2000/03/06 19:47:20 kls Exp $ + * $Id: dvbapi.h 1.3 2000/04/15 13:36:10 kls Exp $ */ #ifndef __DVBAPI_H #define __DVBAPI_H // FIXME: these should be defined in ../DVB/driver/dvb.h!!! -typedef unsigned int u32; -typedef unsigned short u16; -typedef unsigned char u8; +typedef unsigned int __u32; +typedef unsigned short __u16; +typedef unsigned char __u8; #if defined(DEBUG_OSD) || defined(DEBUG_REMOTE) #include #endif +#include #include "../DVB/driver/dvb.h" enum eDvbColor { clrBackground, @@ -36,56 +37,15 @@ enum eDvbColor { clrBackground, clrWhite, }; -extern const char *DvbQuality; // Low, Medium, High - -bool DvbSetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid); - -class cDvbRecorder { +class cDvbApi { private: - bool recording; + int videoDev; public: - cDvbRecorder(void); - ~cDvbRecorder(); - bool Recording(void); - // Returns true if this recorder is currently recording, false if it - // is playing back or does nothing. - bool Record(const char *FileName, char Quality); - // Starts recording the current channel into the given file, with the - // given quality level. Any existing file will be overwritten. - // Returns true if recording was started successfully. - // If there is already a recording session active, false will be - // returned. - bool Play(const char *FileName, int Frame = 0); - // Starts playback of the given file, at the optional Frame (default - // is the beginning of the file). If Frame is beyond the last recorded - // frame in the file (or if it is negative), playback will be positioned - // to the last frame in the file (or the frame with the absolute value of - // Frame) and will do an implicit Pause() there. - // If there is already a playback session active, it will be stopped - // and the new file or frame (which may be in the same file) will - // be played back. - bool FastForward(void); - // Runs the current playback session forward at a higher speed. - // TODO allow different fast forward speeds??? - bool FastRewind(void); - // Runs the current playback session backwards forward at a higher speed. - // TODO allow different fast rewind speeds??? - bool Pause(void); - // Pauses the current recording or playback session, or resumes a paused - // session. - // Returns true if there is actually a recording or playback session - // active that was paused/resumed. - void Stop(void); - // Stops the current recording or playback session. - int Frame(void); - // Returns the number of the current frame in the current recording or - // playback session, which can be used to start playback at a given position. - // The number returned is the actual number of frames counted from the - // beginning of the current file. - // The very first frame has the number 1. - }; + cDvbApi(void); + ~cDvbApi(); + + // On Screen Display facilities -class cDvbOsd { private: enum { charWidth = 12, // average character width lineHeight = 27 // smallest text height @@ -95,19 +55,70 @@ private: enum { MaxColorPairs = 16 }; int colorPairs[MaxColorPairs]; void SetColor(eDvbColor colorFg, eDvbColor colorBg = clrBackground); -#else - void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); #endif int cols, rows; + void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); public: - cDvbOsd(void); - ~cDvbOsd(); void Open(int w, int h); 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); + + // 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 + dvbPauseReplay, + dvbFastForward, + dvbFastRewind, + dvbSkip, + }; + bool isMainProcess; + pid_t pidRecord, pidReplay; + int fromRecord, toRecord; + int fromReplay, toReplay; + void SetReplayMode(int Mode); + void KillProcess(pid_t pid); +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). + bool StartReplay(const char *FileName); + // 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. + void StopReplay(void); + // Stops the current replay session (if any). + void PauseReplay(void); + // Pauses the current replay session, or resumes a paused session. + void FastForward(void); + // Runs the current replay session forward at a higher speed. + void FastRewind(void); + // 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. }; #endif //__DVBAPI_H -- cgit v1.2.3