Difference between revisions of "Talk:ExternalAPI"
(→autogeneration?: link to a fast gnerated one) |
(Delphi port) |
||
Line 29: | Line 29: | ||
It is possible to have a look to the doxygen [http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc.html autogenerated documentation] to have up-to-date names extracted from the source code. Copy as text the first part (summary docs), paste into a file, then apply a <code>grep -v '^ '</code> on this file and you will have a quite good listing of its API. [[User:Thannoy/stripped_Libvlc_API| Here]] is a fast (not perfect) generation. --[[User:Thannoy|Thannoy]] 11:29, 1 March 2008 (CET) | It is possible to have a look to the doxygen [http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc.html autogenerated documentation] to have up-to-date names extracted from the source code. Copy as text the first part (summary docs), paste into a file, then apply a <code>grep -v '^ '</code> on this file and you will have a quite good listing of its API. [[User:Thannoy/stripped_Libvlc_API| Here]] is a fast (not perfect) generation. --[[User:Thannoy|Thannoy]] 11:29, 1 March 2008 (CET) | ||
+ | |||
+ | == Delphi port == | ||
+ | VLC API as changed a lot seens I've made the Delphi port...but there's no up to date documentation of the new API so I will not update my code...in fact, I've tried with last release (0.9.9) with both this Wiki and doxygen, but libvlc_new() just hang the application after some debug messages. | ||
+ | |||
+ | <pre> | ||
+ | program VLC99; | ||
+ | |||
+ | {$APPTYPE CONSOLE} | ||
+ | |||
+ | uses | ||
+ | Windows; | ||
+ | |||
+ | function 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; | ||
+ | |||
+ | type | ||
+ | libvlc_exception = record | ||
+ | raised : Integer; | ||
+ | code : Integer; | ||
+ | Msg : PChar; | ||
+ | end; | ||
+ | |||
+ | var | ||
+ | path : string; | ||
+ | lib : THandle; | ||
+ | core : THandle; | ||
+ | init : function(argc: Integer; args: PPChar; var excpt: libvlc_exception): Pointer; cdecl; | ||
+ | args : array[0..1] of PChar; | ||
+ | plugins : string; | ||
+ | excpt : libvlc_exception; | ||
+ | vlc : Pointer; | ||
+ | begin | ||
+ | path := getLibPath; | ||
+ | // load core dll first | ||
+ | core := LoadLibrary(PChar(path + 'libvlccore.dll')); | ||
+ | if core = 0 then | ||
+ | WriteLn('can''t load libvlccore'); | ||
+ | lib := LoadLibrary(PChar(path + 'libvlc.dll')); | ||
+ | if lib = 0 then | ||
+ | WriteLn('can''t load libvlc'); | ||
+ | @init := GetProcAddress(lib, 'libvlc_new'); | ||
+ | if @init = nil then | ||
+ | WriteLn('can''t find libvlc_new()') | ||
+ | else | ||
+ | begin | ||
+ | FillChar(excpt, SizeOf(excpt), 0); | ||
+ | plugins := '--plugin-path=' + path + 'plugins'; | ||
+ | args[0] := PChar(plugins); | ||
+ | args[1] := nil; | ||
+ | vlc := init(1, @args[0], excpt); | ||
+ | WriteLn('never executed !'); // :( | ||
+ | end; | ||
+ | WriteLn('done'); | ||
+ | ReadLn; | ||
+ | end. | ||
+ | </pre> | ||
+ | just display this and never return to the calling delphi application : | ||
+ | <pre> | ||
+ | [00000001] main libvlc debug: VLC media player - version 0.9.9 Grishenko - (c) 1 | ||
+ | 996-2009 the VideoLAN team | ||
+ | [00000001] main libvlc debug: libvlc was configured with ../configure '--host=i | ||
+ | 586-mingw32msvc' '--build=i386-linux' '--enable-mkv' '--enable-release' '--witho | ||
+ | ut-contrib' '--enable-nls' '--enable-shared-libvlc' '--enable-update-check' '--e | ||
+ | nable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' | ||
+ | '--enable-quicktime' '--enable-real' '--enable-realrtsp' '--enable-ffmpeg' '--wi | ||
+ | th-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-config-path=/usr/win32/bi | ||
+ | n' '--with-ffmpeg-zlib' '--enable-live555' '--with-live555-tree=/usr/win32/live. | ||
+ | com' '--en | ||
+ | [00000001] main libvlc debug: translation test: code is "C" | ||
+ | </pre> | ||
+ | |||
+ | --[[User:PaulTOTH|PaulTOTH]] 20:38, 3 May 2009 (CEST) |
Revision as of 18:38, 3 May 2009
Comments
Exception
A "libvcl_exception * libvlc_exception_create(void)" function should be great. Actualy, the API let use an opaque exception structure but you need to know the structure size anyway !
Vout
toggle_fullscreen() is useless from an embedder point of view: if I am writing an application, I need to set the movie fullscreen or not. Which makes me think that the same reasoning should apply to audio_mute: we should rather have set_mute/get_mute: the status of mute is of interest for an application developer.
Zorglub Yes. I was thinking about actually putting both options for simplicity.
OlivierAubert Both options can be a little redundant, but it does not cost much anyway.
Playlist
Zorglub I don't really know how to handle playlist retrieval as VLC playlist is not a simple list ...
OlivierAubert Yes, but it is a needed functionality anyway. We can defined a flattened view of the playlist, which will not exactly map to the playlist but be a reasonable view.
VLM
Dionoea Something like libvlc_vlm_cmd( libvlc_instance *, char *cmd, libvlc_exception ) could be usefull. This would let the enduser do whatever he wants with vlm easily.
autogeneration?
I have been cutting and pasting out of this page into my code, and a number of the function names and arguments are slightly wrong. I have corrected a few. Is there a way to autogenerate *just* these API calls out of the sources? Davidlallen 22:57, 20 August 2007 (CEST)
It is possible to have a look to the doxygen autogenerated documentation to have up-to-date names extracted from the source code. Copy as text the first part (summary docs), paste into a file, then apply a grep -v '^ '
on this file and you will have a quite good listing of its API. Here is a fast (not perfect) generation. --Thannoy 11:29, 1 March 2008 (CET)
Delphi port
VLC API as changed a lot seens I've made the Delphi port...but there's no up to date documentation of the new API so I will not update my code...in fact, I've tried with last release (0.9.9) with both this Wiki and doxygen, but libvlc_new() just hang the application after some debug messages.
program VLC99; {$APPTYPE CONSOLE} uses Windows; function 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; type libvlc_exception = record raised : Integer; code : Integer; Msg : PChar; end; var path : string; lib : THandle; core : THandle; init : function(argc: Integer; args: PPChar; var excpt: libvlc_exception): Pointer; cdecl; args : array[0..1] of PChar; plugins : string; excpt : libvlc_exception; vlc : Pointer; begin path := getLibPath; // load core dll first core := LoadLibrary(PChar(path + 'libvlccore.dll')); if core = 0 then WriteLn('can''t load libvlccore'); lib := LoadLibrary(PChar(path + 'libvlc.dll')); if lib = 0 then WriteLn('can''t load libvlc'); @init := GetProcAddress(lib, 'libvlc_new'); if @init = nil then WriteLn('can''t find libvlc_new()') else begin FillChar(excpt, SizeOf(excpt), 0); plugins := '--plugin-path=' + path + 'plugins'; args[0] := PChar(plugins); args[1] := nil; vlc := init(1, @args[0], excpt); WriteLn('never executed !'); // :( end; WriteLn('done'); ReadLn; end.
just display this and never return to the calling delphi application :
[00000001] main libvlc debug: VLC media player - version 0.9.9 Grishenko - (c) 1 996-2009 the VideoLAN team [00000001] main libvlc debug: libvlc was configured with ../configure '--host=i 586-mingw32msvc' '--build=i386-linux' '--enable-mkv' '--enable-release' '--witho ut-contrib' '--enable-nls' '--enable-shared-libvlc' '--enable-update-check' '--e nable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-real' '--enable-realrtsp' '--enable-ffmpeg' '--wi th-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-config-path=/usr/win32/bi n' '--with-ffmpeg-zlib' '--enable-live555' '--with-live555-tree=/usr/win32/live. com' '--en [00000001] main libvlc debug: translation test: code is "C"
--PaulTOTH 20:38, 3 May 2009 (CEST)