Playbin video scaling

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Playbin video scaling

soumendra satapathy
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Playbin video scaling

soumendra satapathy
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 <[hidden email]> 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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Playbin video scaling

Tvrtko Ursulin
On Monday 10 Oct 2011 10:41:36 soumendra satapathy 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 ...

Two problems here - you are not connecting elements and more importantly I
don't think it makes sense to add elements behind playbin. What you need to do
is build your own video output bin and set it to playbin's video-sink
property.

To recap, instantiate a bin, add and link videoscale, capsfilter and
autovideosink, and then tell playbin to use it via it's video-sink property.

Tvrtko
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Playbin video scaling

ak.ashwini
In reply to this post by soumendra satapathy
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel