From 0735f182a48966865fc5a198c10b8a7c0a317634 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 26 Mar 2009 01:41:38 -0500 Subject: Removed all that llgst and symbol grabbing silliness. Some symbols require gstreamer >= 0.10.11. --- linden/indra/llmedia/CMakeLists.txt | 2 - linden/indra/llmedia/llmediaimplgstreamer.cpp | 118 ++++++++------------- .../indra/llmedia/llmediaimplgstreamervidplug.cpp | 57 +++++----- 3 files changed, 71 insertions(+), 106 deletions(-) (limited to 'linden/indra/llmedia') diff --git a/linden/indra/llmedia/CMakeLists.txt b/linden/indra/llmedia/CMakeLists.txt index 026afc1..0440153 100644 --- a/linden/indra/llmedia/CMakeLists.txt +++ b/linden/indra/llmedia/CMakeLists.txt @@ -30,7 +30,6 @@ set(llmedia_SOURCE_FILES llmediaimplfactory.cpp llmediamanager.cpp llmediaimplgstreamer.cpp - llmediaimplgstreamer_syms.cpp llmediaimplgstreamervidplug.cpp ) @@ -48,7 +47,6 @@ set(llmedia_HEADER_FILES llmediaobserver.h llmediaimplgstreamer.h llmediaimplgstreamervidplug.h - llmediaimplgstreamer_syms.h ) # Work around a bad interaction between broken gstreamer headers and diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 30706f1..5d4d553 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -44,9 +44,8 @@ extern "C" { #include "llmediaimplgstreamervidplug.h" -#include "llmediaimplgstreamer_syms.h" - #include "llerror.h" +#include "linden_common.h" // register this impl with media manager factory static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); @@ -90,7 +89,7 @@ LLMediaImplGStreamer () : } // instantiate a playbin element to do the hard work - mPlaybin = llgst_element_factory_make ("playbin", "play"); + mPlaybin = gst_element_factory_make ("playbin", "play"); if (!mPlaybin) { // todo: cleanup pump @@ -104,7 +103,7 @@ LLMediaImplGStreamer () : // Plays inworld instead of in external player mVideoSink = - GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo")); + GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); if (!mVideoSink) { LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL; @@ -148,7 +147,7 @@ LLMediaImplGStreamer:: std::string LLMediaImplGStreamer::getVersion() { guint major, minor, micro, nano; - llgst_version(&major, &minor, µ, &nano); + gst_version(&major, &minor, µ, &nano); std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano); return version; } @@ -165,31 +164,10 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) // Init the glib type system - we need it. g_type_init(); - // Get symbols! -#if LL_WINDOWS - if (! grab_gst_syms("libgstreamer-0.10.dll", "libgstvideo-0.10.dll", "libgstaudio-0.10.dll") ) - { - LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL; - return false; - } -#else - if (! grab_gst_syms("libgstreamer-0.10.so.0", "libgstvideo-0.10.so.0", "libgstaudio-0.10.so.0") ) - { - LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL; - return false; - } -#endif - if (llgst_segtrap_set_enabled) - llgst_segtrap_set_enabled(FALSE); - else - { - LL_WARNS("MediaImpl") << "gst_segtrap_set_enabled() is not available; Automated crash-reporter may cease to function until next restart." << LL_ENDL; - } - // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; saved_locale = setlocale(LC_ALL, NULL); - if (0 == llgst_init_check(NULL, NULL, NULL)) + if (0 == gst_init_check(NULL, NULL, NULL)) { LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL; setlocale(LC_ALL, saved_locale.c_str() ); @@ -208,7 +186,6 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) bool LLMediaImplGStreamer::closedown() { - ungrab_gst_syms(); return true; } @@ -236,7 +213,7 @@ static const char* get_gst_state_name(GstState state) gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data) { #ifdef LL_GST_REPORT_STATE_CHANGES - LL_DEBUGS("MediaCallback") << "Got GST message type: " << LLGST_MESSAGE_TYPE_NAME (message) << LL_ENDL; + LL_DEBUGS("MediaCallback") << "Got GST message type: " << GST_MESSAGE_TYPE_NAME (message) << LL_ENDL; #endif LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data; @@ -245,17 +222,13 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp { case GST_MESSAGE_BUFFERING: { - // NEEDS GST 0.10.11+ - if (llgst_message_parse_buffering) - { - gint percent = 0; - llgst_message_parse_buffering(message, &percent); + gint percent = 0; + gst_message_parse_buffering(message, &percent); #ifdef LL_GST_REPORT_STATE_CHANGES - LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL; + LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL; #endif - LLMediaEvent event( impl, percent ); - impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); - } + LLMediaEvent event( impl, percent ); + impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); } break; case GST_MESSAGE_STATE_CHANGED: @@ -263,7 +236,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp GstState old_state; GstState new_state; GstState pending_state; - llgst_message_parse_state_changed(message, + gst_message_parse_state_changed(message, &old_state, &new_state, &pending_state); @@ -308,7 +281,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp GError *err = NULL; gchar *debug = NULL; - llgst_message_parse_error (message, &err, &debug); + gst_message_parse_error (message, &err, &debug); LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL; g_error_free (err); g_free (debug); @@ -320,17 +293,14 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp } case GST_MESSAGE_INFO: { - if (llgst_message_parse_info) - { - GError *err = NULL; - gchar *debug = NULL; + GError *err = NULL; + gchar *debug = NULL; - llgst_message_parse_info (message, &err, &debug); - LL_INFOS("MediaImpl") << "GST info: " << err->message - << LL_ENDL; - g_error_free (err); - g_free (debug); - } + gst_message_parse_info (message, &err, &debug); + LL_INFOS("MediaImpl") << "GST info: " << err->message + << LL_ENDL; + g_error_free (err); + g_free (debug); break; } case GST_MESSAGE_WARNING: @@ -338,7 +308,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp GError *err = NULL; gchar *debug = NULL; - llgst_message_parse_warning (message, &err, &debug); + gst_message_parse_warning (message, &err, &debug); LL_WARNS("MediaImpl") << "GST warning: " << err->message << LL_ENDL; g_error_free (err); @@ -351,10 +321,10 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp GstTagList *tag_list; gchar *title; gchar *artist; - llgst_message_parse_tag(message, &tag_list); - gboolean hazTitle = llgst_tag_list_get_string(tag_list, + gst_message_parse_tag(message, &tag_list); + gboolean hazTitle = gst_tag_list_get_string(tag_list, GST_TAG_TITLE, &title); - gboolean hazArtist = llgst_tag_list_get_string(tag_list, + gboolean hazArtist = gst_tag_list_get_string(tag_list, GST_TAG_ARTIST, &artist); if(hazTitle) LL_INFOS("MediaInfo") << "Title: " << title << LL_ENDL; @@ -408,13 +378,13 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn) g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); // get playbin's bus - perhaps this can/should be done in ctor - GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); + GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); if (!bus) { return false; } - llgst_bus_add_watch (bus, bus_callback, this); - llgst_object_unref (bus); + gst_bus_add_watch (bus, bus_callback, this); + gst_object_unref (bus); mState = GST_STATE_READY; @@ -431,9 +401,9 @@ bool LLMediaImplGStreamer::unload() LL_DEBUGS("MediaImpl") << "unloading media..." << LL_ENDL; if (mPlaybin) { - llgst_element_set_state (mPlaybin, GST_STATE_NULL); + gst_element_set_state (mPlaybin, GST_STATE_NULL); mState = GST_STATE_NULL; - llgst_object_unref (GST_OBJECT (mPlaybin)); + gst_object_unref (GST_OBJECT (mPlaybin)); mPlaybin = NULL; } @@ -591,18 +561,18 @@ bool LLMediaImplGStreamer::stop() if (!mPlaybin || mState == GST_STATE_NULL) return true; - GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); - llgst_object_unref(pipeline); + GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); + gst_object_unref(pipeline); - llgst_element_set_state(pipeline, GST_STATE_READY); + gst_element_set_state(pipeline, GST_STATE_READY); if (mState == GST_STATE_PLAYING) mState = GST_STATE_VOID_PENDING; else mState = GST_STATE_READY; - GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); - LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; + GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); + LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; return true; } @@ -616,16 +586,16 @@ bool LLMediaImplGStreamer::play() if (!mPlaybin || mState == GST_STATE_NULL) return true; - GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); - llgst_object_unref(pipeline); + GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); + gst_object_unref(pipeline); - llgst_element_set_state(pipeline, GST_STATE_PLAYING); + gst_element_set_state(pipeline, GST_STATE_PLAYING); mState = GST_STATE_PLAYING; - /*llgst_element_set_state(mPlaybin, GST_STATE_PLAYING); + /*gst_element_set_state(mPlaybin, GST_STATE_PLAYING); mState = GST_STATE_PLAYING;*/ - GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); - LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; + GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); + LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; // Check to make sure playing was successful. If not, stop. if (state_change == GST_STATE_CHANGE_FAILURE) @@ -646,11 +616,11 @@ bool LLMediaImplGStreamer::pause() if (!mPlaybin || mState == GST_STATE_NULL) return true; - llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); + gst_element_set_state(mPlaybin, GST_STATE_PAUSED); mState = GST_STATE_PAUSED; - GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); - LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; + GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); + LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; return true; }; @@ -671,7 +641,7 @@ bool LLMediaImplGStreamer::seek(double time) bool success = false; if (mPlaybin) { - success = llgst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME, + success = gst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME, GstSeekFlags(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), GST_SEEK_TYPE_SET, gint64(time*1000000000.0F), diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp index c95ef36..651b1b3 100644 --- a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp @@ -37,8 +37,6 @@ #include #include -#include "llmediaimplgstreamer_syms.h" - #include "llthread.h" #include "llmediaimplgstreamervidplug.h" @@ -88,9 +86,9 @@ gst_slvideo_base_init (gpointer gclass) }; GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - llgst_element_class_add_pad_template (element_class, - llgst_static_pad_template_get (&sink_factory)); - llgst_element_class_set_details (element_class, &element_details); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details (element_class, &element_details); } @@ -101,7 +99,7 @@ gst_slvideo_finalize (GObject * object) slvideo = GST_SLVIDEO (object); if (slvideo->caps) { - llgst_caps_unref(slvideo->caps); + gst_caps_unref(slvideo->caps); } G_OBJECT_CLASS(parent_class)->finalize (object); @@ -112,7 +110,7 @@ static GstFlowReturn gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) { GstSLVideo *slvideo; - llg_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); + g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); slvideo = GST_SLVIDEO(bsink); @@ -205,7 +203,7 @@ gst_slvideo_get_caps (GstBaseSink * bsink) GstSLVideo *slvideo; slvideo = GST_SLVIDEO(bsink); - return llgst_caps_ref (slvideo->caps); + return gst_caps_ref (slvideo->caps); } @@ -221,36 +219,36 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps) filter = GST_SLVIDEO(bsink); - intersection = llgst_caps_intersect (filter->caps, caps); - if (llgst_caps_is_empty (intersection)) + intersection = gst_caps_intersect (filter->caps, caps); + if (gst_caps_is_empty (intersection)) { // no overlap between our caps and requested caps return FALSE; } - llgst_caps_unref(intersection); + gst_caps_unref(intersection); int width = 0; int height = 0; gboolean ret; const GValue *fps; const GValue *par; - structure = llgst_caps_get_structure (caps, 0); - ret = llgst_structure_get_int (structure, "width", &width); - ret = ret && llgst_structure_get_int (structure, "height", &height); - fps = llgst_structure_get_value (structure, "framerate"); + structure = gst_caps_get_structure (caps, 0); + ret = gst_structure_get_int (structure, "width", &width); + ret = ret && gst_structure_get_int (structure, "height", &height); + fps = gst_structure_get_value (structure, "framerate"); ret = ret && (fps != NULL); - par = llgst_structure_get_value (structure, "pixel-aspect-ratio"); + par = gst_structure_get_value (structure, "pixel-aspect-ratio"); if (!ret) return FALSE; filter->width = width; filter->height = height; - filter->fps_n = llgst_value_get_fraction_numerator(fps); - filter->fps_d = llgst_value_get_fraction_denominator(fps); + filter->fps_n = gst_value_get_fraction_numerator(fps); + filter->fps_d = gst_value_get_fraction_denominator(fps); if (par) { - filter->par_n = llgst_value_get_fraction_numerator(par); - filter->par_d = llgst_value_get_fraction_denominator(par); + filter->par_n = gst_value_get_fraction_numerator(par); + filter->par_d = gst_value_get_fraction_denominator(par); } else { @@ -261,15 +259,15 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps) GST_VIDEO_SINK_HEIGHT(filter) = height; filter->format = SLV_PF_UNKNOWN; - if (0 == strcmp(llgst_structure_get_name(structure), + if (0 == strcmp(gst_structure_get_name(structure), "video/x-raw-rgb")) { int red_mask; int green_mask; int blue_mask; - llgst_structure_get_int(structure, "red_mask", &red_mask); - llgst_structure_get_int(structure, "green_mask", &green_mask); - llgst_structure_get_int(structure, "blue_mask", &blue_mask); + gst_structure_get_int(structure, "red_mask", &red_mask); + gst_structure_get_int(structure, "green_mask", &green_mask); + gst_structure_get_int(structure, "blue_mask", &blue_mask); if ((unsigned int)red_mask == 0xFF000000 && (unsigned int)green_mask == 0x00FF0000 && (unsigned int)blue_mask == 0x0000FF00) @@ -366,9 +364,9 @@ gst_slvideo_update_caps (GstSLVideo * slvideo) // GStreamer will automatically convert colourspace if necessary. // GStreamer will automatically resize media to one of these enumerated // powers-of-two that we ask for (yay GStreamer!) - caps = llgst_caps_from_string (SLV_ALLCAPS); + caps = gst_caps_from_string (SLV_ALLCAPS); - llgst_caps_replace (&slvideo->caps, caps); + gst_caps_replace (&slvideo->caps, caps); } @@ -401,7 +399,7 @@ static void gst_slvideo_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - llg_return_if_fail (GST_IS_SLVIDEO (object)); + g_return_if_fail (GST_IS_SLVIDEO (object)); if (prop_id) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -412,7 +410,7 @@ static void gst_slvideo_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - llg_return_if_fail (GST_IS_SLVIDEO (object)); + g_return_if_fail (GST_IS_SLVIDEO (object)); if (prop_id) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -433,7 +431,7 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, "private-slvideo-plugin", 0, "Second Life Video Sink"); - return llgst_element_register (plugin, "private-slvideo", + return gst_element_register (plugin, "private-slvideo", GST_RANK_NONE, GST_TYPE_SLVIDEO); } @@ -455,7 +453,6 @@ plugin_init (GstPlugin * plugin) void gst_slvideo_init_class (void) { - ll_gst_plugin_register_static (&gst_plugin_desc); //fprintf(stderr, "\n\n\nCLASS INIT\n\n\n"); } -- cgit v1.1