AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi ActiveX-Komponente von "VideoLAN" nutzbar
Thema durchsuchen
Ansicht
Themen-Optionen

ActiveX-Komponente von "VideoLAN" nutzbar

Ein Thema von DXler · begonnen am 28. Nov 2005 · letzter Beitrag vom 8. Mai 2009
Antwort Antwort
Seite 2 von 2     12   
Troelli

Registriert seit: 1. Mai 2003
15 Beiträge
 
Delphi 7 Enterprise
 
#11

Re: ActiveX-Komponente von "VideoLAN" nutzbar

  Alt 11. Dez 2008, 19:56
Sonst Versuche es doch mal mit dem Wrapper ...



Delphi-Quellcode:
unit libVLC;


{ VideoLAN libvcl.dll (0.8.6b) Interface for Delphi (c)2007 by Paul TOTH
  - Modified by Keypad    libvcl.dll (0.9.2)                       }


// [url]http://wiki.videolan.org/ExternalAPI#VLC_Control[/url]

interface
uses Dialogs, sysutils, forms;

const
 LibName = 'libvlc.dll';


// Structures
type
  libvlc_exception= record
    Code : integer;
    Message : pchar;
end;

type
  libvlc_playlist_item= record
    itemid : integer;
    itemurl : pchar;
    itemname : pchar
end;

 libvlc_media_discoverer = pointer;
 libvlc_media_list = pointer;
 libvlc_media_list_player = pointer;
 libvlc_media_player = pointer;
 libvlc_media = pointer;
 libvlc_instance = pointer;
 libvlc_input = pointer;
 libvlc_time = integer;
 libvlc_state = integer;

{$IFDEF STATIC}

// Core
function libvlc_new(argc:integer; args:ppchar; var exception:libvlc_exception):libvlc_instance; cdecl external lib;
procedure libvlc_exception_clear(var exception:libvlc_exception); cdecl external lib;
procedure libvlc_release(vlc:libvlc_instance); cdecl external lib;

// Media
function libvlc_media_new(vlc: libvlc_instance; var mrl : pchar; var exception:libvlc_exception):libvlc_media;cdecl external lib;
procedure libvlc_media_release(media : libvlc_media); cdecl external lib;
function libvlc_media_add_option(media : libvlc_media; var options : pchar; var exception:libvlc_exception):integer; cdecl external lib;
function libvlc_media_subitems(media : libvlc_media; var exception:libvlc_exception) : libvlc_media_list; cdecl external lib;
function libvlc_media_player_get_media(mediaplayer: libvlc_media_player; var exception:libvlc_exception) : libvlc_media; cdecl external lib;
function libvlc_media_get_mrl(media : libvlc_media; var exception:libvlc_exception) : string; cdecl external lib;

// Media player
procedure libvlc_media_player_play(mediaplayer: libvlc_media_player;var exception:libvlc_exception); cdecl external lib;
procedure libvlc_media_player_release(mediaplayer : libvlc_media_player); cdecl external lib;
function libvlc_media_player_new_from_media(media: libvlc_media;var exception:libvlc_exception): libvlc_media_player; cdecl external lib;
function libvlc_media_player_new(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_player;cdecl external lib;
function libvlc_media_player_get_length(mediaplayer : libvlc_media_player; var exception : libvlc_exception):int64;cdecl external lib;
function libvlc_media_player_get_time(mediaplayer : libvlc_media_player; var exception : libvlc_exception):int64;cdecl external lib;
function libvlc_media_player_get_position(mediaplayer : libvlc_media_player; var exception : libvlc_exception):single;cdecl external lib;
function libvlc_media_player_stop(mediaplayer: libvlc_media_player;var exception:libvlc_exception);cdecl external lib;
function libvlc_media_player_pause(mediaplayer: libvlc_media_player;var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_player_set_position(mediaplayer : libvlc_media_player; position : single; var exception : libvlc_exception);cdecl external lib;
procedure libvlc_media_player_set_time(mediaplayer : libvlc_media_player; timeset : libvlc_time; var exception : libvlc_exception): int64;cdecl external lib;
function libvlc_media_player_get_state(mediaplayer : libvlc_media_player;var exception : libvlc_exception): libvlc_state;cdecl external lib;
function libvlc_media_player_has_vout(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl external lib;
function libvlc_media_player_is_seekable(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl external lib;
function libvlc_media_player_get_rate(mediaplayer : libvlc_media_player;var exception : libvlc_exception): single;cdecl external lib;
function libvlc_media_player_set_rate(mediaplayer : libvlc_media_player; speed: single; var exception : libvlc_exception): int64;cdecl external lib;
function libvlc_media_player_get_chapter_count(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl external lib;
function libvlc_media_player_retain(mediaplayer : libvlc_media_player): int64;cdecl external lib;
// Media List Player
function libvlc_media_list_player_new(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_list_player;cdecl external lib;
procedure libvlc_media_list_player_release(medialistplayer :libvlc_media_list_player);cdecl external lib;
procedure libvlc_media_list_player_set_media_player(medialistplayer :libvlc_media_list_player; mediaplayer : libvlc_media_player; var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_list_player_play(medialistplayer :libvlc_media_list_player; var exception:libvlc_exception);cdecl external lib;
function libvlc_media_list_new(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_list;cdecl external lib;
procedure libvlc_media_list_add_file_content(medialist: libvlc_media_list; filename : pchar; var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_list_player_set_media_list(medialistplayer :libvlc_media_list_player;medialist: libvlc_media_list;var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_list_player_next(medialistplayer :libvlc_media_list_player;var exception:libvlc_exception);cdecl external lib;
function libvlc_media_list_count(medialist: libvlc_media_list;var exception:libvlc_exception):int64;cdecl external lib;
function libvlc_media_discoverer_new_from_name(vlc: libvlc_instance; filename : pchar; var exception:libvlc_exception):libvlc_media_discoverer;cdecl external lib;
function libvlc_media_discoverer_media_list(mediadiscoverer: libvlc_media_discoverer;var exception:libvlc_exception) : libvlc_media_list;cdecl external lib;
procedure libvlc_media_list_add_media(medialist: libvlc_media_list; media : libvlc_media; var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_list_lock(medialist: libvlc_media_list);cdecl external lib;
procedure libvlc_media_list_player_play_item_at_index(medialistplayer :libvlc_media_list_player; numeroindex : integer;var exception:libvlc_exception);cdecl external lib;
procedure libvlc_media_list_unlock(medialist: libvlc_media_list);cdecl external lib;
procedure libvlc_media_list_release(medialist: libvlc_media_list);cdecl external lib;

// Playlist
function libvlc_playlist_add(vlc:libvlc_instance; fileName,name:pchar; var exception:libvlc_exception):integer; cdecl external lib;
function libvlc_playlist_add_extended(vlc:libvlc_instance; fileName,name:pchar; optCount:integer; opts:ppchar; var exception:libvlc_exception):integer; cdecl external lib;
procedure libvlc_playlist_clear(vlc:libvlc_instance; var exception:libvlc_exception); cdecl external lib;
function libvlc_playlist_items_count(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl external lib;
function libvlc_playlist_isplaying(vlc:libvlc_instance; var exception:libvlc_exception):longbool; cdecl external lib;
procedure libvlc_playlist_play(vlc:libvlc_instance; index,optCount:integer; opts:ppchar; var exception:libvlc_exception); cdecl external lib;
procedure libvlc_playlist_pause(vlc:libvlc_instance; var exception:libvlc_exception); cdecl external lib;
procedure libvlc_playlist_stop(vlc:libvlc_instance; var exception:libvlc_exception); cdecl external lib;
procedure libvlc_playlist_next(vlc:libvlc_instance; var exception:libvlc_exception); cdecl external lib;
procedure libvlc_playlist_prev(vlc:libvlc_instance; var exception:libvlc_exception); cdecl external lib;
function libvlc_playlist_get_input(vlc:libvlc_instance; var exception:libvlc_exception):libvlc_input; cdecl external lib;
function libvlc_playlist_get_media_player(vlc:libvlc_instance; var exception:libvlc_exception):libvlc_media_player; cdecl external lib;
//function libvlc_playlist_get_current_index(vlc:libvlc_instance; var exception:libvlc_exception):int64; cdecl external lib;
function libvlc_playlist_get_current_index(vlc:libvlc_instance; var exception:libvlc_exception):int64; cdecl external lib;

procedure libvlc_playlist_lock(vlc:libvlc_instance); cdecl external lib;
procedure libvlc_playlist_unlock(vlc:libvlc_instance); cdecl external lib;

// Input
procedure libvlc_input_free(input:libvlc_input); cdecl external lib;
procedure libvlc_toggle_fullscreen(input:libvlc_input; var exception:libvlc_exception); cdecl external lib;

// Video
function libvlc_video_get_width(input:libvlc_input; var exception:libvlc_exception):integer; cdecl external lib;
function libvlc_video_get_height(input:libvlc_input; var exception:libvlc_exception):integer; cdecl external lib;
procedure libvlc_set_fullscreen(mediaplayer : libvlc_media_player; fullscreen : integer; var exception:libvlc_exception); cdecl external lib;
function libvlc_get_fullscreen(mediaplayer : libvlc_media_player; var exception:libvlc_exception): integer; cdecl external lib;
procedure libvlc_video_take_snapshot(mediaplayer : libvlc_media_player; filepath : pchar; var width : integer; var height : integer;var exception:libvlc_exception); cdecl external lib;

// Audio
function libvlc_audio_get_mute(vlc:libvlc_instance; var exception:libvlc_exception):longbool; cdecl external lib;
procedure libvlc_audio_set_mute(vlc:libvlc_instance; mute:longbool; var exception:libvlc_exception); cdecl external lib;
function libvlc_audio_get_volume(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl external lib;
procedure libvlc_audio_set_volume(vlc:libvlc_instance; volume:integer; var exception:libvlc_exception); cdecl external lib;

//Other
procedure libvlc_video_set_parent(vlc:libvlc_instance; libvlc_drawable_t:integer; var exception:libvlc_exception); cdecl external lib;
//function libvlc_video_get_parent(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl external lib;
 {$ELSE}

var

// Core
 libvlc_new:function(argc:integer; args:ppchar; var exception:libvlc_exception):libvlc_instance; cdecl;
 libvlc_exception_clear:procedure(var exception:libvlc_exception); cdecl;
 libvlc_release:procedure(vlc:libvlc_instance); cdecl;

// media
  libvlc_media_new:function(vlc: libvlc_instance; mrl : pchar; var exception:libvlc_exception):libvlc_media;cdecl;
  libvlc_media_release: procedure(media : libvlc_media); cdecl;
  libvlc_media_add_option: function(media : libvlc_media; options : pchar; var exception:libvlc_exception):integer; cdecl;
  libvlc_media_subitems: function(media : libvlc_media; var exception:libvlc_exception) : libvlc_media_list; cdecl;
  libvlc_media_player_get_media: function(mediaplayer: libvlc_media_player; var exception:libvlc_exception) : libvlc_media; cdecl ;
  libvlc_media_get_mrl: function(media : libvlc_media; var exception:libvlc_exception) : string; cdecl ;

// media player
  libvlc_media_player_play: procedure(mediaplayer: libvlc_media_player;var exception:libvlc_exception); cdecl;
  libvlc_media_player_new_from_media : function(media: libvlc_media;var exception:libvlc_exception): libvlc_media_player; cdecl;
  libvlc_media_player_release: procedure(mediaplayer : libvlc_media_player); cdecl;
  libvlc_media_player_new: function(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_player;cdecl;
  libvlc_media_player_get_length: function(mediaplayer : libvlc_media_player; var exception : libvlc_exception):int64;cdecl;
  libvlc_media_player_get_time: function(mediaplayer : libvlc_media_player; var exception : libvlc_exception):int64;cdecl;
  libvlc_media_player_get_position: function(mediaplayer : libvlc_media_player; var exception : libvlc_exception):single;cdecl;
  libvlc_media_player_stop: procedure(mediaplayer: libvlc_media_player;var exception:libvlc_exception); cdecl;
  libvlc_media_player_pause: procedure(mediaplayer: libvlc_media_player;var exception:libvlc_exception); cdecl;
  libvlc_media_player_set_position: procedure(mediaplayer : libvlc_media_player; position : single; var exception : libvlc_exception);cdecl ;
  libvlc_media_player_set_time: procedure(mediaplayer : libvlc_media_player; timeset : libvlc_time; var exception : libvlc_exception);cdecl;
  libvlc_media_player_get_state: function(mediaplayer : libvlc_media_player;var exception : libvlc_exception): libvlc_state;cdecl;
  libvlc_media_player_has_vout: function(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl ;
  libvlc_media_player_is_seekable: function(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl ;
  libvlc_media_player_get_rate: function(mediaplayer : libvlc_media_player;var exception : libvlc_exception): single;cdecl ;
  libvlc_media_player_set_rate: function(mediaplayer : libvlc_media_player; speed: single; var exception : libvlc_exception): int64;cdecl ;
  libvlc_media_player_get_chapter_count: function(mediaplayer : libvlc_media_player;var exception : libvlc_exception): int64;cdecl;
  libvlc_media_player_retain:function(mediaplayer : libvlc_media_player): int64;cdecl;
// media list (ancien playlist)
  libvlc_media_list_player_new: function(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_list_player;cdecl ;
  libvlc_media_list_player_release: procedure(medialistplayer :libvlc_media_list_player);cdecl;
  libvlc_media_list_player_set_media_player: procedure(medialistplayer :libvlc_media_list_player; mediaplayer : libvlc_media_player; var exception:libvlc_exception);cdecl ;
  libvlc_media_list_player_play: procedure(medialistplayer :libvlc_media_list_player; var exception:libvlc_exception);cdecl ;
  libvlc_media_list_new: function(vlc: libvlc_instance; var exception:libvlc_exception):libvlc_media_list;cdecl ;
  libvlc_media_list_add_file_content: procedure(medialist: libvlc_media_list; filename : pchar; var exception:libvlc_exception);cdecl ;
  libvlc_media_list_player_set_media_list : procedure(medialistplayer :libvlc_media_list_player;medialist: libvlc_media_list;var exception:libvlc_exception);cdecl ;
  libvlc_media_list_player_next : procedure(medialistplayer :libvlc_media_list_player;var exception:libvlc_exception);cdecl ;
  libvlc_media_list_count: function(medialist: libvlc_media_list;var exception:libvlc_exception):int64;cdecl ;
  libvlc_media_discoverer_new_from_name: function(vlc: libvlc_instance; filename : pchar; var exception:libvlc_exception):libvlc_media_discoverer;cdecl;
  libvlc_media_discoverer_media_list: function(mediadiscoverer: libvlc_media_discoverer;var exception:libvlc_exception) : libvlc_media_list;cdecl;
  libvlc_media_list_add_media: procedure(medialist: libvlc_media_list; media : libvlc_media; var exception:libvlc_exception);cdecl;
  libvlc_media_list_lock: procedure(medialist: libvlc_media_list);cdecl ;
  libvlc_media_list_player_play_item_at_index: procedure(medialistplayer :libvlc_media_list_player; numeroindex : integer ;var exception:libvlc_exception);cdecl ;
  libvlc_media_list_unlock: procedure(medialist: libvlc_media_list);cdecl ;
  libvlc_media_list_release: procedure(medialist: libvlc_media_list);cdecl ;

// Playlist (deprecated)
 libvlc_playlist_add:function(vlc:libvlc_instance; fileName,name:pchar; var exception:libvlc_exception):integer; cdecl;
 libvlc_playlist_add_extended:function(vlc:libvlc_instance; fileName,name:pchar; optCount:integer; opts:ppchar; var exception:libvlc_exception):integer; cdecl;
 libvlc_playlist_clear:procedure(vlc:libvlc_instance; var exception:libvlc_exception); cdecl;
 libvlc_playlist_items_count:function(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl;
 libvlc_playlist_isplaying:function(vlc:libvlc_instance; var exception:libvlc_exception):longbool; cdecl;
 libvlc_playlist_play:procedure(vlc:libvlc_instance; index,optCount:integer; opts:ppchar; var exception:libvlc_exception); cdecl;
 libvlc_playlist_pause:procedure(vlc:libvlc_instance; var exception:libvlc_exception); cdecl;
 libvlc_playlist_stop:procedure(vlc:libvlc_instance; var exception:libvlc_exception); cdecl;
 libvlc_playlist_next:procedure(vlc:libvlc_instance; var exception:libvlc_exception); cdecl;
 libvlc_playlist_prev:procedure(vlc:libvlc_instance; var exception:libvlc_exception); cdecl;
 libvlc_playlist_get_input:function(vlc:libvlc_instance; var exception:libvlc_exception):libvlc_input; cdecl;
 libvlc_playlist_get_media_player: function(vlc:libvlc_instance; var exception:libvlc_exception):libvlc_media_player; cdecl;
 libvlc_playlist_get_current_index: function(vlc:libvlc_instance; var exception:libvlc_exception):int64; cdecl ;
 libvlc_playlist_lock: procedure(vlc:libvlc_instance); cdecl ;
 libvlc_playlist_unlock: procedure(vlc:libvlc_instance); cdecl ;

// Input (Vout)
 libvlc_input_free:procedure(input:libvlc_input); cdecl;
 libvlc_input_get_length:function(input:libvlc_input; var exception:libvlc_exception):int64; cdecl;
 libvlc_input_get_time:function(input:libvlc_input; var exception:libvlc_exception):Int64; cdecl;
 libvlc_input_get_position:function(input:libvlc_input; var exception:libvlc_exception):Single; cdecl;
 libvlc_toggle_fullscreen:procedure(input:libvlc_input; var exception:libvlc_exception); cdecl;
 libvlc_set_fullscreen: procedure(mediaplayer : libvlc_media_player; fullscreen : integer; var exception:libvlc_exception); cdecl ;
 libvlc_get_fullscreen: function(mediaplayer : libvlc_media_player; var exception:libvlc_exception): integer; cdecl;

// Video
 libvlc_video_get_width:function(input:libvlc_input; var exception:libvlc_exception):integer; cdecl;
 libvlc_video_get_height:function(input:libvlc_input; var exception:libvlc_exception):integer; cdecl;
 libvlc_video_set_parent:procedure(vlc:libvlc_instance; libvlc_drawable_t:integer; var exception:libvlc_exception); cdecl;
 libvlc_video_get_parent:function(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl;
 libvlc_video_set_visual: function(vlc :libvlc_instance; var visual_id: integer;var exception:libvlc_exception):integer; cdecl;
 libvlc_video_take_snapshot: procedure(mediaplayer : libvlc_media_player; filepath : pchar; width : integer; height : integer;var exception:libvlc_exception); cdecl;

// Audio
 libvlc_audio_get_mute:function(vlc:libvlc_instance; var exception:libvlc_exception):longbool; cdecl;
 libvlc_audio_set_mute:procedure(vlc:libvlc_instance; mute:longbool; var exception:libvlc_exception); cdecl;
 libvlc_audio_get_volume:function(vlc:libvlc_instance; var exception:libvlc_exception):integer; cdecl;
 libvlc_audio_set_volume:procedure(vlc:libvlc_instance; volume:integer; var exception:libvlc_exception); cdecl;

//Other

const
  VLD_SUCCESS = 0;
  VLD_NOLIB = -1;
  VLD_NOTFOUND = -2;



// load libvlc.dll (get Install path from registry)
function VLD_LoadLibrary:integer;
// return Install path found in registry by VLD_LoadLibrary
function VLD_LibPath:string;
// return libvlc.dll proc adress
function VLD_GetProcAddress(Name:pchar; var addr:pointer):integer;
// return (and clear) last VLD error
function VLD_LastError:integer;
// load everything (dll & procs) and return last VLD error
function VLD_Startup:integer;

{$ENDIF}

implementation

{$IFNDEF STATIC}

uses
 Windows;
 
var
  LibVLCHandle: THandle = 0;
  LibPath: string;
  LastError: integer = VLD_SUCCESS;
  VLCLibLoaded: boolean = false;


function GetLibPath: boolean;
var
Applikation_Path : string;
 Handle: HKEY;
 RegType: integer;
 DataSize: integer;
begin

  Result := False;
// verifie si libvlc.dll existe
   Applikation_Path := ExtractFilePath(Application.ExeName);

 //if FileExists(racine + 'VLC\libvlc.dll') then
 if FileExists(Applikation_Path + 'libvlc.dll') then
        begin
        result := true;
         libPath := Applikation_Path;
  // libPath := racine + 'VLC\' ;
        end
 else
        begin
        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(LibPath, Datasize);
                        RegQueryValueEx(Handle, 'InstallDir', nil, @RegType, PByte(@LibPath[1]), @DataSize);
                        LibPath[DataSize] := '\';
                        Result := True;
                        end;
                RegCloseKey(Handle);
                end;
        end;
end;

function VLD_LibPath: string;
begin
  if LibPath = 'then
    getLibPath;
  Result := LibPath;
end;

function VLD_LoadLibrary:integer;
begin
if LibVLCHandle=0 then begin
  LibVLCHandle:=LoadLibrary(libname);
  
  if (LibVLCHandle=0)and(getLibPath) then begin
   LibVLCHandle:=LoadLibrary(pchar(libPath+libname));
  end;
 end;
 if LibVLCHandle<>0 then
  Result:=VLD_SUCCESS
 else begin
 {$ifdef console}
  WriteLn(libPath,libname,' not found');
 {$endif}
  lastError:=VLD_NOLIB;
  Result:=lastError;
 end;
  
end;


function VLD_GetProcAddress(Name: PChar; var Addr: Pointer): Integer;
begin
  if LibVLCHandle = 0 then
  begin
    Result := VLD_LoadLibrary;
    if Result <> VLD_SUCCESS then exit;
  end;
  Addr := GetProcAddress(LibVLCHandle, Name);
  if Addr <> nil then
    Result := VLD_SUCCESS
  else
  begin
    LastError := VLD_NOTFOUND;
    Result := LastError;
  end;
end;

function VLD_LastError: Integer;
begin
 Result := LastError;
 LastError := VLD_SUCCESS;
end;

function VLD_Startup: Integer;
begin
  LastError := VLD_SUCCESS;
  if VLD_LoadLibrary = VLD_SUCCESS then
  begin
    VLD_GetProcAddress('libvlc_new', @libvlc_new);
    VLD_GetProcAddress('libvlc_release', @libvlc_release);
    VLD_GetProcAddress('libvlc_exception_clear', @libvlc_exception_clear);
    VLD_GetProcAddress('libvlc_playlist_add', @libvlc_playlist_add);
    VLD_GetProcAddress('libvlc_playlist_add_extended', @libvlc_playlist_add_extended);
    VLD_GetProcAddress('libvlc_playlist_clear', @libvlc_playlist_clear);
    VLD_GetProcAddress('libvlc_playlist_items_count', @libvlc_playlist_items_count);
    VLD_GetProcAddress('libvlc_playlist_isplaying', @libvlc_playlist_isplaying);
    VLD_GetProcAddress('libvlc_playlist_play', @libvlc_playlist_play);
    VLD_GetProcAddress('libvlc_playlist_pause', @libvlc_playlist_pause);
    VLD_GetProcAddress('libvlc_playlist_stop', @libvlc_playlist_stop);
    VLD_GetProcAddress('libvlc_playlist_next', @libvlc_playlist_next);
    VLD_GetProcAddress('libvlc_playlist_prev', @libvlc_playlist_prev);
    VLD_GetProcAddress('libvlc_playlist_lock', @libvlc_playlist_lock);
    VLD_GetProcAddress('libvlc_playlist_unlock', @libvlc_playlist_unlock);
    VLD_GetProcAddress('libvlc_playlist_get_media_player', @libvlc_playlist_get_media_player);
    VLD_GetProcAddress('libvlc_media_new', @libvlc_media_new);
    VLD_GetProcAddress('libvlc_media_get_mrl', @libvlc_media_get_mrl);
    VLD_GetProcAddress('libvlc_media_release', @libvlc_media_release);
    VLD_GetProcAddress('libvlc_media_add_option', @libvlc_media_add_option);
    VLD_GetProcAddress('libvlc_media_player_release', @libvlc_media_player_release);
    VLD_GetProcAddress('libvlc_media_player_new', @libvlc_media_player_new);
    VLD_GetProcAddress('libvlc_media_player_new_from_media', @libvlc_media_player_new_from_media);
    VLD_GetProcAddress('libvlc_media_player_play', @libvlc_media_player_play);
    VLD_GetProcAddress('libvlc_media_player_get_length', @libvlc_media_player_get_length);
    VLD_GetProcAddress('libvlc_media_player_get_time', @libvlc_media_player_get_time);
    VLD_GetProcAddress('libvlc_media_player_get_position', @libvlc_media_player_get_position);
    VLD_GetProcAddress('libvlc_media_player_set_time', @libvlc_media_player_set_time);
    VLD_GetProcAddress('libvlc_media_player_set_position', @libvlc_media_player_set_position);
    VLD_GetProcAddress('libvlc_media_player_stop', @libvlc_media_player_stop);
    VLD_GetProcAddress('libvlc_media_player_play', @libvlc_media_player_play);
    VLD_GetProcAddress('libvlc_media_player_pause', @libvlc_media_player_pause);
    VLD_GetProcAddress('libvlc_media_player_get_state', @libvlc_media_player_get_state);
    VLD_GetProcAddress('libvlc_toggle_fullscreen', @libvlc_toggle_fullscreen);
    VLD_GetProcAddress('libvlc_video_get_width', @libvlc_video_get_width);
    VLD_GetProcAddress('libvlc_video_get_height', @libvlc_video_get_height);
    VLD_GetProcAddress('libvlc_set_fullscreen', @libvlc_set_fullscreen);
    VLD_GetProcAddress('libvlc_get_fullscreen', @libvlc_get_fullscreen);
    VLD_GetProcAddress('libvlc_audio_get_mute', @libvlc_audio_get_mute);
    VLD_GetProcAddress('libvlc_audio_set_mute', @libvlc_audio_set_mute);
    VLD_GetProcAddress('libvlc_audio_get_volume', @libvlc_audio_get_volume);
    VLD_GetProcAddress('libvlc_audio_set_volume', @libvlc_audio_set_volume);
    VLD_GetProcAddress('libvlc_video_set_parent', @libvlc_video_set_parent);
    VLD_GetProcAddress('libvlc_video_take_snapshot', @libvlc_video_take_snapshot);
    VLD_GetProcAddress('libvlc_media_list_player_new', @libvlc_media_list_player_new);
    VLD_GetProcAddress('libvlc_media_list_player_release', @libvlc_media_list_player_release);
    VLD_GetProcAddress('libvlc_media_list_player_set_media_player', @libvlc_media_list_player_set_media_player);
    VLD_GetProcAddress('libvlc_media_list_new', @libvlc_media_list_new);
    VLD_GetProcAddress('libvlc_media_list_player_set_media_list', @libvlc_media_list_player_set_media_list);
    VLD_GetProcAddress('libvlc_media_list_add_file_content', @libvlc_media_list_add_file_content);
    VLD_GetProcAddress('libvlc_media_list_player_next', @libvlc_media_list_player_next);
    VLD_GetProcAddress('libvlc_media_list_player_play', @libvlc_media_list_player_play);
    VLD_GetProcAddress('libvlc_media_list_count', @libvlc_media_list_count);
    VLD_GetProcAddress('libvlc_media_discoverer_new_from_name', @libvlc_media_discoverer_new_from_name);
    VLD_GetProcAddress('libvlc_media_discoverer_media_list', @libvlc_media_discoverer_media_list);
    VLD_GetProcAddress('libvlc_media_list_add_media', @libvlc_media_list_add_media);
    VLD_GetProcAddress('libvlc_media_list_lock', @libvlc_media_list_lock);
    VLD_GetProcAddress('libvlc_media_list_unlock', @libvlc_media_list_lock);
    VLD_GetProcAddress('libvlc_media_subitems', @libvlc_media_subitems);
    VLD_GetProcAddress('libvlc_media_list_player_play_item_at_index', @libvlc_media_list_player_play_item_at_index);
    VLD_GetProcAddress('libvlc_media_list_release', @libvlc_media_list_release);
    VLD_GetProcAddress('libvlc_media_player_get_media', @libvlc_media_player_get_media);
    VLD_GetProcAddress('libvlc_playlist_get_current_index', @libvlc_playlist_get_current_index);
    VLD_GetProcAddress('libvlc_media_player_has_vout', @libvlc_media_player_has_vout);
    VLD_GetProcAddress('libvlc_media_player_is_seekable', @libvlc_media_player_is_seekable);
    VLD_GetProcAddress('libvlc_media_player_get_rate', @libvlc_media_player_get_rate);
    VLD_GetProcAddress('libvlc_media_player_set_rate', @libvlc_media_player_set_rate);
    VLD_GetProcAddress('libvlc_media_player_get_chapter_count', @libvlc_media_player_get_chapter_count);
    VLD_GetProcAddress('libvlc_media_player_retain', @libvlc_media_player_retain);
    //VLD_GetProcAddress('libvlc_media_list_add', @libvlc_media_list_add);
    //VLD_GetProcAddress('libvlc_media_descriptor_release', @libvlc_media_descriptor_release);
    //VLD_GetProcAddress('libvlc_media_list_player_play_item_at_index', @libvlc_media_list_player_play_item_at_index);
   // VLD_GetProcAddress('libvlc_media_list_player_stop', @libvlc_media_list_player_stop);
    VLCLibLoaded := true;
  end;
  Result := LastError;
end;
{$ENDIF}

end.

Wen es interessiert, ich habe da auch schon was fertig. Sagen wir so ... 80 % funkt einwandfrei.
  Mit Zitat antworten Zitat
Benutzerbild von Sunlight7
Sunlight7

Registriert seit: 17. Sep 2006
Ort: Sonnensystem, Zentral
1.522 Beiträge
 
Delphi 5 Standard
 
#12

Re: ActiveX-Komponente von "VideoLAN" nutzbar

  Alt 11. Dez 2008, 20:05
Ich bin schon auf die libvcl umgestiegen, aber da ist das gleiche Problem, im Debugger läufts nicht und VLC macht mich fertig, weil keine Fehlercodes zurückkommen
Windows: Ja - Microsoft: Nein -> www.ReactOS.org
  Mit Zitat antworten Zitat
Troelli

Registriert seit: 1. Mai 2003
15 Beiträge
 
Delphi 7 Enterprise
 
#13

Re: ActiveX-Komponente von "VideoLAN" nutzbar

  Alt 11. Dez 2008, 20:11
Ich sitze da auch schon 2 Tage dran, jedoch möchte ich dazu sagen das ich Vollnoob bin.
Aber die meisten Funktionen gehen bei mir ...
Mal abgesehen davon das man sich die DLLs in APP verzeichnis kopieren muss.
Ach ja ... ich habe die neue vlc-0.9.8a-win32.exe genommen ...

Delphi-Quellcode:
unit VLCPlayer;

{ TTFPlayer  -  VLC Player for Delphi (0.9.2) (c)2008 by Keypad
  Thanks to IceBob for his IceVLCPlayer : [url]http://wiki.videolan.org/IceVLCPlayer[/url]  }


interface

uses
  Dialogs, SysUtils, Classes, Controls, ExtCtrls, libvlc, Graphics, Windows,
  Forms,Variants;

type

 TValue=packed record
 case byte of
  0:(AsInteger:integer);
  1:(AsBoolean:longbool);
  2:(AsFloat :single);
  3:(AsPChar :pchar);
  4:(AsPointer:pointer);
  5:(AsObject :pointer); // ^vcl_object_t
  6:(AsList :pointer); // ^vcl_list_t
  7:(AsTime :int64);
  8:(AsVar :record name:pchar; id:integer end );
 end;
  TEVLCException = class(Exception);
  TEVLCNotFound = class(Exception);
  TEVLCLoadLibrary = class(Exception);

  TErrorEvent = procedure(Sender: TObject; ErrorCode: integer; ErrorMessage: string) of object;


  TTFPPlayer = class(TCustomPanel)
  private
    VLC : libvlc_instance;
    Media : libvlc_media;
    MediaTime : libvlc_time;
    MediaState : libvlc_state;
    Medialist : libvlc_media_list;
    Medialistplayer : libvlc_media_list_player;
    MediaPlayer : libvlc_media_player;
    MediaDiscoverer : libvlc_media_discoverer;
    PlaylistIt : libvlc_playlist_item;
    logofond : TImage;
    VLCVideo : integer;
    VLCMP : integer;
    VLCInput : libvlc_input;
    VLCError : libvlc_exception;
    FLength: Int64;
    FIsPlaying: boolean;
    FSpeed : single;
    FIsCreate : boolean;
    FTime: Int64;
    FPosition: Single;
    FVLCPanel:TPanel;
    Fvolume : integer;
    FTimer: TTimer;
    FVideoWidth: integer;
    FPlaylistIndex: integer;
    FVideoHeight: integer;
    FVideo : integer;
    FSeekable : integer;
    FOnPlay: TNotifyEvent;
    FOnStop: TNotifyEvent;
    FOnError: TErrorEvent;
    FOnStartPlaying : Tnotifyevent; // Début de lecture
    FOnEndPlaying : TNotifyEvent; // Fin de la lecture en cours
    function GetVolume: Integer;
    procedure SetVolume(const Value: Integer);
    function GetSpeed: Single;
    procedure SetSpeed(const Value: Single);
    function Gettime : integer;
    procedure Settime(const value: libvlc_time);
    function Getposition : single;

    procedure Setposition(const Value: single);

    function GetState: Integer;

    function GetVideo: Integer;
    function GetSeekable : integer;
   // function GetPlaylistIndex : integer;
    function CheckError: boolean;
    procedure FTimerTimer(Sender: TObject);
    procedure StartPlaying;
    procedure SetOnPlay(const Value: TNotifyEvent);
    procedure SetOnStop(const Value: TNotifyEvent);
    procedure SetOnError(const Value: TErrorEvent);
    procedure StopIfPlaying;



    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
    property Length: Int64 read FLength;
    property IsPlaying: boolean read FIsPlaying;
    property IsVideo: integer read GetVideo;
    property IsSeekable: integer read GetSeekable;
    property IsCreate: boolean read FIsCreate;
    property VideoWidth: integer read FVideoWidth;
    property VideoHeight: integer read FVideoHeight;
    property Volume:Integer read GetVolume write SetVolume;
    property Speed:Single read GetSpeed write SetSpeed;
    property Position:Single read GetPosition write SetPosition;
    property PlayListIndex: integer read FPlaylistIndex;
    property Time:Integer read GetTime write SetTime;
    property State:Integer read GetState;
    
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    // lancement d'un média
    procedure Play(const FilePath, FileName, options: string; second : integer);
    procedure PlayTV(const CaptureDev: string; const Channel: integer; const Country: integer = 0);
    procedure fullscreen;
    procedure Stop;
    procedure pause;
    procedure photo(Filename: pchar; largeur, hauteur:integer);
    procedure Playlistnext;
   procedure Playlistprevious;
   function PlaylistItemIndex : integer;
   function PlaylistItemCount : integer;
   procedure Playlist_Clear;
 // procedure Playlist_play(filename : pchar);

  published
    { Published declarations }
    property Align;
    property OnPlay: TNotifyEvent read FOnPlay write SetOnPlay;
    property OnStop: TNotifyEvent read FOnStop write SetOnStop;
    property OnError: TErrorEvent read FOnError write SetOnError;
  end;



implementation



{ TIceVLCPlayer }

constructor TTFPPlayer.Create(AOwner: TComponent);
var
  Args: array [0..1] of PChar;
  val:TValue;
begin
  inherited Create(AOwner);
  FIsCreate := false;
  VLC := nil;
  VLCInput := nil;
  Media := nil;
  MediaPlayer := nil;
  VLCVideo := 0;
  FIsPlaying := False;
  ParentColor := false;
  Color := clBlack;
  Caption := '';
  BevelOuter := bvNone;

  case VLD_Startup of
   VLD_SUCCESS :
    begin

    end;
   VLD_NOLIB :
    begin
      raise TEVLCLoadLibrary.Create('VLC Player ist nicht installiert!');
      exit;
    end;
   VLD_NOTFOUND :
    begin
      raise TEVLCNotFound.Create('VLC Player ist nicht installiert oder falsche Version!');
      exit;
    end;
  end;

  //On efface les erreurs
  FillChar(VLCError,SizeOf(VLCError),0);

  //On crée une instance de VLC
  args[0]:=pchar('--plugin-path=' + VLD_LibPath);
  Args[1] := nil;

  VLC := libvlc_new( 1, @Args[0], VLCError);

  // on crée un timer
  FTimer := TTimer.Create(nil);
  FTimer.Enabled := False;
  FIsCreate := true;
  FTimer.Interval := 500;
  FTimer.OnTimer := FTimerTimer;
end;

destructor TTFPPlayer.Destroy;
begin
  FTimer.Free;
  // NTDLL.DLL error :(
  // if Assigned(VLC) then
  // libvlc_destroy(VLC);

  inherited;
end;

////////////////////////////////////////////////////////////////////////////
// Fonction State, renvoie sous forme d'un entier l'état du lecteur : //
// IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, //
// FORWARD=6, BACKWARD=7, ENDED=8, ERROR=9 //
////////////////////////////////////////////////////////////////////////////
function TTFPPlayer.getstate : Integer;
begin
Result := libvlc_media_player_get_state(mediaplayer, vlcerror);
checkerror;
end;

function TTFPPlayer.getvolume : Integer;
begin
Result := libvlc_audio_get_volume(VLC, Vlcerror);
checkerror;
end;

function TTFPPlayer.getvideo : Integer;
begin
Result := libvlc_media_player_has_vout(mediaplayer, vlcerror);
FVideo := Result;
checkerror;
end;

function TTFPPlayer.getspeed : Single;
begin
Result := libvlc_media_player_get_rate(mediaplayer, vlcerror);
FSpeed := Result;
checkerror;
end;

procedure TTFPPlayer.SetSpeed(const value: single);
begin
libvlc_media_player_set_rate(mediaplayer,value,vlcerror);
checkerror;
end;

function TTFPPlayer.getseekable : Integer;
begin
Result := libvlc_media_player_is_seekable(mediaplayer, vlcerror);
FSeekable := Result;
checkerror;
end;

procedure TTFPPlayer.photo(Filename: pchar; largeur, hauteur:integer);
begin
libvlc_video_take_snapshot(MediaPlayer, pchar(filename), largeur,hauteur,vlcerror);
checkerror;
end;

procedure TTFPPlayer.Playlist_Clear;
begin
libvlc_playlist_clear(vlc,vlcerror);
end;

procedure TTFPPlayer.playlistnext;
begin
libvlc_playlist_next(vlc,vlcerror);
checkerror;
end;

function TTFPPlayer.PlaylistItemcount : integer;
begin
result := libvlc_playlist_items_count(vlc, vlcerror);
checkerror;
end;

function TTFPPlayer.PlaylistItemIndex : integer;
begin
result := libvlc_playlist_get_current_index(vlc, vlcerror);
checkerror;
end;

procedure TTFPPlayer.playlistprevious;
begin
libvlc_playlist_prev(vlc,vlcerror);
checkerror;
end;

procedure ttfpplayer.fullscreen;
begin
if IsPlaying then
  begin
    if Assigned(mediaplayer) then
    begin
if libvlc_get_fullscreen(mediaplayer,vlcerror) = 0 then
        libvlc_set_fullscreen(mediaplayer,1, vlcerror)
else
        libvlc_set_fullscreen(mediaplayer,0, vlcerror);
checkerror;
end;
end;
end;

procedure TTFPPlayer.SetVolume(const Value: Integer);
begin
libvlc_audio_set_volume(vlc,value,vlcerror);
checkerror;
end;

function TTFPPlayer.gettime : Integer;
begin
result := libvlc_media_player_get_time(mediaplayer, vlcerror) div 1000;
//result := libvlc_media_player_get_time(mediaplayer, vlcerror) ;
checkerror;
end;

procedure TTFPPlayer.Settime(const value: libvlc_time);
//procedure TTFPPlayer.Settime(const value: Integer);
var
duree : integer;
pos : single;
begin
duree := libvlc_media_player_get_length(mediaplayer, vlcerror) div 1000;
//duree := libvlc_media_player_get_length(mediaplayer, vlcerror) ;
checkerror;
pos := value / duree;
libvlc_media_player_set_position(mediaplayer, value, vlcerror);
checkerror;
end;

function TTFPPlayer.getposition : single;
begin
result := libvlc_media_player_get_position(mediaplayer, vlcerror);
checkerror;
end;

procedure TTFPPlayer.Setposition(const Value: single);
begin
libvlc_media_player_set_position(mediaplayer, value,vlcerror);
checkerror;
end;

procedure TTFPPlayer.Stop;
begin
  StopIfPlaying;
end;

procedure TTFPPlayer.pause;
begin
libvlc_playlist_pause(vlc,vlcerror);
CheckError;
end;

procedure TTFPPlayer.StopIfPlaying;
begin
if (IsPlaying) then
  begin
  libvlc_playlist_stop(VLC, VLCError);
  CheckError;
  libvlc_playlist_clear(VLC, VLCError);
  CheckError;

  FTimer.Enabled := False;
  FIsPlaying := False;
  VLCVideo := 0;
  if Assigned(OnStop) then
    OnStop(Self);
  end;
end;


procedure TTFPPlayer.Play(const FilePath, FileName, options: string; second : integer);
var
 slTmp:TStringList;
 i,j:integer;
 s:array of String;
begin
  // on arrete la lecture s'il y a ..
  StopIfPlaying;
  vlcvideo := 0;
  // on récupere les options de lecture (toujours passer les options comme suit 'option1' + #13'option2' )
  slTmp:=TStringList.Create;
        try
        slTmp.text:=options;
        for j:=slTmp.Count-1 downto 0 do
                begin
                if slTmp[j]='then slTmp.Delete(j);
                end;
        for i:=0 to slTmp.count-1 do
                begin
                If slTmp[i]<>'then
                      SetLength(s,system.length(s)+1);
                s[system.length(s)-1]:=PChar(slTmp[i]);
                end;
        finally
                slTmp.free;
        end;
vlcvideo := libvlc_playlist_add_extended(vlc,pchar(filepath),pchar(filename), system.length(s), ppchar(s), vlcerror);//on ajoute le nouveau flu
checkerror;
StartPlaying;
end;

procedure TTFPPlayer.PlayTV(const CaptureDev: string; const Channel, Country: integer);
var
  Args: array[0..14] of PChar;
  DevStr: string;
begin
  StopIfPlaying;

  args[0] := ':dshow-adev=""';
  args[1] := ':dshow-size=""';
  args[2] := ':dshow-caching=200';
  args[3] := ':dshow-chroma=""';
  args[4] := ':dshow-fps=0.000000';
  args[5] := ':no-dshow-config';
  args[6] := ':no-dshow-tuner';
  args[7] := PChar(':dshow-tuner-channel=' + IntToStr(Channel));
  args[8] := PChar(':dshow-tuner-country=' + IntToStr(Country));
  args[9] := ':dshow-tuner-input=2'; //1-Cable, 2-Antenna
  args[10] := ':dshow-video-input=-1';
  args[11] := ':dshow-audio-input=-1';
  args[12] := ':dshow-video-output=-1';
  args[13] := ':dshow-audio-output=-1';
  args[14] := nil;

  DevStr := 'dshow:// :dshow-vdev="' + CaptureDev + '"';
  VLCVideo := libvlc_playlist_add_extended(VLC, PChar(UTF8Encode(DevStr)), '', 14, @Args[0], VLCError);
  CheckError;

  StartPlaying;
end;

function TTFPPlayer.CheckError: boolean;
var
  ErrorCode: Integer;
  ErrorMsg: string;
begin
  if VLCError.Code <> 0 then
  begin
    Result := False;
    ErrorCode := VLCError.Code;
    ErrorMsg := VLCError.Message;
    libvlc_exception_clear(VLCError);

    if Assigned(OnError) then
      OnError(Self, ErrorCode, ErrorMsg);

// raise TEVLCException.CreateFmt('Error %d! %s', [ErrorCode, ErrorMsg]);
  end
  else
    Result := True;
end;

procedure TTFPPlayer.StartPlaying;
begin
libvlc_video_set_parent(VLC, Self.Handle, VLCError);
CheckError;
libvlc_playlist_play(VLC, VLCVideo, 0, nil, VLCError);
checkerror;
FLength := -2; //returned Length = -1 - stream; 0 - TV , >0 - local file
// on active le timer
FTimer.Enabled := true;


end;




procedure TTFPPlayer.FTimerTimer(Sender: TObject);
var
  Ln: int64;
begin
  MediaPlayer := libvlc_playlist_get_media_player(vlc, vlcerror);
  checkerror;
  
  FTimer.Enabled := False;
        try
        //Durée du média (msec)
        Ln := libvlc_media_player_get_length(MediaPlayer, VLCError) div 1000;
        //Ln := libvlc_media_player_get_length(MediaPlayer, VLCError) ;
        CheckError;
        if not CheckError then
                begin
                if IsPlaying then
                        begin
                        //If end of movie then cause error.
                        FIsPlaying := False;
                        StopifPlaying;
                        exit;
                        end
                else
                        begin
                        FTimer.Enabled := True;
                        exit;
                        end;
                end;

        FLength := Ln;
        //Position en ms du média (msec)
        FTime := libvlc_media_player_get_time(MediaPlayer, vlcerror) div 1000;
        CheckError;

        // position (0 -> 1) du media
        FPosition := libvlc_media_player_get_position(MediaPlayer, VLCError);
        CheckError;

        if CheckError and (not IsPlaying) then
                begin
                FIsPlaying := True;
                if Assigned(OnPlay) then
                        OnPlay(Self);
                end;
        FTimer.Enabled := True;
        Except
                if IsPlaying then
                        begin
                        StopifPlaying;
                        //if Assigned(OnStop) then
                               // OnStop(Self);
                        end;
        end;
end;

procedure TTFPPlayer.SetOnError(const Value: TErrorEvent);
begin
  FOnError := Value;
end;

procedure TTFPPlayer.SetOnPlay(const Value: TNotifyEvent);
begin
  FOnPlay := Value;
end;

procedure TTFPPlayer.SetOnStop(const Value: TNotifyEvent);
begin
  FOnStop := Value;
end;

end.
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls,VLCPlayer, ComCtrls, JvExComCtrls, JvComCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Timer1: TTimer;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button10: TButton;
    Button11: TButton;
    Button12: TButton;
    JvTrackBar1: TJvTrackBar;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Button13: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure JvTrackBar1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Timer1Timer(Sender: TObject);
    procedure CreateVLC;
    procedure Button13Click(Sender: TObject);
  private
    { Private declarations }
  public
      vlccreate : boolean;
      Applikation_Path : string;
  end;

var
  Form1: TForm1;
  vlcp : TTFPPlayer;
  IndexPlaylist : integer;
  
implementation

{$R *.dfm}
function MSecToTime(mSec: Int64): string;
var
  dt : TDateTime;
begin
   dt := mSec / MSecsPerSec / SecsPerDay;
   Result := FormatDateTime('hh:nn:ss', Frac(dt)) ;
end;


procedure TForm1.CreateVLC;
begin
if vlccreate = false then
        begin
        vlcp := TTFPPlayer.Create(Form1.Panel1);
        vlcp.Parent := Form1.Panel1;
        vlcp.Align := alClient;
        vlccreate := true;
        //vlcp.OnPlay := DebutLectureVLC;
        //vlcp.OnStop := Finlecturevlc;
        end;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
Applikation_Path:= ExtractFilePath(Application.ExeName);
createVLC;
end;

procedure TForm1.Button1Click(Sender: TObject);
var options : string;
begin
createVLC;
//options := 'fullscreen';
Timer1.Enabled := true;
vlcp.Playlist_Clear;
vlcp.play(Applikation_Path + 'test.m3u', 'test', options,0);
end;

procedure TForm1.Button2Click(Sender: TObject);
var options : string;
begin
createVLC;
options := 'audio-visual=goom';
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// You can have options := 'audio-visual=goom' + #13'fullscreen' if you want to have several options !!!! //
////////////////////////////////////////////////////////////////////////////////////////////////////////////
Timer1.Enabled := true;
//'http://www.pop-radio.de/stream_1_dsl_winamp.pls'
//vlcp.play('http://viphttp.yacast.fr/v4/virgin/virgin.asx', 'test audio', options,0);
vlcp.play('http://www.pop-radio.de/stream_1_dsl_winamp.pls', 'test audio', options,0);
end;


procedure TForm1.Button3Click(Sender: TObject);
begin
 ShowMessage(FloatToStr(vlcp.Speed));
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
      try
          vlcp.Speed := vlcp.Speed * 2;
      except
      end;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
        try
          vlcp.Speed := vlcp.Speed / 2;
        except
          vlcp.Speed := 1;
          end;
end;



procedure TForm1.Button6Click(Sender: TObject);
begin
if indexplaylist > 1 then
        begin

        vlcp.Playlistprevious;
        IndexPlaylist := IndexPlaylist - 1;
        end;
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
if indexplaylist < vlcp.PlaylistItemcount then
        begin
        vlcp.Playlistnext;
        IndexPlaylist := Indexplaylist + 1;
        end;
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
vlcp.fullscreen;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
 vlcp.Volume := vlcp.Volume - 10;
end;

procedure TForm1.Button10Click(Sender: TObject);
begin
vlcp.Volume := vlcp.Volume + 10;
end;

procedure TForm1.Button11Click(Sender: TObject);
begin
 vlcp.pause;
end;

procedure TForm1.Button12Click(Sender: TObject);
begin
 vlcp.Stop;
end;

procedure TForm1.JvTrackBar1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
//vlcp.time := jvTrackBar1.Position;
showmessage(inttostr(jvTrackBar1.Position));
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
label1.Caption := MSecToTime(vlcp.time)+ ' / ' + MSecToTime(vlcp.Length);
label3.Caption := inttostr(vlcp.time)+ ' / ' + inttostr(vlcp.Length);
label4.Caption := inttostr(JvTrackBar1.Position);
JvTrackBar1.Max := vlcp.Length;
JvTrackBar1.Min := 0;
JvTrackBar1.Position := vlcp.time;
case vlcp.State of
0: Form1.Caption := 'Idle/Close';
1: Form1.Caption := 'Geöffnet';
2: Form1.Caption := 'Am Cachen';
3: Form1.Caption := 'Abspielen';
4: Form1.Caption := 'Pausieren';
5: Form1.Caption := 'Gestoppt';
6: Form1.Caption := 'Vorwärts';
7: Form1.Caption := 'Rückwärts';
8: begin
   Form1.Caption := 'Beenden';
   IndexPlaylist := 1;
   end;
9: Form1.Caption := 'Fehler';
end;
 label2.Caption := inttostr(vlcp.PlaylistItemindex) +' "'+inttostr(indexplaylist)+'"' + ' of ' + inttostr(vlcp.PlaylistItemcount);
end;

procedure TForm1.Button13Click(Sender: TObject);
begin
vlcp.time:=100000;
end;

end.
Vielleicht hilft es ja weiter ...
  Mit Zitat antworten Zitat
Madtrax

Registriert seit: 16. Sep 2003
19 Beiträge
 
#14

Re: ActiveX-Komponente von "VideoLAN" nutzbar

  Alt 27. Apr 2009, 12:20
Hallo

welche DLL Dateien muss man den ins App Verzeichnis kopieren ??? Bei mir kann er die libvlc.dll nicht laden. returncode 0..
Für etwas Hilfe wäre ich dankbar...
-----------------------------------
Madtrax
  Mit Zitat antworten Zitat
Benutzerbild von Sunlight7
Sunlight7

Registriert seit: 17. Sep 2006
Ort: Sonnensystem, Zentral
1.522 Beiträge
 
Delphi 5 Standard
 
#15

Re: ActiveX-Komponente von "VideoLAN" nutzbar

  Alt 8. Mai 2009, 20:10
Keine, aber Du mußt erst mit Hier im Forum suchenSetCurrentDir den Pfad seten, wo VLC installiert ist, sonst läßt ich die DLL net richtig laden.
Den Pfad fndest Du in der Registry
Windows: Ja - Microsoft: Nein -> www.ReactOS.org
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:18 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz