static void clutter_vlc_video_texture_dispose(GObject* object) { ClutterVlcVideoTexture* self; ClutterVlcVideoTexturePrivate* priv; self = CLUTTER_VLC_VIDEO_TEXTURE(object); priv = self->priv; if (priv->vlc_media_player != NULL) { libvlc_media_player_stop(priv->vlc_media_player, &priv->vlc_exception); clutter_vlc_catch(&priv->vlc_exception); libvlc_media_player_release(priv->vlc_media_player); priv->vlc_media_player = NULL; g_source_remove(priv->tick_timeout_id); priv->tick_timeout_id = 0; } if (priv->vlc_instance != NULL) { libvlc_release(priv->vlc_instance); priv->vlc_instance = NULL; } G_OBJECT_CLASS(clutter_vlc_video_texture_parent_class)->dispose(object); }
static void _file_close(struct _App *app) { app->playing = 0; if (app->opening) goto release_resources; if (libvlc_media_player_get_state(app->mp) != libvlc_Playing) { _send_file_closed(app); return; } app->closing = 1; release_resources: libvlc_media_player_stop(app->mp); if (app->filename) free(app->filename); if (app->mp) { libvlc_media_release(app->m); libvlc_media_player_release(app->mp); free(app->tmpbuffer); } }
void VlcVideoWidget::StatusPoller() { if (statusAccess.tryLock()) { if (status.doStop) { Stop(); libvlc_media_player_release(vlcPlayer_); status.doStop = false; } else if (status.doRestart && !status.playing) { RestartPlayback(); status.doRestart = false; } // Emit a status update if there is one if (status.change != PlayerStatus::NoChange) { emit StatusUpdate(status); status.change = PlayerStatus::NoChange; } statusAccess.unlock(); } }
VideoWindow::~VideoWindow() { if (!init) return; // we didn't initialise properly so all bets are off #if (defined Q_OS_LINUX) && (QT_VERSION < 0x050000) && (defined GC_VIDEO_VLC) // unembed vlc backend first x11Container->discardClient(); #endif stopPlayback(); #ifdef GC_VIDEO_VLC // VLC /* No need to keep the media now */ if (m) libvlc_media_release (m); /* nor the player */ libvlc_media_player_release (mp); // unload vlc libvlc_release (inst); #endif #ifdef GC_VIDEO_QT5 // QT MEDIA delete mp; delete wd; #endif }
VLCVideoWidgetDelegator:: ~VLCVideoWidgetDelegator(){ //may run on the main thread if( m_widgetInstance != Nullptr ){ delete m_widgetInstance; } if( m_player != Nullptr ){ if( m_isPlaying ){ libvlc_media_player_stop ( m_player ); } } if( m_currentMedia != Nullptr ){ libvlc_media_release( m_currentMedia ); } if( m_player != Nullptr ){ /* Free the media_player */ libvlc_media_player_release (m_player); } if( m_instance != Nullptr ){ libvlc_release (m_instance); } }
VideoSource::~VideoSource() { // media list and media list player libvlc_media_list_player_stop(mediaListPlayer); libvlc_media_list_player_release(mediaListPlayer); libvlc_media_list_release(mediaList); // media player libvlc_video_set_callbacks(mediaPlayer, nullptr, nullptr, nullptr, nullptr); libvlc_media_player_stop(mediaPlayer); delete audioOutputStreamHandler; audioOutputStreamHandler = nullptr; libvlc_media_player_release(mediaPlayer); if (pixelData) { free(pixelData); pixelData = nullptr; } if (texture) { delete texture; texture = nullptr; } delete config; config = nullptr; DeleteCriticalSection(&textureLock); }
void Java_org_videolan_libvlc_MediaPlayer_nativeRelease(JNIEnv *env, jobject thiz) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return; /* TODO: REMOVE */ libvlc_event_manager_t *ev = libvlc_media_player_event_manager(p_obj->u.p_mp); static const libvlc_event_type_t mp_events[] = { libvlc_MediaPlayerPlaying, libvlc_MediaPlayerPaused, libvlc_MediaPlayerEndReached, libvlc_MediaPlayerStopped, libvlc_MediaPlayerVout, libvlc_MediaPlayerPositionChanged, libvlc_MediaPlayerTimeChanged, libvlc_MediaPlayerEncounteredError, libvlc_MediaPlayerESAdded, libvlc_MediaPlayerESDeleted, }; for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++) libvlc_event_detach(ev, mp_events[i], vlc_event_callback, NULL); libvlc_media_player_release(p_obj->u.p_mp); VLCJniObject_release(env, thiz, p_obj); }
CReportCameraWorker::~CReportCameraWorker() { m_Thread.WaitStopThread(); CloseHandle(m_hStartCaptureEvent); CloseHandle(m_hStopCaptureEvent); m_Client = NULL; // clear vlc StopCapture(); if (m_m) { libvlc_media_release (m_m); m_m = NULL; } if (m_mp) { libvlc_media_player_stop (m_mp); libvlc_media_player_release (m_mp); m_mp = NULL; } if (m_inst) { libvlc_release(m_inst); m_inst = NULL; } }
void SoundPlay::inputFile(char* input_name) { libvlc_instance_t *inst; libvlc_media_player_t *mp; libvlc_media_t *m; // load the vlc engine inst = libvlc_new(0, NULL); // create a new item m = libvlc_media_new_path(inst, input_name); // create a media play playing environment mp = libvlc_media_player_new_from_media(m); // no need to keep the media now libvlc_media_release(m); // play the media_player libvlc_media_player_play(mp); sleep(2); // stop playing libvlc_media_player_stop(mp); // free the media_player libvlc_media_player_release(mp); libvlc_release(inst); }
static void xmr_player_dispose(GObject *object) { XmrPlayer *player = XMR_PLAYER(object); XmrPlayerPrivate *priv = player->priv; libvlc_event_manager_t *event_mgr; gint i; event_mgr = libvlc_media_player_event_manager(priv->player); for (i = 0; i < g_vlc_event_count; ++i) libvlc_event_detach(event_mgr, g_vlc_events[i], vlc_event_callback, player); if (priv->event_idle_id != 0) { g_source_remove (priv->event_idle_id); priv->event_idle_id = 0; } if (priv->event_queue) { g_async_queue_unref(priv->event_queue); priv->event_queue = NULL; } libvlc_media_player_release(priv->player); libvlc_release(priv->instance); G_OBJECT_CLASS(xmr_player_parent_class)->dispose(object); }
void VlcVideoWidget::ShutDown() { if (vlcPlayer_ && vlcInstance_) { /** @bug @todo These should not be here and is not actually doing anything. Take a fresh look at the threading in this object and remove these hacks. */ if (onScreenPixmapMutex_.tryLock(50)) onScreenPixmapMutex_.unlock(); if (renderPixmapMutex_.tryLock(50)) renderPixmapMutex_.unlock(); if (statusAccess.tryLock(50)) statusAccess.unlock(); libvlc_media_release(vlcMedia_); libvlc_media_player_stop(vlcPlayer_); libvlc_media_player_release(vlcPlayer_); libvlc_release(vlcInstance_); vlcMedia_ = 0; vlcPlayer_ = 0; vlcInstance_ = 0; close(); } }
static void releaseMediaPlayer(JNIEnv *env, jobject thiz) { libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz); if (p_mp) { libvlc_media_player_stop(p_mp); libvlc_media_player_release(p_mp); setLong(env, thiz, "mInternalMediaPlayerInstance", 0); } }
int main(int argc, char* argv[]) { const char * const vlc_args[] = { "-I", "dummy", /* Don't use any interface */ "--ignore-config", /* Don't use VLC's config */ "--plugin-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx" }; libvlc_exception_t ex; libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *m; libvlc_exception_init (&ex); /* init vlc modules, should be done only once */ inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex); raise (&ex); /* Create a new item */ m = libvlc_media_new (inst, "http://mycool.movie.com/test.mov", &ex); raise (&ex); /* XXX: demo art and meta information fetching */ /* Create a media player playing environement */ mp = libvlc_media_player_new_from_media (m, &ex); raise (&ex); /* No need to keep the media now */ libvlc_media_release (m); #if 0 /* This is a non working code that show how to hooks into a window, * if we have a window around */ libvlc_drawable_t drawable = xdrawable; /* or on windows */ libvlc_drawable_t drawable = hwnd; libvlc_media_player_set_drawable (mp, drawable, &ex); raise (&ex); #endif /* play the media_player */ libvlc_media_player_play (mp, &ex); raise (&ex); sleep (10); /* Let it play a bit */ /* Stop playing */ #warning There is known deadlock bug here. Please update to LibVLC 1.1! libvlc_media_player_stop (mp, &ex); /* Free the media_player */ libvlc_media_player_release (mp); libvlc_release (inst); raise (&ex); return 0; }
void CAVPlayer::Stop() { if (m_pVLC_Player) { libvlc_media_player_stop (m_pVLC_Player); /* Stop playing */ libvlc_media_player_release (m_pVLC_Player); /* Free the media_player */ m_pVLC_Player = NULL; } }
VideoPlayer::~VideoPlayer() { if ( _status!=INVALID ) { libvlc_media_player_stop( _vlcPlayer ); libvlc_media_player_release( _vlcPlayer ); } libvlc_release( _vlc ); }
void VLCMainwindow::stop() { if(vlcPlayer) { libvlc_media_player_stop(vlcPlayer); libvlc_media_player_release(vlcPlayer); slider->setValue(0); playBut->setText("Play"); } vlcPlayer = NULL; }
VlcMediaPlayer::~VlcMediaPlayer() { delete _check; delete _vlcAudio; delete _vlcVideo; libvlc_media_player_release(_vlcMediaPlayer); }
NPlaybackEngineVlc::~NPlaybackEngineVlc() { if (!m_init) return; stop(); libvlc_media_player_release(m_mediaPlayer); libvlc_release(m_vlcInstance); }
VlcMediaWidget::~VlcMediaWidget() { if (vlcMediaPlayer != NULL) { libvlc_media_player_release(vlcMediaPlayer); } if (vlcInstance != NULL) { libvlc_release(vlcInstance); } }
void LiveWidget::closeApplication(const CloseApplicationEvent& event) { stopStream(this->deviceName, this->deviceChannel); libvlc_media_player_release(this->vlcMediaPlayer); libvlc_release(this->vlcInstance); this->vlcMediaPlayer = NULL; this->vlcInstance = NULL; }
VlcControl::~VlcControl() { setlog("VlcControl destructor " + QString().sprintf("%08p", this)); stop(); libvlc_media_player_release(vlcPlayer); if(vlcMedia) { libvlc_media_release(vlcMedia); } }
Player::~Player() { /* Stop playing */ libvlc_media_player_stop (mediaPlayer); /* Free the media_player */ libvlc_media_player_release (mediaPlayer); libvlc_release (vlcInstance); }
static void releaseMediaPlayer(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) { libvlc_media_player_stop(mp); libvlc_media_player_release(mp); unsetMediaPlayer(env, thiz); } }
int libvlc_stop(int nameId) { CHECK_NAMEID(nameId); is_used[nameId] = 0; libvlc_media_player_stop(soundPlay[nameId]); libvlc_media_player_release(soundPlay[nameId]); libvlc_media_release(soundMedia[nameId]); libvlc_release(soundInst[nameId]); return 0; }
VideoStream::~VideoStream() { libvlc_media_player_stop(vlcMediaPlayer_); libvlc_media_player_release(vlcMediaPlayer_); libvlc_release(vlcInstance_); if(gui_) { gui_->deleteTexture(guiVideoTexture_); } }
VlcMediaPlayer::~VlcMediaPlayer() { removeCoreConnections(); delete _vlcAudio; delete _vlcVideo; libvlc_media_player_release(_vlcMediaPlayer); VlcError::errmsg(); }
void QtVLCWidget::stop() { if (m_mp) { libvlc_media_player_release(m_mp); m_mp = nullptr; } if (m_media) { libvlc_media_release(m_media); m_media = nullptr; } }
static void gtk_vlc_player_finalize(GObject *gobject) { GtkVlcPlayer *player = GTK_VLC_PLAYER(gobject); libvlc_media_player_release(player->priv->media_player); libvlc_release(player->priv->vlc_inst); /* Chain up to the parent class */ G_OBJECT_CLASS(gtk_vlc_player_parent_class)->finalize(gobject); }
//desctructor Player::~Player() { /* Stop playing */ libvlc_media_player_stop (_mp); //libvlc_media_player_stop (_mp, &_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. /* Free the media_player */ libvlc_media_player_release (_mp); libvlc_release (_vlcinstance); //raise (&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. }
int main(int argc, const char **argv) { const char *in; char *out, *out_with_ext; int width; pthread_condattr_t attr; libvlc_instance_t *libvlc; libvlc_media_player_t *mp; libvlc_media_t *m; /* mandatory to support UTF-8 filenames (provided the locale is well set)*/ setlocale(LC_ALL, ""); cmdline(argc, argv, &in, &out, &out_with_ext, &width); pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&wait, &attr); pthread_condattr_destroy(&attr); /* starts vlc */ libvlc = create_libvlc(); assert(libvlc); m = libvlc_media_new_path(libvlc, in); assert(m); mp = libvlc_media_player_new_from_media(m); assert(mp); libvlc_media_player_play(mp); /* takes snapshot */ set_position(mp); snapshot(mp, width, out_with_ext); libvlc_media_player_stop(mp); /* clean up */ if (out != out_with_ext) { rename(out_with_ext, out); free(out_with_ext); } free(out); libvlc_media_player_release(mp); libvlc_media_release(m); libvlc_release(libvlc); pthread_cond_destroy(&wait); return 0; }