你好:请问 infoadas 元件为啥不发送 “pad-added” 信号。我的代码如下:
#include <gst/gst.h>
/* Structure to contain all our information, so we can pass it to callbacks */
typedef struct _panorama{
GstElement *left_queue;
GstElement *right_queue;
GstElement *front_queue;
GstElement *back_queue;
GstElement *left_waylandsink;
GstElement *right_waylandsink;
GstElement *front_waylandsink;
GstElement *back_waylandsink;
//
GstElement *infoadas_360;
GstElement *infoadas_360_queue;
GstElement *stitch_waylandsink;
//
GstElement *pipeline;
}CustomData;
/* Handler for the pad-added signal */
static void pad_added_handler (GstElement *src, GstPad *pad, CustomData *data);
int main(int argc, char *argv[]) {
CustomData data;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
gboolean terminate = FALSE;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Create the elements */
data.left_queue = gst_element_factory_make ("queue", "left_queue");
data.right_queue = gst_element_factory_make ("queue", "right_queue");
data.front_queue = gst_element_factory_make ("queue", "front_queue");
data.back_queue = gst_element_factory_make ("queue", "back_queue");
data.left_waylandsink = gst_element_factory_make ("waylandsink", "left_waylandsink");
data.right_waylandsink = gst_element_factory_make ("waylandsink", "right_waylandsink");
data.front_waylandsink = gst_element_factory_make ("waylandsink", "front_waylandsink");
data.back_waylandsink = gst_element_factory_make ("waylandsink", "back_waylandsink");
data.infoadas_360 = gst_element_factory_make ("infoadas", "infoadas_360");
data.infoadas_360_queue = gst_element_factory_make ("queue", "infoadas_360_queue");
data.stitch_waylandsink = gst_element_factory_make ("waylandsink", "stitch_waylandsink");
/* Create the empty pipeline */
data.pipeline = gst_pipeline_new ("test-pipeline");
if (!data.left_queue || !data.right_queue || !data.front_queue || !data.back_queue) {
g_printerr ("left…queue: Not all elements could be created.\n");
return -1; } if (!data.left_waylandsink || !data.right_waylandsink || !data.front_waylandsink || !data.back_waylandsink) {
g_printerr ("left…waylandsink: Not all elements could be created.\n");
return -1; }
if (!data.infoadas_360 || !data.infoadas_360_queue || !data.stitch_waylandsink) {
g_printerr ("infoadas…: Not all elements could be created.\n");
return -1; }
gst_bin_add_many (GST_BIN (data.pipeline), data.infoadas_360, data.infoadas_360_queue, data.stitch_waylandsink,
data.left_queue, data.left_waylandsink,
data.right_queue, data.right_waylandsink,
data.front_queue, data.front_waylandsink, data.back_queue, data.back_waylandsink, NULL);
if ( gst_element_link_many(data.infoadas_360_queue, data.stitch_waylandsink, NULL) != TRUE || gst_element_link_many(data.left_queue, data.left_waylandsink, NULL) != TRUE || gst_element_link_many(data.right_queue, data.right_waylandsink, NULL) != TRUE ||
gst_element_link_many(data.front_queue, data.front_waylandsink, NULL) != TRUE ||
gst_element_link_many(data.back_queue, data.back_waylandsink, NULL) != TRUE) {
g_printerr ("360 could not be linked.\n");
gst_object_unref (data.pipeline);
return -1;
}
g_object_set(data.stitch_waylandsink, "sync", FALSE, "use-drm", TRUE, NULL);
g_object_set(data.left_waylandsink, "sync", FALSE, "use-drm", TRUE, NULL);
g_object_set(data.right_waylandsink, "sync", FALSE, "use-drm", TRUE, NULL); g_object_set(data.front_waylandsink, "sync", FALSE, "use-drm", TRUE, NULL);
g_object_set(data.back_waylandsink, "sync", FALSE, "use-drm", TRUE, NULL); g_object_set(data.infoadas_360, "chain", "lvds-srv-3d-880×1080", NULL); //lvds-srv-3d-880×1080
// Element Signals:
// "pad-added" : void user_function (GstElement* object,
// GstPad* arg0,
// gpointer user_data);
g_signal_connect (data.infoadas_360, "pad-added", G_CALLBACK (pad_added_handler), &data);
/* Start playing */
ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (data.pipeline);
return -1;
}
/* Listen to the bus */
bus = gst_element_get_bus (data.pipeline);
do {
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Parse message */
if (msg != NULL) {
GError *err;
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &err, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
g_clear_error (&err);
g_free (debug_info);
terminate = TRUE;
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
terminate = TRUE;
break;
case GST_MESSAGE_STATE_CHANGED:
/* We are only interested in state-changed messages from the pipeline */
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data.pipeline)) {
GstState old_state, new_state, pending_state;
gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);
g_print ("Pipeline state changed from %s to %s:\n",
gst_element_state_get_name (old_state), gst_element_state_get_name (new_state));
}
break;
default:
/* We should not reach here */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
} while (!terminate);
/* Free resources */
gst_object_unref (bus);
gst_element_set_state (data.pipeline, GST_STATE_NULL);
gst_object_unref (data.pipeline);
return 0;
}
/* This function will be called by the pad-added signal */
static void pad_added_handler (GstElement *src, GstPad *new_pad, CustomData *data) {
GstPad *sink_pad = gst_element_get_static_pad (data->infoadas_360_queue, "sink");
GstPadLinkReturn ret;
GstCaps *new_pad_caps = NULL;
GstStructure *new_pad_struct = NULL;
const gchar *new_pad_type = NULL;
g_print ("Received new pad '%s' from '%s':\n", GST_PAD_NAME (new_pad), GST_ELEMENT_NAME (src));
/* If our converter is already linked, we have nothing to do here */
if (gst_pad_is_linked (sink_pad)) {
g_print ("We are already linked. Ignoring.\n");
goto exit;
}
/* Check the new pad's type */
new_pad_caps = gst_pad_get_current_caps (new_pad);
new_pad_struct = gst_caps_get_structure (new_pad_caps, 0);
new_pad_type = gst_structure_get_name (new_pad_struct);
if (!g_str_has_prefix (new_pad_type, "audio/x-raw")) {
g_print ("It has type '%s' which is not raw audio. Ignoring.\n", new_pad_type);
goto exit;
}
/* Attempt the link */
ret = gst_pad_link (new_pad, sink_pad);
if (GST_PAD_LINK_FAILED (ret)) {
g_print ("Type is '%s' but link failed.\n", new_pad_type);
} else {
g_print ("Link succeeded (type '%s').\n", new_pad_type);
}
exit:
/* Unreference the new pad's caps, if we got them */
if (new_pad_caps != NULL)
gst_caps_unref (new_pad_caps);
/* Unreference the sink pad */
gst_object_unref (sink_pad);
}
hao huang:
注明:
代码中我想实现的是:
gst-launch-1.0 -e infoadas chain="lvds-srv-3d-880×1080" name=q \
q.stitched ! queue ! waylandsink use-drm=true sync=false \
q.left ! queue ! waylandsink use-drm=true sync=false \
q.right ! queue ! waylandsink use-drm=true sync=false \
q.front ! queue ! waylandsink use-drm=true sync=false \
q.back ! queue ! waylandsink use-drm=true sync=false
hao huang:
上面代码实现的是下面的pipeline:
gst-launch-1.0 -e infoadas chain="lvds-srv-3d-880×1080" name=q \q.stitched ! queue ! waylandsink use-drm=true sync=false \q.left ! queue ! waylandsink use-drm=true sync=false \q.right ! queue ! waylandsink use-drm=true sync=false \q.front ! queue ! waylandsink use-drm=true sync=false \q.back ! queue ! waylandsink use-drm=true sync=false
Shine:
回复 hao huang:
请问用的是哪款芯片?
hao huang:
回复 Shine:
DRA7*
Shine:
回复 hao huang:
抱歉,e2echina不支持DRA系列的汽车电子芯片,您可以联系TI的销售或者代理,也可以到e2e英文论坛咨询,有专门的automotive论坛。
e2e.ti.com/…/1020
hao huang:
回复 hao huang:
root@dra7xx-evm:/opt/infoadas/bin#
root@dra7xx-evm:/opt/infoadas/bin# gst-inspect-1.0 infoadas
Factory Details:Ranknone (0)Long-nameInfoADASKlassSource/Filter/Converter/VideoDescriptionElement to connect with InfoADAS frameworkAuthorPooja Prajod <poojaprajod@ti.com>Plugin Details:NameinfoadaspluginDescriptionPlugin for using Infoadas frameworkFilename/usr/lib/gstreamer-1.0/libgstinfoadas.soVersion1.6.3LicenseLGPLSource modulegst-plugins-badSource release date2016-01-20Binary packageGStreamer Bad Plug-insOrigin URLUnknown package origin
GObject+—-GInitiallyUnowned+—-GstObject+—-GstElement+—-GstInfoADAS
Pad Templates:SRC template: 'src'Availability: SometimesCapabilities:video/x-rawformat: NV12width: [ 1, 2147483647 ]height: [ 1, 2147483647 ]framerate: [ 0/1, 2147483647/1 ]video/x-rawformat: BGRAwidth: [ 1, 2147483647 ]height: [ 1, 2147483647 ]framerate: [ 0/1, 2147483647/1 ]
Element Flags:no flags set
我查看infoadas 中SRC template: 'src' 这个是不是写的有问题???