我已经为相机直播和录制同时编写了gstreamer代码.
我的管道看起来像这样:
/ [ queue1 | videosink ]
v4l2src | tee
\ [ queue2 | filesink ]
Run Code Online (Sandbox Code Playgroud)
目前,直播和文件录制都在一起工作.
现在我需要只用一个队列即queue1(实时流队列)启动管道.过了一段时间我需要添加记录队列并动态删除它.
我的工作代码如下:
pipeline = gst_pipeline_new ("rv_camera");
/*Create source element. We use mfw_v4lsrc from Freescale as source */
source= gst_element_factory_make (GSTREAMER_SOURCE,"camera-source");
g_object_set(G_OBJECT(source),"device",camDeviceName, (char *)0);
/*Set default properties of mfw_v4lsrc */
g_object_set(G_OBJECT(source),"capture-width", CAMERA_CAPTURE_WIDTH,
"capture-height", CAMERA_CAPTURE_HEIGHT,
"sensor-width", CAMERA_SENSOR_WIDTH,
"sensor-height", CAMERA_SENSOR_HEIGHT,
"preview", CAMERA_PREVIEW_DISPLAY,
"preview-width",CAMERA_PREVIEW_WIDTH,
"preview-height",CAMERA_PREVIEW_HEIGHT,
"fps-n",CAMERA_FRAMERATE,
"rotate",mirror_effect,
(char *)0);
/* Tee that copies the stream to multiple outputs */
tee = gst_element_factory_make("tee", "tee");
/* Queue creates …Run Code Online (Sandbox Code Playgroud) gstreamer ×1