版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://jeremiah.blog.51cto.com/539865/184115 |
本篇博客将简单介绍MFC调用libvlc.dll作一个简单的播放器,抛砖引玉,各位VC++达人继续深入研究,Jeremiah对VC++确实不太感兴趣,所以就不做太深入的研究了。
2009.10.29修改:加入clip_children属性设置。参考第1步。
2010.04.14修改:中文路径问题。参考第7步。
环境:
1) VC6 SP5 2) vlc-0.9.9a 0. 引言 根据上一篇博客的研究,任何一个VC环境都可以调用MinGW/Gcc编译得到的libvlc.dll。VLC在编译打包之后(也就是执行完make package-win32-base),或者去官网下载zip包解压之后,或者是安装完VLC之后,在vlc-0.9.9a目录下有个sdk文件夹,里 面又包含两个文件夹:include--头文件及lib--库。这些都是我们用MFC调用libvlc.dll所必须的。头文件没啥好说的,库里面的libvlc.dll.a及libvlccore.dll.a就是上一篇博客所说的静态库,我们分别手动改成libvlc.lib及libvlccore.lib就可以在VC环境中调用啦。下面简要说一下调用的过程,对各位VC++达人来说绝对是小菜一碟。 1. 建立工程
新建MFC AppWizard(exe)工程,名字为:MFCVLC。选择项目为Dialog based,点击完成。删除Dialog窗体上的所有的控件,包括“确定”、“取消”按钮及"TODO"静态文本。勾选窗口的clip_children属性,这样就会避免拖动、最大化最小化及全屏还原时找不到图像的缺陷。 2. 画控件
画四个控件,两个静态文本框,一个输入框,一个按钮。其中,第一个静态文本框修改Caption为“路径:”,第二个文本框为视频的显示区域,所以讲ID 改为IDC_DISPLAY,Caption去掉。输入框关联一个变量,CString类型,命名为m_path。按钮的Caption改为“播放”,并 为BN_CLICKED增加一个Function。在CMFCVLCdlg的构造方法中加入一下语句方便调试。 m_path = _T("d:/01.avi"); // 输入常用的视频地址 3. 拷贝vlc的相关库及头文件
在资源管理器的MFCVLC工程目录下新建文件夹vlc,lib,将vlc-0.9.9a/sdk/include/vlc.h拷贝到MFCVLC工程目 录下,将vlc-0.9.9a/sdk/include除了vlc.h之外的所有文件拷贝到vlc目录下,将vlc-0.9.9a/sdk/lib下的 libvlc.dll.a及libvlccore.dll.a拷贝到lib下,并分别修改为libvlc.lib及libvlccore.lib。将 vlc-0.9.9a目录下的libvlc.dll, libvlccore.dll, plugins目录拷贝到Debug目录下。如果有Cygwin环境,需要将stdint.h(/usr/include/stdint.h)这个头文件 也拷贝到MFCVLC工程目录下。在VC6环境中FileView中新建文件夹及导入上述文件,最后入下图所示。 4. 修改头文件
1) 修改vlc.h,将所有的#include <***>改为 #include "***" 2) 修改stdint.h,将所有的long long替换为__int64
3) 修改libvlc_structures.h,#include <stdint.h>为#include "stdint.h"
5. 编写代码
在MFCVLCDlg.cpp中加入头文件导入。 #include "vlc.h" 在button的onclick关联函数中加入代码:
void CMFCVLCDlg::OnButton1() { // TODO: Add your control notification handler code here char path[100]; this->GetDlgItemText(IDC_EDIT1, path, 100); libvlc_exception_t ex; libvlc_exception_init(&ex); int vlc_argc = 0; char *vlc_argv[100]; vlc_argv[vlc_argc++] = "--ignore-config"; libvlc_instance_t *p_instance = libvlc_new( vlc_argc, vlc_argv, &ex); libvlc_media_t *p_media = libvlc_media_new( p_instance, path, &ex); libvlc_media_player_t *p_media_player = libvlc_media_player_new_from_media( p_media, &ex); libvlc_drawable_t hwnd = (libvlc_drawable_t) this->GetDlgItem(IDC_DISPLAY)->GetSafeHwnd(); libvlc_media_player_set_drawable(p_media_player, hwnd, &ex); libvlc_media_player_play(p_media_player, &ex); } 6. 关联静态库及编译运行 打开Project Setting,在link标签的Object/library modules:下输入lib/libvlc.lib lib/libvlccore.lib。 build项目,应该没有错误。 Execute Program就可以执行了。 7. 两个BUG
第6步执行的是Execute模式,如果是Debug模式,点击“播放”后,后台会显示加载的vlc的plugins的dll的信息,但是加载完最后一个 dll的时候程序就Block住了。暂时不晓得为啥。经过更多的测试(win2003虚拟机里的vc6),发现Jeremiah的VC6可能真的有问 题,debug的时候,打开Output窗口显示加载的dll的情况,就会block住。不打开Output窗口偶尔会set_drawable不成功, 弹出新窗口。其他几位朋友测试则正常。 上面的代码如果开带中文路径的地址会无法打开,因为传入的中文路径vlc识别不了。需要将路径也就是path变量从ANSIZ转换为UTF8代码。具体怎么转换,各位VC达人自己研究吧。
8. 用VC6以上版本调试结果
Jeremiah使用了vs2003及vs2005。
1) 会两个重复定义的错误,解决方法是将stdint.h中注释掉:
#ifndef __intptr_t_defined #define __intptr_t_defined //typedef long intptr_t; #endif //typedef unsigned long uintptr_t; 2)
发布Release版本会报内存错误。具体原因待查,应该是.lib不兼容的问题。不知道为啥Debug版就可以而Release版就不行。解决方法是用
dll2lib.exe(附件提供)将0.9.9a的libvlc.dll及libvlccore.dll转换为相应的lib库,替换工程的lib/下面
的相应的库,然后再次Release即可。
Jeremiah对MFC只有一点点了解,所以上述的各个过程如果重复烦琐,及如何修复第7,8步讲的BUG及问题,请各位VC++达人指导
Jeremiah。先谢过。本文附件中提供了MFCVLC的源码,只是需要把vlc-0.9.9a的libvlc.dll,
libvlccore.dll, plugins目录拷贝到Debug目录下就可以编译执行。需要的自己下载添加调试。 本文出自 “Jeremiah的流媒体乐园” 博客,请务必保留此出处http://jeremiah.blog.51cto.com/539865/184115 本文出自 51CTO.COM技术博客 |
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://jeremiah.blog.51cto.com/539865/245509 |
n就没有更新博客了,主要是Jeremiah最近对vlc研究的非常的少了,工作重点转移了,又增加了管理工作,让Jeremiah忙的晕头转向的。
这篇博客是很久之前就想写的,今天终于提笔写了,心情还是比较爽的。废话不多说。
0. 环境搭建
Jeremiah这次主要是用的vlc-1.0.0(英文版)进行讲解。首先需要准备摄像头,Jeremiah用的是一个普通摄像头(以前钓MM用的,嘻嘻),驱动安装好后,在“我的电脑”中显示如下。 1. vlc播放摄像头
开启vlc-1.0.0,media->open capture device,进入Capture Device页面。这个也可以通过media->Advanced open file,选取此标签页。
video device name选择VIMICRO USB PC Camera (ZC0301PLH),如果没有,请先选择Refresh list刷新列表。 audio device name选择SoundMAX HD Audio,这个是Jeremiah的声卡。 之后可以勾选show more options,里面可是设置缓冲及看到MRL和Edit Options,这些信息都是很重要的。Advance Option按钮里面有一些详细设置,大家可以进去选择,其中video size是可以做调整的。下面会讲到。 之后点play,就可以播放了。 2. 用命令行开启vlc播放摄像头
命令行的最大好处就是,vlc命令后面的参数,就是我们在编程的时候调用libvlc_new的argv,将这些参数搞明白,我们就可以在编程的时候调用了。 开启cmd,切换到vlc目录下。 根据1中的MRL和Edit Options信息,设置vlc播放参数如下。 vlc dshow:// :dshow-vdev="VIMICRO USB PC Camera (ZC0301PLH)" :dshow-adev="SoundMAX HD Audio" :dshow-size=320*240 各个参数什么意思都是很明显的,如果不明白,就运行vlc -H,然后到vlc目录下面去找vlc-help.txt,里面是全部的参数的介绍。
3. 将vlc播放的摄像头信息存入文件中
播放成功之后,在达到我们的目的前,我们先做一个简单的验证工作,就是播放摄像头并存入文件。
根据以前stream到文件的参数,修改2的参数如下。 vlc
dshow:// :dshow-vdev="VIMICRO USB PC Camera (ZC0301PLH)"
:dshow-adev="SoundMAX HD udio" :dshow-size=320*240
:sout=#transcode{vcodec=h264,vb=800,scale=1,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ts,dst=D:/01.ts}} 这里用到了转码,就是将摄像头的视频编码为h264,音频编码为MP3,然后封装为ts写入到d:/01.ts中。
这个不会显示摄像头,但是通过刷新d:/01.ts就会发现这个文件是在增大的,也就是有视频流在写入。 4. 将摄像头串流到网络中
根据3的参数做简单的修改就可以达到串流摄像头视频流到网络的目的了。修改3的参数如下。 vlc
dshow:// :dshow-vdev="VIMICRO USB PC Camera (ZC0301PLH)"
:dshow-adev="SoundMAX HD Audio" :dshow-size=320*240
:sout=#transcode{vcodec=h264,vb=800,scale=1,acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=display,dst=rtp{dst=127.0.0.1,mux=ts,port=1234}} 这里的duplicate大家应该都很熟悉了,因为在录像,vlm里面都讲过这个参数。参数的意思是,将摄像头
的音视频流分别编码为MP3和h264之后封装为ts,然后通过rtp发送到127.0.0.1的1234端口上,同时显示出来。如果希望发送到其他网络
地址或组播里面只需要改变127.0.0.1和1234为我们需要的地址和端口即可。
再开启一个vlc,播放这个ts over rtp流。 vlc rtp://@:1234 --rtp-caching=1500 成功后就可以看到了。切图如下:
左边的是摄像头的流服务,右边的是流的客户端,从下边的地址就能看的很清楚。
5. 遗留问题: 从图片可以看出,播放的视频颜色是不对的,是摄像头的问题还是vlc本身的问题还是参数设置的问题,现在不得而知,当然摄像头本身是没问题的,因为qq视频都很正常。希望谁研究出来告诉我一声。谢谢。 本文出自 “Jeremiah的流媒体乐园” 博客,请务必保留此出处http://jeremiah.blog.51cto.com/539865/245509 |
// ##############################################################################################
// Author: DsChAeK
// URL: http://www.dschaek.de
// Projekt: uTLibvlc
// Lizenz: Freeware
// Version: 1.0
//
// Aufgabe: Wrapper for LibVLC v1.1 (or higher)
//
// Info: based on code from TheUnknownOnes (THX!)
//
// Lizenz: Copyright (c) 2009, DsChAeK
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted, provided that the above copyright notice
// and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
// OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// ##############################################################################################
//
// Changelog:
//
// 01.06.2010, DsChAeK
// -adaptions for LibVLC v1.1
// -replaced ILibVLC through TLibVLC, each object loads its own libvlc.dll!
// ->not so many locations to adapt if a function changes
// ->libvlc functions and own functions like e.g. VLC_Play() handled in one class
// -support of registered/custom vlc path, no need to copy vlc files into the app folder
// -removed version check
// -libvlc_vprinterr/libvlc_printerr not implemented, delphi don't handle var_args by default and no need
// -fullscreen toggle through own TForm, no vlc window to handle
// (since libVLC 1.1 you have to handle this by yourself, there are als no vlc hotkeys in fullscreen anymore!)
//
// ##############################################################################################
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
unit uTLibvlc;
interface
uses
sysUtils, windows,
classes, extctrls, forms;
type
Plibvlc_instance_t = type Pointer;
libvlc_time_t = Int64;
libvlc_playlist_item_t = record
i_id : Integer;
psz_uri : PAnsiChar;
psz_name : PAnsiChar;
end;
Plibvlc_playlist_item_t = ^libvlc_playlist_item_t;
Plibvlc_log_t = type Pointer;
Plibvlc_log_iterator_t = type Pointer;
libvlc_log_message_t = record
sizeof_msg : Cardinal; // sizeof() of message structure, must be filled in by user
i_severity : Integer; // 0=INFO, 1=ERR, 2=WARN, 3=DBG
psz_type, // module type
psz_name, // module name
psz_header, // optional header
psz_message : PAnsiChar; // message
end;
Plibvlc_log_message_t = ^libvlc_log_message_t;
Plibvlc_event_manager_t = type Pointer;
libvlc_event_type_t = (libvlc_MediaMetaChanged,
libvlc_MediaSubItemAdded,
libvlc_MediaDurationChanged,
libvlc_MediaPreparsedChanged,
libvlc_MediaFreed,
libvlc_MediaStateChanged,
libvlc_MediaPlayerNothingSpecial,
libvlc_MediaPlayerOpening,
libvlc_MediaPlayerBuffering,
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerForward,
libvlc_MediaPlayerBackward,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerPausableChanged,
libvlc_MediaListItemAdded,
libvlc_MediaListWillAddItem,
libvlc_MediaListItemDeleted,
libvlc_MediaListWillDeleteItem,
libvlc_MediaListViewItemAdded,
libvlc_MediaListViewWillAddItem,
libvlc_MediaListViewItemDeleted,
libvlc_MediaListViewWillDeleteItem,
libvlc_MediaListPlayerPlayed,
libvlc_MediaListPlayerNextItemSet,
libvlc_MediaListPlayerStopped,
libvlc_MediaDiscovererStarted,
libvlc_MediaDiscovererEnded,
libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerSnapshotTaken);
Plibvlc_media_t = type Pointer;
libvlc_meta_t = (libvlc_meta_Title,
libvlc_meta_Artist,
libvlc_meta_Genre,
libvlc_meta_Copyright,
libvlc_meta_Album,
libvlc_meta_TrackNumber,
libvlc_meta_Description,
libvlc_meta_Rating,
libvlc_meta_Date,
libvlc_meta_Setting,
libvlc_meta_URL,
libvlc_meta_Language,
libvlc_meta_NowPlaying,
libvlc_meta_Publisher,
libvlc_meta_EncodedBy,
libvlc_meta_ArtworkURL,
libvlc_meta_TrackID);
libvlc_state_t = (libvlc_NothingSpecial,//=0,
libvlc_Opening,
libvlc_Buffering,
libvlc_Playing,
libvlc_Paused,
libvlc_Stopped,
libvlc_Ended,
libvlc_Error);
const
libvlc_media_option_trusted = $2;
libvlc_media_option_unique = $100;
type
libvlc_track_type_t = Integer;
const
libvlc_track_unknown = -1;
libvlc_track_audio = 0;
libvlc_track_video = 1;
libvlc_track_text = 2;
type
libvlc_media_stats_t = record
i_read_bytes : Integer;
f_input_bitrate : Single;
i_demux_read_bytes : Integer;
f_demux_bitrate : Single;
i_demux_corrupted : Integer;
i_demux_discontinuity : Integer;
i_decoded_video : Integer;
i_decoded_audio : Integer;
i_displayed_pictures : Integer;
i_lost_pictures : Integer;
i_played_abuffers : Integer;
i_lost_abuffers : Integer;
i_sent_packets : Integer;
i_sent_bytes : Integer;
f_send_bitrate : Single;
end;
Plibvlc_media_stats_t = ^libvlc_media_stats_t;
type
Plibvlc_media_list_t = type Pointer;
Plibvlc_media_library_t = type Pointer;
Plibvlc_media_player_t = type Pointer;
Plibvlc_track_description_t = ^libvlc_track_description_t;
libvlc_track_description_t = record
i_id : Integer;
psz_name : PAnsiChar;
p_next : Plibvlc_track_description_t;
end;
Plibvlc_audio_output_t = ^libvlc_audio_output_t;
libvlc_audio_output_t = record
psz_name : PAnsiChar;
pst_description : PAnsiChar;
p_next : Plibvlc_audio_output_t;
end;
libvlc_rectangle_t = record
top, left,
bottom, right : Integer;
end;
Plibvlc_rectangle_t = ^libvlc_rectangle_t;
type
libvlc_audio_output_device_types_t = Integer;
const
libvlc_AudioOutputDevice_Error = -1;
libvlc_AudioOutputDevice_Mono = 1;
libvlc_AudioOutputDevice_Stereo = 2;
libvlc_AudioOutputDevice_2F2R = 4;
libvlc_AudioOutputDevice_3F2R = 5;
libvlc_AudioOutputDevice_5_1 = 6;
libvlc_AudioOutputDevice_6_1 = 7;
libvlc_AudioOutputDevice_7_1 = 8;
libvlc_AudioOutputDevice_SPDIF = 10;
type
libvlc_audio_output_channel_t = Integer;
const
libvlc_AudioChannel_Error = -1;
libvlc_AudioChannel_Stereo = 1;
libvlc_AudioChannel_RStereo = 2;
libvlc_AudioChannel_Left = 3;
libvlc_AudioChannel_Right = 4;
libvlc_AudioChannel_Dolbys = 5;
type
Plibvlc_media_list_player_t = type Pointer;
Tmedia_meta_changed = record
meta_type : libvlc_meta_t;
end;
Tmedia_subitem_added = record
new_child : Plibvlc_media_t;
end;
Tmedia_duration_changed = record
new_duration : Int64;
end;
Tmedia_preparsed_changed = record
new_status : Integer;
end;
Tmedia_freed = record
md : Plibvlc_media_t;
end;
Tmedia_state_changed = record
new_state : libvlc_state_t;
end;
Tmedia_player_position_changed = record
new_position : Single;
end;
Tmedia_player_time_changed = record
new_time : libvlc_time_t;
end;
Tmedia_player_title_changed = record
new_title : Integer;
end;
Tmedia_player_seekable_changed = record
new_seekable : Int64;
end;
Tmedia_player_pausable_changed = record
new_pausable : Int64;
end;
Tmedia_list_item_added = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_will_add_item = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_item_deleted = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_will_delete_item = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_view_item_added = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_view_will_add_item = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_view_item_deleted = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_list_view_will_delete_item = record
item : Plibvlc_media_t;
index : Integer;
end;
Tmedia_player_snapshot_taken = record
psz_filename : PAnsiChar;
end;
libvlc_event_t = record
_type : libvlc_event_type_t;
p_obj : Pointer;
case Integer of
0 : (media_meta_changed : Tmedia_meta_changed);
1 : (media_subitem_added : Tmedia_subitem_added);
2 : (media_duration_changed : Tmedia_duration_changed);
3 : (media_preparsed_changed : Tmedia_preparsed_changed);
4 : (media_freed : Tmedia_freed);
5 : (media_state_changed : Tmedia_state_changed);
6 : (media_player_position_changed : Tmedia_player_position_changed);
7 : (media_player_time_changed : Tmedia_player_time_changed);
8 : (media_player_title_changed : Tmedia_player_title_changed);
9 : (media_player_seekable_changed : Tmedia_player_seekable_changed);
10: (media_player_pausable_changed : Tmedia_player_pausable_changed);
11: (media_list_item_added : Tmedia_list_item_added);
12: (media_list_will_add_item : Tmedia_list_will_add_item);
13: (media_list_item_deleted : Tmedia_list_item_deleted);
14: (media_list_will_delete_item : Tmedia_list_will_delete_item);
15: (media_list_view_item_added : Tmedia_list_view_item_added);
16: (media_list_view_will_add_item : Tmedia_list_view_will_add_item);
17: (media_list_view_item_deleted : Tmedia_list_view_item_deleted);
18: (media_list_view_will_delete_item : Tmedia_list_view_will_delete_item);
19: (media_player_snapshot_taken : Tmedia_player_snapshot_taken);
end;
Plibvlc_event_t = ^libvlc_event_t;
libvlc_callback_t = procedure(p_event : Plibvlc_event_t; userdata : Pointer); cdecl;
Plibvlc_media_discoverer_t = type Pointer;
type
TLibVLC = class(TObject)
private
FName : String; // name for instance
FVersion : String; // version as string
FDllHandle : Integer; // dll handle
FLib : Plibvlc_instance_t; // libvlc instance
FLastError : Integer; // last error
FLog : Plibvlc_log_t; // log
FIterator : Plibvlc_log_iterator_t; // log iter
FPlayer : Plibvlc_media_player_t; // media_player
FMedia : Plibvlc_media_t; // media
FMediaURL : String; // media url
FMediaOpt : TStringList; // media options
FStats : libvlc_media_stats_t; // stats
FPnlOutput : TPanel; // panel for video output
FFormFS : TForm; // form for video fullscreen display
FFullscreen : Boolean; // true=fullscreen false=window
FOldPanTop : Integer; // orig panel pos
FOldPanLeft : Integer; // orig panel pos
FOldPanHeight : Integer; // orig panel pos
FOldPanWidth : Integer; // orig panel pos
FCallback : libvlc_callback_t; // callback for events
// internal functions
function GetAProcAddress( var Addr : Pointer; Name : PChar) : Integer;
procedure LoadFunctions;
function SetAParent(hWndChild, hWndNewParent: HWND; NewParentWidth, NewParentHeight: integer): boolean;
public
constructor Create(InstName, DLL : String; Params : array of PAnsiChar; LogLevel : Integer; MediaURL: String; MediaOptions : TStringList; PnlOutput : TPanel; Callback : libvlc_callback_t); overload;
constructor Create(InstName, DLL : String; Params : array of PAnsiChar; LogLevel : Integer; PnlOutput : TPanel; Callback : libvlc_callback_t); overload;
destructor Destroy(); override;
function VLC_GetLibPath : String;
function VLC_GetVersion() : String;
procedure VLC_SetPlayer(MediaURL: String; MediaOptions : TStringList);
procedure VLC_Play();
procedure VLC_Stop();
procedure VLC_Pause();
function VLC_IsPlaying(): Boolean;
procedure VLC_TakeSnapshot(Path : String; width, height : Integer);
procedure VLC_SetDeinterlaceMode(Mode : String);
procedure VLC_SetCropMode(Mode : String);
procedure VLC_SetARMode(Mode : String);
procedure VLC_ToggleFullscreen(Panel : TPanel);
procedure VLC_SetAudioTrack(iTrack : Integer);
function VLC_GetAudioTrack() : Integer;
procedure VLC_ToggleMute();
procedure VLC_SetVolume(Level : Integer);
function VLC_GetVolume() : Integer;
procedure VLC_AppendLastLogMsgs(List : TStringList);
function VLC_GetStats() : libvlc_media_stats_t;
property IsFullscreen: Boolean read FFullscreen;
property MediaURL: String read FMediaURL;
property Version: String read FVersion;
public
// libvlc functions
libvlc_playlist_play : procedure (p_instance : Plibvlc_instance_t;
i_id : Integer;
i_options : Integer;
ppsz_options : PAnsiChar); cdecl;
libvlc_errmsg : function () : PAnsiChar; cdecl;
libvlc_clearerr : procedure (); cdecl;
libvlc_new : function(argc : Integer;
argv : PChar) : Plibvlc_instance_t; cdecl;
libvlc_release : procedure(p_instance : Plibvlc_instance_t); cdecl;
libvlc_retain : procedure(p_instance : Plibvlc_instance_t); cdecl;
libvlc_add_intf : procedure(p_instalce : Plibvlc_instance_t;
name : PAnsiChar); cdecl;
libvlc_wait : procedure(p_instance : Plibvlc_instance_t); cdecl;
libvlc_get_version : function() : PAnsiChar; cdecl;
libvlc_get_compiler : function() : PAnsiChar; cdecl;
libvlc_get_changeset : function() : PAnsiChar; cdecl;
libvlc_event_attach : procedure(p_event_manager : Plibvlc_event_manager_t;
event_type : libvlc_event_type_t;
f_callback : libvlc_callback_t;
userdata : Pointer); cdecl;
libvlc_event_detach : procedure(p_event_manager : Plibvlc_event_manager_t;
event_type : libvlc_event_type_t;
f_callback : libvlc_callback_t;
userdata : Pointer); cdecl;
libvlc_event_type_name : function(event_type : libvlc_event_type_t) : PAnsiChar; cdecl;
libvlc_get_log_verbosity : function(p_instance : Plibvlc_instance_t) : Cardinal; cdecl;
libvlc_set_log_verbosity : procedure(p_instance : Plibvlc_instance_t;
level : Cardinal); cdecl;
libvlc_log_open : function(p_instance : Plibvlc_instance_t) : Plibvlc_log_t; cdecl;
libvlc_log_close : procedure(p_log : Plibvlc_log_t); cdecl;
libvlc_log_count : function(p_log : Plibvlc_log_t) : Cardinal; cdecl;
libvlc_log_clear : procedure(p_log : Plibvlc_log_t); cdecl;
libvlc_log_get_iterator : function(p_log : Plibvlc_log_t) : Plibvlc_log_iterator_t; cdecl;
libvlc_log_iterator_free : procedure(p_iter : Plibvlc_log_iterator_t); cdecl;
libvlc_log_iterator_has_next : function(p_iter : Plibvlc_log_iterator_t) : Integer; cdecl;
libvlc_log_iterator_next : function(p_iter : Plibvlc_log_iterator_t;
p_buffer : Plibvlc_log_message_t) : Plibvlc_log_message_t; cdecl;
libvlc_media_new_location : function(p_instance : Plibvlc_instance_t;
psz_mrl : PAnsiChar) : Plibvlc_media_t; cdecl;
libvlc_media_new_path : function(p_instance : Plibvlc_instance_t;
path : PAnsiChar) : Plibvlc_media_t; cdecl;
libvlc_media_new_as_node : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar) : Plibvlc_media_t; cdecl;
libvlc_media_add_option : procedure(p_media : Plibvlc_media_t;
ppsz_options : PAnsiChar); cdecl;
libvlc_media_retain : procedure(p_media : Plibvlc_media_t); cdecl;
libvlc_media_release : procedure(p_media : Plibvlc_media_t); cdecl;
libvlc_media_get_mrl : function(p_media : Plibvlc_media_t) : PAnsiChar; cdecl;
libvlc_media_duplicate : function(p_media : Plibvlc_media_t) : Plibvlc_media_t; cdecl;
libvlc_media_get_meta : function(p_media : Plibvlc_media_t;
e_meta : libvlc_meta_t) : PAnsiChar; cdecl;
libvlc_media_get_state : function(p_media : Plibvlc_media_t) : libvlc_state_t; cdecl;
libvlc_media_get_stats : function (p_media : Plibvlc_media_t;
p_stats : Plibvlc_media_stats_t) : Integer; cdecl;
libvlc_media_subitems : function(p_media : Plibvlc_media_t) : Plibvlc_media_list_t; cdecl;
libvlc_media_event_manager : function(p_media : Plibvlc_media_t) : Plibvlc_event_manager_t; cdecl;
libvlc_media_get_duration : function(p_media : Plibvlc_media_t) : libvlc_time_t; cdecl;
libvlc_media_parse : procedure(p_media : Plibvlc_media_t); cdecl;
libvlc_media_parse_async : procedure(p_media : Plibvlc_media_t); cdecl;
libvlc_media_is_parsed : procedure(p_media : Plibvlc_media_t); cdecl;
libvlc_media_set_user_data : procedure(p_media : Plibvlc_media_t;
p_new_user_data : Pointer); cdecl;
libvlc_media_get_user_data : function(p_media : Plibvlc_media_t) : Pointer; cdecl;
libvlc_media_list_new : function(p_instance : Plibvlc_instance_t) : Plibvlc_media_list_t; cdecl;
libvlc_media_list_release : procedure(p_media_list : Plibvlc_media_list_t); cdecl;
libvlc_media_list_retain : procedure(p_media_list : Plibvlc_media_list_t); cdecl;
libvlc_media_list_set_media : procedure(p_media_list : Plibvlc_media_list_t;
p_media : Plibvlc_media_t); cdecl;
libvlc_media_list_media : function(p_media_list : Plibvlc_media_list_t) : Plibvlc_media_t; cdecl;
libvlc_media_list_add_media : procedure(p_media_list : Plibvlc_media_list_t;
p_media : Plibvlc_media_t); cdecl;
libvlc_media_list_insert_media : procedure(p_media_list : Plibvlc_media_list_t;
p_media : Plibvlc_media_t;
index : Integer); cdecl;
libvlc_media_list_remove_index : procedure(p_media_list : Plibvlc_media_list_t;
index : Integer); cdecl;
libvlc_media_list_count : function(p_media_list : Plibvlc_media_list_t) : Integer; cdecl;
libvlc_media_list_item_at_index : function(p_media_list : Plibvlc_media_list_t;
index : Integer) : Plibvlc_media_t; cdecl;
libvlc_media_list_index_of_item : function(p_media_list : Plibvlc_media_list_t;
p_media : Plibvlc_media_t) : Integer; cdecl;
libvlc_media_list_is_readonly : function(p_media_list : Plibvlc_media_list_t) : Integer; cdecl;
libvlc_media_list_lock : procedure(p_media_list : Plibvlc_media_list_t); cdecl;
libvlc_media_list_unlock : procedure(p_media_list : Plibvlc_media_list_t); cdecl;
libvlc_media_list_event_manager : function(p_media_list : Plibvlc_media_list_t) : Plibvlc_event_manager_t; cdecl;
libvlc_media_library_new : function(p_instance : Plibvlc_instance_t) : Plibvlc_media_library_t; cdecl;
libvlc_media_library_release : procedure(p_mlib : Plibvlc_media_library_t); cdecl;
libvlc_media_library_retain : procedure(p_mlib : Plibvlc_media_library_t); cdecl;
libvlc_media_library_load : procedure(p_mlib : Plibvlc_media_library_t); cdecl;
libvlc_media_library_media_list : function(p_mlib : Plibvlc_media_library_t) : Plibvlc_media_list_t; cdecl;
libvlc_media_player_new : function(p_instance : Plibvlc_instance_t) : Plibvlc_media_player_t; cdecl;
libvlc_media_player_new_from_media : function(p_media : Plibvlc_media_t) : Plibvlc_media_player_t; cdecl;
libvlc_media_player_release : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_retain : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_set_media : procedure(p_media_player : Plibvlc_media_player_t;
p_media : Plibvlc_media_t); cdecl;
libvlc_media_player_get_media : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_media_t; cdecl;
libvlc_media_player_event_manager : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_event_manager_t; cdecl;
libvlc_media_player_is_playing : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_play : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_pause : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_stop : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_set_nsobject : procedure(p_media_player : Plibvlc_media_player_t;
drawable : Pointer); cdecl;
libvlc_media_player_get_nsobject : function(p_media_player : Plibvlc_media_player_t) : Pointer; cdecl;
libvlc_media_player_set_agl : procedure(p_media_player : Plibvlc_media_player_t;
drawable : Cardinal); cdecl;
libvlc_media_player_get_agl : function(p_media_player : Plibvlc_media_player_t) : Cardinal; cdecl;
libvlc_media_player_set_xwindow : procedure(p_media_player : Plibvlc_media_player_t;
drawable : Cardinal); cdecl;
libvlc_media_player_get_xwindow : function(p_media_player : Plibvlc_media_player_t) : Cardinal; cdecl;
libvlc_media_player_set_hwnd : procedure(p_media_player : Plibvlc_media_player_t;
drawable : Pointer); cdecl;
libvlc_media_player_get_hwnd : function(p_media_player : Plibvlc_media_player_t) : Pointer; cdecl;
libvlc_media_player_get_length : function(p_media_player : Plibvlc_media_player_t) : libvlc_time_t; cdecl;
libvlc_media_player_get_time : function(p_media_player : Plibvlc_media_player_t) : libvlc_time_t; cdecl;
libvlc_media_player_set_time : procedure(p_media_player : Plibvlc_media_player_t;
time : libvlc_time_t); cdecl;
libvlc_media_player_get_position : function(p_media_player : Plibvlc_media_player_t) : Single; cdecl;
libvlc_media_player_set_position : procedure(p_media_player : Plibvlc_media_player_t;
position : Single); cdecl;
libvlc_media_player_set_chapter : procedure(p_media_player : Plibvlc_media_player_t;
chapter : Integer); cdecl;
libvlc_media_player_get_chapter : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_get_chapter_count : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_will_play : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_get_chapter_count_for_title : function(p_media_player : Plibvlc_media_player_t;
title : Integer) : Integer; cdecl;
libvlc_media_player_set_title : procedure(p_media_player : Plibvlc_media_player_t;
title : Integer); cdecl;
libvlc_media_player_get_title : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_get_title_count : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_previous_chapter : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_next_chapter : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_player_get_rate : function(p_media_player : Plibvlc_media_player_t) : Single; cdecl;
libvlc_media_player_set_rate : procedure(p_media_player : Plibvlc_media_player_t;
rate : Single); cdecl;
libvlc_media_player_get_state : function(p_media_player : Plibvlc_media_player_t) : libvlc_state_t; cdecl;
libvlc_media_player_get_fps : function(p_media_player : Plibvlc_media_player_t) : Single; cdecl;
libvlc_media_player_has_vout : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_is_seekable : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_media_player_can_pause : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_track_description_release : procedure(p_track_description : Plibvlc_track_description_t); cdecl;
libvlc_toggle_fullscreen : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_set_fullscreen : procedure(p_media_player : Plibvlc_media_player_t;
enabled : Integer); cdecl;
libvlc_get_fullscreen : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_set_deinterlace : procedure(p_media_player : Plibvlc_media_player_t; psz_mode : PChar);
libvlc_video_set_key_input : procedure(p_media_player : Plibvlc_media_player_t;
Activate : Integer); cdecl;
libvlc_video_set_mouse_input : procedure(p_media_player : Plibvlc_media_player_t;
Activate : Integer); cdecl;
libvlc_video_get_size : function(p_media_player : Plibvlc_media_player_t;
var num : Integer;
var px : Integer;
var py : Integer) : Integer; cdecl;
libvlc_video_get_cursor : function(p_media_player : Plibvlc_media_player_t;
var num : Integer;
var px : Integer;
var py : Integer) : Integer; cdecl;
libvlc_video_get_height : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_get_width : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_get_scale : function(p_media_player : Plibvlc_media_player_t) : Single; cdecl;
libvlc_video_set_scale : procedure(p_media_player : Plibvlc_media_player_t;
scale : Single); cdecl;
libvlc_video_get_aspect_ratio : function(p_media_player : Plibvlc_media_player_t) : PAnsiChar; cdecl;
libvlc_video_set_aspect_ratio : procedure(p_media_player : Plibvlc_media_player_t;
psz_aspect : PAnsiChar); cdecl;
libvlc_video_get_spu : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_get_spu_count : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_get_spu_description : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_track_description_t; cdecl;
libvlc_video_set_spu : procedure(p_media_player : Plibvlc_media_player_t;
i_spu : Integer); cdecl;
libvlc_video_set_subtitle_file : function(p_media_player : Plibvlc_media_player_t;
filename : PAnsiChar) : Integer; cdecl;
libvlc_video_get_title_description : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_track_description_t; cdecl;
libvlc_video_get_chapter_description : function(p_media_player : Plibvlc_media_player_t;
title : Integer) : Plibvlc_track_description_t; cdecl;
libvlc_video_get_crop_geometry : function(p_media_player : Plibvlc_media_player_t) : PAnsiChar; cdecl;
libvlc_video_set_crop_geometry : procedure(p_media_player : Plibvlc_media_player_t;
geometry : PAnsiChar); cdecl;
libvlc_toggle_teletext : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_video_get_teletext : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_set_teletext : procedure(p_media_player : Plibvlc_media_player_t;
page : Integer); cdecl;
libvlc_video_get_track_count : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_get_track_description : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_track_description_t; cdecl;
libvlc_video_get_track : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_video_set_track : procedure(p_media_player : Plibvlc_media_player_t;
track : Integer); cdecl;
libvlc_video_take_snapshot : procedure(p_media_player : Plibvlc_media_player_t;
num : Integer;
filepath : PAnsiChar;
width, height : Integer); cdecl;
libvlc_audio_output_list_get : function(p_instance : Plibvlc_instance_t) : Plibvlc_audio_output_t; cdecl;
libvlc_audio_output_list_release : procedure(audio_output_list : Plibvlc_audio_output_t); cdecl;
libvlc_audio_output_set : function(p_media_player : Plibvlc_media_player_t;
psz_audio_output : PAnsiChar) : Integer; cdecl;
libvlc_audio_output_device_count : function(p_instance : Plibvlc_instance_t;
psz_audio_output : PAnsiChar) : Integer; cdecl;
libvlc_audio_output_device_longname : function(p_instance : Plibvlc_instance_t;
psz_audio_output : PAnsiChar;
device : Integer) : PAnsiChar; cdecl;
libvlc_audio_output_device_id : function(p_instance : Plibvlc_instance_t;
psz_audio_output : PAnsiChar;
device : Integer) : PAnsiChar; cdecl;
libvlc_audio_output_device_set : procedure(p_media_player : Plibvlc_media_player_t;
psz_audio_output : PAnsiChar;
device : PAnsiChar); cdecl;
libvlc_audio_output_get_device_type : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_output_set_device_type : procedure(p_media_player : Plibvlc_media_player_t;
device_type : Integer); cdecl;
libvlc_audio_toggle_mute : procedure(p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_audio_get_mute : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_set_mute : procedure(p_media_player : Plibvlc_media_player_t;
status : Integer); cdecl;
libvlc_audio_get_volume : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_set_volume : function(p_media_player : Plibvlc_media_player_t;
volume : Integer) : Integer; cdecl;
libvlc_audio_get_track_count : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_get_track_description : function(p_media_player : Plibvlc_media_player_t) : Plibvlc_track_description_t; cdecl;
libvlc_audio_get_track : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_set_track : procedure(p_media_player : Plibvlc_media_player_t; i_track : Integer); cdecl;
libvlc_audio_get_channel : function(p_media_player : Plibvlc_media_player_t) : Integer; cdecl;
libvlc_audio_set_channel : procedure(p_media_player : Plibvlc_media_player_t;
channel : Integer); cdecl;
libvlc_media_list_player_new : function(p_instance : Plibvlc_instance_t) : Plibvlc_media_list_player_t; cdecl;
libvlc_media_list_player_release : procedure(p_mlp : Plibvlc_media_list_player_t); cdecl;
libvlc_media_list_player_set_media_player : procedure(p_mlp : Plibvlc_media_list_player_t;
p_media_player : Plibvlc_media_player_t); cdecl;
libvlc_media_list_player_set_media_list : procedure(p_mlp : Plibvlc_media_list_player_t;
p_media_list : Plibvlc_media_list_t); cdecl;
libvlc_media_list_player_play : procedure(p_mlp : Plibvlc_media_list_player_t); cdecl;
libvlc_media_list_player_pause : procedure(p_mlp : Plibvlc_media_list_player_t); cdecl;
libvlc_media_list_player_is_playing : function(p_mlp : Plibvlc_media_list_player_t) : Integer; cdecl;
libvlc_media_list_player_get_state : function(p_mlp : Plibvlc_media_list_player_t) : libvlc_state_t; cdecl;
libvlc_media_list_player_play_item_at_index : procedure(p_mlp : Plibvlc_media_list_player_t;
i_index : Integer); cdecl;
libvlc_media_list_player_play_item : procedure(p_mlp : Plibvlc_media_list_player_t;
p_media : Plibvlc_media_t); cdecl;
libvlc_media_list_player_stop : procedure(p_mlp : Plibvlc_media_list_player_t); cdecl;
libvlc_media_list_player_next : procedure(p_mlp : Plibvlc_media_list_player_t); cdecl;
libvlc_media_discoverer_new_from_name : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar) : Plibvlc_media_discoverer_t; cdecl;
libvlc_media_discoverer_release : procedure(p_mdis : Plibvlc_media_discoverer_t); cdecl;
libvlc_media_discoverer_localized_name : function(p_mdis : Plibvlc_media_discoverer_t) : PAnsiChar; cdecl;
libvlc_media_discoverer_media_list : function(p_mdis : Plibvlc_media_discoverer_t) : Plibvlc_media_list_t; cdecl;
libvlc_media_discoverer_event_manager : function(p_mdis : Plibvlc_media_discoverer_t) : Plibvlc_event_manager_t; cdecl;
libvlc_media_discoverer_is_running : function(p_mdis : Plibvlc_media_discoverer_t) : Integer; cdecl;
libvlc_vlm_release : procedure(p_instance : Plibvlc_instance_t); cdecl;
libvlc_vlm_add_broadcast : procedure(p_instance : Plibvlc_instance_t;
psz_name,
psz_input,
psz_output : PAnsiChar;
options : Integer;
ppsz_options : Pointer;
b_enabled : Integer;
b_loop : Integer); cdecl;
libvlc_vlm_add_vod : procedure(p_instance : Plibvlc_instance_t;
psz_name,
psz_input : PAnsiChar;
i_options : Integer;
ppsz_options : Pointer;
b_enabled : Integer;
psz_mux : PAnsiChar); cdecl;
libvlc_vlm_del_media : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar); cdecl;
libvlc_vlm_set_enabled : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
b_enabled : Integer); cdecl;
libvlc_vlm_set_output : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
psz_output : PAnsiChar); cdecl;
libvlc_vlm_set_input : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
psz_input : PAnsiChar); cdecl;
libvlc_vlm_add_input : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
pst_input : PAnsiChar); cdecl;
libvlc_vlm_set_loop : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
b_loop : Integer); cdecl;
libvlc_vlm_set_mux : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
psz_mux : PAnsiChar); cdecl;
libvlc_vlm_change_media : procedure(p_instance : Plibvlc_instance_t;
psz_name,
psz_input,
psz_output : PAnsiChar;
i_options : Integer;
ppsz_options : Pointer;
b_enabled : Integer;
b_loop : Integer); cdecl;
libvlc_vlm_play_media : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar); cdecl;
libvlc_vlm_stop_media : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar); cdecl;
libvlc_vlm_pause_media : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar); cdecl;
libvlc_vlm_seek_media : procedure(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
f_percentage : Single); cdecl;
libvlc_vlm_show_media : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar) : PAnsiChar; cdecl;
libvlc_vlm_get_media_instance_position : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
i_instance : Integer) : Single; cdecl;
libvlc_vlm_get_media_instance_time : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
i_instance : Integer) : Integer; cdecl;
libvlc_vlm_get_media_instance_length : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
i_instance : Integer) : Integer; cdecl;
libvlc_vlm_get_media_instance_rate : function(p_instance : Plibvlc_instance_t;
psz_name : PAnsiChar;
i_instance : Integer) : Integer; cdecl;
// libvlc_vlm_get_media_instance_title : function(p_instance : Plibvlc_instance_t;
// psz_name : PAnsiChar;
// i_instance : Integer) : Integer; cdecl;
// libvlc_vlm_get_media_instance_chapter : function(p_instance : Plibvlc_instance_t;
// psz_name : PAnsiChar;
// i_instance : Integer) : Integer; cdecl;
// libvlc_vlm_get_media_instance_seekable : function(p_instance : Plibvlc_instance_t;
// psz_name : PAnsiChar;
// i_instance : Integer) : Integer; cdecl;
end;
implementation
procedure Delay(msDelay: DWORD);
var
Start : DWORD;
begin
Start:=GetTickCount;
repeat
sleep(2);
Application.ProcessMessages;
until GetTickCount-Start > msDelay;
end;
{ TLibVLC }
procedure TLibVLC.VLC_AppendLastLogMsgs(List: TStringList);
var
i,Cnt : Integer;
Msg : libvlc_log_message_t;
begin
if not Assigned(FLog) then
exit;
Cnt := libvlc_log_count(FLog);
FIterator := libvlc_log_get_iterator(FLog);
if not Assigned(FIterator) then
exit;
for i:=0 to Cnt-1 do begin
libvlc_log_iterator_next(FIterator, @Msg);
if not Assigned(@Msg) then
break;
if Assigned(List) then
List.Append(FName+': '+Msg.psz_message);
end;
libvlc_log_clear(FLog);
end;
constructor TLibVLC.Create(InstName, DLL: String; Params : array of PAnsiChar; LogLevel : Integer; MediaURL: String; MediaOptions : TStringList; PnlOutput : TPanel; Callback : libvlc_callback_t);
begin
if (DLL = '') or (DLL = 'libvlc.dll') then
DLL := VLC_GetLibPath+'libvlc.dll';
// load libvlccore.dll (actually only needed if vlc is in a diffrent folder then the application)
FDllHandle := LoadLibrary(PChar(ExtractFilePath(DLL)+'libvlccore.dll'));
// callback
FCallback := Callback;
// load libvlc.dll
FDllHandle := LoadLibrary(PChar(DLL));
// name
FName := InstName;
// fullscreen
FFullscreen := false;
FFormFS := TForm.Create(nil);
FFormFS.BorderStyle := bsNone;
FFormFS.Width := Screen.Width;
FFormFS.Height := Screen.Height;
FFormFS.Top := 0;
FFormFS.Left := 0;
// media
FMediaURL := MediaURL;
FMediaOpt := MediaOptions;
FPnlOutput := PnlOutput;
if FDllHandle = 0 then
raise Exception.Create('load libvlc.dll failed!');
LoadFunctions;
// init libvlc instance
FLib := libvlc_new(Length(Params), @Params[0]);
// init logging
libvlc_set_log_verbosity(FLib, LogLevel);
FLog := libvlc_log_open(FLib);
end;
destructor TLibVLC.Destroy;
begin
libvlc_log_close(FLog);
libvlc_release(FLib);
FFormFS.Free;
end;
procedure TLibVLC.LoadFunctions;
begin
GetAProcAddress(@libvlc_playlist_play, 'libvlc_playlist_play');
GetAProcAddress(@libvlc_errmsg , 'libvlc_errmsg');
GetAProcAddress(@libvlc_clearerr , 'libvlc_clearerr');
GetAProcAddress(@libvlc_new , 'libvlc_new');
GetAProcAddress(@libvlc_release , 'libvlc_release');
GetAProcAddress(@libvlc_retain , 'libvlc_retain');
GetAProcAddress(@libvlc_add_intf , 'libvlc_add_intf');
GetAProcAddress(@libvlc_wait , 'libvlc_wait');
GetAProcAddress(@libvlc_get_version , 'libvlc_get_version');
GetAProcAddress(@libvlc_get_compiler , 'libvlc_get_compiler');
GetAProcAddress(@libvlc_get_changeset , 'libvlc_get_changeset');
GetAProcAddress(@libvlc_event_attach , 'libvlc_event_attach');
GetAProcAddress(@libvlc_event_detach , 'libvlc_event_detach');
GetAProcAddress(@libvlc_event_type_name , 'libvlc_event_type_name');
GetAProcAddress(@libvlc_get_log_verbosity , 'libvlc_get_log_verbosity');
GetAProcAddress(@libvlc_set_log_verbosity , 'libvlc_set_log_verbosity');
GetAProcAddress(@libvlc_log_open , 'libvlc_log_open');
GetAProcAddress(@libvlc_log_close , 'libvlc_log_close');
GetAProcAddress(@libvlc_log_count , 'libvlc_log_count');
GetAProcAddress(@libvlc_log_clear , 'libvlc_log_clear');
GetAProcAddress(@libvlc_log_get_iterator , 'libvlc_log_get_iterator');
GetAProcAddress(@libvlc_log_iterator_free , 'libvlc_log_iterator_free');
GetAProcAddress(@libvlc_log_iterator_has_next , 'libvlc_log_iterator_has_next');
GetAProcAddress(@libvlc_log_iterator_next , 'libvlc_log_iterator_next');
GetAProcAddress(@libvlc_media_new_location , 'libvlc_media_new_location');
GetAProcAddress(@libvlc_media_new_path , 'libvlc_media_new_path');
GetAProcAddress(@libvlc_media_new_as_node , 'libvlc_media_new_as_node');
GetAProcAddress(@libvlc_media_add_option , 'libvlc_media_add_option');
GetAProcAddress(@libvlc_media_retain , 'libvlc_media_retain');
GetAProcAddress(@libvlc_media_release , 'libvlc_media_release');
GetAProcAddress(@libvlc_media_get_mrl , 'libvlc_media_get_mrl');
GetAProcAddress(@libvlc_media_duplicate , 'libvlc_media_duplicate');
GetAProcAddress(@libvlc_media_get_meta , 'libvlc_media_get_meta');
GetAProcAddress(@libvlc_media_get_state , 'libvlc_media_get_state');
GetAProcAddress(@libvlc_media_get_stats , 'libvlc_media_get_stats');
GetAProcAddress(@libvlc_media_subitems , 'libvlc_media_subitems');
GetAProcAddress(@libvlc_media_event_manager , 'libvlc_media_event_manager');
GetAProcAddress(@libvlc_media_get_duration , 'libvlc_media_get_duration');
GetAProcAddress(@libvlc_media_parse, 'libvlc_media_parse');
GetAProcAddress(@libvlc_media_parse_async, 'libvlc_media_parse_async');
GetAProcAddress(@libvlc_media_is_parsed, 'libvlc_media_is_parsed');
GetAProcAddress(@libvlc_media_set_user_data , 'libvlc_media_set_user_data');
GetAProcAddress(@libvlc_media_get_user_data , 'libvlc_media_get_user_data');
GetAProcAddress(@libvlc_media_list_new , 'libvlc_media_list_new');
GetAProcAddress(@libvlc_media_list_release , 'libvlc_media_list_release');
GetAProcAddress(@libvlc_media_list_retain , 'libvlc_media_list_retain');
GetAProcAddress(@libvlc_media_list_set_media , 'libvlc_media_list_set_media');
GetAProcAddress(@libvlc_media_list_media , 'libvlc_media_list_media');
GetAProcAddress(@libvlc_media_list_add_media , 'libvlc_media_list_add_media');
GetAProcAddress(@libvlc_media_list_insert_media , 'libvlc_media_list_insert_media');
GetAProcAddress(@libvlc_media_list_remove_index , 'libvlc_media_list_remove_index');
GetAProcAddress(@libvlc_media_list_count , 'libvlc_media_list_count');
GetAProcAddress(@libvlc_media_list_item_at_index , 'libvlc_media_list_item_at_index');
GetAProcAddress(@libvlc_media_list_index_of_item , 'libvlc_media_list_index_of_item');
GetAProcAddress(@libvlc_media_list_is_readonly , 'libvlc_media_list_is_readonly');
GetAProcAddress(@libvlc_media_list_lock , 'libvlc_media_list_lock');
GetAProcAddress(@libvlc_media_list_unlock , 'libvlc_media_list_unlock');
GetAProcAddress(@libvlc_media_list_event_manager , 'libvlc_media_list_event_manager');
GetAProcAddress(@libvlc_media_library_new , 'libvlc_media_library_new');
GetAProcAddress(@libvlc_media_library_release , 'libvlc_media_library_release');
GetAProcAddress(@libvlc_media_library_retain , 'libvlc_media_library_retain');
GetAProcAddress(@libvlc_media_library_load , 'libvlc_media_library_load');
GetAProcAddress(@libvlc_media_library_media_list , 'libvlc_media_library_media_list');
GetAProcAddress(@libvlc_media_player_new , 'libvlc_media_player_new');
GetAProcAddress(@libvlc_media_player_new_from_media , 'libvlc_media_player_new_from_media');
GetAProcAddress(@libvlc_media_player_release , 'libvlc_media_player_release');
GetAProcAddress(@libvlc_media_player_retain , 'libvlc_media_player_retain');
GetAProcAddress(@libvlc_media_player_set_media , 'libvlc_media_player_set_media');
GetAProcAddress(@libvlc_media_player_get_media , 'libvlc_media_player_get_media');
GetAProcAddress(@libvlc_media_player_event_manager , 'libvlc_media_player_event_manager');
GetAProcAddress(@libvlc_media_player_is_playing , 'libvlc_media_player_is_playing');
GetAProcAddress(@libvlc_media_player_play , 'libvlc_media_player_play');
GetAProcAddress(@libvlc_media_player_pause , 'libvlc_media_player_pause');
GetAProcAddress(@libvlc_media_player_stop , 'libvlc_media_player_stop');
GetAProcAddress(@libvlc_media_player_set_nsobject , 'libvlc_media_player_set_nsobject');
GetAProcAddress(@libvlc_media_player_get_nsobject , 'libvlc_media_player_get_nsobject');
GetAProcAddress(@libvlc_media_player_set_agl , 'libvlc_media_player_set_agl');
GetAProcAddress(@libvlc_media_player_get_agl , 'libvlc_media_player_get_agl');
GetAProcAddress(@libvlc_media_player_set_xwindow , 'libvlc_media_player_set_xwindow');
GetAProcAddress(@libvlc_media_player_get_xwindow , 'libvlc_media_player_get_xwindow');
GetAProcAddress(@libvlc_media_player_set_hwnd , 'libvlc_media_player_set_hwnd');
GetAProcAddress(@libvlc_media_player_get_hwnd , 'libvlc_media_player_get_hwnd');
GetAProcAddress(@libvlc_media_player_get_length , 'libvlc_media_player_get_length');
GetAProcAddress(@libvlc_media_player_get_time , 'libvlc_media_player_get_time');
GetAProcAddress(@libvlc_media_player_set_time , 'libvlc_media_player_set_time');
GetAProcAddress(@libvlc_media_player_get_position , 'libvlc_media_player_get_position');
GetAProcAddress(@libvlc_media_player_set_position , 'libvlc_media_player_set_position');
GetAProcAddress(@libvlc_media_player_set_chapter , 'libvlc_media_player_set_chapter');
GetAProcAddress(@libvlc_media_player_get_chapter , 'libvlc_media_player_get_chapter');
GetAProcAddress(@libvlc_media_player_get_chapter_count , 'libvlc_media_player_get_chapter_count');
GetAProcAddress(@libvlc_media_player_will_play , 'libvlc_media_player_will_play');
GetAProcAddress(@libvlc_media_player_get_chapter_count_for_title , 'libvlc_media_player_get_chapter_count_for_title');
GetAProcAddress(@libvlc_media_player_set_title , 'libvlc_media_player_set_title');
GetAProcAddress(@libvlc_media_player_get_title , 'libvlc_media_player_get_title');
GetAProcAddress(@libvlc_media_player_get_title_count , 'libvlc_media_player_get_title_count');
GetAProcAddress(@libvlc_media_player_previous_chapter , 'libvlc_media_player_previous_chapter');
GetAProcAddress(@libvlc_media_player_next_chapter , 'libvlc_media_player_next_chapter');
GetAProcAddress(@libvlc_media_player_get_rate , 'libvlc_media_player_get_rate');
GetAProcAddress(@libvlc_media_player_set_rate , 'libvlc_media_player_set_rate');
GetAProcAddress(@libvlc_media_player_get_state , 'libvlc_media_player_get_state');
GetAProcAddress(@libvlc_media_player_get_fps , 'libvlc_media_player_get_fps');
GetAProcAddress(@libvlc_media_player_has_vout , 'libvlc_media_player_has_vout');
GetAProcAddress(@libvlc_media_player_is_seekable , 'libvlc_media_player_is_seekable');
GetAProcAddress(@libvlc_media_player_can_pause , 'libvlc_media_player_can_pause');
GetAProcAddress(@libvlc_track_description_release , 'libvlc_track_description_release');
GetAProcAddress(@libvlc_toggle_fullscreen , 'libvlc_toggle_fullscreen');
GetAProcAddress(@libvlc_set_fullscreen , 'libvlc_set_fullscreen');
GetAProcAddress(@libvlc_get_fullscreen , 'libvlc_get_fullscreen');
GetAProcAddress(@libvlc_video_set_deinterlace , 'libvlc_video_set_deinterlace');
GetAProcAddress(@libvlc_video_set_key_input , 'libvlc_video_set_key_input');
GetAProcAddress(@libvlc_video_set_mouse_input , 'libvlc_video_set_mouse_input');
GetAProcAddress(@libvlc_video_get_size , 'libvlc_video_get_size');
GetAProcAddress(@libvlc_video_get_cursor , 'libvlc_video_get_cursor');
GetAProcAddress(@libvlc_video_get_height , 'libvlc_video_get_height');
GetAProcAddress(@libvlc_video_get_width , 'libvlc_video_get_width');
GetAProcAddress(@libvlc_video_get_scale , 'libvlc_video_get_scale');
GetAProcAddress(@libvlc_video_set_scale , 'libvlc_video_set_scale');
GetAProcAddress(@libvlc_video_get_aspect_ratio , 'libvlc_video_get_aspect_ratio');
GetAProcAddress(@libvlc_video_set_aspect_ratio , 'libvlc_video_set_aspect_ratio');
GetAProcAddress(@libvlc_video_get_spu , 'libvlc_video_get_spu');
GetAProcAddress(@libvlc_video_get_spu_count , 'libvlc_video_get_spu_count');
GetAProcAddress(@libvlc_video_get_spu_description , 'libvlc_video_get_spu_description');
GetAProcAddress(@libvlc_video_set_spu , 'libvlc_video_set_spu');
GetAProcAddress(@libvlc_video_set_subtitle_file , 'libvlc_video_set_subtitle_file');
GetAProcAddress(@libvlc_video_get_title_description , 'libvlc_video_get_title_description');
GetAProcAddress(@libvlc_video_get_chapter_description , 'libvlc_video_get_chapter_description');
GetAProcAddress(@libvlc_video_get_crop_geometry , 'libvlc_video_get_crop_geometry');
GetAProcAddress(@libvlc_video_set_crop_geometry , 'libvlc_video_set_crop_geometry');
GetAProcAddress(@libvlc_toggle_teletext , 'libvlc_toggle_teletext');
GetAProcAddress(@libvlc_video_get_teletext , 'libvlc_video_get_teletext');
GetAProcAddress(@libvlc_video_set_teletext , 'libvlc_video_set_teletext');
GetAProcAddress(@libvlc_video_get_track_count , 'libvlc_video_get_track_count');
GetAProcAddress(@libvlc_video_get_track_description , 'libvlc_video_get_track_description');
GetAProcAddress(@libvlc_video_get_track , 'libvlc_video_get_track');
GetAProcAddress(@libvlc_video_set_track , 'libvlc_video_set_track');
GetAProcAddress(@libvlc_video_take_snapshot , 'libvlc_video_take_snapshot');
GetAProcAddress(@libvlc_audio_output_list_get , 'libvlc_audio_output_list_get');
GetAProcAddress(@libvlc_audio_output_list_release , 'libvlc_audio_output_list_release');
GetAProcAddress(@libvlc_audio_output_set , 'libvlc_audio_output_set');
GetAProcAddress(@libvlc_audio_output_device_count , 'libvlc_audio_output_device_count');
GetAProcAddress(@libvlc_audio_output_device_longname , 'libvlc_audio_output_device_longname');
GetAProcAddress(@libvlc_audio_output_device_id , 'libvlc_audio_output_device_id');
GetAProcAddress(@libvlc_audio_output_device_set , 'libvlc_audio_output_device_set');
GetAProcAddress(@libvlc_audio_output_get_device_type , 'libvlc_audio_output_get_device_type');
GetAProcAddress(@libvlc_audio_output_set_device_type , 'libvlc_audio_output_set_device_type');
GetAProcAddress(@libvlc_audio_toggle_mute , 'libvlc_audio_toggle_mute');
GetAProcAddress(@libvlc_audio_get_mute , 'libvlc_audio_get_mute');
GetAProcAddress(@libvlc_audio_set_mute , 'libvlc_audio_set_mute');
GetAProcAddress(@libvlc_audio_get_volume , 'libvlc_audio_get_volume');
GetAProcAddress(@libvlc_audio_set_volume , 'libvlc_audio_set_volume');
GetAProcAddress(@libvlc_audio_get_track_count , 'libvlc_audio_get_track_count');
GetAProcAddress(@libvlc_audio_get_track_description , 'libvlc_audio_get_track_description');
GetAProcAddress(@libvlc_audio_get_track , 'libvlc_audio_get_track');
GetAProcAddress(@libvlc_audio_set_track , 'libvlc_audio_set_track');
GetAProcAddress(@libvlc_audio_get_channel , 'libvlc_audio_get_channel');
GetAProcAddress(@libvlc_audio_set_channel , 'libvlc_audio_set_channel');
GetAProcAddress(@libvlc_media_list_player_new , 'libvlc_media_list_player_new');
GetAProcAddress(@libvlc_media_list_player_release , 'libvlc_media_list_player_release');
GetAProcAddress(@libvlc_media_list_player_set_media_player , 'libvlc_media_list_player_set_media_player');
GetAProcAddress(@libvlc_media_list_player_set_media_list , 'libvlc_media_list_player_set_media_list');
GetAProcAddress(@libvlc_media_list_player_play , 'libvlc_media_list_player_play');
GetAProcAddress(@libvlc_media_list_player_pause , 'libvlc_media_list_player_pause');
GetAProcAddress(@libvlc_media_list_player_is_playing , 'libvlc_media_list_player_is_playing');
GetAProcAddress(@libvlc_media_list_player_get_state , 'libvlc_media_list_player_get_state');
GetAProcAddress(@libvlc_media_list_player_play_item_at_index , 'libvlc_media_list_player_play_item_at_index');
GetAProcAddress(@libvlc_media_list_player_play_item , 'libvlc_media_list_player_play_item');
GetAProcAddress(@libvlc_media_list_player_stop , 'libvlc_media_list_player_stop');
GetAProcAddress(@libvlc_media_list_player_next , 'libvlc_media_list_player_next');
GetAProcAddress(@libvlc_media_discoverer_new_from_name , 'libvlc_media_discoverer_new_from_name');
GetAProcAddress(@libvlc_media_discoverer_release , 'libvlc_media_discoverer_release');
GetAProcAddress(@libvlc_media_discoverer_localized_name , 'libvlc_media_discoverer_localized_name');
GetAProcAddress(@libvlc_media_discoverer_media_list , 'libvlc_media_discoverer_media_list');
GetAProcAddress(@libvlc_media_discoverer_event_manager , 'libvlc_media_discoverer_event_manager');
GetAProcAddress(@libvlc_media_discoverer_is_running , 'libvlc_media_discoverer_is_running');
GetAProcAddress(@libvlc_vlm_release , 'libvlc_vlm_release');
GetAProcAddress(@libvlc_vlm_add_broadcast , 'libvlc_vlm_add_broadcast');
GetAProcAddress(@libvlc_vlm_add_vod , 'libvlc_vlm_add_vod');
GetAProcAddress(@libvlc_vlm_del_media , 'libvlc_vlm_del_media');
GetAProcAddress(@libvlc_vlm_set_enabled , 'libvlc_vlm_set_enabled');
GetAProcAddress(@libvlc_vlm_set_output , 'libvlc_vlm_set_output');
GetAProcAddress(@libvlc_vlm_set_input , 'libvlc_vlm_set_input');
GetAProcAddress(@libvlc_vlm_add_input , 'libvlc_vlm_add_input');
GetAProcAddress(@libvlc_vlm_set_loop , 'libvlc_vlm_set_loop');
GetAProcAddress(@libvlc_vlm_set_mux , 'libvlc_vlm_set_mux');
GetAProcAddress(@libvlc_vlm_change_media , 'libvlc_vlm_change_media');
GetAProcAddress(@libvlc_vlm_play_media , 'libvlc_vlm_play_media');
GetAProcAddress(@libvlc_vlm_stop_media , 'libvlc_vlm_stop_media');
GetAProcAddress(@libvlc_vlm_pause_media , 'libvlc_vlm_pause_media');
GetAProcAddress(@libvlc_vlm_seek_media , 'libvlc_vlm_seek_media');
GetAProcAddress(@libvlc_vlm_show_media , 'libvlc_vlm_show_media');
GetAProcAddress(@libvlc_vlm_get_media_instance_position , 'libvlc_vlm_get_media_instance_position');
GetAProcAddress(@libvlc_vlm_get_media_instance_time , 'libvlc_vlm_get_media_instance_time');
GetAProcAddress(@libvlc_vlm_get_media_instance_length , 'libvlc_vlm_get_media_instance_length');
GetAProcAddress(@libvlc_vlm_get_media_instance_rate , 'libvlc_vlm_get_media_instance_rate');
// GetAProcAddress(@libvlc_vlm_get_media_instance_title , 'libvlc_vlm_get_media_instance_title');
// GetAProcAddress(@libvlc_vlm_get_media_instance_chapter , 'libvlc_vlm_get_media_instance_chapter');
// GetAProcAddress(@libvlc_vlm_get_media_instance_seekable , 'libvlc_vlm_get_media_instance_seekable');
if FLastError = -1 then begin
raise Exception.Create('libvlc function error!');
end
else begin
// set internal version only, e.g. 1.1.0
FVersion := Copy(VLC_GetVersion(), 1, 5);
end;
end;
procedure TLibVLC.VLC_Pause;
begin
if Assigned(FPlayer) then
libvlc_media_player_pause(FPlayer);
end;
procedure TLibVLC.VLC_Play;
var
i : Integer;
// Pevent_manager : Plibvlc_event_manager_t;
begin
// if Assigned(FMedia) then
// libvlc_media_release(FMedia);
// if Assigned(FPlayer) then
// libvlc_media_player_release(FPlayer);
if not Assigned(FMedia) then
FMedia := libvlc_media_new_location(FLib, PAnsiChar(AnsiString(FMediaURL)));
for i := 0 to FMediaOpt.Count-1 do begin
libvlc_media_add_option(FMedia, PChar(FMediaOpt.Strings[i]));
end;
if not Assigned(FPlayer) then
FPlayer := libvlc_media_player_new_from_media(FMedia);
// libvlc_media_release(FMedia); // could be released, but needed for VLC_GetStats()
if Assigned(FPnlOutput) then
libvlc_media_player_set_hwnd(FPlayer, Pointer(FPnlOutput.Handle));
// libvlc_video_set_mouse_input(FPlayer, 0);
// VLC.Lib.libvlc_video_set_key_input(FPlayer, 1);
// Events
(* Pevent_manager := libvlc_media_player_event_manager(FPlayer);
libvlc_event_attach(Pevent_manager,
libvlc_MediaPlayerPlaying,
FCallback,
Pointer(Self));
*)
libvlc_media_player_play(FPlayer);
end;
procedure TLibVLC.VLC_Stop;
begin
if not Assigned(FPlayer) then
exit;
libvlc_media_player_stop(FPlayer);
Delay(300); // stopping time, too fast is not good
// media_player mu? freigegeben werden, damit Panel schwarz wird!!!
// libvlc_media_player_release(FPlayer);
// FPlayer := nil;
// damit neu initialisiert werden kann
// libvlc_media_release(FMedia);
// FMedia := nil;
end;
procedure TLibVLC.VLC_ToggleFullscreen(Panel: TPanel);
begin
if not Assigned(FPnlOutput) then
exit;
if FFullscreen then begin
FFormFS.Hide;
SetAParent(Panel.Handle, Panel.Parent.Handle, Screen.height, Screen.Width);
Panel.Top := FOldPanTop;
Panel.Left := FOldPanLeft;
Panel.Height := FOldPanHeight;
Panel.Width := FOldPanWidth;
FFullscreen := false;
end
else begin
FOldPanTop := Panel.Top;
FOldPanLeft := Panel.Left;
FOldPanHeight := Panel.Height;
FOldPanWidth := Panel.Width;
SetAParent(Panel.Handle, FFormFS.Handle, Screen.height, Screen.Width);
Panel.Top := 0;
Panel.Left := 0;
Panel.Height := Screen.height;
Panel.Width := Screen.width;
FFormFS.Show;
FFormFS.BringToFront;
FFullscreen := true;
end;
end;
function TLibVLC.GetAProcAddress(var Addr: Pointer; Name: PChar): Integer;
begin
Addr := GetProcAddress(FDLLHandle, Name);
if (Addr <> nil) then
Result := 0
else begin
raise Exception.Create(Name);
FLastError := -1;
end;
end;
function TLibVLC.VLC_GetStats: libvlc_media_stats_t;
begin
if not Assigned(FPlayer) then
exit;
if Assigned(FMedia) and (libvlc_media_player_is_playing(FPlayer) = 1) then
libvlc_media_get_stats(FMedia, @FStats);
Result := FStats;
end;
function TLibVLC.SetAParent(hWndChild, hWndNewParent: HWND; NewParentWidth, NewParentHeight: integer): boolean;
var
hWndPrevParent: HWND;
begin
hWndPrevParent := Windows.SetParent(hWndChild, hWndNewParent);
if hWndPrevParent = 0 then
Result := false
else
Result := true;
end;
procedure TLibVLC.VLC_SetAudioTrack(iTrack: Integer);
begin
if not Assigned(FPlayer) then
exit;
libvlc_audio_set_track(FPlayer, iTrack);
end;
function TLibVLC.VLC_GetAudioTrack: Integer;
begin
Result := -1;
if not Assigned(FPlayer) then
exit;
Result := libvlc_audio_get_track(FPlayer);
end;
procedure TLibVLC.VLC_TakeSnapshot(Path: String; width, height : Integer);
begin
if not Assigned(FPlayer) then
exit;
if not Assigned(FPnlOutput) then
exit;
libvlc_video_take_snapshot(FPlayer, 0, PChar(Path), width, height);
end;
procedure TLibVLC.VLC_SetDeinterlaceMode(Mode: String);
begin
if not Assigned(FPlayer) then
exit;
if not Assigned(FPnlOutput) then
exit;
libvlc_video_set_deinterlace(FPlayer, PChar(Mode));
end;
function TLibVLC.VLC_IsPlaying: Boolean;
begin
Result := false;
if not Assigned(FPlayer) then
exit;
if libvlc_media_player_is_playing(FPlayer) = 1 then
Result := true
else
Result := false;
end;
procedure TLibVLC.VLC_SetCropMode(Mode: String);
begin
if not Assigned(FPlayer) then
exit;
libvlc_video_set_crop_geometry(FPlayer, PChar(Mode));
end;
procedure TLibVLC.VLC_SetARMode(Mode: String);
begin
if not Assigned(FPlayer) then
exit;
libvlc_video_set_aspect_ratio(FPlayer, PChar(Mode));
end;
procedure TLibVLC.VLC_ToggleMute;
begin
if not Assigned(FPlayer) then
exit;
libvlc_audio_toggle_mute(FPlayer);
end;
procedure TLibVLC.VLC_SetVolume (Level : Integer);
begin
if not Assigned(FPlayer) then
exit;
libvlc_audio_set_volume(FPlayer, Level);
end;
constructor TLibVLC.Create(InstName, DLL: String; Params: array of PAnsiChar; LogLevel: Integer; PnlOutput: TPanel; Callback : libvlc_callback_t);
begin
if (DLL = '') or (DLL = 'libvlc.dll') then
DLL := VLC_GetLibPath+'libvlc.dll';
// load libvlccore.dll (well, only needed if vlc is in a diffrent folder then the application)
FDllHandle := LoadLibrary(PChar(ExtractFilePath(DLL)+'libvlccore.dll'));
// load libvlc.dll
FDllHandle := LoadLibrary(PChar(DLL));
// name
FName := InstName;
// fullscreen
FFullscreen := false;
FFormFS := TForm.Create(nil);
FFormFS.BorderStyle := bsNone;
FFormFS.Width := Screen.Width;
FFormFS.Height := Screen.Height;
FFormFS.Top := 0;
FFormFS.Left := 0;
//output
FPnlOutput := PnlOutput;
// callback
FCallback := Callback;
if FDllHandle = 0 then
raise Exception.Create('load library failed!');
LoadFunctions;
// init libvlc instance
FLib := libvlc_new(Length(Params), @Params[0]);
// init logging
libvlc_set_log_verbosity(FLib, LogLevel);
FLog := libvlc_log_open(FLib);
end;
procedure TLibVLC.VLC_SetPlayer(MediaURL: String; MediaOptions : TStringList);
begin
// media
FMediaURL := MediaURL;
FMediaOpt := MediaOptions;
// wird in Play() jedesmal neu erzeugt, notwendig???
end;
function TLibVLC.VLC_GetVersion: String;
begin
Result := libvlc_get_version();
end;
function TLibVLC.VLC_GetVolume: Integer;
begin
Result := -1;
if not Assigned(FPlayer) then
exit;
Result := libvlc_audio_get_volume(FPlayer);
end;
function TLibVLC.VLC_GetLibPath: String;
var
Handle:HKEY;
RegType:integer;
DataSize:integer;
begin
Result := '';
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,'Software\VideoLAN\VLC',0,KEY_ALL_ACCESS,Handle)=ERROR_SUCCESS) then begin
if RegQueryValueEx(Handle,'InstallDir',nil,@RegType,nil,@DataSize)=ERROR_SUCCESS then begin
SetLength(Result,Datasize);
RegQueryValueEx(Handle,'InstallDir',nil,@RegType,PByte(@Result[1]),@DataSize);
Result[DataSize]:='\';
end;
RegCloseKey(Handle);
end;
end;
end.