• 大小: 29.25MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-21
  • 语言: C/C++
  • 标签:

资源简介

跨平台的C++播放器 MFC播放器 VC++播放器

资源截图

代码片段和文件信息

#include “AVPlayer.h“
#include “vlc/vlc.h“
#pragma comment(lib “libvlc.lib“)
#pragma comment(lib “libvlccore.lib“)


CAVPlayer::CAVPlayer(void) :
m_pVLC_Inst(NULL)
m_pVLC_Player(NULL)
m_bOpen(false)
m_bPause(false)
m_nVolume(50)
m_nFilePos(0)
{
}

CAVPlayer::~CAVPlayer(void)
{
    Close();
}

void CAVPlayer::Init()
{
    if (! m_pVLC_Inst)
    {
        m_pVLC_Inst = libvlc_new(0 NULL);
    }
}

void CAVPlayer::Close()
{
    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;
    }

    if (m_pVLC_Inst)
    {
        libvlc_release (m_pVLC_Inst);
        m_pVLC_Inst   = NULL;
    }
}

bool CAVPlayer::Play(const std::string &strPath)
{
    if (! m_pVLC_Inst)
    {
        Init();
    }

    if(strPath.empty() || ! m_pVLC_Inst)
    {
        return false;
    }

    libvlc_media_t *m;
    m = libvlc_media_new_path(m_pVLC_Inst strPath.c_str());    /* Create a new item */ 
    m_pVLC_Player = libvlc_media_player_new_from_media(m);      /* Create a media player playing environement */     
    libvlc_media_release(m);                                    /* No need to keep the media now */
    libvlc_media_player_play(m_pVLC_Player);                    /* play the media_player */    

    return true;
}

void CAVPlayer::PlayNext()
{

}

void CAVPlayer::PlayPre()
{

}

void CAVPlayer::Stop()
{

}

void CAVPlayer::Pause()
{
    m_bPause = !m_bPause;

    if (! m_bPause) 
    {

    }
}

void CAVPlayer::Volume(int nVol)
{

}

void CAVPlayer::VolumeIncrease()
{

}

void CAVPlayer::VolumeReduce()
{

}

void CAVPlayer::SeekTo(int nPos)
{

}

void CAVPlayer::SeekForward()
{

}

void CAVPlayer::SeekBackward()
{

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-10-14 20:44  cppPlayer\
     文件        1920  2013-10-14 20:14  cppPlayer\AVPlayer.cpp
     文件        2048  2013-10-14 20:14  cppPlayer\AVPlayer.h
     文件        4437  2013-10-14 20:24  cppPlayer\cppPlayer.dsp
     文件         543  2013-10-14 20:19  cppPlayer\cppPlayer.dsw
     文件         884  2013-10-14 20:27  cppPlayer\cppPlayer.sln
     文件        6475  2013-10-14 20:32  cppPlayer\cppPlayer.vcxproj
     目录           0  2013-10-14 20:35  cppPlayer\Debug\
     文件      113664  2013-10-14 20:14  cppPlayer\Debug\libvlc.dll
     文件     2341888  2013-10-14 20:14  cppPlayer\Debug\libvlccore.dll
     目录           0  2013-10-14 20:35  cppPlayer\Debug\plugins\
     目录           0  2013-10-14 20:25  cppPlayer\Debug\plugins\access\
     文件       35840  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_attachment_plugin.dll
     文件      100352  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_bd_plugin.dll
     文件       74240  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_ftp_plugin.dll
     文件      117248  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_http_plugin.dll
     文件       48128  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_imem_plugin.dll
     文件       73216  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_mms_plugin.dll
     文件       41984  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_rar_plugin.dll
     文件       96256  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_realrtsp_plugin.dll
     文件       39424  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_smb_plugin.dll
     文件       35840  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_tcp_plugin.dll
     文件       36352  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_udp_plugin.dll
     文件       76288  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libaccess_vdr_plugin.dll
     文件      162304  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libcdda_plugin.dll
     文件      246784  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libdshow_plugin.dll
     文件      215552  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libdtv_plugin.dll
     文件      258560  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libdvdnav_plugin.dll
     文件      182784  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libdvdread_plugin.dll
     文件       46592  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libfilesystem_plugin.dll
     文件       36864  2013-10-14 20:14  cppPlayer\Debug\plugins\access\libidummy_plugin.dll
............此处省略396个文件信息

评论

共有 条评论

相关资源