Playbin video scaling

Ashwini Sharma ak.ashwini at gmail.com
Mon Oct 10 04:29:01 PDT 2011


Ur playbin is full in its respect, i.e. it gives u full pipe from src to
sink.

How could you fit in the videoscale in that.? Just adding to the pipeline
will not help.

Your pipe will not be going to PLAY state it self.

You have to use individual elements and add them to bin and link. Then there
u can use ur scale element before the videosink.

--Ashwini

On Mon, Oct 10, 2011 at 3:11 PM, soumendra satapathy <
soumendra.satapathy at gmail.com> wrote:

> 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
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111010/ac2d4bc5/attachment.html>


More information about the gstreamer-devel mailing list