diff options
author | McCabe Maxsted | 2011-02-18 19:07:44 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-02-18 19:10:17 -0700 |
commit | 4a8a4197076b18db16ae6bc466a21e6235b94dc5 (patch) | |
tree | 80e7cb1f4506ad920a8a84a438323d7e441887c8 /linden | |
parent | Fixed cmake using the old windows gstreamer plugin libs (diff) | |
download | meta-impy-4a8a4197076b18db16ae6bc466a21e6235b94dc5.zip meta-impy-4a8a4197076b18db16ae6bc466a21e6235b94dc5.tar.gz meta-impy-4a8a4197076b18db16ae6bc466a21e6235b94dc5.tar.bz2 meta-impy-4a8a4197076b18db16ae6bc466a21e6235b94dc5.tar.xz |
Created a media_plugin_gstreamer010.log file in the cwd for the GStreamer plugin
Diffstat (limited to 'linden')
-rwxr-xr-x | linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp | 164 |
1 files changed, 96 insertions, 68 deletions
diff --git a/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/linden/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index ed6d920..fbe3e49 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,11 @@ 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_TAG) |
211 | { | 237 | { |
212 | DEBUGMSG("Got GST message type: %s", | 238 | 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 | } | 239 | } |
221 | 240 | ||
222 | switch (GST_MESSAGE_TYPE (message)) | 241 | switch (GST_MESSAGE_TYPE (message)) |
@@ -226,7 +245,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
226 | // NEEDS GST 0.10.11+ and America discovered by C.Columbus | 245 | // NEEDS GST 0.10.11+ and America discovered by C.Columbus |
227 | gint percent = 0; | 246 | gint percent = 0; |
228 | gst_message_parse_buffering(message, &percent); | 247 | gst_message_parse_buffering(message, &percent); |
229 | DEBUGMSG("GST buffering: %d%%", percent); | 248 | writeToLog("GST buffering: %d%%", percent); |
230 | 249 | ||
231 | break; | 250 | break; |
232 | } | 251 | } |
@@ -240,7 +259,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
240 | &pending_state); | 259 | &pending_state); |
241 | #ifdef LL_GST_REPORT_STATE_CHANGES | 260 | #ifdef LL_GST_REPORT_STATE_CHANGES |
242 | // not generally very useful, and rather spammy. | 261 | // not generally very useful, and rather spammy. |
243 | DEBUGMSG("state change (old,<new>,pending): %s,<%s>,%s", | 262 | writeToLog("state change (old,<new>,pending): %s,<%s>,%s", |
244 | get_gst_state_name(old_state), | 263 | get_gst_state_name(old_state), |
245 | get_gst_state_name(new_state), | 264 | get_gst_state_name(new_state), |
246 | get_gst_state_name(pending_state)); | 265 | get_gst_state_name(pending_state)); |
@@ -270,7 +289,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
270 | gchar *debug = NULL; | 289 | gchar *debug = NULL; |
271 | 290 | ||
272 | gst_message_parse_error (message, &err, &debug); | 291 | gst_message_parse_error (message, &err, &debug); |
273 | WARNMSG("GST error: %s", err?err->message:"(unknown)"); | 292 | writeToLog("GST error: %s", err?err->message:"(unknown)"); |
274 | if (err) | 293 | if (err) |
275 | g_error_free (err); | 294 | g_error_free (err); |
276 | g_free (debug); | 295 | g_free (debug); |
@@ -287,7 +306,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
287 | gchar *debug = NULL; | 306 | gchar *debug = NULL; |
288 | 307 | ||
289 | gst_message_parse_info (message, &err, &debug); | 308 | gst_message_parse_info (message, &err, &debug); |
290 | INFOMSG("GST info: %s", err?err->message:"(unknown)"); | 309 | writeToLog("GST info: %s", err?err->message:"(unknown)"); |
291 | if (err) | 310 | if (err) |
292 | g_error_free (err); | 311 | g_error_free (err); |
293 | g_free (debug); | 312 | g_free (debug); |
@@ -300,7 +319,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
300 | gchar *debug = NULL; | 319 | gchar *debug = NULL; |
301 | 320 | ||
302 | gst_message_parse_warning (message, &err, &debug); | 321 | gst_message_parse_warning (message, &err, &debug); |
303 | WARNMSG("GST warning: %s", err?err->message:"(unknown)"); | 322 | writeToLog("GST warning: %s", err?err->message:"(unknown)"); |
304 | if (err) | 323 | if (err) |
305 | g_error_free (err); | 324 | g_error_free (err); |
306 | g_free (debug); | 325 | g_free (debug); |
@@ -317,7 +336,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
317 | 336 | ||
318 | if ( gst_tag_list_get_string(new_tags, GST_TAG_TITLE, &title) ) | 337 | if ( gst_tag_list_get_string(new_tags, GST_TAG_TITLE, &title) ) |
319 | { | 338 | { |
320 | //WARMING("Title: %s", title); | 339 | //writeToLog("Title: %s", title); |
321 | std::string newtitle(title); | 340 | std::string newtitle(title); |
322 | gst_tag_list_free(new_tags); | 341 | gst_tag_list_free(new_tags); |
323 | 342 | ||
@@ -336,10 +355,10 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
336 | case GST_MESSAGE_EOS: | 355 | case GST_MESSAGE_EOS: |
337 | { | 356 | { |
338 | /* end-of-stream */ | 357 | /* end-of-stream */ |
339 | DEBUGMSG("GST end-of-stream."); | 358 | writeToLog("GST end-of-stream."); |
340 | if (mIsLooping) | 359 | if (mIsLooping) |
341 | { | 360 | { |
342 | DEBUGMSG("looping media..."); | 361 | //writeToLog("looping media..."); |
343 | double eos_pos_sec = 0.0F; | 362 | double eos_pos_sec = 0.0F; |
344 | bool got_eos_position = getTimePos(eos_pos_sec); | 363 | bool got_eos_position = getTimePos(eos_pos_sec); |
345 | 364 | ||
@@ -348,7 +367,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
348 | // if we know that the movie is really short, don't | 367 | // if we know that the movie is really short, don't |
349 | // loop it else it can easily become a time-hog | 368 | // loop it else it can easily become a time-hog |
350 | // because of GStreamer spin-up overhead | 369 | // because of GStreamer spin-up overhead |
351 | DEBUGMSG("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec); | 370 | writeToLog("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec); |
352 | // inject a COMMAND_PAUSE | 371 | // inject a COMMAND_PAUSE |
353 | mCommand = COMMAND_PAUSE; | 372 | mCommand = COMMAND_PAUSE; |
354 | } | 373 | } |
@@ -367,7 +386,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, | |||
367 | else | 386 | else |
368 | #endif // LLGST_LOOP_BY_SEEKING | 387 | #endif // LLGST_LOOP_BY_SEEKING |
369 | { // use clumsy stop-start to loop | 388 | { // use clumsy stop-start to loop |
370 | DEBUGMSG("didn't loop by rewinding - stopping and starting instead..."); | 389 | writeToLog("didn't loop by rewinding - stopping and starting instead..."); |
371 | stop(); | 390 | stop(); |
372 | play(1.0); | 391 | play(1.0); |
373 | } | 392 | } |
@@ -413,7 +432,7 @@ MediaPluginGStreamer010::navigateTo ( const std::string urlIn ) | |||
413 | 432 | ||
414 | setStatus(STATUS_LOADING); | 433 | setStatus(STATUS_LOADING); |
415 | 434 | ||
416 | DEBUGMSG("Setting media URI: %s", urlIn.c_str()); | 435 | writeToLog("Setting media URI: %s", urlIn.c_str()); |
417 | 436 | ||
418 | mSeekWanted = false; | 437 | mSeekWanted = false; |
419 | 438 | ||
@@ -441,13 +460,13 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
441 | if (!mDoneInit) | 460 | if (!mDoneInit) |
442 | return false; // error | 461 | return false; // error |
443 | 462 | ||
444 | DEBUGMSG("updating media..."); | 463 | //writeToLog("updating media..."); |
445 | 464 | ||
446 | // sanity check | 465 | // sanity check |
447 | if (NULL == mPump || | 466 | if (NULL == mPump || |
448 | NULL == mPlaybin) | 467 | NULL == mPlaybin) |
449 | { | 468 | { |
450 | DEBUGMSG("dead media..."); | 469 | writeToLog("dead media..."); |
451 | return false; | 470 | return false; |
452 | } | 471 | } |
453 | 472 | ||
@@ -477,7 +496,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
477 | GST_OBJECT_LOCK(mVideoSink); | 496 | GST_OBJECT_LOCK(mVideoSink); |
478 | if (mVideoSink->retained_frame_ready) | 497 | if (mVideoSink->retained_frame_ready) |
479 | { | 498 | { |
480 | DEBUGMSG("NEW FRAME READY"); | 499 | writeToLog("NEW FRAME READY"); |
481 | 500 | ||
482 | if (mVideoSink->retained_frame_width != mCurrentWidth || | 501 | if (mVideoSink->retained_frame_width != mCurrentWidth || |
483 | mVideoSink->retained_frame_height != mCurrentHeight) | 502 | mVideoSink->retained_frame_height != mCurrentHeight) |
@@ -508,7 +527,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
508 | GST_OBJECT_UNLOCK(mVideoSink); | 527 | GST_OBJECT_UNLOCK(mVideoSink); |
509 | 528 | ||
510 | mCurrentRowbytes = neww * newd; | 529 | mCurrentRowbytes = neww * newd; |
511 | DEBUGMSG("video container resized to %dx%d", | 530 | writeToLog("video container resized to %dx%d", |
512 | neww, newh); | 531 | neww, newh); |
513 | 532 | ||
514 | mDepth = newd; | 533 | mDepth = newd; |
@@ -536,7 +555,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
536 | } | 555 | } |
537 | 556 | ||
538 | GST_OBJECT_UNLOCK(mVideoSink); | 557 | GST_OBJECT_UNLOCK(mVideoSink); |
539 | DEBUGMSG("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST"); | 558 | writeToLog("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST"); |
540 | 559 | ||
541 | setDirty(0,0,mCurrentWidth,mCurrentHeight); | 560 | setDirty(0,0,mCurrentWidth,mCurrentHeight); |
542 | } | 561 | } |
@@ -547,7 +566,7 @@ MediaPluginGStreamer010::update(int milliseconds) | |||
547 | 566 | ||
548 | GST_OBJECT_UNLOCK(mVideoSink); | 567 | GST_OBJECT_UNLOCK(mVideoSink); |
549 | 568 | ||
550 | DEBUGMSG("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize"); | 569 | writeToLog("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize"); |
551 | } | 570 | } |
552 | 571 | ||
553 | return true; | 572 | return true; |
@@ -586,7 +605,7 @@ MediaPluginGStreamer010::mouseMove( int x, int y ) | |||
586 | bool | 605 | bool |
587 | MediaPluginGStreamer010::pause() | 606 | MediaPluginGStreamer010::pause() |
588 | { | 607 | { |
589 | DEBUGMSG("pausing media..."); | 608 | writeToLog("pausing media..."); |
590 | // todo: error-check this? | 609 | // todo: error-check this? |
591 | gst_element_set_state(mPlaybin, GST_STATE_PAUSED); | 610 | gst_element_set_state(mPlaybin, GST_STATE_PAUSED); |
592 | return true; | 611 | return true; |
@@ -595,7 +614,7 @@ MediaPluginGStreamer010::pause() | |||
595 | bool | 614 | bool |
596 | MediaPluginGStreamer010::stop() | 615 | MediaPluginGStreamer010::stop() |
597 | { | 616 | { |
598 | DEBUGMSG("stopping media..."); | 617 | writeToLog("stopping media..."); |
599 | // todo: error-check this? | 618 | // todo: error-check this? |
600 | gst_element_set_state(mPlaybin, GST_STATE_READY); | 619 | gst_element_set_state(mPlaybin, GST_STATE_READY); |
601 | return true; | 620 | return true; |
@@ -605,8 +624,7 @@ bool | |||
605 | MediaPluginGStreamer010::play(double rate) | 624 | MediaPluginGStreamer010::play(double rate) |
606 | { | 625 | { |
607 | // NOTE: we don't actually support non-natural rate. | 626 | // NOTE: we don't actually support non-natural rate. |
608 | 627 | writeToLog("playing media... rate=%f", rate); | |
609 | DEBUGMSG("playing media... rate=%f", rate); | ||
610 | // todo: error-check this? | 628 | // todo: error-check this? |
611 | gst_element_set_state(mPlaybin, GST_STATE_PLAYING); | 629 | gst_element_set_state(mPlaybin, GST_STATE_PLAYING); |
612 | return true; | 630 | return true; |
@@ -643,7 +661,7 @@ MediaPluginGStreamer010::seek(double time_sec) | |||
643 | GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND), | 661 | GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND), |
644 | GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); | 662 | GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); |
645 | } | 663 | } |
646 | DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d", | 664 | writeToLog("MEDIA SEEK REQUEST to %f sec result was %d", |
647 | float(time_sec), int(success)); | 665 | float(time_sec), int(success)); |
648 | return success; | 666 | return success; |
649 | } | 667 | } |
@@ -697,7 +715,7 @@ MediaPluginGStreamer010::load() | |||
697 | 715 | ||
698 | setStatus(STATUS_LOADING); | 716 | setStatus(STATUS_LOADING); |
699 | 717 | ||
700 | DEBUGMSG("setting up media..."); | 718 | writeToLog("setting up media..."); |
701 | 719 | ||
702 | mIsLooping = false; | 720 | mIsLooping = false; |
703 | mVolume = (float) 0.1234567; // minor hack to force an initial volume update | 721 | mVolume = (float) 0.1234567; // minor hack to force an initial volume update |
@@ -736,7 +754,7 @@ MediaPluginGStreamer010::load() | |||
736 | GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); | 754 | GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo")); |
737 | if (!mVideoSink) | 755 | if (!mVideoSink) |
738 | { | 756 | { |
739 | WARNMSG("Could not instantiate private-slvideo element."); | 757 | writeToLog("Could not instantiate private-slvideo element."); |
740 | // todo: cleanup. | 758 | // todo: cleanup. |
741 | setStatus(STATUS_ERROR); | 759 | setStatus(STATUS_ERROR); |
742 | return false; // error | 760 | return false; // error |
@@ -755,7 +773,7 @@ MediaPluginGStreamer010::unload () | |||
755 | if (!mDoneInit) | 773 | if (!mDoneInit) |
756 | return false; // error | 774 | return false; // error |
757 | 775 | ||
758 | DEBUGMSG("unloading media..."); | 776 | writeToLog("unloading media..."); |
759 | 777 | ||
760 | // stop getting callbacks for this bus | 778 | // stop getting callbacks for this bus |
761 | g_source_remove(mBusWatchID); | 779 | g_source_remove(mBusWatchID); |
@@ -813,7 +831,7 @@ MediaPluginGStreamer010::startup() | |||
813 | "libgstvideo-0.10.so.0") ) | 831 | "libgstvideo-0.10.so.0") ) |
814 | #endif | 832 | #endif |
815 | { | 833 | { |
816 | WARNMSG("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); | 834 | writeToLog("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); |
817 | return false; | 835 | return false; |
818 | } | 836 | } |
819 | */ | 837 | */ |
@@ -823,7 +841,7 @@ MediaPluginGStreamer010::startup() | |||
823 | // } | 841 | // } |
824 | // else | 842 | // else |
825 | // { | 843 | // { |
826 | // WARNMSG("gst_segtrap_set_enabled() is not available; plugin crashes won't be caught."); | 844 | // writeToLog("gst_segtrap_set_enabled() is not available; plugin crashes won't be caught."); |
827 | // } | 845 | // } |
828 | /* | 846 | /* |
829 | #if LL_LINUX | 847 | #if LL_LINUX |
@@ -866,12 +884,12 @@ MediaPluginGStreamer010::startup() | |||
866 | { | 884 | { |
867 | if (err) | 885 | if (err) |
868 | { | 886 | { |
869 | WARNMSG("GST init failed: %s", err->message); | 887 | writeToLog("GST init failed: %s", err->message); |
870 | g_error_free(err); | 888 | g_error_free(err); |
871 | } | 889 | } |
872 | else | 890 | else |
873 | { | 891 | { |
874 | WARNMSG("GST init failed for unspecified reason."); | 892 | writeToLog("GST init failed for unspecified reason."); |
875 | } | 893 | } |
876 | return false; | 894 | return false; |
877 | } | 895 | } |
@@ -882,22 +900,22 @@ MediaPluginGStreamer010::startup() | |||
882 | 900 | ||
883 | // Init our custom plugins - only really need do this once. | 901 | // Init our custom plugins - only really need do this once. |
884 | gst_slvideo_init_class(); | 902 | gst_slvideo_init_class(); |
885 | /* | 903 | |
886 | // List the plugins GStreamer can find | 904 | // List the plugins GStreamer can find |
887 | LL_DEBUGS("MediaImpl") << "Found GStreamer plugins:" << LL_ENDL; | 905 | writeToLog("Found GStreamer plugins:"); |
888 | GList *list; | 906 | GList *list; |
889 | GstRegistry *registry = gst_registry_get_default(); | 907 | GstRegistry *registry = gst_registry_get_default(); |
890 | std::string loaded = ""; | 908 | std::string loaded = "No"; |
891 | for (list = gst_registry_get_plugin_list(registry); | 909 | for (list = gst_registry_get_plugin_list(registry); |
892 | list != NULL; | 910 | list != NULL; |
893 | list = g_list_next(list)) | 911 | list = g_list_next(list)) |
894 | { | 912 | { |
895 | GstPlugin *list_plugin = (GstPlugin *)list->data; | 913 | GstPlugin *list_plugin = (GstPlugin *)list->data; |
896 | (bool)gst_plugin_is_loaded(list_plugin) ? loaded = "Yes" : loaded = "No"; | 914 | if (gst_plugin_is_loaded(list_plugin)) loaded = "Yes"; |
897 | LL_DEBUGS("MediaImpl") << gst_plugin_get_name(list_plugin) << ", loaded? " << loaded << LL_ENDL; | 915 | writeToLog("%s, loaded? %s", gst_plugin_get_name(list_plugin), loaded.c_str()); |
898 | } | 916 | } |
899 | gst_plugin_list_free(list); | 917 | gst_plugin_list_free(list); |
900 | */ | 918 | |
901 | mDoneInit = true; | 919 | mDoneInit = true; |
902 | } | 920 | } |
903 | 921 | ||
@@ -941,11 +959,11 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
941 | 959 | ||
942 | if( imp_dir == "" ) | 960 | if( imp_dir == "" ) |
943 | { | 961 | { |
944 | WARNMSG("Could not get application directory, not setting GST_PLUGIN_PATH."); | 962 | writeToLog("Could not get application directory, not setting GST_PLUGIN_PATH."); |
945 | return; | 963 | return; |
946 | } | 964 | } |
947 | 965 | ||
948 | DEBUGMSG("Imprudence is installed at %s", imp_dir); | 966 | writeToLog("Imprudence is installed at %s", imp_dir.c_str()); |
949 | 967 | ||
950 | // ":" on Mac and 'Nix, ";" on Windows | 968 | // ":" on Mac and 'Nix, ";" on Windows |
951 | std::string separator = G_SEARCHPATH_SEPARATOR_S; | 969 | std::string separator = G_SEARCHPATH_SEPARATOR_S; |
@@ -955,7 +973,7 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
955 | char *old_path = getenv("GST_PLUGIN_PATH"); | 973 | char *old_path = getenv("GST_PLUGIN_PATH"); |
956 | if(old_path == NULL) | 974 | if(old_path == NULL) |
957 | { | 975 | { |
958 | DEBUGMSG("Did not find user-set GST_PLUGIN_PATH."); | 976 | writeToLog("Did not find user-set GST_PLUGIN_PATH."); |
959 | } | 977 | } |
960 | else | 978 | else |
961 | { | 979 | { |
@@ -986,11 +1004,11 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
986 | 1004 | ||
987 | if( put_result == -1 ) | 1005 | if( put_result == -1 ) |
988 | { | 1006 | { |
989 | WARNMSG("Setting GST_PLUGIN_PATH failed!"); | 1007 | writeToLog("Setting GST_PLUGIN_PATH failed!"); |
990 | } | 1008 | } |
991 | else | 1009 | else |
992 | { | 1010 | { |
993 | DEBUGMSG("GST_PLUGIN_PATH set to %s", getenv("GST_PLUGIN_PATH")); | 1011 | writeToLog("GST_PLUGIN_PATH set to %s", getenv("GST_PLUGIN_PATH")); |
994 | } | 1012 | } |
995 | 1013 | ||
996 | // Don't load system plugins. We only want to use ours, to avoid conflicts. | 1014 | // Don't load system plugins. We only want to use ours, to avoid conflicts. |
@@ -1002,7 +1020,7 @@ void MediaPluginGStreamer010::set_gst_plugin_path() | |||
1002 | 1020 | ||
1003 | if( put_result == -1 ) | 1021 | if( put_result == -1 ) |
1004 | { | 1022 | { |
1005 | WARNMSG("Setting GST_PLUGIN_SYSTEM_PATH=\"\" failed!"); | 1023 | writeToLog("Setting GST_PLUGIN_SYSTEM_PATH=\"\" failed!"); |
1006 | } | 1024 | } |
1007 | 1025 | ||
1008 | #endif // LL_WINDOWS || LL_DARWIN | 1026 | #endif // LL_WINDOWS || LL_DARWIN |
@@ -1020,7 +1038,7 @@ MediaPluginGStreamer010::sizeChanged() | |||
1020 | { | 1038 | { |
1021 | mNaturalWidth = mCurrentWidth; | 1039 | mNaturalWidth = mCurrentWidth; |
1022 | mNaturalHeight = mCurrentHeight; | 1040 | mNaturalHeight = mCurrentHeight; |
1023 | DEBUGMSG("Media NATURAL size better detected as %dx%d", | 1041 | writeToLog("Media NATURAL size better detected as %dx%d", |
1024 | mNaturalWidth, mNaturalHeight); | 1042 | mNaturalWidth, mNaturalHeight); |
1025 | } | 1043 | } |
1026 | 1044 | ||
@@ -1035,7 +1053,7 @@ MediaPluginGStreamer010::sizeChanged() | |||
1035 | message.setValue("name", mTextureSegmentName); | 1053 | message.setValue("name", mTextureSegmentName); |
1036 | message.setValueS32("width", mNaturalWidth); | 1054 | message.setValueS32("width", mNaturalWidth); |
1037 | message.setValueS32("height", mNaturalHeight); | 1055 | 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); | 1056 | writeToLog("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight); |
1039 | sendMessage(message); | 1057 | sendMessage(message); |
1040 | } | 1058 | } |
1041 | } | 1059 | } |
@@ -1058,11 +1076,11 @@ MediaPluginGStreamer010::closedown() | |||
1058 | 1076 | ||
1059 | MediaPluginGStreamer010::~MediaPluginGStreamer010() | 1077 | MediaPluginGStreamer010::~MediaPluginGStreamer010() |
1060 | { | 1078 | { |
1061 | DEBUGMSG("MediaPluginGStreamer010 destructor"); | 1079 | //writeToLog("MediaPluginGStreamer010 destructor"); |
1062 | 1080 | ||
1063 | closedown(); | 1081 | closedown(); |
1064 | 1082 | ||
1065 | DEBUGMSG("GStreamer010 closing down"); | 1083 | writeToLog("GStreamer010 closing down"); |
1066 | } | 1084 | } |
1067 | 1085 | ||
1068 | 1086 | ||
@@ -1085,7 +1103,7 @@ MediaPluginGStreamer010::getVersion() | |||
1085 | 1103 | ||
1086 | void MediaPluginGStreamer010::receiveMessage(const char *message_string) | 1104 | void MediaPluginGStreamer010::receiveMessage(const char *message_string) |
1087 | { | 1105 | { |
1088 | //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\"" << std::endl; | 1106 | //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\""; |
1089 | 1107 | ||
1090 | LLPluginMessage message_in; | 1108 | LLPluginMessage message_in; |
1091 | 1109 | ||
@@ -1106,11 +1124,11 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1106 | 1124 | ||
1107 | if ( load() ) | 1125 | if ( load() ) |
1108 | { | 1126 | { |
1109 | DEBUGMSG("GStreamer010 media instance set up"); | 1127 | writeToLog("GStreamer010 media instance set up"); |
1110 | } | 1128 | } |
1111 | else | 1129 | else |
1112 | { | 1130 | { |
1113 | WARNMSG("GStreamer010 media instance failed to set up"); | 1131 | writeToLog("GStreamer010 media instance failed to set up"); |
1114 | } | 1132 | } |
1115 | 1133 | ||
1116 | message.setValue("plugin_version", getVersion()); | 1134 | message.setValue("plugin_version", getVersion()); |
@@ -1137,7 +1155,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1137 | std::string name = message_in.getValue("name"); | 1155 | std::string name = message_in.getValue("name"); |
1138 | 1156 | ||
1139 | std::ostringstream str; | 1157 | std::ostringstream str; |
1140 | INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); | 1158 | writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); |
1141 | 1159 | ||
1142 | mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); | 1160 | mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); |
1143 | } | 1161 | } |
@@ -1145,7 +1163,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1145 | { | 1163 | { |
1146 | std::string name = message_in.getValue("name"); | 1164 | std::string name = message_in.getValue("name"); |
1147 | 1165 | ||
1148 | DEBUGMSG("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str()); | 1166 | writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str()); |
1149 | 1167 | ||
1150 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); | 1168 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); |
1151 | if(iter != mSharedSegments.end()) | 1169 | if(iter != mSharedSegments.end()) |
@@ -1163,7 +1181,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1163 | } | 1181 | } |
1164 | else | 1182 | else |
1165 | { | 1183 | { |
1166 | WARNMSG("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!"); | 1184 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!"); |
1167 | } | 1185 | } |
1168 | 1186 | ||
1169 | // Send the response so it can be cleaned up. | 1187 | // Send the response so it can be cleaned up. |
@@ -1174,7 +1192,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1174 | else | 1192 | else |
1175 | { | 1193 | { |
1176 | std::ostringstream str; | 1194 | std::ostringstream str; |
1177 | INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str()); | 1195 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str()); |
1178 | } | 1196 | } |
1179 | } | 1197 | } |
1180 | else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) | 1198 | else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) |
@@ -1217,7 +1235,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1217 | S32 texture_height = message_in.getValueS32("texture_height"); | 1235 | S32 texture_height = message_in.getValueS32("texture_height"); |
1218 | 1236 | ||
1219 | std::ostringstream str; | 1237 | 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); | 1238 | writeToLog("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height); |
1221 | 1239 | ||
1222 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); | 1240 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); |
1223 | message.setValue("name", name); | 1241 | message.setValue("name", name); |
@@ -1233,8 +1251,8 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1233 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); | 1251 | SharedSegmentMap::iterator iter = mSharedSegments.find(name); |
1234 | if(iter != mSharedSegments.end()) | 1252 | if(iter != mSharedSegments.end()) |
1235 | { | 1253 | { |
1236 | INFOMSG("*** Got size change with matching shm, new size is %d x %d", width, height); | 1254 | 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); | 1255 | writeToLog("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height); |
1238 | 1256 | ||
1239 | mPixels = (unsigned char*)iter->second.mAddress; | 1257 | mPixels = (unsigned char*)iter->second.mAddress; |
1240 | mTextureSegmentName = name; | 1258 | mTextureSegmentName = name; |
@@ -1244,7 +1262,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1244 | if (texture_width > 1 || | 1262 | if (texture_width > 1 || |
1245 | texture_height > 1) // not a dummy size from the app, a real explicit forced size | 1263 | texture_height > 1) // not a dummy size from the app, a real explicit forced size |
1246 | { | 1264 | { |
1247 | INFOMSG("**** = REAL RESIZE REQUEST FROM APP"); | 1265 | writeToLog("**** = REAL RESIZE REQUEST FROM APP"); |
1248 | 1266 | ||
1249 | GST_OBJECT_LOCK(mVideoSink); | 1267 | GST_OBJECT_LOCK(mVideoSink); |
1250 | mVideoSink->resize_forced_always = true; | 1268 | mVideoSink->resize_forced_always = true; |
@@ -1326,13 +1344,23 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) | |||
1326 | } | 1344 | } |
1327 | else | 1345 | else |
1328 | { | 1346 | { |
1329 | INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str()); | 1347 | writeToLog("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str()); |
1330 | } | 1348 | } |
1331 | } | 1349 | } |
1332 | } | 1350 | } |
1333 | 1351 | ||
1334 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) | 1352 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) |
1335 | { | 1353 | { |
1354 | // init log file | ||
1355 | LLFILE* fp = LLFile::fopen("media_plugin_gstreamer010.log", "w"); | ||
1356 | if (fp) | ||
1357 | { | ||
1358 | time_t timeptr = time(NULL); | ||
1359 | fprintf(fp, "%s", asctime(localtime(&timeptr))); | ||
1360 | fprintf(fp, "<--- Begin media_plugin_gstreamer010 initialization --->\n"); | ||
1361 | fclose(fp); | ||
1362 | } | ||
1363 | |||
1336 | if (MediaPluginGStreamer010::startup()) | 1364 | if (MediaPluginGStreamer010::startup()) |
1337 | { | 1365 | { |
1338 | MediaPluginGStreamer010 *self = new MediaPluginGStreamer010(host_send_func, host_user_data); | 1366 | MediaPluginGStreamer010 *self = new MediaPluginGStreamer010(host_send_func, host_user_data); |