diff options
author | Jacek Antonelli | 2009-03-26 01:41:38 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-03-26 01:41:38 -0500 |
commit | 0735f182a48966865fc5a198c10b8a7c0a317634 (patch) | |
tree | 65696060978a8f6360550ea5856b1476a7e6479a /linden/indra/llmedia/llmediaimplgstreamer.cpp | |
parent | Link with some gstreamer core libs on Linux. (diff) | |
download | meta-impy-0735f182a48966865fc5a198c10b8a7c0a317634.zip meta-impy-0735f182a48966865fc5a198c10b8a7c0a317634.tar.gz meta-impy-0735f182a48966865fc5a198c10b8a7c0a317634.tar.bz2 meta-impy-0735f182a48966865fc5a198c10b8a7c0a317634.tar.xz |
Removed all that llgst and symbol grabbing silliness.
Some symbols require gstreamer >= 0.10.11.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmedia/llmediaimplgstreamer.cpp | 118 |
1 files changed, 44 insertions, 74 deletions
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" { | |||
44 | 44 | ||
45 | #include "llmediaimplgstreamervidplug.h" | 45 | #include "llmediaimplgstreamervidplug.h" |
46 | 46 | ||
47 | #include "llmediaimplgstreamer_syms.h" | ||
48 | |||
49 | #include "llerror.h" | 47 | #include "llerror.h" |
48 | #include "linden_common.h" | ||
50 | 49 | ||
51 | // register this impl with media manager factory | 50 | // register this impl with media manager factory |
52 | static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); | 51 | static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); |
@@ -90,7 +89,7 @@ LLMediaImplGStreamer () : | |||
90 | } | 89 | } |
91 | 90 | ||
92 | // instantiate a playbin element to do the hard work | 91 | // instantiate a playbin element to do the hard work |
93 | mPlaybin = llgst_element_factory_make ("playbin", "play"); | 92 | mPlaybin = gst_element_factory_make ("playbin", "play"); |
94 | if (!mPlaybin) | 93 | if (!mPlaybin) |
95 | { | 94 | { |
96 | // todo: cleanup pump | 95 | // todo: cleanup pump |
@@ -104,7 +103,7 @@ LLMediaImplGStreamer () : | |||
104 | 103 | ||
105 | // Plays inworld instead of in external player | 104 | // Plays inworld instead of in external player |
106 | mVideoSink = | 105 | mVideoSink = |
107 | GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo")); | 106 | GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); |
108 | if (!mVideoSink) | 107 | if (!mVideoSink) |
109 | { | 108 | { |
110 | LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL; | 109 | LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL; |
@@ -148,7 +147,7 @@ LLMediaImplGStreamer:: | |||
148 | std::string LLMediaImplGStreamer::getVersion() | 147 | std::string LLMediaImplGStreamer::getVersion() |
149 | { | 148 | { |
150 | guint major, minor, micro, nano; | 149 | guint major, minor, micro, nano; |
151 | llgst_version(&major, &minor, µ, &nano); | 150 | gst_version(&major, &minor, µ, &nano); |
152 | std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano); | 151 | std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano); |
153 | return version; | 152 | return version; |
154 | } | 153 | } |
@@ -165,31 +164,10 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) | |||
165 | // Init the glib type system - we need it. | 164 | // Init the glib type system - we need it. |
166 | g_type_init(); | 165 | g_type_init(); |
167 | 166 | ||
168 | // Get symbols! | ||
169 | #if LL_WINDOWS | ||
170 | if (! grab_gst_syms("libgstreamer-0.10.dll", "libgstvideo-0.10.dll", "libgstaudio-0.10.dll") ) | ||
171 | { | ||
172 | LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL; | ||
173 | return false; | ||
174 | } | ||
175 | #else | ||
176 | if (! grab_gst_syms("libgstreamer-0.10.so.0", "libgstvideo-0.10.so.0", "libgstaudio-0.10.so.0") ) | ||
177 | { | ||
178 | LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL; | ||
179 | return false; | ||
180 | } | ||
181 | #endif | ||
182 | if (llgst_segtrap_set_enabled) | ||
183 | llgst_segtrap_set_enabled(FALSE); | ||
184 | else | ||
185 | { | ||
186 | LL_WARNS("MediaImpl") << "gst_segtrap_set_enabled() is not available; Automated crash-reporter may cease to function until next restart." << LL_ENDL; | ||
187 | } | ||
188 | |||
189 | // Protect against GStreamer resetting the locale, yuck. | 167 | // Protect against GStreamer resetting the locale, yuck. |
190 | static std::string saved_locale; | 168 | static std::string saved_locale; |
191 | saved_locale = setlocale(LC_ALL, NULL); | 169 | saved_locale = setlocale(LC_ALL, NULL); |
192 | if (0 == llgst_init_check(NULL, NULL, NULL)) | 170 | if (0 == gst_init_check(NULL, NULL, NULL)) |
193 | { | 171 | { |
194 | LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL; | 172 | LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL; |
195 | setlocale(LC_ALL, saved_locale.c_str() ); | 173 | setlocale(LC_ALL, saved_locale.c_str() ); |
@@ -208,7 +186,6 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) | |||
208 | 186 | ||
209 | bool LLMediaImplGStreamer::closedown() | 187 | bool LLMediaImplGStreamer::closedown() |
210 | { | 188 | { |
211 | ungrab_gst_syms(); | ||
212 | return true; | 189 | return true; |
213 | } | 190 | } |
214 | 191 | ||
@@ -236,7 +213,7 @@ static const char* get_gst_state_name(GstState state) | |||
236 | gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data) | 213 | gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data) |
237 | { | 214 | { |
238 | #ifdef LL_GST_REPORT_STATE_CHANGES | 215 | #ifdef LL_GST_REPORT_STATE_CHANGES |
239 | LL_DEBUGS("MediaCallback") << "Got GST message type: " << LLGST_MESSAGE_TYPE_NAME (message) << LL_ENDL; | 216 | LL_DEBUGS("MediaCallback") << "Got GST message type: " << GST_MESSAGE_TYPE_NAME (message) << LL_ENDL; |
240 | #endif | 217 | #endif |
241 | 218 | ||
242 | LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data; | 219 | LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data; |
@@ -245,17 +222,13 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
245 | { | 222 | { |
246 | case GST_MESSAGE_BUFFERING: | 223 | case GST_MESSAGE_BUFFERING: |
247 | { | 224 | { |
248 | // NEEDS GST 0.10.11+ | 225 | gint percent = 0; |
249 | if (llgst_message_parse_buffering) | 226 | gst_message_parse_buffering(message, &percent); |
250 | { | ||
251 | gint percent = 0; | ||
252 | llgst_message_parse_buffering(message, &percent); | ||
253 | #ifdef LL_GST_REPORT_STATE_CHANGES | 227 | #ifdef LL_GST_REPORT_STATE_CHANGES |
254 | LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL; | 228 | LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL; |
255 | #endif | 229 | #endif |
256 | LLMediaEvent event( impl, percent ); | 230 | LLMediaEvent event( impl, percent ); |
257 | impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); | 231 | impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); |
258 | } | ||
259 | } | 232 | } |
260 | break; | 233 | break; |
261 | case GST_MESSAGE_STATE_CHANGED: | 234 | case GST_MESSAGE_STATE_CHANGED: |
@@ -263,7 +236,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
263 | GstState old_state; | 236 | GstState old_state; |
264 | GstState new_state; | 237 | GstState new_state; |
265 | GstState pending_state; | 238 | GstState pending_state; |
266 | llgst_message_parse_state_changed(message, | 239 | gst_message_parse_state_changed(message, |
267 | &old_state, | 240 | &old_state, |
268 | &new_state, | 241 | &new_state, |
269 | &pending_state); | 242 | &pending_state); |
@@ -308,7 +281,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
308 | GError *err = NULL; | 281 | GError *err = NULL; |
309 | gchar *debug = NULL; | 282 | gchar *debug = NULL; |
310 | 283 | ||
311 | llgst_message_parse_error (message, &err, &debug); | 284 | gst_message_parse_error (message, &err, &debug); |
312 | LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL; | 285 | LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL; |
313 | g_error_free (err); | 286 | g_error_free (err); |
314 | g_free (debug); | 287 | g_free (debug); |
@@ -320,17 +293,14 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
320 | } | 293 | } |
321 | case GST_MESSAGE_INFO: | 294 | case GST_MESSAGE_INFO: |
322 | { | 295 | { |
323 | if (llgst_message_parse_info) | 296 | GError *err = NULL; |
324 | { | 297 | gchar *debug = NULL; |
325 | GError *err = NULL; | ||
326 | gchar *debug = NULL; | ||
327 | 298 | ||
328 | llgst_message_parse_info (message, &err, &debug); | 299 | gst_message_parse_info (message, &err, &debug); |
329 | LL_INFOS("MediaImpl") << "GST info: " << err->message | 300 | LL_INFOS("MediaImpl") << "GST info: " << err->message |
330 | << LL_ENDL; | 301 | << LL_ENDL; |
331 | g_error_free (err); | 302 | g_error_free (err); |
332 | g_free (debug); | 303 | g_free (debug); |
333 | } | ||
334 | break; | 304 | break; |
335 | } | 305 | } |
336 | case GST_MESSAGE_WARNING: | 306 | case GST_MESSAGE_WARNING: |
@@ -338,7 +308,7 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
338 | GError *err = NULL; | 308 | GError *err = NULL; |
339 | gchar *debug = NULL; | 309 | gchar *debug = NULL; |
340 | 310 | ||
341 | llgst_message_parse_warning (message, &err, &debug); | 311 | gst_message_parse_warning (message, &err, &debug); |
342 | LL_WARNS("MediaImpl") << "GST warning: " << err->message | 312 | LL_WARNS("MediaImpl") << "GST warning: " << err->message |
343 | << LL_ENDL; | 313 | << LL_ENDL; |
344 | g_error_free (err); | 314 | g_error_free (err); |
@@ -351,10 +321,10 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
351 | GstTagList *tag_list; | 321 | GstTagList *tag_list; |
352 | gchar *title; | 322 | gchar *title; |
353 | gchar *artist; | 323 | gchar *artist; |
354 | llgst_message_parse_tag(message, &tag_list); | 324 | gst_message_parse_tag(message, &tag_list); |
355 | gboolean hazTitle = llgst_tag_list_get_string(tag_list, | 325 | gboolean hazTitle = gst_tag_list_get_string(tag_list, |
356 | GST_TAG_TITLE, &title); | 326 | GST_TAG_TITLE, &title); |
357 | gboolean hazArtist = llgst_tag_list_get_string(tag_list, | 327 | gboolean hazArtist = gst_tag_list_get_string(tag_list, |
358 | GST_TAG_ARTIST, &artist); | 328 | GST_TAG_ARTIST, &artist); |
359 | if(hazTitle) | 329 | if(hazTitle) |
360 | LL_INFOS("MediaInfo") << "Title: " << title << LL_ENDL; | 330 | LL_INFOS("MediaInfo") << "Title: " << title << LL_ENDL; |
@@ -408,13 +378,13 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn) | |||
408 | g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); | 378 | g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); |
409 | 379 | ||
410 | // get playbin's bus - perhaps this can/should be done in ctor | 380 | // get playbin's bus - perhaps this can/should be done in ctor |
411 | GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); | 381 | GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); |
412 | if (!bus) | 382 | if (!bus) |
413 | { | 383 | { |
414 | return false; | 384 | return false; |
415 | } | 385 | } |
416 | llgst_bus_add_watch (bus, bus_callback, this); | 386 | gst_bus_add_watch (bus, bus_callback, this); |
417 | llgst_object_unref (bus); | 387 | gst_object_unref (bus); |
418 | 388 | ||
419 | mState = GST_STATE_READY; | 389 | mState = GST_STATE_READY; |
420 | 390 | ||
@@ -431,9 +401,9 @@ bool LLMediaImplGStreamer::unload() | |||
431 | LL_DEBUGS("MediaImpl") << "unloading media..." << LL_ENDL; | 401 | LL_DEBUGS("MediaImpl") << "unloading media..." << LL_ENDL; |
432 | if (mPlaybin) | 402 | if (mPlaybin) |
433 | { | 403 | { |
434 | llgst_element_set_state (mPlaybin, GST_STATE_NULL); | 404 | gst_element_set_state (mPlaybin, GST_STATE_NULL); |
435 | mState = GST_STATE_NULL; | 405 | mState = GST_STATE_NULL; |
436 | llgst_object_unref (GST_OBJECT (mPlaybin)); | 406 | gst_object_unref (GST_OBJECT (mPlaybin)); |
437 | mPlaybin = NULL; | 407 | mPlaybin = NULL; |
438 | } | 408 | } |
439 | 409 | ||
@@ -591,18 +561,18 @@ bool LLMediaImplGStreamer::stop() | |||
591 | if (!mPlaybin || mState == GST_STATE_NULL) | 561 | if (!mPlaybin || mState == GST_STATE_NULL) |
592 | return true; | 562 | return true; |
593 | 563 | ||
594 | GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); | 564 | GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); |
595 | llgst_object_unref(pipeline); | 565 | gst_object_unref(pipeline); |
596 | 566 | ||
597 | llgst_element_set_state(pipeline, GST_STATE_READY); | 567 | gst_element_set_state(pipeline, GST_STATE_READY); |
598 | 568 | ||
599 | if (mState == GST_STATE_PLAYING) | 569 | if (mState == GST_STATE_PLAYING) |
600 | mState = GST_STATE_VOID_PENDING; | 570 | mState = GST_STATE_VOID_PENDING; |
601 | else | 571 | else |
602 | mState = GST_STATE_READY; | 572 | mState = GST_STATE_READY; |
603 | 573 | ||
604 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | 574 | GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); |
605 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | 575 | LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; |
606 | 576 | ||
607 | return true; | 577 | return true; |
608 | } | 578 | } |
@@ -616,16 +586,16 @@ bool LLMediaImplGStreamer::play() | |||
616 | if (!mPlaybin || mState == GST_STATE_NULL) | 586 | if (!mPlaybin || mState == GST_STATE_NULL) |
617 | return true; | 587 | return true; |
618 | 588 | ||
619 | GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); | 589 | GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); |
620 | llgst_object_unref(pipeline); | 590 | gst_object_unref(pipeline); |
621 | 591 | ||
622 | llgst_element_set_state(pipeline, GST_STATE_PLAYING); | 592 | gst_element_set_state(pipeline, GST_STATE_PLAYING); |
623 | mState = GST_STATE_PLAYING; | 593 | mState = GST_STATE_PLAYING; |
624 | /*llgst_element_set_state(mPlaybin, GST_STATE_PLAYING); | 594 | /*gst_element_set_state(mPlaybin, GST_STATE_PLAYING); |
625 | mState = GST_STATE_PLAYING;*/ | 595 | mState = GST_STATE_PLAYING;*/ |
626 | 596 | ||
627 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | 597 | GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); |
628 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | 598 | LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; |
629 | 599 | ||
630 | // Check to make sure playing was successful. If not, stop. | 600 | // Check to make sure playing was successful. If not, stop. |
631 | if (state_change == GST_STATE_CHANGE_FAILURE) | 601 | if (state_change == GST_STATE_CHANGE_FAILURE) |
@@ -646,11 +616,11 @@ bool LLMediaImplGStreamer::pause() | |||
646 | if (!mPlaybin || mState == GST_STATE_NULL) | 616 | if (!mPlaybin || mState == GST_STATE_NULL) |
647 | return true; | 617 | return true; |
648 | 618 | ||
649 | llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); | 619 | gst_element_set_state(mPlaybin, GST_STATE_PAUSED); |
650 | mState = GST_STATE_PAUSED; | 620 | mState = GST_STATE_PAUSED; |
651 | 621 | ||
652 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | 622 | GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); |
653 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | 623 | LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; |
654 | 624 | ||
655 | return true; | 625 | return true; |
656 | }; | 626 | }; |
@@ -671,7 +641,7 @@ bool LLMediaImplGStreamer::seek(double time) | |||
671 | bool success = false; | 641 | bool success = false; |
672 | if (mPlaybin) | 642 | if (mPlaybin) |
673 | { | 643 | { |
674 | success = llgst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME, | 644 | success = gst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME, |
675 | GstSeekFlags(GST_SEEK_FLAG_FLUSH | | 645 | GstSeekFlags(GST_SEEK_FLAG_FLUSH | |
676 | GST_SEEK_FLAG_KEY_UNIT), | 646 | GST_SEEK_FLAG_KEY_UNIT), |
677 | GST_SEEK_TYPE_SET, gint64(time*1000000000.0F), | 647 | GST_SEEK_TYPE_SET, gint64(time*1000000000.0F), |