diff options
-rw-r--r-- | config.h | 226 | ||||
-rw-r--r-- | device.h | 170 | ||||
-rw-r--r-- | dummy_player.h | 39 | ||||
-rw-r--r-- | equalizer.h | 36 | ||||
-rw-r--r-- | frontend.h | 143 | ||||
-rw-r--r-- | frontend_local.h | 72 | ||||
-rw-r--r-- | frontend_svr.h | 111 | ||||
-rw-r--r-- | i18n.h | 18 | ||||
-rw-r--r-- | logdefs.h | 91 | ||||
-rw-r--r-- | media_player.h | 88 | ||||
-rw-r--r-- | menu.h | 46 | ||||
-rw-r--r-- | menuitems.h | 70 | ||||
-rw-r--r-- | osd.h | 72 | ||||
-rw-r--r-- | setup_menu.h | 27 | ||||
-rw-r--r-- | xine_frontend.h | 100 | ||||
-rw-r--r-- | xine_input_vdr.h | 46 | ||||
-rw-r--r-- | xine_input_vdr_net.h | 91 | ||||
-rw-r--r-- | xine_osd_command.h | 68 |
18 files changed, 1514 insertions, 0 deletions
diff --git a/config.h b/config.h new file mode 100644 index 00000000..535c6237 --- /dev/null +++ b/config.h @@ -0,0 +1,226 @@ +/* + * config.h: Global configuration and user settings + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: config.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef _XINELIB_CONFIG_H_ +#define _XINELIB_CONFIG_H_ + +#include <string.h> + +// Decoder buffer size +#define PES_BUFFERS_CUSTOM 0 +#define PES_BUFFERS_TINY_50 1 +#define PES_BUFFERS_SMALL_250 2 +#define PES_BUFFERS_MEDIUM_500 3 +#define PES_BUFFERS_LARGE_1000 4 +#define PES_BUFFERS_HUGE_2000 5 +#define PES_BUFFERS_count 6 + +// Output window aspect ratio +#define ASPECT_AUTO 0 +#define ASPECT_DEFAULT 1 +#define ASPECT_4_3 2 +#define ASPECT_16_9 3 +#define ASPECT_PAN_SCAN 4 +#define ASPECT_CENTER_CUT_OUT 5 +#define ASPECT_count 6 + +// De-interlace method +#define DEINTERLACE_NONE 0 +#define DEINTERLACE_BOB 1 +#define DEINTERLACE_WEAVE 2 +#define DEINTERLACE_GREEDY 3 +#define DEINTERLACE_ONEFIELD 4 +#define DEINTERLACE_ONEFIELD_XV 5 +#define DEINTERLACE_LINEARLEND 6 +#define DEINTERLACE_TVTIME 7 +#define DEINTERLACE_count 8 + +// Decoder priority +#define DECODER_PRIORITY_LOW 0 +#define DECODER_PRIORITY_NORMAL 1 +#define DECODER_PRIORITY_HIGH 2 +#define DECODER_PRIORITY_count 3 + +#define FIELD_ORDER_NORMAL 0 +#define FIELD_ORDER_INVERTED 1 +#define FIELD_ORDER_count 2 + +// Audio driver +#define AUDIO_DRIVER_AUTO 0 +#define AUDIO_DRIVER_ALSA 1 +#define AUDIO_DRIVER_OSS 2 +#define AUDIO_DRIVER_NONE 3 +#define AUDIO_DRIVER_ARTS 4 +#define AUDIO_DRIVER_ESOUND 5 +#define AUDIO_DRIVER_count 6 + +// Video driver +#define X11_DRIVER_AUTO 0 +#define X11_DRIVER_XSHM 1 +#define X11_DRIVER_XV 2 +#define X11_DRIVER_XVMC 3 +#define X11_DRIVER_XXMC 4 +#define X11_DRIVER_NONE 5 +#define X11_DRIVER_count 6 + +#define FB_DRIVER_AUTO 0 +#define FB_DRIVER_FB 1 +#define FB_DRIVER_DIRECTFB 2 +#define FB_DRIVER_NONE 3 +#define FB_DRIVER_count 4 + +// Local frontend +#define FRONTEND_X11 0 +#define FRONTEND_FB 1 +#define FRONTEND_NONE 2 +#define FRONTEND_count 3 +#define DEFAULT_FRONTEND "sxfe" + +#define LISTEN_PORT 37890 +#define LISTEN_PORT_S "37890" +#define DISCOVERY_PORT 37890 + +#define AUDIO_EQ_30HZ 0 +#define AUDIO_EQ_60HZ 1 +#define AUDIO_EQ_125HZ 2 +#define AUDIO_EQ_250HZ 3 +#define AUDIO_EQ_500HZ 4 +#define AUDIO_EQ_1000HZ 5 +#define AUDIO_EQ_2000HZ 6 +#define AUDIO_EQ_4000HZ 7 +#define AUDIO_EQ_8000HZ 8 +#define AUDIO_EQ_16000HZ 9 +#define AUDIO_EQ_count 10 + +#define AUDIO_VIS_NONE 0 +#define AUDIO_VIS_GOOM 1 +#define AUDIO_VIS_count 5 + +typedef enum { + ShowMenu = 0, + ShowEq = 1, + ShowFiles = 2, + ShowImages = 3, + CloseOsd = 4 +} eMainMenuMode; + +class config_t { + public: + static const char *s_bufferSize[]; + static const int i_pesBufferSize[]; + static const char *s_aspects[]; + static const char *s_deinterlaceMethods[]; + static const char *s_deinterlaceMethodNames[]; + static const char *s_decoderPriority[]; + static const char *s_fieldOrder[]; + static const char *s_audioDriverNames[]; + static const char *s_audioDrivers[]; + static const char *s_videoDriverNamesX11[]; + static const char *s_videoDriversX11[]; + static const char *s_videoDriverNamesFB[]; + static const char *s_videoDriversFB[]; + static const char *s_frontendNames[]; + static const char *s_frontends[]; + static const char *s_frontend_files[]; + static const char *s_audioEqNames[]; + static const char *s_audioVisualizations[]; + static const char *s_audioVisualizationNames[]; + + public: + char video_driver[32]; + char video_port[64]; // X11: DISPLAY=... + char audio_driver[32]; + char audio_port[32]; + char *post_plugins; // from command line options + + int audio_delay; // in ms + int audio_compression; // 100%(=off)...500% + int audio_equalizer[AUDIO_EQ_count]; + char audio_visualization[256]; + //char audio_vis_goom_opts[256]; + int audio_surround; + int headphone; + int audio_upmix; + + int inactivity_timer; + int decoder_priority; + int pes_buffers; + char deinterlace_method[32]; + char deinterlace_opts[256]; + int display_aspect; + + int hide_main_menu; + int prescale_osd; + int prescale_osd_downscale; + int unscaled_osd; + int unscaled_osd_opaque; + int unscaled_osd_lowresvideo; + int alpha_correction; + int alpha_correction_abs; + + char local_frontend[256]; + char modeline[128]; + + int fullscreen; + int modeswitch; + int width; + int height; + int scale_video; + int field_order; + int autocrop; + + int remote_mode; + int listen_port; + int use_remote_keyboard; + int remote_usetcp, remote_useudp, remote_usertp, remote_usepipe; + int remote_usebcast; + + char remote_rtp_addr[64]; + int remote_rtp_port; + int remote_rtp_ttl; + int remote_rtp_always_on; + + int use_x_keyboard; + + int hue; // 0...0xffff, -1 == off + int saturation; // 0...0xffff, -1 == off + int contrast; // 0...0xffff, -1 == off + int brightness; // 0...0xffff, -1 == off + + char browse_files_dir[4096]; + char browse_images_dir[4096]; + + eMainMenuMode main_menu_mode; + int force_primary_device; + + config_t(); + bool SetupParse(const char *Name, const char *Value); + bool ProcessArgs(int argc, char *argv[]); + + protected: + bool ProcessArg(const char *Name, const char *Value); + char *m_ProcessedArgs; +}; + +// Global instance +extern config_t xc; + +// Find index of string in array of strings +static inline int strstra(const char *str, const char *stra[], int def_index) +{ + int i; + for(i=0; stra[i]; i++) + if(!strcmp(str,stra[i])) + return i; + return def_index; +} + +#endif //_XINELIB_CONFIG_H_ + diff --git a/device.h b/device.h new file mode 100644 index 00000000..87971491 --- /dev/null +++ b/device.h @@ -0,0 +1,170 @@ +/* + * device.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: device.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_DEVICE_H +#define __XINELIB_DEVICE_H + +#include <vdr/config.h> +#include <vdr/device.h> +#include <vdr/tools.h> + +class cXinelibStatusMonitor; +class cXinelibThread; +class cChannel; + +class cXinelibDevice : public cDevice +{ + public: + static cXinelibDevice& Instance(void); // singleton + static void Dispose(void); + + private: + static cXinelibDevice* m_pInstance; // singleton + cXinelibDevice(); // + cXinelibDevice(cXinelibDevice&); // no copy constructor + + public: + virtual ~cXinelibDevice(); + + virtual bool HasDecoder(void) const { return true; }; + virtual bool CanReplay(void) const { return true; }; + + virtual void MakePrimaryDevice(bool On); + void ForcePrimaryDevice(bool On); + + virtual void Clear(void); + virtual void Play(void); + virtual void TrickSpeed(int Speed); + virtual void Freeze(void); + + virtual void StillPicture(const uchar *Data, int Length); + virtual bool Poll(cPoller &Poller, int TimeoutMs = 0); + virtual bool Flush(int TimeoutMs = 0); + virtual int64_t GetSTC(void); + + // Video format facilities + public: + virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); + virtual void SetVideoFormat(bool VideoFormat16_9); + virtual eVideoSystem GetVideoSystem(void); + + // Track facilities + protected: + virtual void SetAudioTrackDevice(eTrackType Type); + + // Audio facilities + private: + int m_AudioChannel; + protected: + virtual int GetAudioChannelDevice(void) {return m_AudioChannel;} + virtual void SetAudioChannelDevice(int AudioChannel); + virtual void SetVolumeDevice(int Volume); + virtual void SetDigitalAudioDevice(bool On); + public: + +#if VDRVERSNUM < 10338 + virtual bool GrabImage(const char *FileName, bool Jpeg = true, + int Quality = -1, int SizeX = -1, int SizeY = -1); + +#else + virtual uchar *GrabImage(int &Size, bool Jpeg = true, + int Quality = -1, int SizeX = -1, int SizeY = -1); +#endif + + virtual cSpuDecoder *GetSpuDecoder(void); + + // Messages from StatusMonitor: + void SetTvMode(cChannel *Channel); + void SetReplayMode(void); + void StopOutput(void); + + // device startup (from cPlugin) + bool StartDevice(void); + void StopDevice(void); + + // Osd Commands (from cXinelibOsd) + void OsdCmd(void *cmd); + + // Configuration + void ConfigureOSD(bool prescale_osd, bool unscaled_osd); + void ConfigurePostprocessing(char *deinterlace_method, int audio_delay, + int audio_compression, int *audio_equalizer, + int audio_surround); + void ConfigurePostprocessing(char *name, bool on=true, char *args=NULL); + void ConfigureVideo(int hue, int saturation, int brightness, int contrast); + // local mode: + void ConfigureWindow(int fullscreen, int width, int height, + int modeswitch, char *modeline, + int aspect, int scale_video, int field_order); + void ConfigureDecoder(int pes_buffers, int priority); + // remote mode: + void Listen(bool activate, int port); + + // File playback + bool PlayFile(const char *Filename, int Position=0, bool LoopPlay=false); + int PlayFileCtrl(const char *Cmd); + bool EndOfStreamReached(void); + +#ifdef ENABLE_SUSPEND + // Suspend decoder + //void Housekeeping(void); + bool IsSuspended() {return m_suspended;}; + void Suspend(bool onoff); + bool SuspendedAction(void); + void CheckInactivityTimer(void); +#endif + + private: + + int PlayAny(const uchar *Data, int Length); + + protected: + virtual int PlayVideo(const uchar *Data, int Length); + virtual int PlayAudio(const uchar *Data, int Length, uchar Id); +#if VDRVERSNUM< 10342 + virtual int PlayAudio(const uchar *Data, int Length) + { return PlayAudio(Data, Length, 0); } +#endif + virtual int PlaySpu(const uchar *Data, int Length, uchar Id); + +#if 0 + // override cDevice to get DVD SPUs + virtual int PlayPesPacket(const uchar *Data, int Length, + bool VideoOnly = false); +#endif + + ePlayMode playMode; + virtual bool SetPlayMode(ePlayMode PlayMode); + + cList<cXinelibThread> m_clients; + cXinelibThread *m_server; + cXinelibThread *m_local; + cXinelibStatusMonitor *m_statusMonitor; + cSpuDecoder *m_spuDecoder; + + bool m_ac3Present; + bool m_spuPresent; +#ifdef ENABLE_SUSPEND + bool m_suspended; + int m_inactivityTimer; +#endif + bool m_liveMode; + int m_TrickSpeed; + int64_t m_TrickSpeedPts; + bool m_SkipAudio; + bool m_PlayingFile; + bool m_StreamStart; + bool m_RadioStream; + int m_AudioCount; + + friend class cXineSpuDecoder; +}; + +#endif // __XINELIB_DEVICE_H diff --git a/dummy_player.h b/dummy_player.h new file mode 100644 index 00000000..9af28ba7 --- /dev/null +++ b/dummy_player.h @@ -0,0 +1,39 @@ +/* + * dummy_player.h: Player that does nothing (saves CPU time) + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: dummy_player.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __DUMMY_PLAYER_H +#define __DUMMY_PLAYER_H + +#include <vdr/player.h> + +class cDummyPlayer; + +class cDummyPlayerControl : public cControl +{ + private: + static cDummyPlayer *m_Player; + static cMutex m_Lock; + + static cDummyPlayer *OpenPlayer(void); + + public: + cDummyPlayerControl(void); + virtual ~cDummyPlayerControl(); + + virtual void Show(void) {}; + virtual void Hide(void) {}; + virtual eOSState ProcessKey(eKeys Key); + + static void Close(void); + static bool IsOpen(void) {return m_Player != NULL;}; +}; + +#endif //__DUMMY_PLAYER_H + diff --git a/equalizer.h b/equalizer.h new file mode 100644 index 00000000..e2c7a9fa --- /dev/null +++ b/equalizer.h @@ -0,0 +1,36 @@ +/* + * equalizer.h: audio equalizer OSD control + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: equalizer.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __EQUALIZER_H +#define __EQUALIZER_H + +#include <vdr/config.h> +#include <vdr/osdbase.h> + +class cEqualizer : public cOsdObject +{ + private: + int *m_Values; + int m_Current; + + cOsd *m_Osd; + + public: + cEqualizer(); + virtual ~cEqualizer(); + + virtual void Show(); + virtual eOSState ProcessKey(eKeys Key); + + void DrawBackground(void); + void DrawBar(int Index, bool Selected = false); +}; + +#endif // __EQUALIZER_H_ diff --git a/frontend.h b/frontend.h new file mode 100644 index 00000000..9110ad44 --- /dev/null +++ b/frontend.h @@ -0,0 +1,143 @@ +/* + * frontend.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: frontend.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_FRONTEND_H +#define __XINELIB_FRONTEND_H + +#include <vdr/tools.h> +#include <vdr/thread.h> + +//----------------------------- cXinelibThread -------------------------------- + +class cXinelibThread : public cThread, public cListObject +{ + private: + cXinelibThread(cXinelibThread&); // no copy contructor + + public: + cXinelibThread(const char *Description = NULL); + virtual ~cXinelibThread(); + + // + // Thread control + // + + public: + virtual void Start(void); + virtual void Stop(void); + bool IsReady(void); + bool IsFinished(void); + + protected: + void SetStopSignal(void); + bool GetStopSignal(void); + + virtual void Action(void) = 0; + + // + // Playback control + // + + public: + void PauseOutput(void) { TrickSpeed(0); } + void ResumeOutput(void) { TrickSpeed(1); } + void TrickSpeed(int Speed); + void SetVolume(int NewVolume); + void SetLiveMode(bool); + void SetStillMode(bool); + void SetNoVideo(bool bVal); + void AudioStreamChanged(bool ac3, int StreamId); + void SpuStreamChanged(int StreamId); + + protected: + int Xine_Control(const char *cmd, char *p1); + int Xine_Control(const char *cmd, int p1); + int Xine_Control(const char *cmd, int64_t p1); + + virtual int Xine_Control(const char *cmd) = 0; + + virtual void Xine_Sync(void) {}; + + // + // Data transfer + // + + public: + virtual bool Poll(cPoller &Poller, int TimeoutMs); + virtual bool Flush(int TimeoutMs); + virtual void Clear(void); + virtual int Play_PES(const uchar *buf, int len); + virtual void OsdCmd(void *cmd) = 0; + virtual int64_t GetSTC(void) { return -1; } + + // Stream type conversions + int Play_Mpeg1_PES(const uchar *data, int len); + bool Play_Mpeg2_ES(const uchar *data, int len, int streamID); + + // Built-in still images + bool BlankDisplay(void); + bool QueueBlankDisplay(void); + bool LogoDisplay(void); + bool NoSignalDisplay(void); + + // Playback files + virtual bool PlayFile(const char *FileName, int Position, + bool LoopPlay=false); + virtual int PlayFileCtrl(const char *Cmd) { return Xine_Control(Cmd); } + virtual bool EndOfStreamReached(void); + + // Image grabbing + virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality, + int SizeX, int SizeY) { return NULL; } + + static void KeypressHandler(char *keymap, char *key, + bool repeat, bool release); + + // + // Configuration + // + + public: + virtual int ConfigureOSD(bool prescale_osd=false, bool unscaled_osd=false); + virtual int ConfigurePostprocessing(char *deinterlace_method, + int audio_delay, + int audio_compression, + int *audio_equalizer, + int audio_surround); + virtual int ConfigurePostprocessing(char *name, bool on, char *args); + virtual int ConfigureVideo(int hue, int saturation, + int brightness, int contrast); + // Local frontend: + virtual void ConfigureWindow(int fullscreen, int width, int height, + int modeswitch, char *modeline, + int aspect, int scale_video, + int field_order) {}; + virtual void ConfigureDecoder(int pes_buffers, int priority) {}; + // Remote frontend server: + virtual bool Listen(int port) { return false; } + + // + // Data + // + + protected: + bool m_bStopThread; + bool m_bReady; + bool m_bIsFinished; + bool m_bNoVideo; + bool m_bLiveMode; + bool m_bEndOfStreamReached; + bool m_bPlayingFile; + char *m_FileName; + uint64_t m_StreamPos; +}; + + +#endif // __XINELIB_FRONTEND_H diff --git a/frontend_local.h b/frontend_local.h new file mode 100644 index 00000000..a7975e3c --- /dev/null +++ b/frontend_local.h @@ -0,0 +1,72 @@ +/* + * frontend_local.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: frontend_local.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_FRONTEND_LOCAL_H +#define __XINELIB_FRONTEND_LOCAL_H + +#include "frontend.h" + +//----------------------------- cXinelibLocal -------------------------------- + +extern "C" { + typedef struct frontend_s frontend_t; +} + +class cXinelibLocal : public cXinelibThread +{ + + public: + cXinelibLocal(const char *frontend_name); + virtual ~cXinelibLocal(); + + // Thread control + virtual void Stop(void); + + protected: + virtual void Action(void); + + + public: + + // Data transfer + //virtual bool Poll(cPoller &Poller, int TimeoutMs); + virtual int Play_PES(const uchar *buf, int len); + virtual void OsdCmd(void *cmd); + virtual int64_t GetSTC(); + + // Image grabbing + virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality, + int SizeX, int SizeY); + + // Configuration + virtual void ConfigureWindow(int fullscreen, int width, int height, + int modeswitch, char *modeline, + int aspect, int scale_video, int field_order); + virtual void ConfigureDecoder(int pes_buffers, int priority); + + protected: + + // Playback control + virtual int Xine_Control(const char *cmd); + + protected: + + // Frontend access + frontend_t *load_frontend(const char *fe_name); + + // Data + void *h_fe_lib; + frontend_t *fe; + cRwLock m_feLock; + bool m_bReconfigRequest; +}; + + +#endif // __XINELIB_FRONTEND_LOCAL_H diff --git a/frontend_svr.h b/frontend_svr.h new file mode 100644 index 00000000..f4caa061 --- /dev/null +++ b/frontend_svr.h @@ -0,0 +1,111 @@ +/* + * frontend_svr.h: server for remote frontends + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: frontend_svr.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_FRONTEND_SVR_H +#define __XINELIB_FRONTEND_SVR_H + + +#include "frontend.h" + +//----------------------------- cXinelibServer -------------------------------- + +#define MAXCLIENTS 10 + +class cBackgroundWriter; +class cUdpScheduler; +class cStcFuture; +class cCmdFutures; + +class cXinelibServer : public cXinelibThread +{ + + public: + cXinelibServer(int listen_port); + virtual ~cXinelibServer(); + + // Thread control + virtual void Stop(void); + + protected: + virtual void Action(void); + + public: + // Data transfer + virtual bool Poll(cPoller &Poller, int TimeoutMs); + virtual bool Flush(int TimeoutMs); + virtual void Clear(void); + virtual int Play_PES(const uchar *buf, int len); + virtual void OsdCmd(void *cmd); + virtual int64_t GetSTC(); + + // Image grabbing + virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality, + int SizeX, int SizeY); + // Playback files + virtual int PlayFileCtrl(const char *Cmd); + virtual bool EndOfStreamReached(void); + + // Configuration + virtual bool Listen(int port); + +protected: + // Playback control + virtual void Xine_Sync(void); + virtual int Xine_Control(const char *cmd); + +protected: + + // Handling of messages from client(s) + + void Handle_Discovery_Broadcast(void); + void Handle_ClientConnected(int fd); + + void Read_Control(int cli); + void Handle_Control(int cli, char *cmd); + + void Handle_Control_PIPE(int cli, char *arg); + void Handle_Control_RTP(int cli, char *arg); + void Handle_Control_UDP(int cli, char *arg); + void Handle_Control_DATA(int cli, char *arg); + void Handle_Control_KEY(int cli, char *arg); + void Handle_Control_UDP_RESEND(int cli, char *arg); + void Handle_Control_CONFIG(int cli); + + void CloseConnection(int cli); + +protected: + + // Data + + int m_Port; + + int fd_listen; + int fd_multicast; + int fd_discovery; + int fd_control[MAXCLIENTS]; + int fd_data[MAXCLIENTS]; + + char m_CtrlBuf[MAXCLIENTS][90+1]; + int m_CtrlBufPos[MAXCLIENTS]; + + bool m_bUdp[MAXCLIENTS]; + bool m_bMulticast[MAXCLIENTS]; + bool m_bConfigOk[MAXCLIENTS]; + int m_iMulticastMask; // bit [cli] is 1 or 0. 1 == multicast in use. + int m_iUdpFlowMask; // bit [cli] is 1 or 0. 1 == buffer full. + + cBackgroundWriter *m_Writer[MAXCLIENTS]; + cUdpScheduler *m_Scheduler; + bool m_Master; + cStcFuture *m_StcFuture; + cCmdFutures *m_Futures; +}; + +#endif // __XINELIB_FRONTEND_SVR_H @@ -0,0 +1,18 @@ +/* + * i18n.h: Internationalization + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: i18n.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIBOUTPUT_I18N_H +#define __XINELIBOUTPUT_I18N_H + +#include <vdr/i18n.h> + +extern const tI18nPhrase Phrases[]; + +#endif //__XINELIBOUTPUT_I18N_H diff --git a/logdefs.h b/logdefs.h new file mode 100644 index 00000000..827ad545 --- /dev/null +++ b/logdefs.h @@ -0,0 +1,91 @@ +/* + * logdefs.h: Logging and debug output + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: logdefs.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef _LOGDEFS_H_ + +#ifndef LOG_MODULENAME +# define LOG_MODULENAME "[xine..put] " +#endif + +#define TRACELINE LOGDBG("at %s:%d %s", __FILE__, __LINE__, __FUNCTION__) + + +#if defined(XINELIBOUTPUT_DEBUG_STDOUT) +# /* logging --> stdout */ +# include <stdio.h> +# define x_syslog(l,x...) do { printf(LOG_MODULENAME x); \ + printf("\n"); \ + } while(0) + +#elif defined(XINELIBOUTPUT_DEBUG_STDERR) +# /* logging --> stderr */ +# include <stdio.h> +# define x_syslog(l,x...) do { fprintf(stderr, LOG_MODULENAME x); \ + fprintf(stderr,"\n"); \ + } while(0) + +#else +# /* logging --> syslog */ +# include <syslog.h> +# if defined(VDRVERSNUM) && VDRVERSNUM >= 10343 +# define x_syslog(l,x...) syslog_with_tid(l, LOG_MODULENAME x) +# else +# define x_syslog(l,x...) syslog(l, LOG_MODULENAME x) +# endif +#endif + +#include <errno.h> + +#define LOG_ERRNO x_syslog(LOG_ERR, "ERROR (%s,%d): %s", \ + __FILE__, __LINE__, strerror(errno)) + +#define LOGERR(x...) do { \ + if(SysLogLevel > 0) { \ + x_syslog(LOG_ERR, x); \ + if(errno) \ + LOG_ERRNO; \ + } \ + } while(0) +#define LOGMSG(x...) do{ if(SysLogLevel > 1) x_syslog(LOG_INFO, x); } while(0) +#define LOGDBG(x...) do{ if(SysLogLevel > 2) x_syslog(LOG_DEBUG, x); } while(0) + + +#ifdef XINELIBOUTPUT_DEBUG +# +# include <fstream> +# include <iostream> +# include <stdio.h> +# +# ifndef TRACE_IDENT +# define TRACE_IDENT "" +# endif +# if defined(XINELIBOUTPUT_DEBUG_STDOUT) +# define TRACE(x) do {std::cout << TRACE_IDENT << x << "\n"; fflush(stdout);}while(0) +# elif defined(XINELIBOUTPUT_DEBUG_STDERR) +# define TRACE(x) do {std::cerr << TRACE_IDENT << x << "\n"; fflush(stderr);}while(0) +# else +# error No trace target ! +# endif +# define TRACEF(x) cTraceFunctionCall _x_cTraceFunctionCall(x); + class cTraceFunctionCall { + public: + const char *m_name; + cTraceFunctionCall(const char *name) : m_name(name) + { TRACE(m_name << " - Enter"); } + ~cTraceFunctionCall() + { TRACE(m_name << " - Leave "); } + }; +#else +# define TRACE(x) +# define TRACEF(x) +#endif + + +#endif /* _LOGDEFS_H_ */ diff --git a/media_player.h b/media_player.h new file mode 100644 index 00000000..830d7929 --- /dev/null +++ b/media_player.h @@ -0,0 +1,88 @@ +/* + * media_player.h: Media and image players + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: media_player.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_PLAYER_H +#define __XINELIB_PLAYER_H + +#include <vdr/player.h> + +// --- Media player --------------------------------------------------------- + +class cXinelibPlayer; +class cSkinDisplayReplay; + +class cXinelibPlayerControl : public cControl +{ + private: + static cXinelibPlayer *m_Player; + static cMutex m_Lock; + + static cXinelibPlayer *OpenPlayer(const char *file); + + cSkinDisplayReplay *m_DisplayReplay; + char *m_File; + int m_Speed; + bool m_ShowModeOnly; + + static int m_SubtitlePos; + + public: + cXinelibPlayerControl(const char *file); + virtual ~cXinelibPlayerControl(); + + virtual void Show(void); + virtual void Hide(void); + virtual eOSState ProcessKey(eKeys Key); + + static void Close(void); + static bool IsOpen(void) {return m_Player != NULL;}; +}; + + +// --- Media player --------------------------------------------------------- + +class cXinelibImagePlayer; + +class cXinelibImagesControl : public cControl +{ + private: + static cXinelibImagePlayer *m_Player; + static cMutex m_Lock; + + cSkinDisplayReplay *m_DisplayReplay; + + char **m_Files; + char *m_File; + int m_Index; + int m_Count; + int m_Speed; + int m_LastShowTime; + bool m_ShowModeOnly; + + static cXinelibImagePlayer *OpenPlayer(const char *file); + + protected: + void Seek(int Rel); + void Delete(void); + + public: + cXinelibImagesControl(char **Files, int Index, int Count); + virtual ~cXinelibImagesControl(); + + virtual void Show(void); + virtual void Hide(void); + virtual eOSState ProcessKey(eKeys Key); + + static void Close(void); + static bool IsOpen(void) {return m_Player != NULL;}; +}; + +#endif // __XINELIB_PLAYER_H + @@ -0,0 +1,46 @@ +/* + * menu.h: Main Menu + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: menu.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_MENU_H +#define __XINELIB_MENU_H + +#include <vdr/menuitems.h> + + +class cMenuXinelib : public cMenuSetupPage +{ + private: + int field_order; + int compression; + int headphone; + int autocrop; + +#ifdef ENABLE_SUSPEND + int suspend; + cOsdItem *decoder_ctrl_suspend; +#endif +#ifdef HAVE_XV_FIELD_ORDER + cOsdItem *video_ctrl_interlace_order; +#endif + cOsdItem *audio_ctrl_compress; + + cOsdItem *ctrl_autocrop; + cOsdItem *ctrl_headphone; + + protected: + virtual void Store(void); + + public: + cMenuXinelib(void); + virtual ~cMenuXinelib(); + virtual eOSState ProcessKey(eKeys Key); +}; + +#endif //__XINELIB_SETUP_MENU_H diff --git a/menuitems.h b/menuitems.h new file mode 100644 index 00000000..09ae0630 --- /dev/null +++ b/menuitems.h @@ -0,0 +1,70 @@ +/* + * menuitems.h: New menu item types + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: menuitems.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_MENUITEMS_H_ +#define __XINELIB_MENUITEMS_H_ + +#include <vdr/menuitems.h> + +// --- cMenuEditTypedIntItem ------------------------------------------------- + +class cMenuEditTypedIntItem : public cMenuEditIntItem +{ + protected: + char *type; + char *zeroText; + + virtual void Set(void); + + public: + cMenuEditTypedIntItem(const char *Name, const char *Type, int *Value, + int Min = 0, int Max = INT_MAX, const char *ZeroText = NULL); + ~cMenuEditTypedIntItem(); +}; + +// --- cMenuEditStraI18nItem ------------------------------------------------- + +class cMenuEditStraI18nItem : public cMenuEditIntItem +{ + private: + const char * const *strings; + + protected: + virtual void Set(void); + + public: + cMenuEditStraI18nItem(const char *Name, int *Value, + int NumStrings, const char * const *Strings); +}; + +// --- cFileListItem --------------------------------------------------------- + +class cFileListItem : public cOsdItem +{ + private: + char *m_Name; + bool m_IsDir, m_HasResume, m_HasSubs, m_ShowFlags, m_Up; + + protected: + virtual void Set(void); + + public: + cFileListItem(const char *name, bool isDir, bool HasResume, bool HasSubs); + cFileListItem(const char *name, bool isDir); + ~cFileListItem(); + + const char *Name() { return m_Name; } + bool IsDir() { return m_IsDir; } + + virtual bool operator< (const cListObject &ListObject); + virtual int Compare(const cListObject &ListObject) const; +}; + +#endif //__XINELIB_MENUITEMS_H_ @@ -0,0 +1,72 @@ +/* + * osd.h: Xinelib On Screen Display control + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: osd.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_OSD_H +#define __XINELIB_OSD_H + +#include <vdr/config.h> +#include <vdr/osd.h> +#include <vdr/thread.h> // cMutex +#include <vdr/tools.h> // cListObject + +class cXinelibDevice; + +class cXinelibOsd : public cOsd, public cListObject +{ + private: + cXinelibOsd(); + cXinelibOsd(cXinelibOsd&); + cXinelibDevice *m_Device; + + protected: + cMutex m_Lock; + bool m_IsVisible; + bool m_Shown; + + virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas); + virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); + virtual void Flush(void); + + // Messages from cXinelibOsdProvider + void Show(void); + void Hide(void); + void Refresh(void); + + friend class cXinelibOsdProvider; + + public: + cXinelibOsd(cXinelibDevice *Device, int x, int y); + virtual ~cXinelibOsd(); +}; + +class cXinelibOsdProvider : public cOsdProvider +{ + protected: + cXinelibDevice *m_Device; + static cList<cXinelibOsd> m_OsdStack; + static cMutex m_Lock; + + // Messages from cXinelibOsd + static void OsdClosing(cXinelibOsd *Osd); + static void OsdClosed(cXinelibOsd *Osd); + + friend class cXinelibOsd; + + public: + cXinelibOsdProvider(cXinelibDevice *Device); + virtual ~cXinelibOsdProvider(); + + virtual cOsd *CreateOsd(int Left, int Top); + + static void RefreshOsd(void); +}; + +#endif //__XINELIB_OSD_H + diff --git a/setup_menu.h b/setup_menu.h new file mode 100644 index 00000000..d77cc797 --- /dev/null +++ b/setup_menu.h @@ -0,0 +1,27 @@ +/* + * setup_menu.h: Setup Menu + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: setup_menu.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_SETUP_MENU_H +#define __XINELIB_SETUP_MENU_H + +#include <vdr/menuitems.h> + +class cMenuSetupXinelib : public cMenuSetupPage { + + protected: + void Set(void); + virtual void Store(void) {}; + + public: + cMenuSetupXinelib(void); + virtual eOSState ProcessKey(eKeys Key); +}; + +#endif //__XINELIB_SETUP_MENU_H diff --git a/xine_frontend.h b/xine_frontend.h new file mode 100644 index 00000000..9bc5cc75 --- /dev/null +++ b/xine_frontend.h @@ -0,0 +1,100 @@ +/* + * xine_frontend.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: xine_frontend.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef _XINE_FRONTEND_H +#define _XINE_FRONTEND_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define FE_VERSION_STR "0.9.9" +#define FE_VERSION 0x99 /*(((0)<<16) | ((9)<<8) | ((9)))*/ + +typedef void (*fe_keypress_f)(char *keymap, char *name); + +typedef struct frontend_config_s frontend_config_t; +typedef struct frontend_s frontend_t; + +#if 0 +struct frontend_config_s { + /* Display */ + int width; + int height; + int fullscreen; + int modeswitch; + char *modeline; + int aspect; + + char *video_port; + + int scale_video; + int field_order; + + fe_keypress_f keypresshandler; + + /* Xine engine */ + char *audio_driver; + char *audio_port; + char *video_driver; + int pes_buffers; + int priority; +}; +#endif + +struct frontend_s { + /* Display */ + int (*fe_display_open)(frontend_t*, int winwidth, int winheight, + int fullscreen, + int modeswitch, char *modeline, int aspect, + fe_keypress_f keypresshandler, char *video_port, + int scale_video, int field_order); + int (*fe_display_config)(frontend_t *, int width, int height, + int fullscreen, + int modeswitch, char *modeline, + int aspect, int scale_video, int field_order); + void (*fe_display_close)(frontend_t*); + + /* Xine engine */ + int (*xine_init)(frontend_t*, char *audio_driver, char *audio_port, + char *video_driver, int pes_buffers, + int priority, char *static_post); + int (*xine_open)(frontend_t*, char *mrl); + int (*xine_play)(frontend_t*); + int (*xine_stop)(frontend_t*); + void (*xine_close)(frontend_t*); + void (*xine_exit)(frontend_t*); + + /* Execution control */ + int (*fe_run)(frontend_t*); + void (*fe_interrupt)(frontend_t*); + void (*fe_free)(frontend_t*); + + /* Data transfer */ + int (*xine_is_finished)(frontend_t*); + int (*xine_osd_command)(frontend_t*, struct osd_command_s *cmd); + int (*xine_control)(frontend_t*, char *cmd); + int (*xine_queue_pes_packet)(frontend_t*, char *data, int len); + + char *(*grab)(frontend_t*, int *size, int jpeg, int quality, + int width, int height); +#if 0 + frontend_config_t config; +#endif +}; + +typedef frontend_t *(*fe_creator_f)(void); + +#ifdef __cplusplus +} /* extern "C" { */ +#endif + +#endif /* _XINE_FRONTEND_H */ + diff --git a/xine_input_vdr.h b/xine_input_vdr.h new file mode 100644 index 00000000..87f41cdb --- /dev/null +++ b/xine_input_vdr.h @@ -0,0 +1,46 @@ +/* + * xine_input_vdr.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: xine_input_vdr.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINE_INPUT_VDR_H_ +#define __XINE_INPUT_VDR_H_ + +#if defined __cplusplus +extern "C" { +#endif + +struct input_plugin_s; +struct osd_command_s; + +typedef struct vdr_input_plugin_funcs_s { + /* VDR --> input plugin (only local mode) */ + int (*push_input_write)(struct input_plugin_s *, char *, int); + int (*push_input_control)(struct input_plugin_s *, char *); + int (*push_input_osd)(struct input_plugin_s *, struct osd_command_s *); + /* input plugin --> frontend (only local mode) */ + void (*xine_input_event)(char *, char *); + /* input plugin --> frontend */ + void *(*fe_control)(void *fe_handle, char *); + void *fe_handle; + /* frontend --> input plugin (remote mode) */ + int (*input_control)(struct input_plugin_s *, char *, char *, int, int); +} vdr_input_plugin_funcs_t; + +#define CONTROL_OK 0 +#define CONTROL_UNKNOWN -1 +#define CONTROL_PARAM_ERROR -2 +#define CONTROL_DISCONNECTED -3 + +#if defined __cplusplus +} +#endif + + +#endif /*__XINE_INPUT_VDR_H_*/ + diff --git a/xine_input_vdr_net.h b/xine_input_vdr_net.h new file mode 100644 index 00000000..f36127e2 --- /dev/null +++ b/xine_input_vdr_net.h @@ -0,0 +1,91 @@ +/* + * xine_input_vdr_net.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: xine_input_vdr_net.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINE_INPUT_VDR_NET_H_ +#define __XINE_INPUT_VDR_NET_H_ + +#include <arpa/inet.h> + + +/* + * Default port(s) + */ + +#ifndef DEFAULT_VDR_PORT +# define DEFAULT_VDR_PORT 37890 +#endif +#ifndef DISCOVERY_PORT +# define DISCOVERY_PORT 37890 +#endif + +/* + * Byte-order conversions + */ + +#define ntohll(val) ((int64_t)ntohull((uint64_t)val)) +#define htonll(val) ((int64_t)htonull((uint64_t)val)) + +#define ntohull(val) \ + (ntohs(0x1234) == 0x1234 ? (val) : \ + (uint64_t) ntohl((uint32_t)((val) >> 32)) | \ + (uint64_t) ntohl((uint32_t)(val)) << 32) + +#define htonull(val) \ + (ntohs(0x1234) == 0x1234 ? (val) : \ + (uint64_t) htonl((uint32_t)((val) >> 32)) | \ + (uint64_t) htonl((uint32_t)(val)) << 32) + + +/* + * Network packet headers + */ + +#if defined __cplusplus +extern "C" { +#endif + + +#if 0 +typedef struct stream_rtp_header { + /* input_rtp.c ? */ + int dummy; +} __attribute__ ((packed)) stream_rtp_header_t; + +#define RTP_PAYLOAD(frame) (((uchar *)frame) + sizeof(stream_rtp_header_t)) +#endif + + +#define UDP_SEQ_MASK 0xff + +typedef struct stream_udp_header { + uint64_t pos; /* stream position of first byte */ + /* -1ULL and first bytes of frame != 00 00 01 */ + /* --> embedded control stream data */ + uint16_t seq; /* packet sequence number + (for re-ordering and detecting missing packets) */ +} __attribute__ ((packed)) stream_udp_header_t; + +#define UDP_PAYLOAD(frame) (((uchar *)frame) + sizeof(stream_udp_header_t)) + + +typedef struct stream_tcp_header { + uint64_t pos; /* stream position of first byte */ + uint32_t len; /* length of following PES packet */ +} __attribute__ ((packed)) stream_tcp_header_t; + +#define TCP_PAYLOAD(frame) (((uchar *)frame) + sizeof(stream_tcp_header_t)) + +#if defined __cplusplus +} +#endif + + +#endif /*__XINE_INPUT_VDR_NET_H_*/ + diff --git a/xine_osd_command.h b/xine_osd_command.h new file mode 100644 index 00000000..367530ee --- /dev/null +++ b/xine_osd_command.h @@ -0,0 +1,68 @@ +/* + * xine_osd_command.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: xine_osd_command.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINE_OSD_COMMAND_H_ +#define __XINE_OSD_COMMAND_H_ + +#define MAX_OSD_OBJECT 50 + +#if defined __cplusplus +extern "C" { +#endif + +typedef enum { + OSD_Nop = 0, /* Do nothing ; used to initialize delay_ms counter */ + OSD_Size = 1, /* Set size of VDR OSD area (usually 720x576) */ + OSD_Set_RLE = 2, /* Create/update OSD window. Data is rle-compressed. */ + OSD_SetPalette = 3, /* Modify palette of already created OSD window */ + OSD_Move = 4, /* Change x/y position of already created OSD window */ + OSD_Close = 5, /* Close OSD window */ + OSD_Set_YUV = 6 /* Create/update OSD window. Data is in YUV420 format. */ +} osd_command_id_t; + +typedef struct xine_clut_s { + uint8_t cb : 8; + uint8_t cr : 8; + uint8_t y : 8; + uint8_t alpha/*foo*/ : 8; +} __attribute__((packed)) xine_clut_t; /* from xine, alphablend.h */ + +typedef struct xine_rle_elem_s { + uint16_t len; + uint16_t color; +} __attribute__((packed)) xine_rle_elem_t; /* from xine */ + +typedef struct osd_command_s { + uint32_t cmd; /* osd_command_id_t */ + + uint32_t wnd; /* OSD window handle */ + + int64_t pts; /* execute at given pts */ + uint32_t delay_ms; /* execute 'delay_ms' ms after previous command (for same window). */ + + uint16_t x; /* window position, x */ + uint16_t y; /* window position, y */ + uint16_t w; /* window width */ + uint16_t h; /* window height */ + + uint32_t datalen; /* size of image data, in bytes */ + xine_rle_elem_t *data; /* RLE compressed image */ + + uint32_t colors; /* palette size */ + xine_clut_t *palette; /* palette (YCrCb) */ + +} __attribute__((packed)) osd_command_t; + + +#if defined __cplusplus +} +#endif + +#endif /*__XINE_OSD_COMMAND_H_*/ |