How to set up glimagesink's properties before frame is displayed ?
lucky chou
shakin at outlook.com
Tue Jul 19 09:26:09 UTC 2016
I use gst-plugins-bad-1.82/gst-libs/gst/player to play media,and now there is
a change in the glimagesink. After MediaCodec decoding is complete directly
using hardware vendors's Video Display Plane to output video, that is ,
glimagesink's gst_glimage_sink_show_frame() does not need to call the
OpenGL instructions to display, just need to return GST_FLOW_OK like the
following:
-----------------------------------
static GstFlowReturn
gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
{
GstGLImageSink *glimage_sink;
glimage_sink = GST_GLIMAGE_SINK (vsink);
if (*!gl_sink->need_show_frame*) {
GST_DEBUG("need_show_frame FALSE,wo ignore each frame get to
gstglimagesink=%p", gl_sink);
return TRUE;
}
GST_TRACE ("rendering buffer:%p", buf);
GST_TRACE ("redisplay texture:%u of size:%ux%u, window size:%ux%u",
glimage_sink->next_tex, GST_VIDEO_INFO_WIDTH
(&glimage_sink->out_info),
GST_VIDEO_INFO_HEIGHT (&glimage_sink->out_info),
GST_VIDEO_SINK_WIDTH (glimage_sink),
GST_VIDEO_SINK_HEIGHT (glimage_sink));
.....
}
As the code above, I added a variable need_show_frame in the GstGLImageSink
structure,and make it as a property(PROP_NEED_SHOW_FRAME),But I don't know
how to set <need_show_frame = 0> before the first frame is displayed with
playbin,I tried the following two ways,but both did not take effect in
time(Set need_show_frame =0 before the gst_glimage_sink_show_frame function
call ...):
1)
static void
state_changed_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg,
gpointer user_data)
{
....
if (old_state == GST_STATE_READY && new_state == GST_STATE_PAUSED
&& pending_state == GST_STATE_VOID_PENDING) {
g_object_get (self->playbin, "video-sink", &video_sink, NULL);
g_object_set( video_sink,"need-show-frame",0,NULL);
}
in addition, _STATE_NULL = >_STATE_READY ,video_sink is NULL.
2)
Processing playbin bus message:
.....
g_signal_connect (G_OBJECT (bus), "message",G_CALLBACK (message_cb), self);
...
switch (GST_MESSAGE_TYPE(msg)) {
//case GST_MESSAGE_ELEMENT:
case GST_MESSAGE_NEED_CONTEXT:
g_object_set(GST_MESSAGE_SRC(msg), "need-show-frame", 0, NULL);
}
GST_MESSAGE_ELEMENT or GST_MESSAGE_NEED_CONTEXT are also displayed after the
frame will be executed.
Is there any other way of using playbin to ensure that the variables of the
GstGLImageSink structure are set before the first frame be displayed?
regards
c
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-set-up-glimagesink-s-properties-before-frame-is-displayed-tp4678745.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list