예제 #1
0
파일: zsh.cpp 프로젝트: 0xheart0/vlc
int main(int argc, const char **argv)
{
    libvlc_instance_t *libvlc = libvlc_new(argc - 1, argv + 1);
    if (!libvlc)
        return 1;

    size_t modules = 0;
    module_t **mod_list;

    mod_list = module_list_get(&modules);
    if (!mod_list || modules == 0)
    {
        libvlc_release(libvlc);
        return 2;
    }

    module_t **max = &mod_list[modules];

    puts("#compdef vlc cvlc rvlc svlc mvlc qvlc nvlc\n"
           "#This file is autogenerated by zsh.cpp\n"
           "typeset -A opt_args\n"
           "local context state line ret=1\n"
           "local modules\n");

    printf("vlc_modules=\"");
    for (module_t **mod = mod_list; mod < max; mod++)
        PrintModule(*mod);
    puts("\"\n");

    puts("_arguments -S -s \\");
    for (module_t **mod = mod_list; mod < max; mod++)
        ParseModule(*mod);
    puts("  \"(--module)-p[print help on module]:print help on module:($vlc_modules)\"\\");
    puts("  \"(-p)--module[print help on module]:print help on module:($vlc_modules)\"\\");
    puts("  \"(--help)-h[print help]\"\\");
    puts("  \"(-h)--help[print help]\"\\");
    puts("  \"(--longhelp)-H[print detailed help]\"\\");
    puts("  \"(-H)--longhelp[print detailed help]\"\\");
    puts("  \"(--list)-l[print a list of available modules]\"\\");
    puts("  \"(-l)--list[print a list of available modules]\"\\");
    puts("  \"--reset-config[reset the current config to the default values]\"\\");
    puts("  \"--config[use alternate config file]\"\\");
    puts("  \"--reset-plugins-cache[resets the current plugins cache]\"\\");
    puts("  \"--version[print version information]\"\\");
    puts("  \"*:Playlist item:->mrl\" && ret=0\n");

    puts("case $state in");
    puts("  mrl)");
    puts("    _alternative 'files:file:_files' 'urls:URL:_urls' && ret=0");
    puts("  ;;");
    puts("esac\n");

    puts("return ret");

    module_list_free(mod_list);
    libvlc_release(libvlc);
    return 0;
}
예제 #2
0
파일: core.c 프로젝트: paa/vlc
static void test_core (const char ** argv, int argc)
{
    libvlc_instance_t *vlc;

    log ("Testing core\n");

    vlc = libvlc_new (argc, argv);
    assert (vlc != NULL);

    libvlc_retain (vlc);
    libvlc_release (vlc);
    libvlc_release (vlc);
}
예제 #3
0
파일: stream.c 프로젝트: 743848887/vlc
static void
stream_close( struct reader *p_reader )
{
    stream_Delete( p_reader->u.s );
    libvlc_release( p_reader->p_data );
    free( p_reader );
}
예제 #4
0
/**************************************************************************
 * Destroy a Media Instance object (libvlc internal)
 *
 * Warning: No lock held here, but hey, this is internal. Caller must lock.
 **************************************************************************/
static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
{
    assert( p_mi );

    /* Detach Callback from the main libvlc object */
    var_DelCallback( p_mi->p_libvlc,
                     "snapshot-file", snapshot_was_taken, p_mi );

    /* No need for lock_input() because no other threads knows us anymore */
    if( p_mi->input.p_thread )
        release_input_thread(p_mi, true);
    if( p_mi->input.p_resource )
    {
        input_resource_Terminate( p_mi->input.p_resource );
        input_resource_Release( p_mi->input.p_resource );
        p_mi->input.p_resource = NULL;
    }
    vlc_mutex_destroy( &p_mi->input.lock );

    libvlc_event_manager_release( p_mi->p_event_manager );
    libvlc_media_release( p_mi->p_md );
    vlc_mutex_destroy( &p_mi->object_lock );

    libvlc_instance_t *instance = p_mi->p_libvlc_instance;
    vlc_object_release( p_mi );
    libvlc_release(instance);
}
예제 #5
0
파일: CPlayer.cpp 프로젝트: saphina/iviLink
void CPlayer::release()
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    mMutex->lockWrite();
    libvlc_release(mInst);
    mMutex->unlockWrite();
}
예제 #6
0
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;
	}
}
예제 #7
0
VlcVideoPlayer::~VlcVideoPlayer()
{
	if( vlcInstance )
	{
		libvlc_release(vlcInstance); // Destroy VLC instance
	}
}
예제 #8
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);
}
예제 #9
0
파일: media_list.c 프로젝트: Geal/vlc
/**************************************************************************
 *       libvlc_media_list_release (Public)
 *
 * Release an object.
 **************************************************************************/
void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
{
    vlc_mutex_lock( &p_mlist->refcount_lock );
    p_mlist->i_refcount--;
    if( p_mlist->i_refcount > 0 )
    {
        vlc_mutex_unlock( &p_mlist->refcount_lock );
        return;
    }
    vlc_mutex_unlock( &p_mlist->refcount_lock );

    /* Refcount null, time to free */

    libvlc_event_manager_release( p_mlist->p_event_manager );

    libvlc_media_release( p_mlist->p_md );

    for ( int i = 0; i < vlc_array_count( &p_mlist->items ); i++ )
    {
        libvlc_media_t* p_md = vlc_array_item_at_index( &p_mlist->items, i );
        libvlc_media_release( p_md );
    }

    vlc_mutex_destroy( &p_mlist->object_lock );
    vlc_mutex_destroy( &p_mlist->refcount_lock );
    vlc_array_clear( &p_mlist->items );

    libvlc_release( p_mlist->p_libvlc_instance );
    free( p_mlist );
}
예제 #10
0
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
}
예제 #11
0
void CMPVlcSourceStream::Clear()
{
    LogDebug("Clear()");
    if(m_hPipe)
    {
        CloseHandle(m_hPipe);
        m_hPipe = NULL;
    }
    if(CAMThread::ThreadExists())
    {
        CAMThread::CallWorker(CMD_EXIT);
        CAMThread::Close();
    }
    if(m_vlc)
    {
        libvlc_vlm_release(m_vlc);
        libvlc_release (m_vlc);
        m_vlc = 0;
    }
    if(m_argv)
        GlobalFree(m_argv);
    if(m_options)
        CoTaskMemFree(m_options);
    m_exec = m_exec_opt = NULL;
}
예제 #12
0
    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);
      }

    }
예제 #13
0
파일: media.c 프로젝트: anonymous31173/vlc
/**************************************************************************
 * Delete a media descriptor object
 **************************************************************************/
void libvlc_media_release( libvlc_media_t *p_md )
{
    if (!p_md)
        return;

    p_md->i_refcount--;

    if( p_md->i_refcount > 0 )
        return;

    uninstall_input_item_observer( p_md );

    if( p_md->p_subitems )
        libvlc_media_list_release( p_md->p_subitems );

    vlc_gc_decref( p_md->p_input_item );

    vlc_cond_destroy( &p_md->parsed_cond );
    vlc_mutex_destroy( &p_md->parsed_lock );
    vlc_mutex_destroy( &p_md->subitems_lock );

    /* Construct the event */
    libvlc_event_t event;
    event.type = libvlc_MediaFreed;
    event.u.media_freed.md = p_md;

    /* Send the event */
    libvlc_event_send( p_md->p_event_manager, &event );

    libvlc_event_manager_release( p_md->p_event_manager );
    libvlc_release( p_md->p_libvlc_instance );
    free( p_md );
}
예제 #14
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();
    }
}
예제 #15
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);
}
예제 #16
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);
}
예제 #17
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;
}
예제 #18
0
파일: cachegen.c 프로젝트: 0xheart0/vlc
int main (int argc, char *argv[])
{
#ifdef _WIN32
    SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
#ifdef HAVE_GETOPT_H
    static const struct option opts[] =
    {
        { "help",       no_argument,       NULL, 'h' },
        { "version",    no_argument,       NULL, 'V' },
        { NULL,         no_argument,       NULL, '\0'}
    };

    int c;

    while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1)
        switch (c)
        {
            case 'h':
                usage (argv[0]);
                return 0;
            case 'V':
                version ();
                return 0;
            default:
                usage (argv[0]);
                return 1;
        }
#else
    int optind = 1;
#endif

    for (int i = optind; i < argc; i++)
    {
        const char *path = argv[i];

        if (setenv ("VLC_PLUGIN_PATH", path, 1))
            abort ();

        const char *vlc_argv[4];
        int vlc_argc = 0;

        vlc_argv[vlc_argc++] = "--quiet";
        vlc_argv[vlc_argc++] = "--reset-plugins-cache";
        vlc_argv[vlc_argc++] = "--"; /* end of options */
        vlc_argv[vlc_argc] = NULL;

        libvlc_instance_t *vlc = libvlc_new (vlc_argc, vlc_argv);
        if (vlc != NULL)
            libvlc_release (vlc);
        if (vlc == NULL)
            fprintf (stderr, "No plugins in %s\n", path);
        if (vlc == NULL)
            return 1;
    }

    return 0;
}
예제 #19
0
VideoPlayer::~VideoPlayer()
{
    if ( _status!=INVALID )
    {
        libvlc_media_player_stop( _vlcPlayer );
        libvlc_media_player_release( _vlcPlayer );
    }
    libvlc_release( _vlc );
}
예제 #20
0
Audio::~Audio()
{
    /* Release libVLC instance on quit */
    if(vlcInstance)
    {
        libvlc_release(vlcInstance);
        vlcInstance=NULL;
    }
}
예제 #21
0
NPlaybackEngineVlc::~NPlaybackEngineVlc()
{
    if (!m_init)
        return;

    stop();
    libvlc_media_player_release(m_mediaPlayer);
    libvlc_release(m_vlcInstance);
}
예제 #22
0
int main(void)
{
    ssize_t val;
    char buf[16];
    bool b;

    test_init();

    vlc = libvlc_new(0, NULL);
    assert(vlc != NULL);
    parent = VLC_OBJECT(vlc->p_libvlc_int);

    s = vlc_stream_fifo_New(parent);
    assert(s != NULL);
    val = stream_Control(s, STREAM_CAN_SEEK, &b);
    assert(val == VLC_SUCCESS && !b);
    val = stream_GetSize(s, &(uint64_t){ 0 });
    assert(val < 0);
    val = stream_Control(s, STREAM_GET_PTS_DELAY, &(int64_t){ 0 });
    assert(val == VLC_SUCCESS);
    stream_Delete(s);
    vlc_stream_fifo_Close(s);

    s = vlc_stream_fifo_New(parent);
    assert(s != NULL);
    val = vlc_stream_fifo_Write(s, "123", 3);
    vlc_stream_fifo_Close(s);
    val = stream_Read(s, buf, sizeof (buf));
    assert(val == 3);
    assert(memcmp(buf, "123", 3) == 0);
    val = stream_Read(s, buf, sizeof (buf));
    assert(val == 0);
    stream_Delete(s);

    s = vlc_stream_fifo_New(parent);
    assert(s != NULL);
    val = vlc_stream_fifo_Write(s, "Hello ", 6);
    assert(val == 6);
    val = vlc_stream_fifo_Write(s, "world!\n", 7);
    assert(val == 7);
    val = vlc_stream_fifo_Write(s, "blahblah", 8);
    assert(val == 8);

    val = stream_Read(s, buf, 13);
    assert(val == 13);
    assert(memcmp(buf, "Hello world!\n", 13) == 0);
    stream_Delete(s);

    val = vlc_stream_fifo_Write(s, "cough cough", 11);
    assert(val == -1 && errno == EPIPE);
    vlc_stream_fifo_Close(s);

    libvlc_release(vlc);

    return 0;
}
예제 #23
0
VlcMediaWidget::~VlcMediaWidget()
{
	if (vlcMediaPlayer != NULL) {
		libvlc_media_player_release(vlcMediaPlayer);
	}

	if (vlcInstance != NULL) {
		libvlc_release(vlcInstance);
	}
}
예제 #24
0
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;
}
예제 #25
0
Player::~Player()
{
    /* Stop playing */
    libvlc_media_player_stop (mediaPlayer);

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

    libvlc_release (vlcInstance);
}
예제 #26
0
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;
}
예제 #27
0
VideoStream::~VideoStream()
{
    libvlc_media_player_stop(vlcMediaPlayer_);
    libvlc_media_player_release(vlcMediaPlayer_);
    libvlc_release(vlcInstance_);

    if(gui_) {
        gui_->deleteTexture(guiVideoTexture_);
    }
}
예제 #28
0
void CAVPlayer::Release()
{
    Stop();

    if (m_pVLC_Inst)
    {
        libvlc_release (m_pVLC_Inst);
        m_pVLC_Inst   = NULL;
    }
}
예제 #29
0
void VLCNative::stopTranscoding() {
	handleMessages();
	DEBUG("VLCNative: stop transcoding");
   libvlc_vlm_stop_media(vlc, medianame);
	DEBUG("VLCNative: stopped media");
   libvlc_vlm_release(vlc);
	DEBUG("VLCNative: released vlm");
   libvlc_release(vlc);
	DEBUG("VLCNative: released libvlc");
}
예제 #30
0
파일: log.c 프로젝트: mahaserver/MHSVLC
void libvlc_log_close( libvlc_log_t *p_log, libvlc_exception_t *p_e )
{
    if( p_log && p_log->p_messages )
    {
        msg_Unsubscribe(p_log->p_instance->p_libvlc_int, p_log->p_messages);
        libvlc_release( p_log->p_instance );
        free(p_log);
    }
    else
        RAISEVOID("Invalid log object!");
}