diff options
Diffstat (limited to 'indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp')
-rw-r--r-- | indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp index 3f636915ea..0f45c151a2 100644 --- a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp +++ b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp @@ -1,4 +1,4 @@ -/** +/** * @file media_plugin_gstreamer10.cpp * @brief GStreamer-1.0 plugin for LLMedia API plugin system * @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2016&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2016, Linden Research, Inc. / Nicky Dasmijn - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ * @endcond @@ -77,7 +77,7 @@ private: bool navigateTo( const std::string urlIn ); bool seek( double time_sec ); bool setVolume( float volume ); - + // misc bool pause(); bool stop(); @@ -86,7 +86,7 @@ private: double MIN_LOOP_SEC = 1.0F; U32 INTERNAL_TEXTURE_SIZE = 1024; - + bool mIsLooping; enum ECommand { @@ -110,9 +110,9 @@ private: void mouseMove( int x, int y ); static bool mDoneInit; - + guint mBusWatchID; - + float mVolume; int mDepth; @@ -120,10 +120,10 @@ private: // padded texture size we need to write into int mTextureWidth; int mTextureHeight; - + bool mSeekWanted; double mSeekDestination; - + // Very GStreamer-specific GMainLoop *mPump; // event pump for this media GstElement *mPlaybin; @@ -148,7 +148,7 @@ MediaPluginGStreamer10::MediaPluginGStreamer10( LLPluginInstance::sendMessageFun gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *message) { - if (!message) + if (!message) return TRUE; // shield against GStreamer bug switch (GST_MESSAGE_TYPE (message)) @@ -213,7 +213,7 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa { GError *err = nullptr; gchar *debug = nullptr; - + llgst_message_parse_info (message, &err, &debug); if (err) llg_error_free (err); @@ -225,7 +225,7 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa { GError *err = nullptr; gchar *debug = nullptr; - + llgst_message_parse_warning (message, &err, &debug); if (err) llg_error_free (err); @@ -239,7 +239,7 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa { double eos_pos_sec = 0.0F; bool got_eos_position = getTimePos(eos_pos_sec); - + if (got_eos_position && eos_pos_sec < MIN_LOOP_SEC) { // if we know that the movie is really short, don't @@ -326,7 +326,7 @@ bool MediaPluginGStreamer10::update(int milliseconds) return false; // error // DEBUGMSG("updating media..."); - + // sanity check if (nullptr == mPump || nullptr == mPlaybin) { @@ -353,13 +353,13 @@ bool MediaPluginGStreamer10::update(int milliseconds) } // check for availability of a new frame - + if( !mAppSink ) return true; if( GST_STATE(mPlaybin) != GST_STATE_PLAYING) // Do not try to pull a sample if not in playing state return true; - + GstSample *pSample = llgst_app_sink_pull_sample( mAppSink ); if(!pSample) return false; // Done playing @@ -379,7 +379,7 @@ bool MediaPluginGStreamer10::update(int milliseconds) if( !mPixels || width == 0 || height == 0) return true; - + GstBuffer *pBuffer = llgst_sample_get_buffer ( pSample ); GstMapInfo map; llgst_buffer_map ( pBuffer, &map, GST_MAP_READ); @@ -396,7 +396,7 @@ bool MediaPluginGStreamer10::update(int milliseconds) U8 *pTexelOut = mPixels + (row * mTextureWidth * mDepth ); #else U8 *pTexelOut = mPixels + ((mTextureHeight-row-1) * mTextureWidth * mDepth ); -#endif +#endif for( int col = 0; col < mTextureWidth; ++col ) { pTexelOut[ 0 ] = pTexelIn[0]; @@ -527,7 +527,7 @@ bool MediaPluginGStreamer10::getTimePos(double &sec_out) { got_position = false; } - + } // If all the preconditions succeeded... we can trust the result. if (got_position) @@ -592,7 +592,7 @@ bool MediaPluginGStreamer10::load() setStatus(STATUS_ERROR); return false; } - + llg_object_set(mPlaybin, "video-sink", mAppSink, nullptr); return true; @@ -677,7 +677,7 @@ bool MediaPluginGStreamer10::startup() // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; saved_locale = setlocale(LC_ALL, nullptr); - + llgst_debug_set_default_threshold( GST_LEVEL_WARNING ); llgst_debug_add_log_function( LogFunction, nullptr, nullptr ); llgst_debug_set_active( false ); @@ -699,7 +699,7 @@ bool MediaPluginGStreamer10::startup() llg_error_free(err); return false; } - + mDoneInit = true; } @@ -771,7 +771,7 @@ void MediaPluginGStreamer10::receiveMessage(const char *message_string) { // no response is necessary here. double time = message_in.getValueReal("time"); - + // Convert time to milliseconds for update() update((int)(time * 1000.0f)); } @@ -863,7 +863,7 @@ void MediaPluginGStreamer10::receiveMessage(const char *message_string) mTextureHeight = texture_height; memset( mPixels, 0, mTextureWidth*mTextureHeight*mDepth ); } - + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request"); message.setValue("name", mTextureSegmentName); message.setValueS32("width", INTERNAL_TEXTURE_SIZE ); @@ -876,14 +876,14 @@ void MediaPluginGStreamer10::receiveMessage(const char *message_string) { std::string uri = message_in.getValue("uri"); navigateTo( uri ); - sendStatus(); + sendStatus(); } else if(message_name == "mouse_event") { std::string event = message_in.getValue("event"); S32 x = message_in.getValueS32("x"); S32 y = message_in.getValueS32("y"); - + if(event == "down") { mouseDown(x, y); @@ -948,10 +948,10 @@ int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void MediaPluginGStreamer10 *self = new MediaPluginGStreamer10(host_send_func, host_user_data); *plugin_send_func = MediaPluginGStreamer10::staticReceiveMessage; *plugin_user_data = (void*)self; - + return 0; // okay } - else + else { return -1; // failed to init } |