procedure TFormDVDPlayer.FilterGraphDVDCurrentHMSFTime(sender: TObject; HMSFTimeCode: tagDVD_HMSF_TIMECODE; TimeCode: tagDVD_TIMECODE); var ttt : tagDVD_HMSF_TIMECODE; fps : ULONG; begin with HMSFTimeCode do StatusBar.Panels.Items[0].Text := format('%d:%d:%d',[bHours, bMinutes ,bSeconds]); with FilterGraph as IDvdInfo2 do GetTotalTitleTime(ttt, fps); Edit1.Text := format('%d:%d:%d',[ttt.bHours, ttt.bMinutes ,ttt.bSeconds]); if BeginPlay then begin if StrToTime(format('%d:%d:%d',[HMSFTimeCode.bHours, HMSFTimeCode.bMinutes ,HMSFTimeCode.bSeconds]))>StrToTime(format('%d:%d:%d',[ttt.bHours, ttt.bMinutes ,ttt.bSeconds]))-2 then begin MessageDlg('影片播放完毕', mtWarning, [mbOK], 0); FilterGraph.Stop; FilterGraph.ClearGraph; end; end; end;
因为媒体文件都有特定的格式,比如MP3最后128字节装载了关于这个文件的一些信息,我想大概是利用了STREAM来读取并显示给用户.
HMSFTimeCode: tagDVD_HMSF_TIMECODE; TimeCode: tagDVD_TIMECODE);
var
ttt : tagDVD_HMSF_TIMECODE;
fps : ULONG;
begin
with HMSFTimeCode do
StatusBar.Panels.Items[0].Text :=
format('%d:%d:%d',[bHours, bMinutes ,bSeconds]);
with FilterGraph as IDvdInfo2 do GetTotalTitleTime(ttt, fps);
Edit1.Text := format('%d:%d:%d',[ttt.bHours, ttt.bMinutes ,ttt.bSeconds]);
if BeginPlay then
begin
if StrToTime(format('%d:%d:%d',[HMSFTimeCode.bHours, HMSFTimeCode.bMinutes ,HMSFTimeCode.bSeconds]))>StrToTime(format('%d:%d:%d',[ttt.bHours, ttt.bMinutes ,ttt.bSeconds]))-2 then
begin
MessageDlg('影片播放完毕', mtWarning, [mbOK], 0);
FilterGraph.Stop;
FilterGraph.ClearGraph;
end;
end;
end;