dcsimg
Problem cloning DataSource and CastException
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Marco_Azzalini
Posted On:   Wednesday, March 27, 2002 01:45 AM

Hi, I am writing an application that have to read some JPG frames (coming from a web cam) and transmit them in a RTP format say JPEG_RTP; at the same time, the app also have to save (possibly in a different format, say QUICKTIME/H263) the transmission in a file. At this moment, I am able to trasmit the frames through the net _OR_ save the rtp transmission but not both things at the same time. I tried to clone my ImageDataSource (a PullBufferDataSource) but every time I start the processor I got the following exception: java.lang.ClassCastException: it.belcom.media.protocol.image.ImageSourceStream at com.ibm.media.protocol.CloneableSourceStreamAdapter$PushBufferStreamSlave.   More>>

Hi, I am writing an application that have to read some JPG frames (coming
from a web cam) and transmit them in a RTP format say JPEG_RTP; at the same
time, the app also have to save (possibly in a different format, say
QUICKTIME/H263) the transmission in a file.
At this moment, I am able to trasmit the frames through the net _OR_ save the
rtp transmission but not both things at the same time.
I tried to clone my ImageDataSource (a PullBufferDataSource) but every time I
start the processor I got the following exception:


java.lang.ClassCastException:
it.belcom.media.protocol.image.ImageSourceStream at
com.ibm.media.protocol.CloneableSourceStreamAdapter$PushBufferStreamSlave.getFormat(CloneableSourceStreamAdapter.java:338)
com.sun.media.parser.RawBufferParser$FrameTrack. (RawBufferParser.java:205)
com.sun.media.parser.RawBufferParser.open(RawBufferParser.java:92)
com.sun.media.BasicSourceModule.doRealize(BasicSourceModule.java:180)


Why ??? Is my approach wrong? ImageSourceStream is the stream that goes along
with ImageDataSource and it is a PullBufferStream, note that both
ImageDataSource and ImageSourceStream are more or less entirely taken from
the "JPEGImagesToMovie" JMF-Solution sample. I suspect that
PullBufferDataSource and Clone doesn't lives together well, am I right? If
so, is it mandatory switch to a PushDataSaource or are there other
alternatives? Hoping that this can help, my program structure could be
summarized like:


  • 1) frames ---> ImageDataSource ---> cDS=Manager.createCloneableDataSource
  • 2) fileDataSource=((SourceCloneable)cDS).createClone();
  • 3) networkDataSource=((SourceCloneable)cDS).createClone();
  • 4) fileProcessor=Manager.createProcessor(fileDataSource);
  • 5) networkProcessor=Manager.createProcessor(networkDataSource);
  • 6) creates and start the two DataSinks


Any suggestion/opinion about the class cast exception and/or the whole
approach taken?

Thanks in advance,
Marco

   <<Less
About | Sitemap | Contact