I am working to get stream from file to my buffer so that i can send it via my custom port/protocol and i am facing couple of issues, so please help me out
where i am:
After reading the tutorial from https://wiki.videolan.org/Stream_to_memory_(smem)_tutorial/ I am able to compile and run
I have done following changes for
smem
options to work with video (please refer to complete code mentioned at the end)sprintf(smem_options, "#transcode{vcodec=RV32}:smem{video-postrender-callback=%lld,video-prerender-callback=%lld}", // We are using transcode because smem only support raw audio and video formats (long long int)(intptr_t)(void*)&handleStream, (long long int)(intptr_t)(void*)&prepareRender);
I can see that both prerender and postrenders are being called and data is being supplied
My Problems:
currently to test the output I am dumping the buffer directly to file, some thing like
fwrite (p_pixel_buffer, sizeof(char), i_size, myfile);
but dumped file is not being read either by VLC player or any other streaming player so I am sure I am missing here something, because if I ask VLC player to write directly to file by giving full transcode values then things are finesprintf(smem_options, "#transcode{vcodec=theo,vb=800,acodec=vorb,ab=128,channels=2,samplerate=44100}:file{dst=stream-output.ogg}" );
My Questions
- Is reading from the buffer correct? because I read
First, a quick warning: starting with VLC2.2 (current git version, to be released soon), the size parameter is a size_t. There's no API for smem (yet? hopefully this will change), which sucks, so this would silently break your application.
from Get frame from video with libvlc smem and convert it to opencv Mat. (c++)
if yes then * Is there any alternative API where i can hook and get buffer?
if not then * What's wrong with what I am doing and what do I need to do to get this done?
Any pointers/sample program would be great help.
PS:
- here is the complete code i am running https://pastebin.com/Dp8rSHuM &
- log file output https://pastebin.com/z5iVD0Jb