SMPEG: playing back MPG in pak-like container

hi!

i am trying to get smpeg to play back a single mpeg file which is inside a container.

the problem: SMPEG always tries to play as long as there is no EOF, you can see this by appending
an mpeg to another mpeg, and playing it back.

now when having many mpegs in a selfmade container file, smpeg theorethically would not stop until container EOF is reached.
this is of course not the wanted behaviour.

any suggestions?

(and having the mpegs outside the container is not an option!)

best regards,

— david_________________________________________________________________________
Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179

now when having many mpegs in a selfmade container file, smpeg theorethically would not stop until container EOF is reached.
this is of course not the wanted behaviour.

any suggestions?

Make a RWOPS that reports EOF when the end of the stream in the pakfile
is reached, or load the .mpg from the pakfile into memory and give SMPEG
a pointer to the memory buffer.

–ryan.

sounds good. are there any tutorials on coding with SDLRWOPs?

“A list for developers using the SDL library. (includes SDL-announce)” schrieb am 27.06.05 17:47:07:>

now when having many mpegs in a selfmade container file, smpeg theorethically would not stop until container EOF is reached.
this is of course not the wanted behaviour.

any suggestions?

Make a RWOPS that reports EOF when the end of the stream in the pakfile
is reached, or load the .mpg from the pakfile into memory and give SMPEG
a pointer to the memory buffer.

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179

sounds good. are there any tutorials on coding with SDLRWOPs?

With rwops, you basically fill in four functions: seek, close, read, and
write for your archive type (and write can just fail if this is
read-only…seek may not be used by smpeg, either), and then smpeg will
do all its i/o through those functions, which means you can make a
single file in an archive visible to the library.

Here’s how PhysicsFS (a generic archive processing library) does it:
http://svn.icculus.org/physfs/trunk/extras/physfsrwops.c?view=auto

create_rwops() sets up the structure with the function pointers; the
return value from that would be what you give to SMPEG_new_rwops(). The
other functions (physfsrwops_close(), physfsrwops_read(), etc) are the
functions that make up the rwops structure. Obviously, "PHYSFS_File"
would be a pointer to whatever data your specific archive code needs.

zziplib (another library like PhysicsFS) did something almost identical:
http://zziplib.sourceforge.net/SDL_rwops_zzip.c

Overall, it’s really just a little bit of glue code. Internally, SMPEG
uses rwops for all cases…if you give it a filename, it’ll create a
rwops that uses fread(), fclose(), etc, so you’re not really even
looking at a wildly different codepath through the library when you’re done.

Good luck,
–ryan.

thanks a lot for the help.

i will look into it.

with best regards,

—david

“A list for developers using the SDL library. (includes SDL-announce)” schrieb am 27.06.05 19:45:21:>

sounds good. are there any tutorials on coding with SDLRWOPs?

With rwops, you basically fill in four functions: seek, close, read, and
write for your archive type (and write can just fail if this is
read-only…seek may not be used by smpeg, either), and then smpeg will
do all its i/o through those functions, which means you can make a
single file in an archive visible to the library.

Here’s how PhysicsFS (a generic archive processing library) does it:
http://svn.icculus.org/physfs/trunk/extras/physfsrwops.c?view=auto

create_rwops() sets up the structure with the function pointers; the
return value from that would be what you give to SMPEG_new_rwops(). The
other functions (physfsrwops_close(), physfsrwops_read(), etc) are the
functions that make up the rwops structure. Obviously, "PHYSFS_File"
would be a pointer to whatever data your specific archive code needs.

zziplib (another library like PhysicsFS) did something almost identical:
http://zziplib.sourceforge.net/SDL_rwops_zzip.c

Overall, it’s really just a little bit of glue code. Internally, SMPEG
uses rwops for all cases…if you give it a filename, it’ll create a
rwops that uses fread(), fclose(), etc, so you’re not really even
looking at a wildly different codepath through the library when you’re done.

Good luck,
–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179