diff options
Diffstat (limited to 'linden/indra/media_plugins')
6 files changed, 119 insertions, 80 deletions
diff --git a/linden/indra/media_plugins/CMakeLists.txt b/linden/indra/media_plugins/CMakeLists.txt index a4c6b18..7c224b4 100755 --- a/linden/indra/media_plugins/CMakeLists.txt +++ b/linden/indra/media_plugins/CMakeLists.txt | |||
@@ -8,8 +8,14 @@ if (LINUX) | |||
8 | add_subdirectory(gstreamer010) | 8 | add_subdirectory(gstreamer010) |
9 | endif (LINUX) | 9 | endif (LINUX) |
10 | 10 | ||
11 | if (WINDOWS OR DARWIN) | 11 | # We use gstreamer for audio, quicktime for media on win-- MC |
12 | if (WINDOWS) | ||
13 | add_subdirectory(gstreamer010) | ||
14 | add_subdirectory(quicktime) | ||
15 | endif (WINDOWS) | ||
16 | |||
17 | if (DARWIN) | ||
12 | add_subdirectory(quicktime) | 18 | add_subdirectory(quicktime) |
13 | endif (WINDOWS OR DARWIN) | 19 | endif (DARWIN) |
14 | 20 | ||
15 | add_subdirectory(example) | 21 | add_subdirectory(example) |
diff --git a/linden/indra/media_plugins/gstreamer010/CMakeLists.txt b/linden/indra/media_plugins/gstreamer010/CMakeLists.txt index 4401e64..e405dc6 100644 --- a/linden/indra/media_plugins/gstreamer010/CMakeLists.txt +++ b/linden/indra/media_plugins/gstreamer010/CMakeLists.txt | |||
@@ -36,9 +36,15 @@ set(media_plugin_gstreamer010_SOURCE_FILES | |||
36 | ) | 36 | ) |
37 | 37 | ||
38 | set(media_plugin_gstreamer010_HEADER_FILES | 38 | set(media_plugin_gstreamer010_HEADER_FILES |
39 | llmediaimplgstreamer.h | ||
39 | llmediaimplgstreamervidplug.h | 40 | llmediaimplgstreamervidplug.h |
40 | llmediaimplgstreamertriviallogging.h | 41 | llmediaimplgstreamertriviallogging.h |
41 | ) | 42 | ) |
43 | |||
44 | set_source_files_properties(${media_plugin_gstreamer010_HEADER_FILES} | ||
45 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
46 | |||
47 | list(APPEND media_plugin_gstreamer010_SOURCE_FILES ${media_plugin_gstreamer010_HEADER_FILES}) | ||
42 | 48 | ||
43 | add_library(media_plugin_gstreamer010 | 49 | add_library(media_plugin_gstreamer010 |
44 | SHARED | 50 | SHARED |
diff --git a/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index bb90aa1..7917232 100755 --- a/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h | |||
@@ -41,7 +41,7 @@ | |||
41 | ///////////////////////////////////////////////////////////////////////// | 41 | ///////////////////////////////////////////////////////////////////////// |
42 | // Debug/Info/Warning macros. | 42 | // Debug/Info/Warning macros. |
43 | #if LL_WINDOWS | 43 | #if LL_WINDOWS |
44 | #include <process.h> | 44 | #include <windows.h> |
45 | #define LL_GETPID GetCurrentProcessId | 45 | #define LL_GETPID GetCurrentProcessId |
46 | #else | 46 | #else |
47 | #include <sys/types.h> | 47 | #include <sys/types.h> |
diff --git a/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index ed6d920..7e2833a 100755 --- a/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp | |||
@@ -83,6 +83,9 @@ public: | |||
83 | gboolean processGSTEvents(GstBus *bus, | 83 | gboolean processGSTEvents(GstBus *bus, |
84 | GstMessage *message); | 84 | GstMessage *message); |
85 | 85 | ||
86 | // basic log file writing | ||
87 | static bool writeToLog(char* str, ...); | ||
88 | |||
86 | private: | 89 | private: |
87 | std::string getVersion(); | 90 | std::string getVersion(); |
88 | bool navigateTo( const std::string urlIn ); | 91 | bool navigateTo( const std::string urlIn ); |
@@ -178,8 +181,7 @@ MediaPluginGStreamer010::MediaPluginGStreamer010( | |||
178 | mVideoSink ( NULL ), | 181 | mVideoSink ( NULL ), |
179 | mCommand ( COMMAND_NONE ) | 182 | mCommand ( COMMAND_NONE ) |
180 | { | 183 | { |
181 | std::ostringstream str; | 184 | writeToLog("MediaPluginGStreamer010 PID=%u", U32(LL_GETPID())); |
182 | INFOMSG("MediaPluginGStreamer010 constructor - my PID=%u", U32(LL_GETPID())); | ||
183 | } | 185 | } |
184 | 186 | ||
185 | /////////////////////////////////////////////////////////////////////////////// | 187 | /////////////////////////////////////////////////////////////////////////////// |
@@ -199,6 +201,29 @@ static char* get_gst_state_name(GstState state) | |||
199 | } | 201 | } |
200 | #endif // LL_GST_REPORT_STATE_CHANGES | 202 | #endif // LL_GST_REPORT_STATE_CHANGES |
201 | 203 | ||
204 | // static | ||
205 | bool MediaPluginGStreamer010::writeToLog(char* str, ...) | ||
206 | { | ||
207 | LLFILE* fp = LLFile::fopen("media_plugin_gstreamer010.log", "a"); | ||
208 | |||
209 | if (!fp) | ||
210 | { | ||
211 | return false; | ||
212 | } | ||
213 | |||
214 | time_t timeptr = time(NULL); | ||
215 | struct tm* ltime = localtime(&timeptr); | ||
216 | fprintf(fp, "[%d:%d:%d] ", ltime->tm_hour, ltime->tm_min, ltime->tm_sec); | ||
217 | va_list arglist; | ||
218 | va_start(arglist, str); | ||
219 | vfprintf(fp, str, arglist); | ||
220 | va_end(arglist); | ||
221 | fprintf(fp, " \n"); | ||
222 | fclose(fp); | ||
223 | |||
224 | return true; | ||
225 | } | ||
226 | |||
202 | gboolean | 227 | gboolean |
203 | MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | 228 | MediaPluginGStreamer010::processGSTEvents(GstBus *bus, |
204 | GstMessage *message) | 229 | GstMessage *message) |
@@ -206,17 +231,12 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
206 | if (!message) | 231 | if (!message) |
207 | return TRUE; // shield against GStreamer bug | 232 | return TRUE; // shield against GStreamer bug |
208 | 233 | ||
234 | // TODO: grok 'duration' message type | ||
209 | if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED && | 235 | if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED && |
210 | GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING) | 236 | GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING && |
237 | GST_MESSAGE_TYPE(message) != GST_MESSAGE_TAG) | ||
211 | { | 238 | { |
212 | DEBUGMSG("Got GST message type: %s", | 239 | writeToLog("Got GST message type: %s", GST_MESSAGE_TYPE_NAME (message)); |
213 | GST_MESSAGE_TYPE_NAME (message)); | ||
214 | } | ||
215 | else | ||
216 | { | ||
217 | // TODO: grok 'duration' message type | ||
218 | DEBUGMSG("Got GST message type: %s", | ||
219 | GST_MESSAGE_TYPE_NAME (message)); | ||
220 | } | 240 | } |
221 | 241 | ||
222 | switch (GST_MESSAGE_TYPE (message)) | 242 | switch (GST_MESSAGE_TYPE (message)) |
@@ -226,7 +246,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
226 | // NEEDS GST 0.10.11+ and America discovered by C.Columbus | 246 | // NEEDS GST 0.10.11+ and America discovered by C.Columbus |
227 | gint percent = 0; | 247 | gint percent = 0; |
228 | gst_message_parse_buffering(message, &percent); | 248 | gst_message_parse_buffering(message, &percent); |
229 | DEBUGMSG("GST buffering: %d%%", percent); | 249 | writeToLog("GST buffering: %d%%", percent); |
230 | 250 | ||
231 | break; | 251 | break; |
232 | } | 252 | } |
@@ -240,7 +260,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
240 | &pending_state); | 260 | &pending_state); |
241 | #ifdef LL_GST_REPORT_STATE_CHANGES | 261 | #ifdef LL_GST_REPORT_STATE_CHANGES |
242 | // not generally very useful, and rather spammy. | 262 | // not generally very useful, and rather spammy. |
243 | DEBUGMSG("state change (old,<new>,pending): %s,<%s>,%s", | 263 | writeToLog("state change (old,<new>,pending): %s,<%s>,%s", |
244 | get_gst_state_name(old_state), | 264 | get_gst_state_name(old_state), |
245 | get_gst_state_name(new_state), | 265 | get_gst_state_name(new_state), |
246 | get_gst_state_name(pending_state)); | 266 | get_gst_state_name(pending_state)); |
@@ -270,7 +290,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
270 | gchar *debug = NULL; | 290 | gchar *debug = NULL; |
271 | 291 | ||
272 | gst_message_parse_error (message, &err, &debug); | 292 | gst_message_parse_error (message, &err, &debug); |
273 | WARNMSG("GST error: %s", err?err->message:"(unknown)"); | 293 | writeToLog("GST error: %s", err?err->message:"(unknown)"); |
274 | if (err) | 294 | if (err) |
275 | g_error_free (err); | 295 | g_error_free (err); |
276 | g_free (debug); | 296 | g_free (debug); |
@@ -287,7 +307,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
287 | gchar *debug = NULL; | 307 | gchar *debug = NULL; |
288 | 308 | ||
289 | gst_message_parse_info (message, &err, &debug); | 309 | gst_message_parse_info (message, &err, &debug); |
290 | INFOMSG("GST info: %s", err?err->message:"(unknown)"); | 310 | writeToLog("GST info: %s", err?err->message:"(unknown)"); |
291 | if (err) | 311 | if (err) |
292 | g_error_free (err); | 312 | g_error_free (err); |
293 | g_free (debug); | 313 | g_free (debug); |
@@ -300,7 +320,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
300 | gchar *debug = NULL; | 320 | gchar *debug = NULL; |
301 | 321 | ||
302 | gst_message_parse_warning (message, &err, &debug); | 322 | gst_message_parse_warning (message, &err, &debug); |
303 | WARNMSG("GST warning: %s", err?err->message:"(unknown)"); | 323 | writeToLog("GST warning: %s", err?err->message:"(unknown)"); |
304 | if (err) | 324 | if (err) |
305 | g_error_free (err); | 325 | g_error_free (err); |
306 | g_free (debug); | 326 | g_free (debug); |
@@ -317,7 +337,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
317 | 337 | ||
318 | if ( gst_tag_list_get_string(new_tags, GST_TAG_TITLE, &title) ) | 338 | if ( gst_tag_list_get_string(new_tags, GST_TAG_TITLE, &title) ) |
319 | { | 339 | { |
320 | //WARMING("Title: %s", title); | 340 | //writeToLog("Title: %s", title); |
321 | std::string newtitle(title); | 341 | std::string newtitle(title); |
322 | gst_tag_list_free(new_tags); | 342 | gst_tag_list_free(new_tags); |
323 | 343 | ||
@@ -336,10 +356,10 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
336 | case GST_MESSAGE_EOS: | 356 | case GST_MESSAGE_EOS: |
337 | { | 357 | { |
338 | /* end-of-stream */ | 358 | /* end-of-stream */ |
339 | DEBUGMSG("GST end-of-stream."); | 359 | writeToLog("GST end-of-stream."); |
340 | if (mIsLooping) | 360 | if (mIsLooping) |
341 | { | 361 | { |
342 | DEBUGMSG("looping media..."); | 362 | //writeToLog("looping media..."); |
343 | double eos_pos_sec = 0.0F; | 363 | double eos_pos_sec = 0.0F; |
344 | bool got_eos_position = getTimePos(eos_pos_sec); | 364 | bool got_eos_position = getTimePos(eos_pos_sec); |
345 | 365 | ||
@@ -348,7 +368,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
348 | // if we know that the movie is really short, don't | 368 | // if we know that the movie is really short, don't |
349 | // loop it else it can easily become a time-hog | 369 | // loop it else it can easily become a time-hog |
350 | // because of GStreamer spin-up overhead | 370 | // because of GStreamer spin-up overhead |
351 | DEBUGMSG("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec); | 371 | writeToLog("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec); |
352 | // inject a COMMAND_PAUSE | 372 | // inject a COMMAND_PAUSE |
353 | mCommand = COMMAND_PAUSE; | 373 | mCommand = COMMAND_PAUSE; |
354 | } | 374 | } |
@@ -367,7 +387,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
367 | else | 387 | else |
368 | #endif // LLGST_LOOP_BY_SEEKING | 388 | #endif // LLGST_LOOP_BY_SEEKING |
369 | { // use clumsy stop-start to loop | 389 | { // use clumsy stop-start to loop |
370 | DEBUGMSG("didn't loop by rewinding - stopping and starting instead..."); | 390 | writeToLog("didn't loop by rewinding - stopping and starting instead..."); |
371 | stop(); | 391 | stop(); |
372 | play(1.0); | 392 | play(1.0); |
373 | } | 393 | } |
@@ -413,7 +433,7 @@ MediaPluginGStreamer010::navigateTo ( const std::string urlIn ) | |||
413 | 433 | ||
414 | setStatus(STATUS_LOADING); | 434 | setStatus(STATUS_LOADING); |
415 | 435 | ||
416 | DEBUGMSG("Setting media URI: %s", urlIn.c_str()); | 436 | writeToLog("Setting media URI: %s", urlIn.c_str()); |
417 | 437 | ||
418 | mSeekWanted = false; | 438 | mSeekWanted = false; |
419 | 439 | ||
@@ -441,13 +461,13 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
441 | if (!mDoneInit) | 461 | if (!mDoneInit) |
442 | return false; // error | 462 | return false; // error |
443 | 463 | ||
444 | DEBUGMSG("updating media..."); | 464 | //writeToLog("updating media..."); |
445 | 465 | ||
446 | // sanity check | 466 | // sanity check |
447 | if (NULL == mPump || | 467 | if (NULL == mPump || |
448 | NULL == mPlaybin) | 468 | NULL == mPlaybin) |
449 | { | 469 | { |
450 | DEBUGMSG("dead media..."); | 470 | writeToLog("dead media..."); |
451 | return false; | 471 | return false; |
452 | } | 472 | } |
453 | 473 | ||
@@ -477,7 +497,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
477 | GST_OBJECT_LOCK(mVideoSink); | 497 | GST_OBJECT_LOCK(mVideoSink); |
478 | if (mVideoSink->retained_frame_ready) | 498 | if (mVideoSink->retained_frame_ready) |
479 | { | 499 | { |
480 | DEBUGMSG("NEW FRAME READY"); | 500 | writeToLog("NEW FRAME READY"); |
481 | 501 | ||
482 | if (mVideoSink->retained_frame_width != mCurrentWidth || | 502 | if (mVideoSink->retained_frame_width != mCurrentWidth || |
483 | mVideoSink->retained_frame_height != mCurrentHeight) | 503 | mVideoSink->retained_frame_height != mCurrentHeight) |
@@ -508,7 +528,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
508 | GST_OBJECT_UNLOCK(mVideoSink); | 528 | GST_OBJECT_UNLOCK(mVideoSink); |
509 | 529 | ||
510 | mCurrentRowbytes = neww * newd; | 530 | mCurrentRowbytes = neww * newd; |
511 | DEBUGMSG("video container resized to %dx%d", | 531 | writeToLog("video container resized to %dx%d", |
512 | neww, newh); | 532 | neww, newh); |
513 | 533 | ||
514 | mDepth = newd; | 534 | mDepth = newd; |
@@ -536,7 +556,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
536 | } | 556 | } |
537 | 557 | ||
538 | GST_OBJECT_UNLOCK(mVideoSink); | 558 | GST_OBJECT_UNLOCK(mVideoSink); |
539 | DEBUGMSG("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST"); | 559 | writeToLog("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST"); |
540 | 560 | ||
541 | setDirty(0,0,mCurrentWidth,mCurrentHeight); | 561 | setDirty(0,0,mCurrentWidth,mCurrentHeight); |
542 | } | 562 | } |
@@ -547,7 +567,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
547 | 567 | ||
548 | GST_OBJECT_UNLOCK(mVideoSink); | 568 | GST_OBJECT_UNLOCK(mVideoSink); |
549 | 569 | ||
550 | DEBUGMSG("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize"); | 570 | writeToLog("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize"); |
551 | } | 571 | } |
552 | 572 | ||
553 | return true; | 573 | return true; |
@@ -586,7 +606,7 @@ MediaPluginGStreamer010::mouseMove( int x, int y ) | |||
586 | bool | 606 | bool |
587 | MediaPluginGStreamer010::pause() | 607 | MediaPluginGStreamer010::pause() |
588 | { | 608 | { |
589 | DEBUGMSG("pausing media..."); | 609 | writeToLog("pausing media..."); |
590 | // todo: error-check this? | 610 | // todo: error-check this? |
591 | gst_element_set_state(mPlaybin, GST_STATE_PAUSED); | 611 | gst_element_set_state(mPlaybin, GST_STATE_PAUSED); |
592 | return true; | 612 | return true; |
@@ -595,7 +615,7 @@ MediaPluginGStreamer010::pause() | |||
595 | bool | 615 | bool |
596 | MediaPluginGStreamer010::stop() | 616 | MediaPluginGStreamer010::stop() |
597 | { | 617 | { |
598 | DEBUGMSG("stopping media..."); | 618 | writeToLog("stopping media..."); |
599 | // todo: error-check this? | 619 | // todo: error-check this? |
600 | gst_element_set_state(mPlaybin, GST_STATE_READY); | 620 | gst_element_set_state(mPlaybin, GST_STATE_READY); |
601 | return true; | 621 | return true; |
@@ -605,8 +625,7 @@ bool | |||
605 | MediaPluginGStreamer010::play(double rate) | 625 | MediaPluginGStreamer010::play(double rate) |
606 | { | 626 | { |
607 | // NOTE: we don't actually support non-natural rate. | 627 | // NOTE: we don't actually support non-natural rate. |
608 | 628 | writeToLog("playing media... rate=%f", rate); | |
609 | DEBUGMSG("playing media... rate=%f", rate); | ||
610 | // todo: error-check this? | 629 | // todo: error-check this? |
611 | gst_element_set_state(mPlaybin, GST_STATE_PLAYING); | 630 | gst_element_set_state(mPlaybin, GST_STATE_PLAYING); |
612 | return true; | 631 | return true; |
@@ -643,7 +662,7 @@ MediaPluginGStreamer010::seek(double time_sec) | |||
643 | GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND), | 662 | GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND), |
644 | GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); | 663 | GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); |
645 | } | 664 | } |
646 | DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d", | 665 | writeToLog("MEDIA SEEK REQUEST to %f sec result was %d", |
647 | float(time_sec), int(success)); | 666 | float(time_sec), int(success)); |
648 | return success; | 667 | return success; |
649 | } | 668 | } |
@@ -697,7 +716,7 @@ MediaPluginGStreamer010::load() | |||
697 | 716 | ||
698 | setStatus(STATUS_LOADING); | 717 | setStatus(STATUS_LOADING); |
699 | 718 | ||
700 | DEBUGMSG("setting up media..."); | 719 | writeToLog("setting up media..."); |
701 | 720 | ||
702 | mIsLooping = false; | 721 | mIsLooping = false; |
703 | mVolume = (float) 0.1234567; // minor hack to force an initial volume update | 722 | mVolume = (float) 0.1234567; // minor hack to force an initial volume update |
@@ -736,7 +755,7 @@ MediaPluginGStreamer010::load() | |||
736 | GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); | 755 | GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); |
737 | if (!mVideoSink) | 756 | if (!mVideoSink) |
738 | { | 757 | { |
739 | WARNMSG("Could not instantiate private-slvideo element."); | 758 | writeToLog("Could not instantiate private-slvideo element."); |
740 | // todo: cleanup. | 759 | // todo: cleanup. |
741 | setStatus(STATUS_ERROR); | 760 | setStatus(STATUS_ERROR); |
742 | return false; // error | 761 | return false; // error |
@@ -755,7 +774,7 @@ MediaPluginGStreamer010::unload () | |||
755 | if (!mDoneInit) | 774 | if (!mDoneInit) |
756 | return false; // error | 775 | return false; // error |
757 | 776 | ||
758 | DEBUGMSG("unloading media..."); | 777 | writeToLog("unloading media..."); |
759 | 778 | ||
760 | // stop getting callbacks for this bus | 779 | // stop getting callbacks for this bus |
761 | g_source_remove(mBusWatchID); | 780 | g_source_remove(mBusWatchID); |
@@ -813,7 +832,7 @@ MediaPluginGStreamer010::startup() | |||
813 | "libgstvideo-0.10.so.0") ) | 832 | "libgstvideo-0.10.so.0") ) |
814 | #endif | 833 | #endif |
815 | { | 834 | { |
816 | WARNMSG("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); | 835 | writeToLog("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); |
817 | return false; | 836 | return false; |
818 | } | 837 | } |
819 | */ | 838 | */ |
@@ -823,7 +842,7 @@ MediaPluginGStreamer010::startup() | |||
823 | // } | 842 | // } |
824 | // else | 843 | // else |
825 | // { | 844 | // { |
826 | // WARNMSG("gst_segtrap_set_enabled() is not available; plugin crashes won't be caught."); | 845 | // writeToLog("gst_segtrap_set_enabled() is not available; plugin crashes won't be caught."); |
827 | // } | 846 | // } |
828 | /* | 847 | /* |
829 | #if LL_LINUX | 848 | #if LL_LINUX |
@@ -866,12 +885,12 @@ MediaPluginGStreamer010::startup() | |||
866 | { | 885 | { |
867 | if (err) | 886 | if (err) |
868 | { | 887 | { |
869 | WARNMSG("GST init failed: %s", err->message); | 888 | writeToLog("GST init failed: %s", err->message); |
870 | g_error_free(err); | 889 | g_error_free(err); |
871 | } | 890 | } |
872 | else | 891 | else |
873 | { | 892 | { |
874 | WARNMSG("GST init failed for unspecified reason."); | 893 | writeToLog("GST init failed for unspecified reason."); |
875 | } | 894 | } |
876 | return false; | 895 | return false; |
877 | } | 896 | } |
@@ -882,22 +901,22 @@ MediaPluginGStreamer010::startup() | |||
882 | 901 | ||
883 | // Init our custom plugins - only really need do this once. | 902 | // Init our custom plugins - only really need do this once. |
884 | gst_slvideo_init_class(); | 903 | gst_slvideo_init_class(); |
885 | /* | 904 | |
886 | // List the plugins GStreamer can find | 905 | // List the plugins GStreamer can find |
887 | LL_DEBUGS("MediaImpl") << "Found GStreamer plugins:" << LL_ENDL; | 906 | writeToLog("Found GStreamer plugins:"); |
888 | GList *list; | 907 | GList *list; |
889 | GstRegistry *registry = gst_registry_get_default(); | 908 | GstRegistry *registry = gst_registry_get_default(); |
890 | std::string loaded = ""; | 909 | std::string loaded = "No"; |
891 | for (list = gst_registry_get_plugin_list(registry); | 910 | for (list = gst_registry_get_plugin_list(registry); |
892 | list != NULL; | 911 | list != NULL; |
893 | list = g_list_next(list)) | 912 | list = g_list_next(list)) |
894 | { | 913 | { |
895 | GstPlugin *list_plugin = (GstPlugin *)list->data; | 914 | GstPlugin *list_plugin = (GstPlugin *)list->data; |
896 | (bool)gst_plugin_is_loaded(list_plugin) ? loaded = "Yes" : loaded = "No"; | 915 | if (gst_plugin_is_loaded(list_plugin)) loaded = "Yes"; |
897 | LL_DEBUGS("MediaImpl") << gst_plugin_get_name(list_plugin) << ", loaded? " << loaded << LL_ENDL; | 916 | writeToLog("%s, loaded? %s", gst_plugin_get_name(list_plugin), loaded.c_str()); |
898 | } | 917 | } |
899 | gst_plugin_list_free(list); | 918 | gst_plugin_list_free(list); |
900 | */ | 919 | |
901 | mDoneInit = true; | 920 | mDoneInit = true; |
902 | } | 921 | } |
903 | 922 | ||
@@ -941,11 +960,11 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
941 | 960 | ||
942 | if( imp_dir == "" ) | 961 | if( imp_dir == "" ) |
943 | { | 962 | { |
944 | WARNMSG("Could not get application directory, not setting GST_PLUGIN_PATH."); | 963 | writeToLog("Could not get application directory, not setting GST_PLUGIN_PATH."); |
945 | return; | 964 | return; |
946 | } | 965 | } |
947 | 966 | ||
948 | DEBUGMSG("Imprudence is installed at %s", imp_dir); | 967 | writeToLog("Imprudence is installed at %s", imp_dir.c_str()); |
949 | 968 | ||
950 | // ":" on Mac and 'Nix, ";" on Windows | 969 | // ":" on Mac and 'Nix, ";" on Windows |
951 | std::string separator = G_SEARCHPATH_SEPARATOR_S; | 970 | std::string separator = G_SEARCHPATH_SEPARATOR_S; |
@@ -955,7 +974,7 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
955 | char *old_path = getenv("GST_PLUGIN_PATH"); | 974 | char *old_path = getenv("GST_PLUGIN_PATH"); |
956 | if(old_path == NULL) | 975 | if(old_path == NULL) |
957 | { | 976 | { |
958 | DEBUGMSG("Did not find user-set GST_PLUGIN_PATH."); | 977 | writeToLog("Did not find user-set GST_PLUGIN_PATH."); |
959 | } | 978 | } |
960 | else | 979 | else |
961 | { | 980 | { |
@@ -986,11 +1005,11 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
986 | 1005 | ||
987 | if( put_result == -1 ) | 1006 | if( put_result == -1 ) |
988 | { | 1007 | { |
989 | WARNMSG("Setting GST_PLUGIN_PATH failed!"); | 1008 | writeToLog("Setting GST_PLUGIN_PATH failed!"); |
990 | } | 1009 | } |
991 | else | 1010 | else |
992 | { | 1011 | { |
993 | DEBUGMSG("GST_PLUGIN_PATH set to %s", getenv("GST_PLUGIN_PATH")); | 1012 | writeToLog("GST_PLUGIN_PATH set to %s", getenv("GST_PLUGIN_PATH")); |
994 | } | 1013 | } |
995 | 1014 | ||
996 | // Don't load system plugins. We only want to use ours, to avoid conflicts. | 1015 | // Don't load system plugins. We only want to use ours, to avoid conflicts. |
@@ -1002,7 +1021,7 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
1002 | 1021 | ||
1003 | if( put_result == -1 ) | 1022 | if( put_result == -1 ) |
1004 | { | 1023 | { |
1005 | WARNMSG("Setting GST_PLUGIN_SYSTEM_PATH=\"\" failed!"); | 1024 | writeToLog("Setting GST_PLUGIN_SYSTEM_PATH=\"\" failed!"); |
1006 | } | 1025 | } |
1007 | 1026 | ||
1008 | #endif // LL_WINDOWS || LL_DARWIN | 1027 | #endif // LL_WINDOWS || LL_DARWIN |
@@ -1020,7 +1039,7 @@ MediaPluginGStreamer010::sizeChanged() | |||
1020 | { | 1039 | { |
1021 | mNaturalWidth = mCurrentWidth; | 1040 | mNaturalWidth = mCurrentWidth; |
1022 | mNaturalHeight = mCurrentHeight; | 1041 | mNaturalHeight = mCurrentHeight; |
1023 | DEBUGMSG("Media NATURAL size better detected as %dx%d", | 1042 | writeToLog("Media NATURAL size better detected as %dx%d", |
1024 | mNaturalWidth, mNaturalHeight); | 1043 | mNaturalWidth, mNaturalHeight); |
1025 | } | 1044 | } |
1026 | 1045 | ||
@@ -1035,7 +1054,7 @@ MediaPluginGStreamer010::sizeChanged() | |||
1035 | message.setValue("name", mTextureSegmentName); | 1054 | message.setValue("name", mTextureSegmentName); |
1036 | message.setValueS32("width", mNaturalWidth); | 1055 | message.setValueS32("width", mNaturalWidth); |
1037 | message.setValueS32("height", mNaturalHeight); | 1056 | message.setValueS32("height", mNaturalHeight); |
1038 | DEBUGMSG("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight); | 1057 | writeToLog("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight); |
1039 | sendMessage(message); | 1058 | sendMessage(message); |
1040 | } | 1059 | } |
1041 | } | 1060 | } |
@@ -1058,11 +1077,11 @@ MediaPluginGStreamer010::closedown() | |||
1058 | 1077 | ||
1059 | MediaPluginGStreamer010::~MediaPluginGStreamer010() | 1078 | MediaPluginGStreamer010::~MediaPluginGStreamer010() |
1060 | { | 1079 | { |
1061 | DEBUGMSG("MediaPluginGStreamer010 destructor"); | 1080 | //writeToLog("MediaPluginGStreamer010 destructor"); |
1062 | 1081 | ||
1063 | closedown(); | 1082 | closedown(); |
1064 | 1083 | ||
1065 | DEBUGMSG("GStreamer010 closing down"); | 1084 | writeToLog("GStreamer010 closing down"); |
1066 | } | 1085 | } |
1067 | 1086 | ||
1068 | 1087 | ||
@@ -1085,7 +1104,7 @@ MediaPluginGStreamer010::getVersion() | |||
1085 | 1104 | ||
1086 | void MediaPluginGStreamer010::receiveMessage(const char *message_string) | 1105 | void MediaPluginGStreamer010::receiveMessage(const char *message_string) |
1087 | { | 1106 | { |
1088 | //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\"" << std::endl; | 1107 | //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\""; |
1089 | 1108 | ||
1090 | LLPluginMessage message_in; | 1109 | LLPluginMessage message_in; |
1091 | 1110 | ||
@@ -1106,11 +1125,11 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1106 | 1125 | ||
1107 | if ( load() ) | 1126 | if ( load() ) |
1108 | { | 1127 | { |
1109 | DEBUGMSG("GStreamer010 media instance set up"); | 1128 | writeToLog("GStreamer010 media instance set up"); |
1110 | } | 1129 | } |
1111 | else | 1130 | else |
1112 | { | 1131 | { |
1113 | WARNMSG("GStreamer010 media instance failed to set up"); | 1132 | writeToLog("GStreamer010 media instance failed to set up"); |
1114 | } | 1133 | } |
1115 | 1134 | ||
1116 | message.setValue("plugin_version", getVersion()); | 1135 | message.setValue("plugin_version", getVersion()); |
@@ -1137,7 +1156,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1137 | std::string name = message_in.getValue("name"); | 1156 | std::string name = message_in.getValue("name"); |
1138 | 1157 | ||
1139 | std::ostringstream str; | 1158 | std::ostringstream str; |
1140 | INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); | 1159 | writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); |
1141 | 1160 | ||
1142 | mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); | 1161 | mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); |
1143 | } | 1162 | } |
@@ -1145,7 +1164,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1145 | { | 1164 | { |
1146 | std::string name = message_in.getValue("name"); | 1165 | std::string name = message_in.getValue("name"); |
1147 | 1166 | ||
1148 | DEBUGMSG("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str()); | 1167 | writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str()); |
1149 | 1168 | ||
1150 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); | 1169 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); |
1151 | if(iter != mSharedSegments.end()) | 1170 | if(iter != mSharedSegments.end()) |
@@ -1163,7 +1182,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1163 | } | 1182 | } |
1164 | else | 1183 | else |
1165 | { | 1184 | { |
1166 | WARNMSG("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!"); | 1185 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!"); |
1167 | } | 1186 | } |
1168 | 1187 | ||
1169 | // Send the response so it can be cleaned up. | 1188 | // Send the response so it can be cleaned up. |
@@ -1174,7 +1193,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1174 | else | 1193 | else |
1175 | { | 1194 | { |
1176 | std::ostringstream str; | 1195 | std::ostringstream str; |
1177 | INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str()); | 1196 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str()); |
1178 | } | 1197 | } |
1179 | } | 1198 | } |
1180 | else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) | 1199 | else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) |
@@ -1217,7 +1236,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1217 | S32 texture_height = message_in.getValueS32("texture_height"); | 1236 | S32 texture_height = message_in.getValueS32("texture_height"); |
1218 | 1237 | ||
1219 | std::ostringstream str; | 1238 | std::ostringstream str; |
1220 | INFOMSG("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height); | 1239 | writeToLog("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height); |
1221 | 1240 | ||
1222 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); | 1241 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); |
1223 | message.setValue("name", name); | 1242 | message.setValue("name", name); |
@@ -1233,8 +1252,8 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1233 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); | 1252 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); |
1234 | if(iter != mSharedSegments.end()) | 1253 | if(iter != mSharedSegments.end()) |
1235 | { | 1254 | { |
1236 | INFOMSG("*** Got size change with matching shm, new size is %d x %d", width, height); | 1255 | writeToLog("*** Got size change with matching shm, new size is %d x %d", width, height); |
1237 | INFOMSG("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height); | 1256 | writeToLog("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height); |
1238 | 1257 | ||
1239 | mPixels = (unsigned char*)iter->second.mAddress; | 1258 | mPixels = (unsigned char*)iter->second.mAddress; |
1240 | mTextureSegmentName = name; | 1259 | mTextureSegmentName = name; |
@@ -1244,7 +1263,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1244 | if (texture_width > 1 || | 1263 | if (texture_width > 1 || |
1245 | texture_height > 1) // not a dummy size from the app, a real explicit forced size | 1264 | texture_height > 1) // not a dummy size from the app, a real explicit forced size |
1246 | { | 1265 | { |
1247 | INFOMSG("**** = REAL RESIZE REQUEST FROM APP"); | 1266 | writeToLog("**** = REAL RESIZE REQUEST FROM APP"); |
1248 | 1267 | ||
1249 | GST_OBJECT_LOCK(mVideoSink); | 1268 | GST_OBJECT_LOCK(mVideoSink); |
1250 | mVideoSink->resize_forced_always = true; | 1269 | mVideoSink->resize_forced_always = true; |
@@ -1326,13 +1345,23 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1326 | } | 1345 | } |
1327 | else | 1346 | else |
1328 | { | 1347 | { |
1329 | INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str()); | 1348 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str()); |
1330 | } | 1349 | } |
1331 | } | 1350 | } |
1332 | } | 1351 | } |
1333 | 1352 | ||
1334 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) | 1353 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) |
1335 | { | 1354 | { |
1355 | // init log file | ||
1356 | LLFILE* fp = LLFile::fopen("media_plugin_gstreamer010.log", "w"); | ||
1357 | if (fp) | ||
1358 | { | ||
1359 | time_t timeptr = time(NULL); | ||
1360 | fprintf(fp, "%s", asctime(localtime(&timeptr))); | ||
1361 | fprintf(fp, "<--- Begin media_plugin_gstreamer010 initialization --->\n"); | ||
1362 | fclose(fp); | ||
1363 | } | ||
1364 | |||
1336 | if (MediaPluginGStreamer010::startup()) | 1365 | if (MediaPluginGStreamer010::startup()) |
1337 | { | 1366 | { |
1338 | MediaPluginGStreamer010 *self = new MediaPluginGStreamer010(host_send_func, host_user_data); | 1367 | MediaPluginGStreamer010 *self = new MediaPluginGStreamer010(host_send_func, host_user_data); |
diff --git a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp index c4c4181..cc3836e 100644 --- a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp +++ b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp | |||
@@ -58,7 +58,7 @@ extern "C" { | |||
58 | #include <pulse/subscribe.h> | 58 | #include <pulse/subscribe.h> |
59 | #include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken. | 59 | #include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken. |
60 | 60 | ||
61 | #include "apr_pools.h" | 61 | #include "aiaprpool.h" |
62 | #include "apr_dso.h" | 62 | #include "apr_dso.h" |
63 | } | 63 | } |
64 | 64 | ||
@@ -74,7 +74,7 @@ extern "C" { | |||
74 | #undef LL_PA_SYM | 74 | #undef LL_PA_SYM |
75 | 75 | ||
76 | static bool sSymsGrabbed = false; | 76 | static bool sSymsGrabbed = false; |
77 | static apr_pool_t *sSymPADSOMemoryPool = NULL; | 77 | static AIAPRPool sSymPADSOMemoryPool; |
78 | static apr_dso_handle_t *sSymPADSOHandleG = NULL; | 78 | static apr_dso_handle_t *sSymPADSOHandleG = NULL; |
79 | 79 | ||
80 | bool grab_pa_syms(std::string pulse_dso_name) | 80 | bool grab_pa_syms(std::string pulse_dso_name) |
@@ -93,11 +93,11 @@ bool grab_pa_syms(std::string pulse_dso_name) | |||
93 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0) | 93 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0) |
94 | 94 | ||
95 | //attempt to load the shared library | 95 | //attempt to load the shared library |
96 | apr_pool_create(&sSymPADSOMemoryPool, NULL); | 96 | sSymPADSOMemoryPool.create(); |
97 | 97 | ||
98 | if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle, | 98 | if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle, |
99 | pulse_dso_name.c_str(), | 99 | pulse_dso_name.c_str(), |
100 | sSymPADSOMemoryPool) )) | 100 | sSymPADSOMemoryPool()) )) |
101 | { | 101 | { |
102 | INFOMSG("Found DSO: %s", pulse_dso_name.c_str()); | 102 | INFOMSG("Found DSO: %s", pulse_dso_name.c_str()); |
103 | 103 | ||
@@ -140,11 +140,7 @@ void ungrab_pa_syms() | |||
140 | sSymPADSOHandleG = NULL; | 140 | sSymPADSOHandleG = NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | if ( sSymPADSOMemoryPool ) | 143 | sSymPADSOMemoryPool.destroy(); |
144 | { | ||
145 | apr_pool_destroy(sSymPADSOMemoryPool); | ||
146 | sSymPADSOMemoryPool = NULL; | ||
147 | } | ||
148 | 144 | ||
149 | // NULL-out all of the symbols we'd grabbed | 145 | // NULL-out all of the symbols we'd grabbed |
150 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0) | 146 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0) |
diff --git a/linden/indra/media_plugins/webkit/windows_volume_catcher.cpp b/linden/indra/media_plugins/webkit/windows_volume_catcher.cpp index f1afea7..64f70c4 100644 --- a/linden/indra/media_plugins/webkit/windows_volume_catcher.cpp +++ b/linden/indra/media_plugins/webkit/windows_volume_catcher.cpp | |||
@@ -34,6 +34,8 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "volume_catcher.h" | 36 | #include "volume_catcher.h" |
37 | # define WIN32_LEAN_AND_MEAN | ||
38 | # include <winsock2.h> | ||
37 | #include <windows.h> | 39 | #include <windows.h> |
38 | #include "llmemory.h" | 40 | #include "llmemory.h" |
39 | class VolumeCatcherImpl : public LLSingleton<VolumeCatcherImpl> | 41 | class VolumeCatcherImpl : public LLSingleton<VolumeCatcherImpl> |