00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef MMSAV_H_
00034 #define MMSAV_H_
00035
00036 #include <sys/stat.h>
00037 #include <sigc++/sigc++.h>
00038 #ifdef __HAVE_GSTREAMER__
00039 #include <gst/gst.h>
00040
00041 #endif
00042 #ifdef __HAVE_XINE__
00043 #include <xine.h>
00044 #endif
00045 #include <map>
00046 #include "mmsgui/mmsgui.h"
00047 #include "mmstools/mmstools.h"
00048 #ifdef __HAVE_XV__
00049 #include <X11/extensions/Xv.h>
00050 #include <X11/extensions/Xvlib.h>
00051 #endif
00052
00053
00054 #ifdef __HAVE_GSTREAMER__
00055
00056 typedef struct {
00057
00058 string uri;
00059
00060
00061 GstElement *pipeline;
00062 } GST_DISKOVIDEOSINK_DATA;
00063
00064
00065
00066 #endif
00067
00068 #ifdef __HAVE_XINE__
00069
00070
00071
00072
00073
00074
00075
00076 typedef struct {
00077 MMSFBSurface *winsurface;
00078 #ifdef __HAVE_DIRECTFB__
00079 DFBWindowDescription windsc;
00080 DFBSurfacePixelFormat format;
00081 #endif
00082 double ratio;
00083 int width;
00084 int height;
00085 MMSFBRectangle rect;
00086 } VODESC;
00087
00088 #ifdef __HAVE_DIRECTFB__
00089
00090 typedef void (*DVOutputCallback) (void *cdata, int width, int height,
00091 double ratio, DFBSurfacePixelFormat format,
00092 DFBRectangle *dest_rect);
00093
00094
00095
00096
00097
00098
00099
00100 typedef struct {
00101 IDirectFBSurface *destination;
00102 IDirectFBSurface *subpicture;
00103 DVOutputCallback output_cb;
00104 void *output_cdata;
00105 DVFrameCallback frame_cb;
00106 void *frame_cdata;
00107 } dfb_visual_t;
00108
00109 #endif
00110 #endif
00111
00112 typedef struct {
00113 MMSFBSurface *surf;
00114 MMSFBSurfacePixelFormat surf_pixelformat;
00115 MMSFBRectangle size;
00116 MMSFBRectangle dest;
00117 double lastaspect;
00118 MMSFBSurface *interim;
00119
00120 MMSFBSurface *overlayInterim;
00121
00122 int numOverlays;
00123 #ifdef __HAVE_XINE__
00124
00125 raw_overlay_t *overlays;
00126 #endif
00127 } MMSRAW_USERDATA;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 class MMSAV
00145 {
00146 private:
00147 sigc::connection onHandleInputConnection;
00148
00149 MMSRAW_USERDATA userd;
00150
00151 #ifdef __HAVE_GSTREAMER__
00152 GST_DISKOVIDEOSINK_DATA gst_diskovideosink_data;
00153 #endif
00154
00155 #ifdef __HAVE_XINE__
00156 #ifdef __HAVE_DIRECTFB__
00157 VODESC vodesc;
00158 dfb_visual_t visual;
00159 #endif
00160 raw_visual_t rawvisual;
00161
00162 pthread_mutex_t lock;
00163
00164 bool setPostPluginParameter(map<string, xine_post_t*> plugins, string name, string parameter, string value);
00165 #endif
00166
00167 protected:
00168
00169
00170 MMSMEDIABackend backend;
00171
00172
00173 MMSWindow *window;
00174
00175
00176 MMSFBSurface *surface;
00177
00178 bool verbose;
00179 short status;
00180 int pos;
00181
00182
00183 #ifdef __HAVE_GSTREAMER__
00184
00185 void gstInit(const string uri);
00186
00187
00188 #endif
00189 string currentMRL;
00190
00191 #ifdef __HAVE_XINE__
00192
00193
00194
00195 xine_t *xine;
00196 xine_video_port_t *vo;
00197 xine_audio_port_t *ao;
00198 xine_stream_t *stream;
00199 xine_event_queue_t *queue;
00200 map<string, xine_post_t*> audioPostPlugins,
00201 videoPostPlugins;
00202
00203
00204
00205 void xineInit();
00206 void xineOpen(xine_event_listener_cb_t queue_cb = NULL, void *userData = NULL);
00207
00208 #endif
00209
00210
00211 void initialize(const bool verbose = false, MMSWindow *window = NULL);
00212 void setStatus(int status);
00213 void sendEvent(int type, void *data = NULL, int datalen = 0);
00214
00215
00216 bool sendKeyPress(MMSKeySymbol key);
00217 bool sendKeyRelease(MMSKeySymbol key);
00218 bool sendButtonPress(int posx, int posy);
00219 bool sendButtonRelease(int posx, int posy);
00220 bool sendAxisMotion(int posx, int posy);
00221
00222 bool sendEvent(MMSInputEvent *input);
00223
00224 bool onHandleInput(MMSWindow *window, MMSInputEvent *input);
00225
00226 public:
00227
00228 static const unsigned short STATUS_NONE = 0;
00229 static const unsigned short STATUS_PLAYING = 1;
00230 static const unsigned short STATUS_PAUSED = 2;
00231 static const unsigned short STATUS_STOPPED = 3;
00232 static const unsigned short STATUS_REWIND = 4;
00233 static const unsigned short STATUS_FFWD = 5;
00234 static const unsigned short STATUS_FFWD2 = 6;
00235 static const unsigned short STATUS_SLOW = 7;
00236 static const unsigned short STATUS_SLOW2 = 8;
00237
00238 #ifdef __HAVE_GSTREAMER__
00239 MMSAV(MMSMEDIABackend backend = MMSMEDIA_BE_GST);
00240 #else
00241 MMSAV(MMSMEDIABackend backend = MMSMEDIA_BE_XINE);
00242 #endif
00243 virtual ~MMSAV();
00244
00245 bool registerAudioPostPlugin(string name);
00246 bool registerVideoPostPlugin(string name);
00247 bool setAudioPostPluginParameter(string name, string parameter, string value);
00248 bool setVideoPostPluginParameter(string name, string parameter, string value);
00249
00250
00251 bool isPlaying();
00252 bool isPaused();
00253 bool isStopped();
00254 void startPlaying(const string mrl, const bool cont = true);
00255 void play();
00256 void stop(const bool savePosition = true);
00257 void pause();
00258 void ffwd();
00259 void slow();
00260
00261 bool getTimes(int *pos, int *length);
00262
00263 void setBrightness(int count);
00264 void brightnessUp(int count);
00265 void brightnessDown(int count);
00266 void setContrast(int count);
00267 void contrastUp(int count);
00268 void contrastDown(int count);
00269 void setSaturation(int count);
00270 void saturationUp(int count);
00271 void saturationDown(int count);
00272 void setHue(int count);
00273 void hueUp(int count);
00274 void hueDown(int count);
00275
00276 void setVolume(int percent);
00277
00278 bool hasVideo();
00279 bool hasAudio();
00280
00281
00282
00283
00284 sigc::signal<void, string> *onError;
00285
00286
00287
00288 sigc::signal<void, const unsigned short, const unsigned short> *onStatusChange;
00289
00290 };
00291
00292 #endif