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. <br><br>Apparently, there are errors somewhere but nothing is output by the program. How do I track down the errors?<br>
<br>Here is the program at the moment:<br><br>Many thanks,<br>Morris<br><br><br>public class AppSrcTest<br> {<br> <br> /** Creates a new instance of AppSrcTest */<br> public AppSrcTest()<br> {<br> }<br>
private static Pipeline pipeline;<br> static TagList tags;<br> public static void main(String[] args)<br> {<br><br> args = Gst.init("AppSrcTest", args);<br> final int width = 320, height = 200;<br>
/* setup pipeline */<br> pipeline = new Pipeline("pipeline");<br> final AppSrc appsrc = (AppSrc) ElementFactory.make("appsrc", "source");<br> final Element srcfilter = ElementFactory.make("capsfilter", "srcfilter");<br>
<br> Caps fltcaps = new Caps("video/x-raw-rgb, framerate=4/1"<br> + ", width=" + width + ", height=" + height<br>// + ", bpp=16, depth=16");<br>
+ ", bpp=32, depth=24, endianness=4321, red_mask=(int)0xFF, green_mask=(int)0xFF00, blue_mask=(int)0xFF0000");<br> srcfilter.setCaps(fltcaps);<br><br> final Element colorspace = ElementFactory.make("ffmpegcolorspace", "ffmpegcolorspace");<br>
<br> final Element enc = ElementFactory.make("ffenc_mpeg4", "ffenc_mpeg4");<br><br> final Element gdppay = ElementFactory.make("gdppay", "gdppay");<br><br> final Element tcp = ElementFactory.make("tcpserversink", "tcpserversink");<br>
tcp.set("port", 3000);<br><br> pipeline.addMany(appsrc, srcfilter, colorspace, enc, gdppay, tcp);<br> Element.linkMany(appsrc, srcfilter, colorspace, enc, gdppay, tcp);<br> appsrc.set("emit-signals", true);<br>
appsrc.setLive(true);<br> appsrc.connect(new AppSrc.NEED_DATA()<br> {<br> byte color = 0;<br> byte[] data = new byte[width * height * 4];<br> public void needData(Element elem, int size, Pointer userData)<br>
{<br> System.out.println("Enter needData - buffer = " + data.length);<br> System.out.println("NEED_DATA: Element=" + elem.getNativeAddress()<br> + " size=" + size + " color=" + color);<br>
color++;<br> for(int i = 0; i < width * height * 4; i += 4)<br> {<br> data[i] = 0; // blue<br> data[i + 1] = 0; // green<br>
data[i + 2] = color; // red<br> data[i + 3] = 0;<br> }<br> Buffer buffer = new Buffer(data.length);<br> buffer.getByteBuffer().put(data);<br>
appsrc.pushBuffer(buffer);<br> }<br> });<br> appsrc.connect(new AppSrc.ENOUGH_DATA()<br> {<br> public void enoughData(Element elem, Pointer userData)<br>
{<br> System.out.println("Enter enoughData");<br> }<br> });<br> pipeline.setState(State.PLAYING);<br> }<br> }<br><br><br>