Playbin video scaling

soumendra satapathy soumendra.satapathy at gmail.com
Mon Oct 10 02:41:36 PDT 2011


OK i learnt that i have to use the videoscale element and then add the caps
filter after that to specify the size but still i am facing issue :( ... It
is not resizing as per the value ...

#include <gst/gst.h>
#include <stdbool.h>

static GMainLoop *loop;

static void player(const char *uri)
{
GstElement *playbin,*filter,*pipeline,*videoscale;
 GstCaps *caps;
loop = g_main_loop_new(NULL, FALSE);

pipeline = gst_pipeline_new ("pipeline");
 videoscale = gst_element_factory_make ("videoscale", NULL);

playbin = gst_element_factory_make("playbin", "player");


filter = gst_element_factory_make ("capsfilter", "filter");


caps = gst_caps_from_string("video/x-raw-yuv, format=I420, width=200,
height=100");



g_object_set ((GObject*) filter, "caps", caps, NULL);
 // g_object_set (G_OBJECT (videoscale), "width", SCALE_WIDTH, NULL);
// g_object_set (G_OBJECT (videoscale), "height", SCALE_HEIGHT, NULL);


if (uri)
g_object_set(G_OBJECT(playbin), "uri", uri,NULL);

gst_bin_add_many(GST_BIN (pipeline),playbin,videoscale,filter,NULL);
 gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);

g_main_loop_run(loop);

gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
gst_object_unref(GST_OBJECT(caps));
 gst_object_unref(GST_OBJECT(pipeline));
}

int main(int argc, char *argv[])
{
gst_init(&argc, &argv);
 player(argv[1]);
return 0;
}

Any help is highly appreciated ..

Rgds,
Som
On Mon, Oct 10, 2011 at 12:36 PM, soumendra satapathy <
soumendra.satapathy at gmail.com> wrote:

> Hi,
>
>
> I have a small issue I am using the "playbin" element in my media-player
> app.
>
> No w i wish to have control over the scale of my video, basically achieve
> the same funcationality as "videoscale".
>
> How do i do it ??
>
>
> Please find the code below:
>
> #include <gst/gst.h>
> #include <stdbool.h>
>
> static GMainLoop *loop;
>
> static void player(const char *uri)
> {
>         GstElement *playbin,*videosink, *audiosink,*flt;
>
>         loop = g_main_loop_new(NULL, FALSE);
>         playbin = gst_element_factory_make("playbin", "player");
>         videosink = gst_element_factory_make ("xvimagesink", "video-sink");
>         audiosink = gst_element_factory_make ("alsasink", "audio-sink");
>
>
>         if (uri){
>
> g_object_set(G_OBJECT(videosink),"force-aspect-ratio",FALSE,NULL);
>                    g_object_set(G_OBJECT(playbin), "uri",
> uri,"audio-sink",audiosink,"video-sink", videosink,NULL);
>
>                 }
>
>
>
>
>         gst_element_set_state(GST_ELEMENT(playbin), GST_STATE_PLAYING);
>
>         g_main_loop_run(loop);
>
>         gst_element_set_state(GST_ELEMENT(playbin), GST_STATE_NULL);
>         gst_object_unref(GST_OBJECT(playbin));
> }
>
> int main(int argc, char *argv[])
> {
>         gst_init(&argc, &argv);
>         player(argv[1]);
>         return 0;
> }
>
>
>
> I am kinda stuck .. any insight will be of real help.
> Regards
>
> --
> follow me @ http://twitter.com/soum1
>



-- 
follow me @ http://twitter.com/soum1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111010/8a27d9aa/attachment.htm>


More information about the gstreamer-devel mailing list