AppSrcTest.java pipeline problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

AppSrcTest.java pipeline problem

morrisford
I am modifying AppSrc.Test.java to change the example code to output to a tcp port. I run the app and it hits NEED_DATA a couple of times and stops.

Apparently, there are errors somewhere but nothing is output by the program. How do I track down the errors?

Here is the program at the moment:

Many thanks,
Morris


public class AppSrcTest
    {
   
    /** Creates a new instance of AppSrcTest */
    public AppSrcTest()
        {
        }
    private static Pipeline pipeline;
    static TagList tags;
    public static void main(String[] args)
        {

        args = Gst.init("AppSrcTest", args);
        final int width = 320, height = 200;
        /* setup pipeline */
        pipeline = new Pipeline("pipeline");
        final AppSrc appsrc = (AppSrc) ElementFactory.make("appsrc", "source");
        final Element srcfilter = ElementFactory.make("capsfilter", "srcfilter");

        Caps fltcaps = new Caps("video/x-raw-rgb, framerate=4/1"
                + ", width=" + width + ", height=" + height
//                + ", bpp=16, depth=16");
                + ", bpp=32, depth=24, endianness=4321, red_mask=(int)0xFF, green_mask=(int)0xFF00, blue_mask=(int)0xFF0000");
        srcfilter.setCaps(fltcaps);

        final Element colorspace = ElementFactory.make("ffmpegcolorspace", "ffmpegcolorspace");

        final Element enc = ElementFactory.make("ffenc_mpeg4", "ffenc_mpeg4");

        final Element gdppay = ElementFactory.make("gdppay", "gdppay");

        final Element tcp = ElementFactory.make("tcpserversink", "tcpserversink");
        tcp.set("port", 3000);

        pipeline.addMany(appsrc, srcfilter, colorspace, enc, gdppay, tcp);
        Element.linkMany(appsrc, srcfilter, colorspace, enc, gdppay, tcp);
        appsrc.set("emit-signals", true);
        appsrc.setLive(true);
        appsrc.connect(new AppSrc.NEED_DATA()
            {
            byte color = 0;
            byte[] data = new byte[width * height * 4];
            public void needData(Element elem, int size, Pointer userData)
                {
                System.out.println("Enter needData - buffer = " + data.length);
                System.out.println("NEED_DATA: Element=" + elem.getNativeAddress()
                                + " size=" + size + " color=" + color);
                color++;
                for(int i = 0; i < width * height * 4; i += 4)
                    {
                    data[i] = 0;         // blue
                    data[i + 1] = 0;     // green
                    data[i + 2] = color; // red
                    data[i + 3] = 0;
                    }
                Buffer buffer = new Buffer(data.length);
                buffer.getByteBuffer().put(data);
                appsrc.pushBuffer(buffer);
                }
            });
        appsrc.connect(new AppSrc.ENOUGH_DATA()
            {
            public void enoughData(Element elem, Pointer userData)
                {
                System.out.println("Enter enoughData");
                }
            });
        pipeline.setState(State.PLAYING);
        }
    }



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