September 22, 2005

Use SDL to play streaming media

Here is some information for me to do the mp3 streaming stuff. If the mp3 is ok, I will move onto video streaming work.

1. Use SDL_RWops
SDL_RWops is a wrapper for you to implement your own R/W methods. For example, if you don't want to play until you read the EOF from a file, or you want to read the streaming media from the web.

2. There are many ways to construct a SDL_RWops structure, including
a. From a file, given a filename (using SDL_RWFromFile)
b. From a file pointer (using SDL_RWFromFP)
c. From a pointer in memory (using SDL_RWFromMem)
d. Allocating and filling it in yourself (using SDL_AllocRW)

Therefore, in the SDL source code you can find the example of how to do a-c and if you want to do your streaming work, you can reference the source code of SDL. The file name is "SDL_rwops.c" and you can download it here.

3. After you have a SDL_RWops structure, you can do the video or audio playback, here are two example codes.

video tutorial

audio

4. References
a. rwops, video streaming tutorial
b. The source of audio sample playmus.c

Posted by skychaser at September 22, 2005 09:59 AM
Comments
Post a comment













Remember personal info?