From 4f675f77fd9e8efedccee87bc58e6c6f754aa437 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 26 Mar 2009 00:52:27 -0500 Subject: Link with some gstreamer core libs on Linux. --- linden/indra/cmake/GStreamer.cmake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'linden') diff --git a/linden/indra/cmake/GStreamer.cmake b/linden/indra/cmake/GStreamer.cmake index b4b984d..7b380a8 100644 --- a/linden/indra/cmake/GStreamer.cmake +++ b/linden/indra/cmake/GStreamer.cmake @@ -54,10 +54,6 @@ if (WINDOWS) else (WINDOWS) - include(FindPkgConfig) - - pkg_check_modules(GSTREAMER REQUIRED gstreamer-0.10) - pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10) set(GSTREAMER_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/gstreamer-0.10 ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0 @@ -66,9 +62,11 @@ else (WINDOWS) ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libxml2 ) - # We don't need to explicitly link against gstreamer itself, because - # LLMediaImplGStreamer probes for the system's copy at runtime. set(GSTREAMER_LIBRARIES + gstvideo-0.10 + gstaudio-0.10 + gstbase-0.10 + gstreamer-0.10 gobject-2.0 gmodule-2.0 dl -- cgit v1.1 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') 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 From 8ea92c69d3405d1a3614f9e454050e607e4437d7 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 26 Mar 2009 02:04:27 -0500 Subject: Removed obsolete gstreamer_syms files. --- linden/indra/llmedia/llmediaimplgstreamer_syms.cpp | 188 --------------------- linden/indra/llmedia/llmediaimplgstreamer_syms.h | 78 --------- .../llmedia/llmediaimplgstreamer_syms_raw.inc | 50 ------ .../llmedia/llmediaimplgstreamer_syms_rawa.inc | 5 - .../llmedia/llmediaimplgstreamer_syms_rawv.inc | 5 - 5 files changed, 326 deletions(-) delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms.cpp delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms.h delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms_rawv.inc (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp deleted file mode 100644 index fb1949a..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @file llmediaimplgstreamer_syms.cpp - * @brief dynamic GStreamer symbol-grabbing code - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -///#if LL_GSTREAMER_ENABLED - -extern "C" { -#include - -#include "apr_pools.h" -#include "apr_dso.h" -} - -#include "llmediaimplgstreamer.h" - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) RTN (*ll##GSTSYM)(__VA_ARGS__) = NULL -#include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" -#include "llmediaimplgstreamer_syms_rawv.inc" -#undef LL_GST_SYM - - -static bool sSymsGrabbed = false; -static apr_pool_t *sSymGSTDSOMemoryPool = NULL; -static apr_dso_handle_t *sSymGSTDSOHandleG = NULL; -static apr_dso_handle_t *sSymGSTDSOHandleV = NULL; -static apr_dso_handle_t *sSymGSTDSOHandleA = NULL; - - -bool grab_gst_syms(std::string gst_dso_name, - std::string gst_dso_name_vid, - std::string gst_dso_name_aud) -{ - if (sSymsGrabbed) - { - // already have grabbed good syms - return TRUE; - } - - bool sym_error = false; - bool rtn = false; - apr_status_t rv; - apr_dso_handle_t *sSymGSTDSOHandle = NULL; - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##GSTSYM, sSymGSTDSOHandle, #GSTSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #GSTSYM); if (REQ) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #GSTSYM, (void*)ll##GSTSYM);}while(0) - - //attempt to load the shared libraries - apr_pool_create(&sSymGSTDSOMemoryPool, NULL); - - if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle, - gst_dso_name.c_str(), - sSymGSTDSOMemoryPool) )) - { - INFOMSG("Found DSO: %s", gst_dso_name.c_str()); -#include "llmediaimplgstreamer_syms_raw.inc" - - if ( sSymGSTDSOHandle ) - { - sSymGSTDSOHandleG = sSymGSTDSOHandle; - sSymGSTDSOHandle = NULL; - } - - if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle, - gst_dso_name_aud.c_str(), - sSymGSTDSOMemoryPool) )) - { - INFOMSG("Found DSO: %s", gst_dso_name_aud.c_str()); -#include "llmediaimplgstreamer_syms_rawa.inc" - - if ( sSymGSTDSOHandle ) - { - sSymGSTDSOHandleA = sSymGSTDSOHandle; - sSymGSTDSOHandle = NULL; - } - - if ( APR_SUCCESS == - (rv = apr_dso_load(&sSymGSTDSOHandle, - gst_dso_name_vid.c_str(), - sSymGSTDSOMemoryPool) )) - { - INFOMSG("Found DSO: %s", gst_dso_name_vid.c_str()); -#include "llmediaimplgstreamer_syms_rawv.inc" - } - else - { - INFOMSG("Couldn't load DSO: %s", gst_dso_name_vid.c_str()); - rtn = false; // failure - } - } - else - { - INFOMSG("Couldn't load DSO: %s", gst_dso_name_aud.c_str()); - rtn = false; // failure - } - - rtn = !sym_error; - } - else - { - INFOMSG("Couldn't load DSO: %s", gst_dso_name.c_str()); - rtn = false; // failure - } - - if (sym_error) - { - WARNMSG("Failed to find necessary symbols in GStreamer libraries."); - } - - if ( sSymGSTDSOHandle ) - { - sSymGSTDSOHandleV = sSymGSTDSOHandle; - sSymGSTDSOHandle = NULL; - } -#undef LL_GST_SYM - - sSymsGrabbed = !!rtn; - return rtn; -} - - -void ungrab_gst_syms() -{ - // should be safe to call regardless of whether we've - // actually grabbed syms. - - if ( sSymGSTDSOHandleG ) - { - apr_dso_unload(sSymGSTDSOHandleG); - sSymGSTDSOHandleG = NULL; - } - - if ( sSymGSTDSOHandleA ) - { - apr_dso_unload(sSymGSTDSOHandleA); - sSymGSTDSOHandleA = NULL; - } - - if ( sSymGSTDSOHandleV ) - { - apr_dso_unload(sSymGSTDSOHandleV); - sSymGSTDSOHandleV = NULL; - } - - if ( sSymGSTDSOMemoryPool ) - { - apr_pool_destroy(sSymGSTDSOMemoryPool); - sSymGSTDSOMemoryPool = NULL; - } - - // NULL-out all of the symbols we'd grabbed -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{ll##GSTSYM = NULL;}while(0) -#include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" -#include "llmediaimplgstreamer_syms_rawv.inc" -#undef LL_GST_SYM - - sSymsGrabbed = false; -} - - -///#endif // LL_GSTREAMER_ENABLED diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.h b/linden/indra/llmedia/llmediaimplgstreamer_syms.h deleted file mode 100644 index ebebd80..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file llmediaimplgstreamer_syms.h - * @brief dynamic GStreamer symbol-grabbing code - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -///#if LL_GSTREAMER_ENABLED - -extern "C" { -#include -} - -bool grab_gst_syms(std::string gst_dso_name, - std::string gst_dso_name_vid, - std::string gst_dso_name_aud); -void ungrab_gst_syms(); - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) extern RTN (*ll##GSTSYM)(__VA_ARGS__) -#include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" -#include "llmediaimplgstreamer_syms_rawv.inc" -#undef LL_GST_SYM - -// regrettable hacks to give us better runtime compatibility with older systems -#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0) -#define llg_return_val_if_fail(COND,V) do{if (!(COND)) return V;}while(0) - -// regrettable hacks because GStreamer was not designed for runtime loading -#undef GST_TYPE_MESSAGE -#define GST_TYPE_MESSAGE (llgst_message_get_type()) -#undef GST_TYPE_OBJECT -#define GST_TYPE_OBJECT (llgst_object_get_type()) -#undef GST_TYPE_PIPELINE -#define GST_TYPE_PIPELINE (llgst_pipeline_get_type()) -#undef GST_TYPE_ELEMENT -#define GST_TYPE_ELEMENT (llgst_element_get_type()) -#undef GST_TYPE_AUDIO_SINK -#define GST_TYPE_AUDIO_SINK (llgst_audio_sink_get_type()) -#undef GST_TYPE_VIDEO_SINK -#define GST_TYPE_VIDEO_SINK (llgst_video_sink_get_type()) -#undef _gst_debug_register_funcptr -#define _gst_debug_register_funcptr ll_gst_debug_register_funcptr -#undef _gst_debug_category_new -#define _gst_debug_category_new ll_gst_debug_category_new -#undef __gst_debug_enabled -#define __gst_debug_enabled (0) - -// more hacks -#define LLGST_MESSAGE_TYPE_NAME(M) (llgst_message_type_get_name(GST_MESSAGE_TYPE(M))) - -///#endif // LL_GSTREAMER_ENABLED diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc deleted file mode 100644 index 0d0d764..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc +++ /dev/null @@ -1,50 +0,0 @@ - -// required symbols to grab -LL_GST_SYM(true, gst_init_check, gboolean, int *argc, char **argv[], GError ** err); -LL_GST_SYM(true, gst_message_get_type, GType, void); -LL_GST_SYM(true, gst_message_type_get_name, const gchar*, GstMessageType type); -LL_GST_SYM(true, gst_message_parse_error, void, GstMessage *message, GError **gerror, gchar **debug); -LL_GST_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug); -LL_GST_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending); -LL_GST_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state); -LL_GST_SYM(true, gst_element_get_state, GstStateChangeReturn, GstElement *element, GstState *state, GstState *pending, GstClockTime timeout); -LL_GST_SYM(true, gst_object_unref, void, gpointer object); -LL_GST_SYM(true, gst_object_ref, gpointer, gpointer object); -LL_GST_SYM(true, gst_object_get_type, GType, void); -LL_GST_SYM(true, gst_pipeline_get_type, GType, void); -LL_GST_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline); -LL_GST_SYM(true, gst_bus_add_watch, guint, GstBus * bus, GstBusFunc func, gpointer user_data); -LL_GST_SYM(true, gst_element_factory_make, GstElement*, const gchar *factoryname, const gchar *name); -LL_GST_SYM(true, gst_element_get_type, GType, void); -LL_GST_SYM(true, gst_static_pad_template_get, GstPadTemplate*, GstStaticPadTemplate *pad_template); -LL_GST_SYM(true, gst_element_class_add_pad_template, void, GstElementClass *klass, GstPadTemplate *temp); -LL_GST_SYM(true, gst_element_class_set_details, void, GstElementClass *klass, const GstElementDetails *details); -LL_GST_SYM(true, gst_caps_unref, void, GstCaps* caps); -LL_GST_SYM(true, gst_caps_ref, GstCaps *, GstCaps* caps); -LL_GST_SYM(true, _gst_debug_register_funcptr, void, GstDebugFuncPtr func, gchar* ptrname); -LL_GST_SYM(true, _gst_debug_category_new, GstDebugCategory *, gchar *name, guint color, gchar *description); -LL_GST_SYM(true, gst_caps_is_empty, gboolean, const GstCaps *caps); -LL_GST_SYM(true, gst_caps_from_string, GstCaps *, const gchar *string); -LL_GST_SYM(true, gst_caps_replace, void, GstCaps **caps, GstCaps *newcaps); -LL_GST_SYM(true, gst_caps_get_structure, GstStructure *, const GstCaps *caps, guint index); -LL_GST_SYM(true, gst_caps_copy, GstCaps *, const GstCaps * caps); -LL_GST_SYM(true, gst_caps_intersect, GstCaps *, const GstCaps *caps1, const GstCaps *caps2); -LL_GST_SYM(true, gst_element_register, gboolean, GstPlugin *plugin, const gchar *name, guint rank, GType type); -LL_GST_SYM(true, _gst_plugin_register_static, void, GstPluginDesc *desc); -LL_GST_SYM(true, gst_structure_get_int, gboolean, const GstStructure *structure, const gchar *fieldname, gint *value); -LL_GST_SYM(true, gst_structure_get_value, G_CONST_RETURN GValue *, const GstStructure *structure, const gchar *fieldname); -LL_GST_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value); -LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value); -LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStructure *structure); -LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64); -LL_GST_SYM(true, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano); -LL_GST_SYM(true, gst_element_state_change_return_get_name, const gchar *, GstStateChangeReturn state_ret); - -// optional symbols to grab -LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled); -LL_GST_SYM(false, gst_message_parse_buffering, void, GstMessage *message, gint *percent); -LL_GST_SYM(false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug); - -//aw tag infos (Artist, Title, ...tbc...) -LL_GST_SYM(true, gst_message_parse_tag, void, GstMessage *message, GstTagList **tag_list); -LL_GST_SYM(true, gst_tag_list_get_string, gboolean, const GstTagList *list, const gchar *tag, gchar **value); diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc deleted file mode 100644 index 0be99b5..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc +++ /dev/null @@ -1,5 +0,0 @@ - -// required symbols to grab -LL_GST_SYM(true, gst_audio_sink_get_type, GType, void); - -// optional symbols to grab diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawv.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_rawv.inc deleted file mode 100644 index 14fbcb4..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawv.inc +++ /dev/null @@ -1,5 +0,0 @@ - -// required symbols to grab -LL_GST_SYM(true, gst_video_sink_get_type, GType, void); - -// optional symbols to grab -- cgit v1.1 From b52580d0858e5a97b03c4c4f2a64f6049d2a7966 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 26 Mar 2009 02:05:38 -0500 Subject: Fixed/improved how slvideo gst plugin is registered. --- .../indra/llmedia/llmediaimplgstreamervidplug.cpp | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp index 651b1b3..eaf2c84 100644 --- a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp @@ -435,25 +435,19 @@ plugin_init (GstPlugin * plugin) GST_RANK_NONE, GST_TYPE_SLVIDEO); } -/* this is the structure that gstreamer looks for to register plugins - */ -/* NOTE: Can't rely upon GST_PLUGIN_DEFINE_STATIC to self-register, since - some g++ versions buggily avoid __attribute__((constructor)) functions - - so we provide an explicit plugin init function. - */ -#define PACKAGE "packagehack" - GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "private-slvideoplugin", - "SL Video sink plugin", - plugin_init, "0.1", GST_LICENSE_UNKNOWN, - "Second Life", - "http://www.secondlife.com/"); -#undef PACKAGE void gst_slvideo_init_class (void) { - //fprintf(stderr, "\n\n\nCLASS INIT\n\n\n"); + gst_plugin_register_static( GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "private-slvideoplugin", + "SL Video sink plugin", + plugin_init, + "0.1", + GST_LICENSE_UNKNOWN, + "Second Life", + "Second Life", + "http://www.secondlife.com/" ); } ///#endif // LL_GSTREAMER_ENABLED -- cgit v1.1