PDA

View Full Version : Imedia + Isource


Anand
08-01-2003, 03:32 AM
Hi,
There is a requirement to get the data from the socket to ISource and use that for IMEDIA_Play(). Can anyone tell, how we can identify, we read whole data from the Socket. As the ISOURCEUTIL_SourceFromSocket() returns either SUCCESS or ENOMEMORY, there is no way to find whether we read whole data from the socket or not.
While reading from the socket, in the first pass itself ISOURCEUTIL_SourceFromMemory() return SUCCESS. But when I try with ISOURCE_Read(), it returns some chunk.
So, I have coded in such a way that even the function ISOURCEUTIL_SourceFromMemory() returns SUCCESS again i am calling the callback function to read the data from the socket to source. In the second pass, the source collects data from the socket, which includes header information also. So, how I can identify whether the ISource has whole data or not.
I want to avoid buffering huge data which returns from the server (say one MP3 with size 5MB). So, I hope we can collect this entire data into ISource and then assign this to IMEDIA parameter as follows:
md.clsData = MMD_ISOURCE;
md.pData = pMe->ppias;
md.dwSize = 0;
IMEDIA_SetMediaData(pMe->m_pMedia, &md);
result = IMEDIA_Play(pMe->m_pMedia);
Please provide me an information to proceed further.

dyslexic
03-02-2004, 05:12 PM
I've been having a similar problem....I'm trying to play a qcp file from an ISource. I'm passed a stream pointer, I convert it to a source and then try to feed it into the iMedia with IMEDIA_SetMediaData. IMEDIA_SetMediaData returns a SUCCESS, but anytime I try to do something other than register a callback (GetTotalTime, or Play) it returns a EUNSUPPORTED. I'm sure the size of the source is set (although it doesn't matter) and the cls is MMD_ISOURCE.
Has anyone had any luck setting the media data with an ISource? If so...do you have some suggestions on how I might do the same or some sample code I can look at? I know the IMedia sample app uses the MMD_FILE_NAME method and I'd rather not write my source to a file.

sdg
03-03-2004, 01:52 AM
hi


you may try this... first get info about how many bytes to read and maintain a count for it.... or use a header to indicate end of file reached while downloading app. .....

sdg

brajendra.g
08-10-2006, 02:04 AM
Hi guys,
when you read data using ISource, then check the value of bytecount
-1 ISOURCE_WAIT (no data available at the moment; call Readable() to wait)
-2 ISOURCE_ERROR (error was encountered (no more data). )
0 ISOURCE_END (peer shut down connection gracefully (no more data)

i hope ur problem wil solve now.