コード例 #1
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
char *
mediacontrol_get_mrl( mediacontrol_Instance *self,
                      mediacontrol_Exception *exception )
{
    libvlc_media_t * p_media;
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    p_media = libvlc_media_player_get_media( self->p_media_player, &ex );
    HANDLE_LIBVLC_EXCEPTION_NULL( &ex );

    if ( ! p_media )
    {
        return strdup( "" );
    }
    else
    {
        char * psz_mrl;

        psz_mrl = libvlc_media_get_mrl( p_media, &ex );
        HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
        return psz_mrl;
    }
}
コード例 #2
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcPlaylistItemsNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_playlistitems_count:
            {
                int val = p_plugin->playlist_count(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #3
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcSubtitleNPObject::setProperty(int index, const NPVariant &value)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
        RETURN_ON_EXCEPTION(this,ex);

        switch( index )
        {
            case ID_subtitle_track:
            {
                if( isNumberValue(value) )
                {
                    /* set the new subtitle track to show */
                    libvlc_video_set_spu(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);

                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            }
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #4
0
ファイル: media_list_view.c プロジェクト: shanewfx/vlc-arib
static void
uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
                       libvlc_media_t * p_md)
{
    libvlc_media_list_t * p_mlist;
    libvlc_exception_t ignored_exception;
    libvlc_exception_init( &ignored_exception );
    libvlc_event_detach( p_md->p_event_manager,
                         libvlc_MediaSubItemAdded,
                         media_list_subitem_added, p_mlv, &ignored_exception );
    if( libvlc_exception_raised( &ignored_exception ) )
        libvlc_exception_clear( &ignored_exception ); /* We don't care if we encounter an exception */
    if((p_mlist = libvlc_media_subitems( p_md )))
    {
        libvlc_media_list_lock( p_mlist );
        libvlc_event_detach( p_mlist->p_event_manager,
                             libvlc_MediaListItemAdded,
                             media_list_item_added, p_mlv, NULL );
        libvlc_event_detach( p_mlist->p_event_manager,
                             libvlc_MediaListItemDeleted,
                             media_list_item_removed, p_mlv, NULL );

        int i, count = libvlc_media_list_count( p_mlist, NULL );
        for( i = 0; i < count; i++)
        {
            libvlc_media_t * p_submd;
            p_submd = libvlc_media_list_item_at_index( p_mlist,i, NULL );
            uninstall_md_listener( p_mlv, p_submd );
            libvlc_media_release( p_submd );
        }
        libvlc_media_list_unlock( p_mlist );
        libvlc_media_list_release( p_mlist );
    }
}
コード例 #5
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_audio_mute:
            {
                bool muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                BOOLEAN_TO_NPVARIANT(muted, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_volume:
            {
                int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(volume, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_track:
            {
                libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                int track = libvlc_audio_get_track(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(track, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_count:
            {
                libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                // get the number of audio track available
                int i_track = libvlc_audio_get_track_count(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                // return it
                INT32_TO_NPVARIANT(i_track, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_channel:
            {
                int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(channel, result);
                return INVOKERESULT_NO_ERROR;
            }
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #6
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;
}
コード例 #7
0
ファイル: variables.c プロジェクト: FLYKingdom/vlc
int main( void )
{
    libvlc_instance_t *p_vlc;

    test_init();

    log( "Testing the core variables\n" );
    libvlc_exception_init( &ex );
    p_vlc = libvlc_new( test_defaults_nargs, test_defaults_args, &ex );
    catch();
コード例 #8
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_audio_mute:
                if( NPVARIANT_IS_BOOLEAN(value) )
                {
                    libvlc_audio_set_mute(p_plugin->getVLC(),
                                          NPVARIANT_TO_BOOLEAN(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_volume:
                if( isNumberValue(value) )
                {
                    libvlc_audio_set_volume(p_plugin->getVLC(),
                                            numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_track:
                if( isNumberValue(value) )
                {
                    libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    libvlc_audio_set_track(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_channel:
                if( isNumberValue(value) )
                {
                    libvlc_audio_set_channel(p_plugin->getVLC(),
                                             numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #9
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
void
mediacontrol_stop( mediacontrol_Instance *self,
                   mediacontrol_Exception *exception )
{
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );
    libvlc_media_player_stop( self->p_media_player, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
}
コード例 #10
0
void
mediacontrol_set_fullscreen( mediacontrol_Instance *self,
                 const int b_fullscreen,
                 mediacontrol_Exception *exception )
{
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    libvlc_set_fullscreen( self->p_media_player, b_fullscreen, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
}
コード例 #11
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
/*
 * Known issues: since moving in the playlist using playlist_Next
 * or playlist_Prev implies starting to play items, the a_position
 * argument will be only honored for the 1st item in the list.
 *
 * XXX:FIXME split moving in the playlist and playing items two
 * different actions or make playlist_<Next|Prev> accept a time
 * value to start to play from.
 */
void
mediacontrol_start( mediacontrol_Instance *self,
                    const mediacontrol_Position * a_position,
                    mediacontrol_Exception *exception )
{
    libvlc_media_t * p_media;
    char * psz_name;
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    p_media = libvlc_media_player_get_media( self->p_media_player, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

    if ( ! p_media )
    {
        /* No media was defined. */
        RAISE( mediacontrol_PlaylistException, "No defined media." );
    }
    else
    {
        /* A media was defined. Get its mrl to reuse it, but reset the options
           (because start-time may have been set on the previous invocation */
        psz_name = libvlc_media_get_mrl( p_media, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        /* Create a new media */
        p_media = libvlc_media_new( self->p_instance, psz_name, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        if( a_position->value )
        {
            char * psz_from;
            libvlc_time_t i_from;

            /* A start position was specified. Add it to media options */
            psz_from = ( char * )malloc( 20 * sizeof( char ) );
            i_from = private_mediacontrol_position2microsecond( self->p_media_player, a_position ) / 1000000;
            snprintf( psz_from, 20, "start-time=%"PRId64, i_from );
            libvlc_media_add_option( p_media, psz_from, &ex );
            HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
        }

        libvlc_media_player_set_media( self->p_media_player, p_media, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        libvlc_media_player_play( self->p_media_player, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
    }
}
コード例 #12
0
ファイル: Transcode.cpp プロジェクト: Aang/vlmc
bool Transcode::m_doTranscode( const QString &transStr )
{
    QString sout( ":sout=" );
    sout += transStr;

    char const *vlc_argv[] = 
    {
        "-I", "dummy", 
        "--no-skip-frame",
    };

    int vlc_argc = sizeof( vlc_argv ) / sizeof( *vlc_argv );

    libvlc_exception_init( &m_vlcEx );
    
    m_libvlc = libvlc_new( vlc_argc, vlc_argv, &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) )
        return false;
    
    m_vlcMedia = libvlc_media_new( m_libvlc, m_origVidPath.toLocal8Bit(), &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;

    libvlc_media_add_option(m_vlcMedia, sout.toStdString().c_str(), &m_vlcEx);
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;

    m_vlcMp = libvlc_media_player_new_from_media( m_vlcMedia, &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) )
        return false;

    m_vlcEM = libvlc_media_player_event_manager( m_vlcMp, &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;

    libvlc_event_attach( m_vlcEM, libvlc_MediaPlayerPlaying, m_callback, this, &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;
    libvlc_event_attach( m_vlcEM, libvlc_MediaPlayerEndReached, m_callback, this,  &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;

    libvlc_media_player_play( m_vlcMp, &m_vlcEx );
    if ( catchVLCException( &m_vlcEx ) ) 
        return false;
    m_running = true;
    m_initProgressDialog();

    return true;
}
コード例 #13
0
ファイル: vlcaudioplayer.cpp プロジェクト: Toyunda/toyunda
bool	VLCAudioPlayer::init(QStringList opt)
{
	handleOption(opt);
	const char * const vlc_args[] = {
              "-I", "dummy", "-A", optionValue["ao"].toString().toStdString().c_str(), /* Don't use any interface */
             "--ignore-config", "--no-video"}; /* Don't use VLC's config */

	libvlc_event_manager_t	*em;
	libvlc_exception_init(&vlc_ex);
	inst = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &vlc_ex);
	mediaPlayer = libvlc_media_player_new(inst, &vlc_ex);
	em = libvlc_media_player_event_manager(mediaPlayer, &vlc_ex);
	return true;
}
コード例 #14
0
ファイル: VlcTagger.cpp プロジェクト: BackupTheBerlios/openmm
void
VlcTagger::handleException()
{
#if LIBVLC_VERSION_INT < 0x110
    if (libvlc_exception_raised(_pException)) {
        LOGNS(Omm::Av, upnpav, error, "vlc tagger: " + std::string(libvlc_exception_get_message(_pException)));
    }
    libvlc_exception_init(_pException);
#else
    const char* errMsg = libvlc_errmsg();
    if (errMsg) {
        LOGNS(Omm::Av, upnpav, error, "vlc tagger: " + std::string(errMsg));
    }
#endif
}
コード例 #15
0
ファイル: VlcTagger.cpp プロジェクト: BackupTheBerlios/openmm
VlcTagger::VlcTagger()
{
#if LIBVLC_VERSION_INT < 0x110
    _pException = new libvlc_exception_t;
    libvlc_exception_init(_pException);
#endif

    int argc = 1;
    const char* argv[1] = {"ommtagger"};
#if LIBVLC_VERSION_INT < 0x110
    _pVlcInstance = libvlc_new(argc, argv, _pException);
#else
    _pVlcInstance = libvlc_new(argc, argv);
#endif
}
コード例 #16
0
int
mediacontrol_get_fullscreen( mediacontrol_Instance *self,
                 mediacontrol_Exception *exception )
{
    libvlc_exception_t ex;
    int i_ret;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    i_ret = libvlc_get_fullscreen( self->p_media_player, &ex );
    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex );

    return i_ret;
}
コード例 #17
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
/* Sets the media position */
void
mediacontrol_set_media_position( mediacontrol_Instance *self,
                                 const mediacontrol_Position * a_position,
                                 mediacontrol_Exception *exception )
{
    libvlc_exception_t ex;
    int64_t i_pos;

    libvlc_exception_init( &ex );
    mediacontrol_exception_init( exception );

    i_pos = private_mediacontrol_position2microsecond( self->p_media_player, a_position );
    libvlc_media_player_set_time( self->p_media_player, i_pos / 1000, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
}
コード例 #18
0
ファイル: media_list_player.c プロジェクト: FLYKingdom/vlc
/**************************************************************************
 *       media_player_reached_end (private) (Event Callback)
 **************************************************************************/
static void
media_player_reached_end(const libvlc_event_t * p_event, void * p_user_data)
{
    VLC_UNUSED(p_event);
    libvlc_media_list_player_t * p_mlp = p_user_data;
    libvlc_exception_t e;
    libvlc_exception_init(&e);

    vlc_mutex_lock(&p_mlp->mp_callback_lock);
    if (!p_mlp->are_mp_callback_cancelled)
        set_relative_playlist_position_and_play(p_mlp, 1, &e);
    vlc_mutex_unlock(&p_mlp->mp_callback_lock);

    // There is no point in reporting an error from this callback
    libvlc_exception_clear(&e);
}
コード例 #19
0
ファイル: VLCWrapperImpl.cpp プロジェクト: swcho/TVBAgentV2
VLCWrapperImpl::VLCWrapperImpl(void)
:	m_pVLCInstance(0),
	m_pMediaPlayer(0),
	m_pMedia(0),
    m_pEvtManager(0),
    m_EH(0),
    m_EvtH(0)
{
	const char * const vlc_args[] = {
		"-I", "dummy",     // No special interface
		"--ignore-config", // Don't use VLC's config
		"--plugins-cache",
		"--no-reset-plugins-cache",
		"--plugin-path=./plugins",
#if defined(WIN32)
		"--one-instance", 
#endif
		"--ts-es-id-pid",
		"--video-on-top",
		"--vout-event=3",
		"--no-video-title-show",
		"--embedded-video",
		"--video-x=0",
		"--video-y=0",
		"--width=1", 
		"--height=1",
		"--scale=1.0",
		"--no-video-deco",
		"--video-title=VLC/VIDEO",
		"--loop",
		};

    // init the exception object.
	libvlc_exception_init (&m_VLCex);

	// init vlc modules, should be done only once
	m_pVLCInstance = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &m_VLCex);
    ProcessVLCException(&m_VLCex, m_EH);

    // Create a media player playing environement
    m_pMediaPlayer = libvlc_media_player_new(m_pVLCInstance, &m_VLCex);
    ProcessVLCException(&m_VLCex, m_EH);

    // Create an event manager for the player for handling e.g. time change events
    m_pEvtManager=libvlc_media_player_event_manager(m_pMediaPlayer, &m_VLCex);
    ProcessVLCException(&m_VLCex, m_EH);
}
コード例 #20
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
void
mediacontrol_set_mrl( mediacontrol_Instance *self,
                      const char * psz_file,
                      mediacontrol_Exception *exception )
{
    libvlc_media_t * p_media;
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    p_media = libvlc_media_new( self->p_instance, psz_file, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

    libvlc_media_player_set_media( self->p_media_player, p_media, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
}
コード例 #21
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
mediacontrol_Instance* mediacontrol_new( int argc, char** argv, mediacontrol_Exception *exception )
{
    mediacontrol_Instance* retval;
    libvlc_exception_t ex;

    libvlc_exception_init( &ex );
    mediacontrol_exception_init( exception );

    retval = ( mediacontrol_Instance* )malloc( sizeof( mediacontrol_Instance ) );
    if( !retval )
        RAISE_NULL( mediacontrol_InternalException, "Out of memory" );

    retval->p_instance = libvlc_new( argc, (const char**)argv, &ex );
    HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
    retval->p_media_player = libvlc_media_player_new( retval->p_instance, &ex );
    HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
    return retval;
}
コード例 #22
0
ファイル: vlcplugin.cpp プロジェクト: shanewfx/vlc-arib
void VlcPlugin::redrawToolbar()
{
    libvlc_exception_t ex;
    int is_playing = 0;
    bool b_mute = false;
    unsigned int dst_x, dst_y;
    GC gc;
    XGCValues gcv;
    unsigned int i_tb_width, i_tb_height;

    /* This method does nothing if toolbar is hidden. */
    if( !b_toolbar )
        return;

    const NPWindow& window = getWindow();
    Window control = getControlWindow();
    Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;

    getToolbarSize( &i_tb_width, &i_tb_height );

    libvlc_exception_init( &ex );

    /* get mute info */
    b_mute = libvlc_audio_get_mute( getVLC() );

    gcv.foreground = BlackPixel( p_display, 0 );
    gc = XCreateGC( p_display, control, GCForeground, &gcv );

    XFillRectangle( p_display, control, gc,
                    0, 0, window.width, i_tb_height );
    gcv.foreground = WhitePixel( p_display, 0 );
    XChangeGC( p_display, gc, GCForeground, &gcv );

    /* position icons */
    dst_x = BTN_SPACE;
    dst_y = i_tb_height >> 1; /* baseline = vertical middle */

    if( p_btnPause && (is_playing == 1) )
    {
        XPutImage( p_display, control, gc, p_btnPause, 0, 0, dst_x,
                   dst_y - (p_btnPause->height >> 1),
                   p_btnPause->width, p_btnPause->height );
        dst_x += BTN_SPACE + p_btnPause->width;
    }
コード例 #23
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
mediacontrol_Instance *
mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
                mediacontrol_Exception *exception )
{
    mediacontrol_Instance* retval;
    libvlc_exception_t ex;

    libvlc_exception_init( &ex );

    retval = ( mediacontrol_Instance* )malloc( sizeof( mediacontrol_Instance ) );
    if( ! retval )
    {
        RAISE_NULL( mediacontrol_InternalException, "Out of memory" );
    }
    retval->p_instance = p_instance;
    retval->p_media_player = libvlc_media_player_new( retval->p_instance, &ex );
    HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
    return retval;
}
コード例 #24
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcPlaylistNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_playlist_itemcount: /* deprecated */
            {
                int val = p_plugin->playlist_count(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_playlist_isplaying:
            {
                int val = p_plugin->playlist_isplaying(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                BOOLEAN_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_playlist_items:
            {
                // create child object in lazyman fashion to avoid
                // ownership problem with firefox
                if( ! playlistItemsObj )
                    playlistItemsObj =
                        NPN_CreateObject(_instance, RuntimeNPClass<
                        LibvlcPlaylistItemsNPObject>::getClass());
                OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj), result);
                return INVOKERESULT_NO_ERROR;
            }
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #25
0
ファイル: mediacontrol_core.c プロジェクト: mahaserver/MHSVLC
/**************************************************************************
 * Playback management
 **************************************************************************/
mediacontrol_Position*
mediacontrol_get_media_position( mediacontrol_Instance *self,
                                 const mediacontrol_PositionOrigin an_origin,
                                 const mediacontrol_PositionKey a_key,
                                 mediacontrol_Exception *exception )
{
    mediacontrol_Position* retval = NULL;
    libvlc_exception_t ex;
    int64_t pos;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    retval = ( mediacontrol_Position* )malloc( sizeof( mediacontrol_Position ) );
    retval->origin = an_origin;
    retval->key = a_key;

    if(  an_origin != mediacontrol_AbsolutePosition )
    {
        free( retval );
        /* Relative or ModuloPosition make no sense */
        RAISE_NULL( mediacontrol_PositionOriginNotSupported,
                    "Only absolute position is valid." );
    }

    /* We are asked for an AbsolutePosition. */
    pos = libvlc_media_player_get_time( self->p_media_player, &ex );

    if( a_key == mediacontrol_MediaTime )
    {
        retval->value = pos;
    }
    else
    {
        retval->value = private_mediacontrol_unit_convert( self->p_media_player,
                                                           mediacontrol_MediaTime,
                                                           a_key,
                                                           pos );
    }
    return retval;
}
コード例 #26
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
                  const NPVariant *args, uint32_t argCount, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_root_versionInfo:
                if( 0 != argCount )
                    return INVOKERESULT_NO_SUCH_METHOD;
                return invokeResultString(libvlc_get_version(),result);
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #27
0
static void
clutter_vlc_video_texture_init(ClutterVlcVideoTexture* video_texture)
{
  ClutterVlcVideoTexturePrivate* priv;
  char const * vlc_argv[] =
    {
      "--ignore-config",
      "--vout", "clutter",
    };
  int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);

  video_texture->priv = CLUTTER_VLC_VIDEO_TEXTURE_GET_PRIVATE(video_texture);
  priv = video_texture->priv;

  libvlc_exception_init(&priv->vlc_exception);
  priv->vlc_instance = libvlc_new(vlc_argc, vlc_argv, &priv->vlc_exception);
  clutter_vlc_catch(&priv->vlc_exception);

  priv->vlc_media_player = NULL;
  priv->uri = NULL;
}
コード例 #28
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcSubtitleNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
        RETURN_ON_EXCEPTION(this,ex);

        switch( index )
        {
            case ID_subtitle_track:
            {
                /* get the current subtitle ID */
                int i_spu = libvlc_video_get_spu(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                /* return it */
                INT32_TO_NPVARIANT(i_spu, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_subtitle_count:
            {
                /* get the number of subtitles available */
                int i_spu = libvlc_video_get_spu_count(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                /* return it */
                INT32_TO_NPVARIANT(i_spu, result);
                return INVOKERESULT_NO_ERROR;
            }
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #29
0
ファイル: npolibvlc.cpp プロジェクト: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args,
                                    uint32_t argCount, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_playlistitems_clear:
                if( argCount == 0 )
                {
                    p_plugin->playlist_clear(&ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    VOID_TO_NPVARIANT(result);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_NO_SUCH_METHOD;
            case ID_playlistitems_remove:
                if( (argCount == 1) && isNumberValue(args[0]) )
                {
                    p_plugin->playlist_delete_item(numberValue(args[0]),&ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    VOID_TO_NPVARIANT(result);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_NO_SUCH_METHOD;
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
コード例 #30
0
mediacontrol_RGBPicture *
mediacontrol_snapshot( mediacontrol_Instance *self,
                       const mediacontrol_Position * a_position,
                       mediacontrol_Exception *exception )
{
    (void)a_position;
    vout_thread_t* p_vout;
    input_thread_t *p_input;
    mediacontrol_RGBPicture *p_pic;
    libvlc_exception_t ex;

    libvlc_exception_init( &ex );
    mediacontrol_exception_init( exception );

    p_input = libvlc_get_input_thread( self->p_media_player );
    if( ! p_input )
    {
        RAISE_NULL( mediacontrol_InternalException, "No input" );
    }

    p_vout = input_GetVout( p_input );
    vlc_object_release( p_input );
    if( ! p_vout )
    {
        RAISE_NULL( mediacontrol_InternalException, "No video output" );
    }

    block_t *p_image;
    video_format_t fmt;

    if( vout_GetSnapshot( p_vout, &p_image, NULL, &fmt, "png", 500*1000 ) )
    {
        vlc_object_release( p_vout );
        RAISE_NULL( mediacontrol_InternalException, "Snapshot exception" );
        return NULL;
    }

    /* */
    char *p_data = malloc( p_image->i_buffer );
    if( p_data )
    {
        memcpy( p_data, p_image->p_buffer, p_image->i_buffer );
        p_pic = private_mediacontrol_createRGBPicture( fmt.i_width,
                                                       fmt.i_height,
                                                       fmt.i_chroma,
                                                       p_image->i_pts,
                                                       p_data,
                                                       p_image->i_buffer );
    }
    else
    {
        p_pic = NULL;
    }
    block_Release( p_image );

    if( !p_pic )
        RAISE_NULL( mediacontrol_InternalException, "Out of memory" );

    vlc_object_release( p_vout );
    return p_pic;
}