I use gst_bus_post and gst_bus_poll to transfrom application message in same pipeline,but error.
zhang007z
zhang007z at gmail.com
Thu May 28 20:05:03 PDT 2015
at first I use pipeline command:
#gst-launch-0.10 videotestsrc ! queue ! cedar_h264enc ! h264parse ! queue
! vdpauh264dec ! vdpauvideopostprocess ! vdpausink
I modify gst_cedarh264enc_chain function in cedar_h264enc plugin file.
at below this code ,My main purpose: transform mutex_lock value to
vdpauh264dec plugin by gst_bus_post function. I adopt gstreamer bus message
method for implementing my purpose. using gst_structure_new and
gst_message_new_application that make mutex_lock value to message
structure,then gst_bus_post function send this message to pipeline bus .
//---------------------cedar_h264 plugin------------------------//
GstBus *bus=NULL;
GstStructure *structure=NULL;
GstMessage *message=NULL;
gboolean b_gstbuspost=FALSE;
bus=gst_element_get_bus(gst_pad_get_parent(pad));
if(bus==NULL)
g_print("zhang100 gst_cedarh264enc_chaing get bus failed\n");
structure = gst_structure_new
("h264hardware_mutex","MutexPoint",G_TYPE_UINT,(guint)g_h264hardware_mutex,
NULL);
if(structure==NULL)
g_print("zhang100 gst_cedarh264enc_chaing gst_structure_new
failed\n");
message = gst_message_new_application (NULL, structure);
if(message==NULL)
g_print("zhang100 gst_cedarh264enc_chaing
gst_message_new_application failed\n");
g_print("zhang100 gst_cedarh264enc_chain
g_h264hardware_mutex=%8x\n",(void*)g_h264hardware_mutex);
g_print("zhang100 gst_cedarh264enc_chain gst_bus_post message start\n");
b_gstbuspost=gst_bus_post (bus, message);
if(b_gstbuspost==FALSE)
g_print("zhang100 cedarh264enc_chain gst_bus_post failed\n");
g_print("zhang007 gst_cedarh264enc_chain gst_bus_post message end\n");
//-------------------------------------------------------//
I modify gst_vdp_h264_dec_handle_frame function in vdpauh264dec plugin
file.
at below this code ,at second section code My main purpose: receive mutex
lock value from cedar_h264enc plugin by gst_bus_poll function.
//----------------------vdpauh264dec plugin at below-------------------//
GstBus *bus=NULL;
guint ui_mutexpoint=0;
GstStructure *structure=NULL;
GstMessage *message=NULL;
gboolean b_ISpendingMessage=FALSE;
gboolean b_ISMyDefineMessage=FALSE;
bus=gst_element_get_bus(GST_ELEMENT(base_video_decoder));
if(bus==NULL)
g_print("zhang007z bus=gst_element_get_bus failed\n");
g_print("zhang100 gst_vdp_h264_dec_handle_frame bus=0x%08x\n",(void*)bus);
gst_bus_add_signal_watch (bus);
g_signal_connect (bus, "message", (GCallback) message_func, NULL);
b_ISpendingMessage=gst_bus_have_pending(bus);
if(b_ISpendingMessage=TRUE)
{
g_print("zhang100 gst_vdp_h264_dec_handle_frame bus YES exist pending
message\n");
}
else
{
g_print("zhang100 gst_vdp_h264_dec_handle_frame bus NO exist pending
message\n");
}
g_print("zhang100 gst_vdp_h264_dec_handle_frame wait message come up\n");
message=gst_bus_poll (bus,GST_MESSAGE_APPLICATION,GST_CLOCK_TIME_NONE);
structure = gst_message_get_structure (message);
b_ISMyDefineMessage=gst_structure_get_uint(structure,"MutexPoint",&ui_mutexpoint);
g_h264hardware_mutex=(pthread_mutex_t*)ui_mutexpoint;
g_print("zhang100 g_h264hardware_mutex=%8x",(void*)g_h264hardware_mutex);
gst_message_unref (message);
gst_bus_remove_signal_watch (bus);
//-------------------------------------------------------//
execute above my pipeline command return result :
//--------pipeline command return result at below------------------//
root at zhang100:/home/zhang100# gst-launch-0.10 videotestsrc ! queue !
cedar_h264enc ! h264parse ! queue ! vdpauh264dec ! vdpauvideopostprocess !
vdpausink
zhang100 gst_cedarh264enc_class_init g_h264hardware_mutex=b6f36000
Setting pipeline to PAUSED ...
[VDPAU SUNXI] VE version 0x1623 opened.
[VDPAU SUNXI] VE version 0x1623 opened.
Pipeline is PREROLLING ...
zhang100 gst_cedarh264_chain bus=0x018e2140
zhang100 gst_cedarh264enc_chain g_h264hardware_mutex=0xb6f36000
zhang100 gst_cedarh264enc_chain gst_bus_post message start
zhang100 gst_cedarh264enc_chain gst_bus_post message end
zhang100 gst_vdp_h264_dec_handle_frame bus=0x018e2140
zhang100 gst_vdp_h264_dec_handle_frame bus YES exist pending message
zhang100 gst_vdp_h264_dec_handle_frame wait message come up
//------------------------------------------------------//
at above returning text, returning result is always wait message to come
up.but I already have send my application message by gst_bus_post function
at cedar_h264enc plugin. why vdpauh264dec plugin don't receive this
application message by gst_bus_poll at gst_vdp_h264_dec_handle_frame
function .
Anybody have any idea for me. thank you for spending your time to my issue.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/I-use-gst-bus-post-and-gst-bus-poll-to-transfrom-application-message-in-same-pipeline-but-error-tp4672043.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list