Dynamically changing resolution of visualisations
Yogesh Marwaha
yogeshm.007 at gmail.com
Sun Jul 24 08:56:40 PDT 2011
On Saturday 23 Jul 2011 20:14:17 Yogesh Marwaha wrote:
> Hi,
>
> I'm to add possibility of changing resolution of visualisation shown in my
> application (using playbin2; sparklemedia.sourceforge.net). Here are some
> points: -
I am now thinking of simplify things and allow there quality settings viz.
Low, High, and Best.
Low: Visualisations are rendered in a size 1/4 of the widget's size
High: Visualisations are rendered in a size 1/2 of the widget's size
Best: Visualisations are rendered in a size 1/1 of the widget's size
>
> (I still have not coded anything regarding subject yet, only gst-launch
> stuff)
>
> * goom, for example, provides only one caps structure on its source pad, so
> changing its width and height is sufficient; but libvisual_jakdaw provides
> three caps structures on its source pad, which one should I use or should I
> change width/height on all?
I'm thinking of following bin as visualisation: -
goom (or any other visualisation) ! ffmpegcolorspace ! capsfilter ! videoscale
I've the following working (preliminary) code (please notice the caps, advice
is needed on it): -
GstElement *newVisualisationElement =
gst_element_factory_make(visualisation.toLocal8Bit(), "visualisation1");
GstElement *newCapsfilterElement = gst_element_factory_make("capsfilter",
"visualisation2");
GstCaps *caps = gst_caps_new_simple ("video/x-raw-yuv",
"width", G_TYPE_INT, 640,
"height", G_TYPE_INT, 480,
NULL);
g_object_set(G_OBJECT(newCapsfilterElement), "caps", caps, NULL);
GstElement *newFfmpegcolorspaceElement =
gst_element_factory_make("ffmpegcolorspace", "visualisation3");
GstElement *newVideoscaleElement = gst_element_factory_make("videoscale",
"visualisation4");
if(newVisualisationElement){
m_pVisualisationBin = gst_bin_new("visualisation-bin");
gst_bin_add_many(GST_BIN(m_pVisualisationBin),
newVisualisationElement, newFfmpegcolorspaceElement, newCapsfilterElement,
newVideoscaleElement, NULL);
gst_element_link_many(newVisualisationElement,
newFfmpegcolorspaceElement, newCapsfilterElement, newVideoscaleElement, NULL);
gst_element_add_pad(m_pVisualisationBin, gst_ghost_pad_new("sink",
gst_element_get_static_pad(newVisualisationElement, "sink")));
gst_element_add_pad(m_pVisualisationBin, gst_ghost_pad_new("src",
gst_element_get_static_pad(newVideoscaleElement, "src")));
g_object_set(G_OBJECT(m_pPlayBin), "flags", PLAYBIN_FLAG_NO_VIS,
NULL);
g_object_set(G_OBJECT(m_pPlayBin), "vis-plugin", m_pVisualisationBin,
NULL);
g_object_set(G_OBJECT(m_pPlayBin), "flags", PLAYBIN_FLAG_VIS, NULL);
mCurrentVisualisation = visualisation;
return true;
}
Code is tested with xvimagesink and ximagesink with similar behaviour.
>
> * which element decides on what resolution the visualisation is run, and
> how? I suppose it to be visualisation element and some default values.
?
>
> * is there any way I can force the visualisation to render on same
> resolution as the current video output widget?
?
Regards,
Yogesh Marwaha
More information about the gstreamer-devel
mailing list