コード例 #1
0
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);
}
コード例 #2
0
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);
     }
}
コード例 #3
0
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();
    }
}
コード例 #4
0
ファイル: VideoWindow.cpp プロジェクト: ejchet/GoldenCheetah
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
}
コード例 #5
0
ファイル: VLCVideoWidget.cpp プロジェクト: 0of/WebOS-Magna
    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);
      }

    }
コード例 #6
0
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);
}
コード例 #7
0
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);
}
コード例 #8
0
ファイル: ReportCameraWorker.cpp プロジェクト: ror13/diplom
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;
	}
}
コード例 #9
0
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);
}
コード例 #10
0
ファイル: xmrplayer.c プロジェクト: dereky7/xmradio
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);
}
コード例 #11
0
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();
    }
}
コード例 #12
0
ファイル: libvlcjni.c プロジェクト: dengzhaotai/vlc_play
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);
	}
}
コード例 #13
0
ファイル: play.c プロジェクト: columbia-irt/manhattan
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;
}
コード例 #14
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;
    }
}
コード例 #15
0
VideoPlayer::~VideoPlayer()
{
    if ( _status!=INVALID )
    {
        libvlc_media_player_stop( _vlcPlayer );
        libvlc_media_player_release( _vlcPlayer );
    }
    libvlc_release( _vlc );
}
コード例 #16
0
void VLCMainwindow::stop() {
    if(vlcPlayer) {
        libvlc_media_player_stop(vlcPlayer);
        libvlc_media_player_release(vlcPlayer);
        slider->setValue(0);
        playBut->setText("Play");
    }
    vlcPlayer = NULL;
}
コード例 #17
0
ファイル: MediaPlayer.cpp プロジェクト: Skiminok/vlc-qt
VlcMediaPlayer::~VlcMediaPlayer()
{
    delete _check;

    delete _vlcAudio;
    delete _vlcVideo;

    libvlc_media_player_release(_vlcMediaPlayer);
}
コード例 #18
0
ファイル: playbackEngineVlc.cpp プロジェクト: nulloy/nulloy
NPlaybackEngineVlc::~NPlaybackEngineVlc()
{
    if (!m_init)
        return;

    stop();
    libvlc_media_player_release(m_mediaPlayer);
    libvlc_release(m_vlcInstance);
}
コード例 #19
0
VlcMediaWidget::~VlcMediaWidget()
{
	if (vlcMediaPlayer != NULL) {
		libvlc_media_player_release(vlcMediaPlayer);
	}

	if (vlcInstance != NULL) {
		libvlc_release(vlcInstance);
	}
}
コード例 #20
0
ファイル: LiveWidget.cpp プロジェクト: IainCole/Client
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;
}
コード例 #21
0
ファイル: vlccontrol.cpp プロジェクト: Etersoft/vargus-viewer
VlcControl::~VlcControl()
{
    setlog("VlcControl destructor " + QString().sprintf("%08p", this));
    stop();
    libvlc_media_player_release(vlcPlayer);
    if(vlcMedia)
    {
        libvlc_media_release(vlcMedia);
    }
}
コード例 #22
0
ファイル: player.cpp プロジェクト: KDelli/Projet_Litchi
Player::~Player()
{
    /* Stop playing */
    libvlc_media_player_stop (mediaPlayer);

    /* Free the media_player */
    libvlc_media_player_release (mediaPlayer);

    libvlc_release (vlcInstance);
}
コード例 #23
0
ファイル: libvlcjni.c プロジェクト: erpragati/vlc-android
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);
    }
}
コード例 #24
0
ファイル: sound-libvlc.c プロジェクト: cosmo-ray/yirl
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;
}
コード例 #25
0
ファイル: VideoStream.cpp プロジェクト: wose/FloatingEye
VideoStream::~VideoStream()
{
    libvlc_media_player_stop(vlcMediaPlayer_);
    libvlc_media_player_release(vlcMediaPlayer_);
    libvlc_release(vlcInstance_);

    if(gui_) {
        gui_->deleteTexture(guiVideoTexture_);
    }
}
コード例 #26
0
ファイル: MediaPlayer.cpp プロジェクト: gunoodaddy/vlc-qt
VlcMediaPlayer::~VlcMediaPlayer()
{
    removeCoreConnections();

    delete _vlcAudio;
    delete _vlcVideo;

    libvlc_media_player_release(_vlcMediaPlayer);

    VlcError::errmsg();
}
コード例 #27
0
ファイル: qtvlcwidget.cpp プロジェクト: mstorsjo/vlc
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;
    }
}
コード例 #28
0
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);
}
コード例 #29
0
//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.
}
コード例 #30
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;
}