00001
00033
00034 #ifndef llmediaimplgstreamer_h
00035 #define llmediaimplgstreamer_h
00036
00037 #include "llmediaimplcommon.h"
00038 #include "llmediaimplfactory.h"
00039
00040 #if LL_GSTREAMER_ENABLED
00041
00042 extern "C" {
00043 #include <stdio.h>
00044 #include <gst/gst.h>
00045
00046 #include <apr-1/apr_pools.h>
00047 #include <apr-1/apr_dso.h>
00048 }
00049
00050 #include "llmediaimplgstreamervidplug.h"
00051 #ifdef LL_GST_SOUNDSINK
00052 #include "llmediaimplgstreamersndplug.h"
00053 #endif // LL_GST_SOUNDSINK
00054
00055 class LLMediaManagerData;
00056 class LLMediaImplMaker;
00057
00059 class LLMediaImplGStreamer:
00060 public LLMediaImplCommon
00061 {
00062 public:
00063 LLMediaImplGStreamer ();
00064 virtual ~LLMediaImplGStreamer ();
00065
00067
00068
00069 static bool startup( LLMediaManagerData* init_data );
00070 static bool closedown();
00071
00072 std::string getVersion();
00073 bool navigateTo( const std::string url );
00074 bool updateMedia();
00075 unsigned char* getMediaData();
00076 int getTextureFormatPrimary() const;
00077 int getTextureFormatType() const;
00078 int getTextureFormatInternal() const;
00079 bool setVolume( float volume );
00080
00081 bool stop();
00082 bool play();
00083 LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;};
00084
00085 private:
00086
00087 bool unload();
00088 bool pause();
00089 unsigned char* mediaData;
00090 int mMediaRowbytes;
00091
00092 int mTextureFormatPrimary;
00093 int mTextureFormatType;
00094
00095
00096 GMainLoop *mPump;
00097 GstElement *mPlaybin;
00098 GstSLVideo *mVideoSink;
00099 #ifdef LL_GST_SOUNDSINK
00100 GstSLSound *mAudioSink;
00101 #endif // LL_GST_SOUNDSINK
00102 };
00103
00104 class LLMediaImplGStreamerMaker : public LLMediaImplMaker
00105 {
00106 public:
00107 LLMediaImplGStreamerMaker();
00108 LLMediaImplGStreamer* create()
00109 {
00110 return new LLMediaImplGStreamer();
00111 }
00112 };
00113
00115
00116 #define STDERRMSG(...) do{\
00117 fprintf(stderr, "%s:%d: ", __FUNCTION__, __LINE__);\
00118 fprintf(stderr, __VA_ARGS__);\
00119 fputc('\n',stderr);\
00120 }while(0)
00121 #define NULLMSG(...) do{}while(0)
00122
00123 #define DEBUGMSG NULLMSG
00124 #define INFOMSG STDERRMSG
00125 #define WARNMSG STDERRMSG
00127
00128 #endif // LL_GSTREAMER_ENABLED
00129
00130 #endif // llmediaimplgstreamer_h