Page 1 of 1

LibVLC and playing a byte array in memory

Posted: 19 Dec 2010 02:32
by ddebugit
First off, I want to say "thank you" for such an amazing product.

Now, I noticed that libVLC (since 1.1.0) has:
* New memory input (imem) access and access_demux module to feed VLC from data in memory
I'm currently using v1.1.5. I've had success using the VLC API documented here to load a video file on disc (HDD) and play it. I've also implemented features of playing/pausing/stopping/changing the volume/and adding a logo to a video. I'm programming in C# (I created my own wrapper for libVLC [I couldn't find one that supported the latest release]).

I've searched for a couple of hours on some documentation for "imem". The best I got was:
Memory input
--imem-caching=<integer> Caching value in ms
Caching value for imem streams. This value should be set in
milliseconds.
--imem-get=<string> Get function
Address of the get callback function
--imem-release=<string> Release function
Address of the release callback function
--imem-cookie=<string> Callback cookie string
Text identifier for the callback functions
--imem-data=<string> Callback data
Data for the get and release functions
--imem-id=<integer> ID
Set the ID of the elementary stream
--imem-group=<integer> Group
Set the group of the elementary stream
--imem-cat={0 (Unknown), 1 (Audio), 2 (Video), 3 (Subtitle), 4 (Data)}
Category
Set the category of the elementary stream
--imem-codec=<string> Codec
Set the codec of the elementary stream
--imem-language=<string> Language
Language of the elementary stream as described by ISO639
--imem-samplerate=<integer>
Sample rate
Sample rate of an audio elementary stream
--imem-channels=<integer> Channels count
Channels count of an audio elementary stream
--imem-width=<integer> Width
Width of video or subtitle elementary streams
--imem-height=<integer> Height
Height of video or subtitle elementary streams
--imem-dar=<string> Display aspect ratio
Display aspect ratio of a video elementary stream
--imem-fps=<string> Frame rate
Frame rate of a video elementary stream
Is there any more documentation regarding this feature? Am I supposed to use these parameters with libvlc_new()? Is there a "better" way of doing this by invoking an API (if so; what is the API)?

Any help is much appreciated. Thanks!

Re: LibVLC and playing a byte array in memory

Posted: 19 Dec 2010 11:40
by Jean-Baptiste Kempf
unfortunately, the best way is to load the imem:// object like this

imem:// :imem-codec= :imem-get= etc...

Like you would load a dvd:// file

Re: LibVLC and playing a byte array in memory

Posted: 19 Dec 2010 17:47
by ddebugit
unfortunately, the best way is to load the imem:// object like this

imem:// :imem-codec= :imem-get= etc...

Like you would load a dvd:// file
Thank you very much for the quick reply.

I was using imem as command line parameters for libvlc_new(argc, argv), previously, as well as "fake://" for the URL in libvlc_media_new_location(instance, URL). It seemed to be working (I was getting callbacks on lock and unlock), however, the video was never played. I didn't quite understand the purpose of "lock" and "unlock" (e.g. what code am I supposed to have in there?). Maybe you can explain that to me. The description doesn't really tell me what needs to be there.

I will try using imem:// for use in the URL in libvlc_media_new_location(). I'll also get on IRC to see if I can get some help with this matter.

Thanks again.

Re: LibVLC and playing a byte array in memory

Posted: 05 Jan 2011 15:58
by mabarak
Where you able to use the imem?
Can you provide an example what are the arguments and the url you used?

Thanks

Re: LibVLC and playing a byte array in memory

Posted: 20 Jan 2011 11:59
by eduard
Can someone give me some points regaring this topic? I posted a related question at: viewtopic.php?f=32&t=86533&e=0