unit uMSWEBDVD;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MSWEBDVDLib_TLB, Menus;
procedure play_pause(DVD: TMSWebDVD; Path:
String);
procedure play_next(DVD: TMSWebDVD);
procedure play_prev(DVD: TMSWebDVD);
procedure fastforward(DVD: TMSWebDVD);
procedure rewind(DVD: TMSWebDVD);
procedure stop_eject(DVD: TMSWebDVD);
procedure file_stop_eject(DVD: TMSWebDVD; ODLG: TOpenDialog);
function current_position(DVD: TMSWebDVD):
String;
function current_chapter(DVD: TMSWebDVD):
String;
function current_title(DVD: TMSWebDVD):
String;
procedure popupmenu_language(DVD: TMSWebDVD; PopUpMenu: TPopupMenu; Owner: TForm);
procedure popupmenu_subtitle(DVD: TMSWebDVD; PopUpMenu: TPopupMenu; Owner: TForm);
var
FastPlay :Boolean;
implementation
procedure play_pause(DVD: TMSWebDVD; Path:
String);
begin
//bei Status "Stop" zuerst aktuellen DVD-Pfad checken und einlesen
if DVD.PlayState <= 0
then
DVD.DVDDirectory := Path;
//DVD abspielen bzw. pausieren
if (DVD.PlayState = 2)
and (FastPlay = false)
then
DVD.Pause
else
DVD.Play;
//DVD Abspielgeschwindigkeit zurücksetzten
if (DVD.PlayState = 2)
and (FastPlay = true)
then
DVD.Play;
FastPlay := False;
end;
procedure play_next(DVD: TMSWebDVD);
begin
//nur möglich bei ungleich Status "Stop"
if DVD.PlayState > 0
then
try
DVD.PlayNextChapter;
except end;
end;
procedure play_prev(DVD: TMSWebDVD);
begin
//nur möglich bei ungleich Status "Stop"
if DVD.PlayState > 0
then
try
DVD.PlayPrevChapter;
except end;
end;
procedure fastforward(DVD: TMSWebDVD);
begin
//nur möglich bei ungleich Status "Stop"
if DVD.PlayState > 0
then
try
FastPlay := true;
DVD.PlayForwards(3.00,false);
except end;
end;
procedure rewind(DVD: TMSWebDVD);
begin
//nur möglich bei ungleich Status "Stop"
if DVD.PlayState > 0
then
try
FastPlay := true;
DVD.PlayBackwards(3.00,false);
except end;
end;
procedure stop_eject(DVD: TMSWebDVD);
begin
//wenn Satus "Play" oder "Pause" dann stop ansonsten eject
if DVD.PlayState <= 0
then
DVD.Eject
else
DVD.Stop;
end;
procedure file_stop_eject(DVD: TMSWebDVD; ODLG: TOpenDialog);
begin
//wenn Satus "Play" oder "Pause" dann stop ansonsten eject
if DVD.PlayState <= 0
then
ODLG.Execute
else
begin
DVD.Stop;
end;
end;
function current_position(DVD: TMSWebDVD):
String;
//gibt aktuelle Playback-Position im Format 00:00:00 zurück
var
Position:
String;
begin
Position := DVD.CurrentTime;
SetLength(Position,8);
result := Position;
end;
function current_chapter(DVD: TMSWebDVD):
String;
//gibt aktuelles Kapitel im Format 00 zurück
var
Chapter:
String;
begin
if DVD.CurrentChapter < 10
then
Chapter := '
0' + IntToStr(DVD.CurrentChapter)
else
Chapter := IntToStr(DVD.CurrentChapter);
result := Chapter;
end;
function current_title(DVD: TMSWebDVD):
String;
//gibt aktuelles Titel im Format 00 zurück
var
Title:
String;
begin
if DVD.CurrentTitle < 10
then
Title := '
0' + IntToStr(DVD.CurrentTitle)
else
Title := IntToStr(DVD.CurrentTitle);
result := Title;
end;
procedure popupmenu_language(DVD: TMSWebDVD; PopUpMenu: TPopupMenu; Owner: TForm);
//fügt alle verfügbaren AudioStreams in ein PopUpMenu ein und ruft dieses auf
var
I: Integer;
Items:
Array[0..50]
Of TMenuItem;
CurPoint: Tpoint;
begin
PopUpMenu.Items.Clear;
for I:=0
to DVD.AudioStreamsAvailable-1
do
begin
if DVD.IsAudioStreamEnabled(I)
then
begin
Items[I] := TMenuItem.Create(Owner);
Items[I].Caption := DVD.GetAudioLanguage(I,true);
if DVD.CurrentAudioStream = I
then
Items[I].Checked := True;
//Items[I].OnClick := ;
PopUpMenu.Items.Add(Items[I]);
end;
end;
GetCursorPos(CurPoint);
PopUpMenu.Popup(CurPoint.x,CurPoint.y);
end;
procedure popupmenu_subtitle(DVD: TMSWebDVD; PopUpMenu: TPopupMenu; Owner: TForm);
//fügt alle verfügbaren Subtitles in ein PopUpMenu ein und ruft dieses auf
var
I: Integer;
Items:
Array[0..50]
Of TMenuItem;
CurPoint: Tpoint;
begin
PopUpMenu.Items.Clear;
if DVD.SubpictureStreamsAvailable > 0
then
begin
Items[50] := TMenuItem.Create(Owner);
Items[50].Caption := '
Show Subtitles';
if DVD.SubpictureOn = True
then
Items[50].Checked := True;
PopUpMenu.Items.Add(Items[50]);
PopUpMenu.Items.InsertNewLineAfter(Items[50]);
end;
for I:=0
to DVD.SubpictureStreamsAvailable-1
do
begin
if DVD.IsSubpictureStreamEnabled(I)
then
begin
Items[I] := TMenuItem.Create(Owner);
Items[I].Caption := DVD.GetSubpictureLanguage(I);
if DVD.CurrentSubpictureStream = I
then
Items[I].Checked := True;
//Items[I].OnClick := ;
PopUpMenu.Items.Add(Items[I]);
end;
end;
GetCursorPos(CurPoint);
PopUpMenu.Popup(CurPoint.x,CurPoint.y);
end;
end.