J
jog81
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个媒体播放器,里面有个取文件时间的功能。用Dspack可以直接实现。我现在不想用DSPACK,想直接使用directshow取出来,结果出现问题。我现在用一个DSPACK组件与directshow和两个框显示两个时间:
var _wfile: array[0..(Max_path * 2) - 1] of wchar;
Duration:int64;miao:real;myGraph: IGraphBuilder;MySeek: IMediaSeeking;
begin
FilterGraph1.Active:=true;
FilterGraph1.ClearGraph;
FilterGraph1.RenderFile(filelistbox1.Items[filelistbox1.itemindex]);
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, myGraph);
MultiByteToWideChar(CP_ACP, 0, pchar(filelistbox1.Items[filelistbox1.itemindex]), -1, @_wFile, MAX_PATH);
myGraph.QueryInterface(IID_IMediaSeeking, MySeek);
mygraph.RenderFile(_wfile, nil);
myseek.GetDuration(duration);
miao:=1/1000/24/3600;
edit1.Text:=FormatDateTime('hh:mm:ss',miao*duration);
edit2.Text:=FormatDateTime('hh:mm:ss',miao*FilterGraph1.duration);
myseek:=nil;
var _wfile: array[0..(Max_path * 2) - 1] of wchar;
Duration:int64;miao:real;myGraph: IGraphBuilder;MySeek: IMediaSeeking;
begin
FilterGraph1.Active:=true;
FilterGraph1.ClearGraph;
FilterGraph1.RenderFile(filelistbox1.Items[filelistbox1.itemindex]);
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, myGraph);
MultiByteToWideChar(CP_ACP, 0, pchar(filelistbox1.Items[filelistbox1.itemindex]), -1, @_wFile, MAX_PATH);
myGraph.QueryInterface(IID_IMediaSeeking, MySeek);
mygraph.RenderFile(_wfile, nil);
myseek.GetDuration(duration);
miao:=1/1000/24/3600;
edit1.Text:=FormatDateTime('hh:mm:ss',miao*duration);
edit2.Text:=FormatDateTime('hh:mm:ss',miao*FilterGraph1.duration);
myseek:=nil;