imem lock and rtsp help
Posted: 26 Jan 2012 02:41
Hi. I've got two issues I am hoping someone can help me with. I am using the imem functionality to encode and stream over rtsp, or at least that is what I plan to do. I am up and running, not yet filling in the buffer in the callback (just nulling it and setting size to 0 for now) but the callbacks are being called. The first problem I am having is that when I call libvlc_media_player_stop the app hangs and I am unable to get any debug information and have to kill the process to continue. The second issue is more a question, what do I need to change to get my image to be encoded to h264 and served up as an rtsp stream? Here is my function that initializes and starts the stream:
Later when this class is destroyed I call stop on the player which hangs.
Here is the vlc output:
I appreciate any help.. Thanks!
Code: Select all
std::string argStr;
argStr += " --imem-get=" + StringUtil::fromPtr(imemGetCb);
argStr += " --imem-release=" + StringUtil::fromPtr(imemReleaseCb);
argStr += " --imem-data=" + StringUtil::fromPtr(_data);
argStr += " --imem-width=" + StringUtil::fromInt(width);
argStr += " --imem-height=" + StringUtil::fromInt(height);
argStr += " -vvv";
argStr += " --verbose=2";
argStr += " --imem-id=1";
argStr += " --imem-group=1";
argStr += " --imem-cat=2";
argStr += " --imem-codec=RV32";
char ** args = NULL;
int argCount = StringUtil::stringToArgs(argStr,&args);
DATA.vlc.instance = libvlc_new(argCount, args);
StringUtil::freeArgs(&args, argCount);
debug(DBG_INFO, "vlc server instance: %p", DATA.vlc.instance);
if( !DATA.vlc.instance ) return false;
std::string outputMrl = "#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}";
outputMrl += ":rtp{sdp=rtsp://0.0.0.0:" + StringUtil::fromInt(port) + "/}";
int result = libvlc_vlm_add_broadcast(DATA.vlc.instance,
"test",
"imem://",
outputMrl.c_str(),
0, // option count
NULL, // options
TRUE, // enabled
FALSE); // loop
if( result!=0 )
{
destroy();
return false;
}
DATA.vlc.media = libvlc_media_new_location(DATA.vlc.instance, "imem://");
if( !DATA.vlc.media )
{
destroy();
return false;
}
DATA.vlc.player = libvlc_media_player_new_from_media(DATA.vlc.media);
if( !DATA.vlc.player )
{
destroy();
return false;
}
// start playing/serving
libvlc_media_player_play(DATA.vlc.player);
//libvlc_vlm_play_media(DATA.vlc.instance, "test");
Here is the vlc output:
Code: Select all
VLC media player - 1.3.0-git Rincewind
Copyright © 1996-2012 the VideoLAN team
revision 1.3.0-git-583-g0c0c1a0
configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-portaudio' '--disable-sdl' '--enable-qt4' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-sqlite' '--disable-dirac' '--host=i586-mingw32msvc' 'host_alias=i586-mingw32msvc'
searching plug-in modules
loading plugins cache file ....blah\debug\plugins\plugins.dat
recursively browsing `....blah\debug\plugins'
saving plugins cache ....blah\debug\plugins\plugins.dat
plug-ins loaded: 396 modules
translation test: code is "C"
CPU has capabilities MMX 3DNow! MMXEXT SSE SSE2 SSE3 FPU
looking for memcpy module: 4 candidates
using memcpy module "memcpymmxext"
looking for interface module: 1 candidate
using interface module "hotkeys"
Creating an input for 'imem://'
using timeshift granularity of 50 MiB, in path '....blah\Temp'
`imem://' gives access `imem' demux `' path `'
creating demux: access='imem' demux='' location='' file='(null)'
looking for access_demux module: 1 candidate
Using get(0xfb98040), release(0xfb98060), data(0x10b81a0), cookie((null))
Video RV32 640x480 SAR 0:0 frame rate 0/0
selecting program id=1
using access_demux module "access_imem"
looking for decoder module: 33 candidates
invalid frame rate 0/0, using 25 fps instead
using decoder module "rawvideo"
looking for meta reader module: 2 candidates
Trying Lua scripts in ....blah\vlc\lua\meta\reader
no meta reader module matching "any" could be loaded
`imem://' successfully opened