コード例 #1
0
ファイル: FBVLCAPI.cpp プロジェクト: kingctan/fbvlc
void FBVLCVideoAPI::getVideoSize( unsigned* width, unsigned* height )
{
    FBVLCPtr plg = getPlugin();
    vlc_player& p = plg->get_player();

    vlc::media media = p.current_media();
    libvlc_media_t* libvlc_media = media.libvlc_media_t();
    if( media && !media.is_parsed() )
        media.parse();

    *width = *height = 0;
    libvlc_video_get_size( p.get_mp(), 0, width, height );

    if( media && ( !*width || !*height ) ) {
        /*FIXME: It's not absolutely correct way to detect media dimensions,
        since now will be returned dimensions of first track with not zero demensions,
        and there are no any guarantee it will be be current playing track.
        But we nothing can do with it, since there are no way to match current
        playing track and track info received from libvlc_media_get_tracks_info for now.*/
        libvlc_media_track_info_t* info;
        int infoCount = libvlc_media_get_tracks_info( libvlc_media, &info );
        for( int i = 0; i < infoCount; ++i ) {
            if( libvlc_track_video == info[i].i_type &&
                info[i].u.video.i_width &&
                info[i].u.video.i_height )
            {
                *width = info[i].u.video.i_width;
                *height = info[i].u.video.i_height;
                break;
            }
        }
        libvlc_free( info );
    }
}
コード例 #2
0
ファイル: QmlVlcVideo.cpp プロジェクト: rodrigogolive/QmlVlc
void QmlVlcVideo::getVideoSize( unsigned* width, unsigned* height )
{
    libvlc_media_t* media = libvlc_media_player_get_media( m_player.get_mp() );
    if( media && !libvlc_media_is_parsed( media ) )
        libvlc_media_parse( media );

    *width = *height = 0;
    libvlc_video_get_size( m_player.get_mp(), 0, width, height );

    if( media && ( !*width || !*height ) ) {
        /*FIXME: It's not absolutely correct way to detect media dimensions,
        since now will be returned dimensions of first track with not zero demensions,
        and there are no any guarantee it will be be current playing track.
        But we nothing can do with it, since there are no way to match current
        playing track and track info received from libvlc_media_get_tracks_info for now.*/
        libvlc_media_track_info_t* info;
        int infoCount = libvlc_media_get_tracks_info( media, &info );
        for( int i = 0; i < infoCount; ++i ) {
            if( libvlc_track_video == info[i].i_type &&
                info[i].u.video.i_width &&
                info[i].u.video.i_height )
            {
                *width = info[i].u.video.i_width;
                *height = info[i].u.video.i_height;
                break;
            }
        }
        libvlc_free( info );
    }
}
コード例 #3
0
ファイル: QmlVlcVideo.cpp プロジェクト: rodrigogolive/QmlVlc
QString QmlVlcVideo::get_crop()
{
    QString crop;
    char* c = libvlc_video_get_crop_geometry( m_player.get_mp() );
    if ( c )
        crop = c;
    libvlc_free( c );

    return crop;
}
コード例 #4
0
ファイル: QmlVlcVideo.cpp プロジェクト: rodrigogolive/QmlVlc
QString QmlVlcVideo::get_aspectRatio()
{
    QString aspectRatio;
    char* ar = libvlc_video_get_aspect_ratio( m_player.get_mp() );
    if ( ar )
        aspectRatio = ar;
    libvlc_free( ar );

    return aspectRatio;
}
コード例 #5
0
ファイル: FBVLCAPI.cpp プロジェクト: kingctan/fbvlc
std::string FBVLCVideoAPI::get_crop()
{
    FBVLCPtr plg = getPlugin();
    vlc_player& p = plg->get_player();

    std::string crop;
    char* c = libvlc_video_get_crop_geometry(p.get_mp());
    if ( c )
        crop = c;
    libvlc_free(c);

    return crop;
}
コード例 #6
0
ファイル: FBVLCAPI.cpp プロジェクト: kingctan/fbvlc
std::string FBVLCVideoAPI::get_aspectRatio()
{
    FBVLCPtr plg = getPlugin();
    vlc_player& p = plg->get_player();

    std::string aspectRatio;
    char* ar = libvlc_video_get_aspect_ratio(p.get_mp());
    if ( ar )
        aspectRatio = ar;
    libvlc_free(ar);

    return aspectRatio;
}
コード例 #7
0
ファイル: FBVLC.cpp プロジェクト: zhaoxiaohui/fbvlc
void FBVLC::vlc_close()
{
    get_player().stop();

    if ( get_player().is_open() && isWindowless() ) {
        vlc::vmem::close();
    }

    if ( get_player().is_open() ) {
        VlcEvents(false);
        get_player().close();
    }

    if ( m_libvlc ) {
        libvlc_free(m_libvlc);
        m_libvlc = 0;
    }
}
コード例 #8
0
ファイル: common.hpp プロジェクト: mwgoldsmith/libvlcpp
 inline std::unique_ptr<char, void (*)(void*)> wrapCStr(char* str)
 {
     return std::unique_ptr<char, void(*)(void*)>( str, [](void* ptr) { libvlc_free(ptr); } );
 }