Skip to content
Snippets Groups Projects
Commit 52c8ffaa authored by Tofu Linden's avatar Tofu Linden
Browse files

Some tidy-ups to the gstreamer media plugin while I try to figure out where...

Some tidy-ups to the gstreamer media plugin while I try to figure out where the black-frame-on-resize is coming from.
parent 27283807
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ extern "C" { ...@@ -53,7 +53,7 @@ extern "C" {
}while(0) }while(0)
#define NULLMSG(...) do{}while(0) #define NULLMSG(...) do{}while(0)
#define DEBUGMSG NULLMSG #define DEBUGMSG STDERRMSG
#define INFOMSG STDERRMSG #define INFOMSG STDERRMSG
#define WARNMSG STDERRMSG #define WARNMSG STDERRMSG
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
......
...@@ -108,7 +108,7 @@ gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) ...@@ -108,7 +108,7 @@ gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf)
slvideo = GST_SLVIDEO(bsink); slvideo = GST_SLVIDEO(bsink);
DEBUGMSG("\n\ntransferring a frame of %dx%d <- %p (%d)\n\n", DEBUGMSG("transferring a frame of %dx%d <- %p (%d)",
slvideo->width, slvideo->height, GST_BUFFER_DATA(buf), slvideo->width, slvideo->height, GST_BUFFER_DATA(buf),
slvideo->format); slvideo->format);
...@@ -336,7 +336,7 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ...@@ -336,7 +336,7 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
#define MAXDEPTHHACK 4 #define MAXDEPTHHACK 4
GST_OBJECT_LOCK(slvideo); GST_OBJECT_LOCK(slvideo);
if (slvideo->resize_forced) if (slvideo->resize_forced_always) // app is giving us a fixed size to work with
{ {
gint slwantwidth, slwantheight; gint slwantwidth, slwantheight;
slwantwidth = slvideo->resize_try_width; slwantwidth = slvideo->resize_try_width;
...@@ -385,6 +385,8 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ...@@ -385,6 +385,8 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
} }
} }
GST_OBJECT_UNLOCK(slvideo);
if (!made_bufferdata_ptr) // need to fallback to malloc at original size if (!made_bufferdata_ptr) // need to fallback to malloc at original size
{ {
GST_BUFFER_SIZE(newbuf) = width * height * MAXDEPTHHACK; GST_BUFFER_SIZE(newbuf) = width * height * MAXDEPTHHACK;
...@@ -393,8 +395,6 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ...@@ -393,8 +395,6 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
llgst_buffer_set_caps (GST_BUFFER_CAST(newbuf), caps); llgst_buffer_set_caps (GST_BUFFER_CAST(newbuf), caps);
} }
GST_OBJECT_UNLOCK(slvideo);
*buf = GST_BUFFER_CAST(newbuf); *buf = GST_BUFFER_CAST(newbuf);
return GST_FLOW_OK; return GST_FLOW_OK;
...@@ -458,7 +458,7 @@ gst_slvideo_init (GstSLVideo * filter, ...@@ -458,7 +458,7 @@ gst_slvideo_init (GstSLVideo * filter,
filter->retained_frame_format = SLV_PF_UNKNOWN; filter->retained_frame_format = SLV_PF_UNKNOWN;
GstCaps *caps = llgst_caps_from_string (SLV_ALLCAPS); GstCaps *caps = llgst_caps_from_string (SLV_ALLCAPS);
llgst_caps_replace (&filter->caps, caps); llgst_caps_replace (&filter->caps, caps);
filter->resize_forced = false; filter->resize_forced_always = false;
filter->resize_try_width = -1; filter->resize_try_width = -1;
filter->resize_try_height = -1; filter->resize_try_height = -1;
GST_OBJECT_UNLOCK(filter); GST_OBJECT_UNLOCK(filter);
...@@ -499,7 +499,7 @@ gst_slvideo_get_property (GObject * object, guint prop_id, ...@@ -499,7 +499,7 @@ gst_slvideo_get_property (GObject * object, guint prop_id,
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
DEBUGMSG("\n\n\nPLUGIN INIT\n\n\n"); DEBUGMSG("PLUGIN INIT");
GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin", GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin",
0, (gchar*)"Second Life Video Sink"); 0, (gchar*)"Second Life Video Sink");
...@@ -527,7 +527,7 @@ void gst_slvideo_init_class (void) ...@@ -527,7 +527,7 @@ void gst_slvideo_init_class (void)
"http://www.secondlife.com/"); "http://www.secondlife.com/");
#undef PACKAGE #undef PACKAGE
ll_gst_plugin_register_static (&gst_plugin_desc); ll_gst_plugin_register_static (&gst_plugin_desc);
DEBUGMSG("\n\n\nCLASS INIT\n\n\n"); DEBUGMSG("CLASS INIT");
} }
#endif // LL_GSTREAMER010_ENABLED #endif // LL_GSTREAMER010_ENABLED
...@@ -90,7 +90,7 @@ struct _GstSLVideo ...@@ -90,7 +90,7 @@ struct _GstSLVideo
int retained_frame_width, retained_frame_height; int retained_frame_width, retained_frame_height;
SLVPixelFormat retained_frame_format; SLVPixelFormat retained_frame_format;
// sticky resize info // sticky resize info
bool resize_forced; bool resize_forced_always;
int resize_try_width; int resize_try_width;
int resize_try_height; int resize_try_height;
}; };
......
...@@ -477,9 +477,8 @@ MediaPluginGStreamer010::update(int milliseconds) ...@@ -477,9 +477,8 @@ MediaPluginGStreamer010::update(int milliseconds)
mCurrentWidth <= mWidth && mCurrentWidth <= mWidth &&
!mTextureSegmentName.empty()) !mTextureSegmentName.empty())
{ {
// we're gonna totally consume this frame - reset 'ready' flag // we're gonna totally consume this frame - reset 'ready' flag
mVideoSink->retained_frame_ready = FALSE; mVideoSink->retained_frame_ready = FALSE;
int destination_rowbytes = mWidth * mDepth; int destination_rowbytes = mWidth * mDepth;
for (int row=0; row<mCurrentHeight; ++row) for (int row=0; row<mCurrentHeight; ++row)
{ {
...@@ -865,7 +864,7 @@ MediaPluginGStreamer010::sizeChanged() ...@@ -865,7 +864,7 @@ MediaPluginGStreamer010::sizeChanged()
message.setValue("name", mTextureSegmentName); message.setValue("name", mTextureSegmentName);
message.setValueS32("width", mNaturalWidth); message.setValueS32("width", mNaturalWidth);
message.setValueS32("height", mNaturalHeight); message.setValueS32("height", mNaturalHeight);
DEBUGMSG("<--- Sending size change request to application with name: '%s' - size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight); DEBUGMSG("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight);
sendMessage(message); sendMessage(message);
} }
...@@ -1000,7 +999,6 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) ...@@ -1000,7 +999,6 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string)
INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress);
mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); mSharedSegments.insert(SharedSegmentMap::value_type(name, info));
} }
else if(message_name == "shm_remove") else if(message_name == "shm_remove")
{ {
...@@ -1079,7 +1077,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) ...@@ -1079,7 +1077,7 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string)
INFOMSG("**** = REAL RESIZE REQUEST FROM APP"); INFOMSG("**** = REAL RESIZE REQUEST FROM APP");
GST_OBJECT_LOCK(mVideoSink); GST_OBJECT_LOCK(mVideoSink);
mVideoSink->resize_forced = true; mVideoSink->resize_forced_always = true;
mVideoSink->resize_try_width = texture_width; mVideoSink->resize_try_width = texture_width;
mVideoSink->resize_try_height = texture_height; mVideoSink->resize_try_height = texture_height;
GST_OBJECT_UNLOCK(mVideoSink); GST_OBJECT_UNLOCK(mVideoSink);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment