This post was updated on .
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: if (g_ascii_strncasecmp(GST_MESSAGE_SRC_NAME(msg), "sink", strlen("sink") == 0)) { 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 |
In fact, I was wrong, the second [2 Processing playbin bus message: ] above have been effective.In playbin2:: bus:: message processing code block, I have access to the prepare-window-handle message was delivered by gst_video_overlay_prepare_window_handle, which is indirect access to the glimagesink's object pointer.
But I still have some questions about how decoder is communicating with the playbin2 ? At present there is a ready-made common way? For example, before playbin2 construct filtergraph complete and ready to play, how does playbin2 know that the selected decoder is androidmedia instead of avcdec_h264? I tried to send GST_MESSAGE_ELEMENT messages in gst_amc_video_dec_init, but it seems playbin2:: bus:: message did not receive this message, why in the glimagesink to send GST_MESSAGE_ELEMENT can be captured? Regards, lucky chou |
Free forum by Nabble | Edit this page |