forwarding and rewinding audio in xuggler

…衆ロ難τιáo~ 提交于 2019-12-13 17:21:55

问题


I have used xuggler to play audio files other than wav,au,aiff. Since xuggler performs audio decoding at low level it is very hard to write a method that both forwards and rewinds the audio being played . ( while decoding xuggler analyzes each data packet and then sends it to play)

One way could be read bunch of packets at a time and then send the next packet to play.This way the effect of forwarding audio can be felt . But i don't know how to implement this method Moreover this is not the best way i can forward the data.

Are there any direct methods to forward and rewind audio ? If not direct what is the algorithm , steps to do this ?


回答1:


Have you looked at the seekKeyFrame() method in IContainer? See here. On seek, you could just flush the dataline and then on execution of the method the container should jump to the given location.

If you want to do it by a percentage call, then getDuration() gets the entire length of the stream (if available.) You can then work out accurate timestamps from there.



来源:https://stackoverflow.com/questions/6924474/forwarding-and-rewinding-audio-in-xuggler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!