emitting AppSrc.ENOUGH_DATA signal

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

emitting AppSrc.ENOUGH_DATA signal

Andrea König
Hi,
I want my application concat 4 strings. The strings I converted into byte arrays.

ArrayList<byte[]> lStreamingBA = new ArrayList<byte[]>();
...

((AppSrc)appsrc).connect(new AppSrc.NEED_DATA() {
            int cnt = 0;
            @Override
            public void needData(Element arg0, int arg1, Pointer arg2) {
                byte[] nextAudioData = lStreamingBA.get(cnt);
                Buffer buf = new Buffer(nextAudioData.length);
                ByteBuffer bb = buf.getByteBuffer();
                bb.clear();
                bb.put(nextAudioData);

                ((AppSrc)appsrc).pushBuffer(buf);
                cnt++;
            }
        });

I have set appsrc properties:
    ((AppSrc)appsrc).setMaxBytes(the Length Of The 4 byte Arrays In the list);

I also tried to set the block property to true. All this I done hoping the ENOUGH_DATA is called, but nothing happens. What has to be set for emitting the ENOUGH_DATA signal?

If I extend the code of needData as follows:
    ...
    ((AppSrc)appsrc).pushBuffer(buf);
    if(cnt==(lStreamingBA.size()-1)){
         System.out.println("cnt to quit " + cnt);
         Gst.quit();
         System.out.println("quitted ...");
    }
    cnt++;

   the method is called 4 times as expected. But the result only contains 3 strings the last string is missed. Can anybody explain why this happens?

-- 
Best regards
Andrea König


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