Categories
c

vlc 源码分析

(13条消息) VLC源码分析知识总结_c_m_deng的博客-CSDN博客

(13条消息) vlc源码分析–issue (未完待续)_王二の黄金时代的博客-CSDN博客

VLM

VLM: VideoLAN (Media) Manager

VLM is a little media manager originally designed to launch multiple
streams with only one VLC.

example

/// This file is included in libVLC main page in the doxygen documentation.

//! [minimal example]
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <unistd.h>
#include <vlc/vlc.h>

int main(int argc, char* argv[])
{
    libvlc_instance_t * inst;
    libvlc_media_player_t *mp;
    libvlc_media_t *m;

    /* Load the VLC engine */
    inst = libvlc_new (0, NULL);//创建lbvlc 实例对象


    /* Create a new item */
    m = libvlc_media_new_location("http://mycool.movie.com/test.mov");
    //创建vlc播放媒体对象
    //m = libvlc_media_new_path("/path/to/test.mov");


    /* Create a media player playing environement */
    mp = libvlc_media_player_new_from_media (inst, m);

   //创建vlc播放器对象

    /* No need to keep the media now */
    libvlc_media_release (m);

    /* play the media_player */
    libvlc_media_player_play (mp);

     //执行播放器播放

    while (libvlc_media_player_is_playing(mp))
    { 

       //循环读取播放状态
        sleep (1);
        int64_t milliseconds = libvlc_media_player_get_time(mp);
        int64_t seconds = milliseconds / 1000;
        int64_t minutes = seconds / 60;
        milliseconds -= seconds * 1000;
        seconds -= minutes * 60;

        printf("Current time: %" PRId64 ":%" PRId64 ":%" PRId64 "\n",
               minutes, seconds, milliseconds);
    }

    /* Stop playing */
    libvlc_media_player_stop_async (mp);

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

    libvlc_release (inst);

    return 0;
}
//! [minimal example]

源码解析

Leave a Reply