emitting AppSrc.ENOUGH_DATA signal

Andrea König andrea.koenig at gmatic.de
Tue Mar 22 05:51:24 PDT 2011


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110322/811d73ec/attachment.htm>


More information about the gstreamer-devel mailing list