How to convert IEvent from IEventDispatcher to BufferedImage

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

How to convert IEvent from IEventDispatcher to BufferedImage

Gunaratnam Kuhajeyan
How to convert IEvent from IEventDispatcher to BufferedImage, I made a following attempt but seems no avail. Would recommend me correct path.

Thanks in advance





private IEventDispatcher streamEventDispatcher = new IEventDispatcher() {
       
public void dispatchEvent(IEvent event) {
       
IRTMPEvent msg =(IRTMPEvent)event;
       
if (msg instanceof VideoData) {
        LOGGER
.debug("Video data");
       
IoBuffer data = ((VideoData) msg).getData();
       
byte[] byteBufferToByteArray = SerializeUtils.ByteBufferToByteArray(data);
        LOGGER
.debug("byte buffer length : {}", byteBufferToByteArray);
       
InputStream in = new ByteArrayInputStream(byteBufferToByteArray);
   
try {
 
BufferedImage bImageFromConvert = ImageIO.read(in);
 LOGGER
.debug("bImage From convert");
 
if(bImageFromConvert != null){
 LOGGER
.debug("is good?");
 
}
 
} catch (IOException e) {
 
// TODO Auto-generated catch block
 e
.printStackTrace();
 
}


       
}
       
            LOGGER
.info("ClientStream.dispachEvent()" + event.toString());
       
}
   
};

--

---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.