How to modify imxg2dcompositor sink_x::alpha in c-code

cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify imxg2dcompositor sink_x::alpha in c-code

Jump to solution
366 Views
adorable
Contributor III

I used the imxg2dcompositor  in my c-code such as bellows:

imxg2dcompositor name=c background-color=0x223344 \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=400 sink_0::height=300 sink_0::alpha=0.5 sink_0::fill_color=0x00000000 \
sink_1::xpos=400 sink_1::ypos=0 sink_1::width=400 sink_1::height=300 sink_1::alpha=0.5 sink_1::fill_color=0x11111111 \
sink_2::xpos=200 sink_4::ypos=150 sink_4::width=400 sink_4::height=300 sink_2::alpha=0.5 sink_4::fill_color=0x44444444 sink_4::alpha=0.5 ! \
queue2 ! video/x-raw, width=800, height=600 ! imxg2dvideosink \
videotestsrc pattern=2 ! queue2 ! c.sink_0 \
videotestsrc pattern=1 ! queue2 ! c.sink_1 \
videotestsrc pattern=0 ! queue2 ! c.sink_2

I want to modifyed the sink_x::alpha when the pipeline is playing...

How should I do ? such as g_object_set();

0 Kudos
1 Solution
349 Views
adorable
Contributor III

下面的代码C是OK的。

GstElement *sink = gst_bin_get_by_name(GST_BIN(app->src), "c");
GstPad *pad = gst_element_get_static_pad(sink, "sink_0");
g_object_set(pad, "alpha", 0.5, NULL);
gst_object_unref(sink);

View solution in original post

0 Kudos
4 Replies
350 Views
adorable
Contributor III

下面的代码C是OK的。

GstElement *sink = gst_bin_get_by_name(GST_BIN(app->src), "c");
GstPad *pad = gst_element_get_static_pad(sink, "sink_0");
g_object_set(pad, "alpha", 0.5, NULL);
gst_object_unref(sink);

0 Kudos
360 Views
Qmiller
NXP Employee
NXP Employee

Hi

 

源代码地址:https://github.com/Freescale/gstreamer-imx/blob/master/src/compositor/compositor.c

初始化时设置alpha:

 

static void gst_imx_video_compositor_pad_init(GstImxVideoCompositorPad *compositor_pad)
{
	memset(&(compositor_pad->canvas), 0, sizeof(GstImxCanvas));
	compositor_pad->canvas.inner_rotation = DEFAULT_PAD_ROTATION;
	compositor_pad->canvas.keep_aspect_ratio = DEFAULT_PAD_KEEP_ASPECT_RATIO;
	compositor_pad->canvas.fill_color = DEFAULT_PAD_FILL_COLOR;
	compositor_pad->canvas_needs_update = TRUE;
	compositor_pad->alpha = DEFAULT_PAD_ALPHA;
	compositor_pad->xpos = DEFAULT_PAD_XPOS;
	compositor_pad->ypos = DEFAULT_PAD_YPOS;
	compositor_pad->width = DEFAULT_PAD_WIDTH;
	compositor_pad->height = DEFAULT_PAD_HEIGHT;
	compositor_pad->input_crop = DEFAULT_PAD_INPUT_CROP;
	compositor_pad->last_frame_with_cropdata = FALSE;
	compositor_pad->pad_is_new = TRUE;
}

 

 

下面代码有一句:g_value_set_double(value, compositor_pad->alpha);

 

你搜一下关键词alpha就知道源码的实现了

 

BR

Zhiming

0 Kudos
355 Views
adorable
Contributor III
你好。我知道源码实现是有get与set imxg2dcompositor的parent熟悉,sinkx::alpha作为parent熟悉里面定义的,这里面是元件的源码。我想在gstreamer-API层面操作imxg2dcompositor 的sinkx::alpha,应该如何来操作?调用哪个gstreamer-api接口?
0 Kudos
353 Views
Qmiller
NXP Employee
NXP Employee

Hi

 

https://gstreamer.freedesktop.org/documentation/compositor/index.html?gi-language=c

 

individual parameters for each input stream can be configured on the GstCompositorPad:

0 Kudos