libvlc_media_player stop doesn't kill sout
Posted: 08 Oct 2010 12:13
Hi,
I'm trying to save a DVB-T channel directly in an avi file.
Here is the command that works in a term :
When closing vlc, the avi file is correctly formed and perfectly readable.
Now what i'm trying to do is to do the same thing directly with libvlc.
This code doesn't work properly when it comes to stop the player, (the avi file is not closed properly).
After a little research in VLC code, I found that input_resource_TerminateSout wasn't called with libvlc_media_player_stop.
However this function is called when stopping a playlist.
I have VLC 1.1.4.
So what am i doing wrong ?
I'm trying to save a DVB-T channel directly in an avi file.
Here is the command that works in a term :
Code: Select all
vlc -vvv dvb:// :ts-es-id-pid :dvb-frequency=XXXXX :program=XX ":sout=#duplicate{dst=display,dst=std{dst=XXX.avi,mux=avi,access=file},select='program=XX'}"
Now what i'm trying to do is to do the same thing directly with libvlc.
Code: Select all
#include <vlc/libvlc.h>
#include <vlc/libvlc_media.h>
#include <vlc/libvlc_media_player.h>
#include <stdlib.h>
int main()
{
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=2"}; //be much more verbose then normal for debugging purpose
libvlc_instance_t* instance1 = libvlc_new (5, vlc_args);
libvlc_media_player_t * player = libvlc_media_player_new (instance1);
libvlc_media_t* media = libvlc_media_new_location(instance1, "dvb://");
libvlc_media_add_option(media, "dvb-frequency=XXXXX");
libvlc_media_add_option(media, "ts-es-id-pid");
libvlc_media_add_option(media, "program=XX");
libvlc_media_add_option(media, "sout=#duplicate{dst=display,dst=std{dst=XXX,mux=avi,access=file},select='program=XX'}");
libvlc_media_player_set_media(player,media);
libvlc_media_player_play(player);
sleep(50);
libvlc_media_player_stop(player);
}
After a little research in VLC code, I found that input_resource_TerminateSout wasn't called with libvlc_media_player_stop.
However this function is called when stopping a playlist.
I have VLC 1.1.4.
So what am i doing wrong ?