program exit at the end of the video or after calling libvlc_media_player_stop
Posted: 07 Jan 2016 17:11
Hi all,
I'm using vlc-3.0.0 for reading video frames into memory. The problem is the program exists when I call libvlc_media_player_stop function or it reaches to the end of the video. I'm on windows 7 and using Visual Studio 2012. Also using nightly build vlc-3.0.0-git-20151221-0002-win32-debug.zip to test.
Here is my main.cpp:
And this is the output of the program if it helps:
What am i missing?
Thanks in advance.
I'm using vlc-3.0.0 for reading video frames into memory. The problem is the program exists when I call libvlc_media_player_stop function or it reaches to the end of the video. I'm on windows 7 and using Visual Studio 2012. Also using nightly build vlc-3.0.0-git-20151221-0002-win32-debug.zip to test.
Here is my main.cpp:
Code: Select all
#include <vlc/vlc.h>
#include <string>
#include <iostream>
static unsigned char* buffer = new unsigned char[1024*1024*3];
static void cbVideoPrerenderDispatcher(void *p_video_data, unsigned char **pp_pixel_buffer, int size)
{
*pp_pixel_buffer = buffer;
}
static void cbVideoPostrenderDispatcher(void *p_video_data, unsigned char *p_pixel_buffer, int width, int height, int pixel_pitch, int size, long long pts)
{
}
int main()
{
libvlc_media_player_t *mMedia_player;
libvlc_media_t *media;
libvlc_instance_t *vlcInstance;
void *pUserData = 0;
char *mVideoSource = "xylophone.mp4"; // size is 320x240
char *vcodecStr = "I420";
// VLC options
char smem_options[1000];
char* timeSyncStr = "time-sync";
sprintf(smem_options
, "#transcode{vcodec=%s,acodec=s16l}:smem{"
"video-prerender-callback=%lld,"
"video-postrender-callback=%lld,"
"audio-prerender-callback=%lld,"
"audio-postrender-callback=%lld,"
"audio-data=%lld,"
"video-data=%lld,"
"%s},"
, vcodecStr
, (long long int)(intptr_t)(void*)&cbVideoPrerenderDispatcher
, (long long int)(intptr_t)(void*)&cbVideoPostrenderDispatcher
, (long long int)(intptr_t)(void*)0
, (long long int)(intptr_t)(void*)0
, (long long int)(intptr_t)0 //This would normally be useful data, 100 is just test data
, (long long int)(intptr_t)0 //Test data
, timeSyncStr);
const char * const vlc_args[] = {
"-I", "dummy", // Don't use any interface
"--ignore-config", // Don't use VLC's config
//"--extraintf=logger", // Log anything
"--verbose=0", // Be verbose
"--sout", smem_options // Stream to memory
};
// We launch VLC
vlcInstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
mMedia_player = libvlc_media_player_new(vlcInstance);
media = libvlc_media_new_path(vlcInstance, mVideoSource);
libvlc_media_player_set_media(mMedia_player, media);
libvlc_media_release(media);
libvlc_release(vlcInstance);
libvlc_media_player_play(mMedia_player);
int counter = 0;
while(true)
{
if(++counter == 10)
libvlc_media_player_stop(mMedia_player);
_sleep(40);
}
}
Code: Select all
core libvlc debug: VLC media player - 3.0.0-git-20151221-0002 Vetinari
core libvlc debug: Copyright © 1996-2015 the VideoLAN team
core libvlc debug: revision 2.2.0-git-5758-g0358127
core libvlc debug: 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-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=i686-w64-mingw32' '--enable-debug' 'host_alias=i686-w64-mingw32'
core libvlc debug: using multimedia timers as clock source
core libvlc debug: min period: 1 ms, max period: 1000000 ms
core libvlc debug: searching plug-in modules
core libvlc debug: loading plugins cache file D:\apps\VLC\vlc-3.0.0\plugins\plugins.dat
core libvlc warning: cannot read D:\apps\VLC\vlc-3.0.0\plugins\plugins.dat: No such file or directory
core libvlc debug: recursively browsing `D:\apps\VLC\vlc-3.0.0\plugins'
core libvlc debug: plug-ins loaded: 436 modules
core logger debug: looking for logger module matching "any": 2 candidates
core logger debug: using logger module "console"
core libvlc debug: translation test: code is "C"
core libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU
core generic debug: creating audio output
core audio output debug: looking for audio output module matching "any": 6 candidates
mmdevice audio output debug: using default device
mmdevice audio output debug: version 2 session control unavailable
mmdevice audio output debug: display name changed: VLC media player (LibVLC 3.0.0-git-20151221-0002)
mmdevice audio output debug: volume from -65.250000 dB to +0.000000 dB with 0.031250 dB increments
core audio output debug: using audio output module "mmdevice"
core generic debug: keeping audio output
core input debug: Creating an input for 'xylophone.mp4'
core stream output debug: using sout chain=`transcode{vcodec=I420,acodec=s16l}:smem{video-prerender-callback=18236016,video-postrender-callback=18235968,audio-prerender-callback=0,audio-postrender-callback=0,audio-data=0,video-data=0,time-sync},'
core stream output debug: stream=`smem'
core stream out debug: looking for sout stream module matching "smem": 22 candidates
core stream out debug: set config option: sout-smem-video-prerender-callback to 18236016
core stream out debug: set config option: sout-smem-video-postrender-callback to 18235968
core stream out debug: set config option: sout-smem-audio-prerender-callback to 0
core stream out debug: set config option: sout-smem-audio-postrender-callback to 0
core stream out debug: set config option: sout-smem-audio-data to 0
core stream out debug: set config option: sout-smem-video-data to 0
core stream out debug: set config option: sout-smem-time-sync to (null)
core stream out debug: using sout stream module "smem"
core stream output debug: stream=`transcode'
core stream out debug: looking for sout stream module matching "transcode": 22 candidates
core stream out debug: set config option: sout-transcode-vcodec to I420
core stream out debug: set config option: sout-transcode-acodec to s16l
stream_out_transcode stream out debug: Checking codec mapping for s16l got s16l
stream_out_transcode stream out debug: codec audio=s16l 0Hz 0 channels 96Kb/s
stream_out_transcode stream out debug: Checking video codec mapping for I420 got I420
stream_out_transcode stream out debug: codec video=I420 0x0 scaling: 0.000000 0kb/s
core stream out debug: using sout stream module "stream_out_transcode"
core input debug: using timeshift granularity of 50 MiB
core input debug: using timeshift path: C:\Users\GTANIS~1.MST\AppData\Local\Temp
core input debug: `file:///D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4' gives access `file' demux `' path `/D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4'
core input source debug: specified demux: any
core input source debug: creating demux: access='file' demux='any' location='/D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4' file='D:\projeler\denemeler\libvlctest\ConsoleApplication1\xylophone.mp4'
core demux debug: looking for access_demux module matching "file": 13 candidates
core demux debug: no access_demux modules matched
core access debug: creating access: file:///D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4
core access debug: (path: D:\projeler\denemeler\libvlctest\ConsoleApplication1\xylophone.mp4)
core access debug: looking for access module matching "file": 25 candidates
core access debug: using access module "filesystem"
core stream debug: looking for stream_filter module matching "prefetch,cache_read": 7 candidates
cache_read stream debug: Using stream method for AStream*
cache_read stream debug: starting pre-buffering
cache_read stream debug: received first data after 1 ms
cache_read stream debug: pre-buffering done 1024 bytes in 0s - 999 KiB/s
core stream debug: using stream_filter module "cache_read"
core stream debug: looking for stream_filter module matching "any": 7 candidates
core stream debug: no stream_filter modules matched
core stream debug: looking for stream_filter module matching "record": 7 candidates
core stream debug: using stream_filter module "record"
core input source debug: creating demux: access='file' demux='any' location='/D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4' file='D:\projeler\denemeler\libvlctest\ConsoleApplication1\xylophone.mp4'
core demux debug: looking for demux module matching "mp4": 68 candidates
mp4 stream debug: read box: "mvhd" creation 694977d-48h:00m:00s modification 694977d-48h:00m:00s time scale 30000 duration 0d-00h:00m:04s rate 1.000000 volume 1.000000 next track id 2
mp4 stream debug: read box: "tkhd" creation 694977d-48h:00m:00s modification 694977d-48h:00m:00s duration 1d-39h:10m:00s track ID 1 layer 0 volume 0.000000 rotation 0.000000 scaleX 1.000000 scaleY 1.000000 translateX 0.000000 translateY 0.000000 width 320.000000 height 240.000000. Matrix: 65536 0 0 0 65536 0 0 0 1073741824
mp4 stream debug: read box: "mdhd" creation 694977d-48h:00m:00s modification 694977d-48h:00m:00s time scale 30000 duration 1d-39h:10m:00s language
mp4 stream debug: read box: "hdlr" handler type: "vide" name: "VideoHandler"
mp4 stream debug: read box: "vmhd" graphics-mode 0 opcolor (0, 0, 0)
mp4 stream debug: read box: "url" url: (null)
mp4 stream debug: read box: "dref" entry-count 1
mp4 stream debug: read box: "avcC" version=1 profile=0x4d level=0xd length size=4 sps=1 pps=1
mp4 stream debug: - sps[0] length=11
mp4 stream debug: - pps[0] length=4
mp4 stream debug: read box: "vide" in stsd 320x240 depth 24 (AVC Coding)
mp4 stream debug: read box: "stsd" entry-count 1
mp4 stream debug: read box: "stts" entry-count 1
mp4 stream debug: read box: "stsc" entry-count 1
mp4 stream debug: read box: "stsz" sample-size 0 sample-count 141
mp4 stream debug: read box: "co64" entry-count 1
mp4 stream debug: read box: "stss" entry-count 2
mp4 stream debug: read box: "hdlr" handler type: "mdir" name: "(null)"
mp4 demux debug: unrecognized major media specification (mp42).
mp4 demux debug: added fragment moov
mp4 stream debug: dumping root Box "root"
mp4 stream debug: | + ftyp size 24 offset 0
mp4 stream debug: | + mdat size 473925 offset 24
mp4 stream debug: | + moov size 1256 offset 473949
mp4 stream debug: | | + mvhd size 108 offset 473957
mp4 stream debug: | | + trak size 1072 offset 474065
mp4 stream debug: | | | + tkhd size 92 offset 474073
mp4 stream debug: | | | + mdia size 972 offset 474165
mp4 stream debug: | | | | + mdhd size 32 offset 474173
mp4 stream debug: | | | | + hdlr size 44 offset 474205
mp4 stream debug: | | | | + minf size 888 offset 474249
mp4 stream debug: | | | | | + vmhd size 20 offset 474257
mp4 stream debug: | | | | | + dinf size 36 offset 474277
mp4 stream debug: | | | | | | + dref size 28 offset 474285
mp4 stream debug: | | | | | | | + url size 12 offset 474301
mp4 stream debug: | | | | | + stbl size 824 offset 474313
mp4 stream debug: | | | | | | + stsd size 136 offset 474321
mp4 stream debug: | | | | | | | + avc1 size 120 offset 474337
mp4 stream debug: | | | | | | | | + avcC size 34 offset 474423
mp4 stream debug: | | | | | | + stts size 24 offset 474457
mp4 stream debug: | | | | | | + stsc size 28 offset 474481
mp4 stream debug: | | | | | | + stsz size 584 offset 474509
mp4 stream debug: | | | | | | + stco size 20 offset 475093
mp4 stream debug: | | | | | | + stss size 24 offset 475113
mp4 stream debug: | | + udta size 68 offset 475137
mp4 stream debug: | | | + meta size 52 offset 475145
mp4 stream debug: | | | | + hdlr size 32 offset 475157
mp4 demux debug: found 1 tracks
mp4 demux debug: track[Id 0x1] read 1 chunk
mp4 demux warning: STTS table of 1 entries
mp4 demux debug: track[Id 0x1] read 141 samples length:4s
core input debug: selecting program id=0
mp4 demux debug: adding track[Id 0x1] video (enable) language undef
fragments demux debug: fragment offset 473949, data 32<->473949 @0, durations (null)
core demux debug: using demux module "mp4"
mp4 demux warning: control query 3 unimplemented
mp4 demux warning: control query 2 unimplemented
core input debug: looking for a subtitle file in D:\projeler\denemeler\libvlctest\ConsoleApplication1\
core decoder debug: looking for packetizer module matching "any": 23 candidates
h264 decoder debug: found NAL_SPS (sps_id=0)
h264 decoder debug: found NAL_PPS (pps_id=0 sps_id=0)
h264 decoder debug: Packetizer fed with AVC, nal length size=4
core decoder debug: using packetizer module "h264"
core input debug: starting in async mode
core demux meta debug: looking for meta reader module matching "any": 2 candidates
lua demux meta debug: Trying Lua scripts in C:\Users\gtanisik.MSTNET\AppData\Roaming\vlc\lua\meta\reader
lua demux meta debug: Trying Lua scripts in D:\apps\VLC\vlc-3.0.0\lua\meta\reader
lua demux meta debug: Trying Lua playlist script D:\apps\VLC\vlc-3.0.0\lua\meta\reader\filename.luac
lua demux meta warning: Error loading script D:\apps\VLC\vlc-3.0.0\lua\meta\reader\filename.luac: D:\apps\VLC\vlc-3.0.0\lua\meta\reader\filename.luac: bad header in precompiled chunk
core demux meta debug: no meta reader modules matched
core input debug: `file:///D:/projeler/denemeler/libvlctest/ConsoleApplication1/xylophone.mp4' successfully opened
mp4 demux debug: track[Id 0x1] using Sync Sample Box (stss)
mp4 demux debug: stss gives 0 --> 0 (sample number)
core input debug: Buffering 0%
core input debug: switching to sync mode
core input debug: Buffering 11%
core input debug: Buffering 22%
core stream output debug: adding a new sout input (sout_input: 02c54d48)
stream_out_transcode stream out debug: creating video transcoding from fcc=`h264' to fcc=`I420'
core generic debug: looking for decoder module matching "any": 44 candidates
core input debug: Buffering 33%
core input debug: Buffering 44%
core input debug: Buffering 55%
core input debug: Buffering 66%
core input debug: Buffering 77%
core input debug: Buffering 88%
core input debug: Buffering 100%
core input debug: Stream buffering done (333 ms in 2 ms)
avcodec generic debug: CPU flags: 0x010053db
avcodec generic debug: allowing 4 thread(s) for decoding
avcodec generic debug: codec (h264) started
avcodec generic debug: using frame thread mode with 4 threads
core generic debug: using decoder module "avcodec"
core encoder debug: looking for encoder module matching "any": 22 candidates
avcodec encoder debug: CPU flags: 0x010053db
avcodec encoder debug: Time base for probing setted to 1/1000000
avcodec encoder debug: Time base set to 1/1000000
avcodec encoder debug: found encoder Raw video
core encoder debug: using encoder module "avcodec"
core encoder debug: removing module "avcodec"
core input debug: Decoder wait done in 14 ms
avcodec generic debug: available hardware decoder output format 61 (dxva2_vld)
avcodec generic debug: available hardware decoder output format 128 (d3d11va_vld)
avcodec generic debug: available software decoder output format 0 (yuv420p)
core generic debug: looking for hw decoder module matching "any": 2 candidates
core generic debug: no hw decoder modules matched
core generic debug: looking for hw decoder module matching "any": 2 candidates
core generic debug: no hw decoder modules matched
avcodec generic warning: plane 0 not aligned: disabling direct rendering
stream_out_transcode stream out debug: decoder aspect is 1.240310:1
stream_out_transcode stream out debug: source pixel aspect is 0.930233:1
stream_out_transcode stream out debug: scaled pixel aspect is 0.930233:1
stream_out_transcode stream out debug: source 320x240, destination 320x240
stream_out_transcode stream out debug: source fps 30/1, destination 30/1
stream_out_transcode stream out debug: encoder aspect is 320:258
stream_out_transcode stream out debug: destination (after video filters) 320x258
core encoder debug: looking for encoder module matching "any": 22 candidates
avcodec encoder debug: CPU flags: 0x010053db
avcodec encoder debug: Time base for probing setted to 1/30
avcodec encoder debug: Time base set to 1/30
avcodec encoder debug: found encoder Raw video
core encoder debug: using encoder module "avcodec"
The thread 0x21b8 has exited with code 0 (0x0).
core decoder debug: killing decoder fourcc `h264', 0 PES in FIFO
core decoder debug: removing module "h264"
core stream output debug: removing a sout input (sout_input: 02c54d48)
The thread 0x157c has exited with code 3 (0x3).
The thread 0x17f4 has exited with code 3 (0x3).
The thread 0xef0 has exited with code 3 (0x3).
The thread 0x15b4 has exited with code 3 (0x3).
The thread 0x1008 has exited with code 3 (0x3).
The thread 0x1ff8 has exited with code 3 (0x3).
The thread 0x16b8 has exited with code 3 (0x3).
The thread 0x1664 has exited with code 3 (0x3).
The thread 0x1474 has exited with code 3 (0x3).
The thread 0x1f94 has exited with code 3 (0x3).
The thread 0x1ddc has exited with code 3 (0x3).
The program '[6332] ConsoleApplication1.exe' has exited with code 3 (0x3).
Thanks in advance.