LibVLC::LibVLC(int argc, const char* const* argv, bool log_check ){ instance = libvlc_new(argc, argv); if(instance == NULL){ static VALUE vlcerror = rb_define_class("VLCException", rb_eStandardError); rb_raise(vlcerror, "can't create istance"); } if(log_check == true) log = libvlc_log_open(instance); else log = NULL; }
void VLCNative::startTranscoding() { DEBUG("VLCNative::startTranscoding called"); // init vlc vlc = libvlc_new(this->argc, this->argv); libvlc_set_user_agent(vlc, USER_AGENT, HTTP_USER_AGENT); // open log libvlc_set_log_verbosity(vlc, 3); log = libvlc_log_open(vlc); // register for events eventManager = libvlc_vlm_get_event_manager(vlc); libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStarted, event_handler_started, (void*)this); libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusPlaying, event_handler_status_playing, (void*)this); libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusError, event_handler_status_error, (void*)this); libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusEnd, event_handler_status_end, (void*)this); // start broadcast libvlc_vlm_add_broadcast(vlc, medianame, input, sout, 0, NULL, true, false); this->state = CREATED; DEBUG("VLCNative: created media"); // and start playing libvlc_vlm_play_media(vlc, medianame); DEBUG("VLCNative: started media") handleMessages(); }