caps incompatiable problem
Ugly Face
xuchangxue365812 at 126.com
Tue Dec 3 03:56:48 PST 2013
Thanks for your pretty quick reply. what you say work well when I ran it on
my computer with "gst-launch" pipe . then I transform it to my android
device in c code, however, the caps problem between videorate and videoconv
came.
My code is like this:
data->pipeline = gst_pipeline_new(NULL);
data->videosrc = gst_element_factory_make("appsrc", "videosrc");
g_assert(data->videosrc);
data->capsfilter= gst_element_factory_make("capsfilter", "capsfilter");
data->queue = gst_element_factory_make("queue", "queue");
data->videorate = gst_element_factory_make("videorate", "videorate");
data->videoconv = gst_element_factory_make("ffmpegcolorspace",
"videoconv");
data->x264encoder = gst_element_factory_make("x264enc", "x264encoder");
data->rtph264pay = gst_element_factory_make("rtph264pay", "rtph264pay");
data->rtpsink = gst_element_factory_make("udpsink", "rtpsink");
data->rtcpsink = gst_element_factory_make("udpsink", "rtcpsink");
data->rtcpsrc = gst_element_factory_make("udpsrc", "rtcpsrc");
data->rtpbin = gst_element_factory_make("gstrtpbin", "rtpbin");
/*caps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "NV21",
"framerate", GST_TYPE_FRACTION, 25, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
NULL);*/
caps =
gst_caps_from_string("video/x-raw-yuv,format=\"(fourcc)NV21\",width=(int)320,height=(int)240");
if(!(data->pipeline) || !(data->videosrc) || !(data->queue) ||
!(data->videorate) || !(data->videoconv) ||
!(data->x264encoder) || !(data->rtph264pay) || !(data->rtpsink) ||
!(data->rtcpsink) ||
!(data->rtcpsrc) || !(data->rtpbin))
{
__android_log_print (ANDROID_LOG_ERROR, JNI_TAG, "Not all elements can be
created");
}
/* configure all elements*/
g_object_set(data->videosrc, "block", TRUE, "is-live", TRUE, NULL);
g_object_set(data->capsfilter, "caps", caps, NULL);
g_object_set(data->x264encoder, "byte-stream", TRUE, "bitrate",
300,"speed-preset", 2, NULL);
g_object_set(data->rtpsink, "port", rtpSendPort, "host", remoteIP, NULL);
g_object_set(data->rtcpsink, "port", rtcpSendPort, "host", remoteIP,
"sync", FALSE, "async", FALSE, NULL);
g_object_set(data->rtcpsrc, "port", rtcpRecvPort, NULL);
gst_bin_add_many(GST_BIN(data->pipeline), data->videosrc, data->capsfilter,
data->queue, data->videorate,
data->videoconv, data->x264encoder,data->rtph264pay, data->rtpsink,
data->rtcpsink, data->rtcpsrc,
data->rtpbin, NULL);
res = gst_element_link(data->videosrc, data->capsfilter);
g_assert(res);
res = gst_element_link(data->capsfilter, data->queue);
g_assert(res);
res = gst_element_link(data->queue, data->videorate);
g_assert(res);
//gst_debug_set_default_threshold(GST_LEVEL_DEBUG);
res = gst_element_link(data->videorate, data->videoconv);
g_assert(res);
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/caps-incompatiable-problem-tp4663808p4663829.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list