哪位高手可以帮我修改一下下面的代码,帮我实现 从mpg 文件到 asf 文件的转换,
如果有别的 delphi 源代码,也可以,谢谢
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, WMEncoderLib_TLB;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
wmencoder1: wmencoder;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
srcgrpcoll:iwmencsourcegroupcollection;
srcgrp:iwmencsourcegroup;
srcaud:iwmencaudiosource;
srcvid:iwmencvideosource;
procoll:iwmencprofilecollection;
sfile:iwmencfile;
begin
wmencoder1:=cowmencoder.Create;
srcgrpcoll:=wmencoder1.SourceGroupCollection;
srcgrp:=srcgrpcoll.Add('sg_1');
sfile:=wmencoder1.File_;
sfile.LocalFileName:='j:/cctv.asf';
wmencoder1.EnableAutoArchive:=true;
srcaud:=srcgrp.AddSource(emenc_audio);//这里出现类型不匹配,
srcvid:=srcgrp.addsource(wmenc_video);//同上
procoll:=wmencoder1.ProfileCollection;
srcgrp.set_Profile(procoll.Item(2));
srcvid.SetInput('j://cctv.mpg','','');//这里程序调试时没错,但运行时出错,在VB.net里面可以不用带后面的两个空参数,但如果delphi 中不带,就会提示参数不足
srcaud.SetInput('j://cctv.mpg','','');//同上
srcvid.Repeat_:=false;
srcaud.Repeat_:=false;
wmencoder1.PrepareToEncode(true);
wmencoder1.Start;
end;
end.