Jak można przewinąć (seek) w komponencie TVideoWindow (DSPack) nie używając DSTrackBar (tzn. przez polecenie)?
0
0
czesc
pokombinuj z tymi funkcjami:
var
MediaSeeking : IMediaSeeking;
Pos : Int64;
begin
FilterGraph.QueryInterface(IMediaSeeking, MediaSeeking);
mediaseeking.GetCurrentPosition(pos);
dstrackbar1.SetPosition(pos+inttostr(ilestam));
end;
coś takiego, nie jestem pewny do końca. powodzenia...
Pepe
0
Spróbowałem zwyczajnie DSTrackBar1.SetPosition(87), ale nie działa.
[Error] Unit1.pas(561): Undeclared identifier: 'SetPosition'
0
a sproboj tego:
procedure TForm1.Button4Click(Sender: TObject);
Var
MediaSeeking: IMediaSeeking;
CurPos: Int64;
EndPos2 : Int64;
Begin
If FilterGraph.Active Then
Begin
with mediaseeking do begin
FilterGraph.QueryInterface(IMediaSeeking, MediaSeeking);
GetDuration(EndPos2);//koniec filmu
Curpos := endpos2-10000000000; //te miliardy to wartosc czasu od konca filmu do miejsca na ktore chcemy sie zatrzymac - to trzeba przeliczyc
If boolean(MediaSeeking.IsUsingTimeFormat(TIME_FORMAT_BYTE)) Then
Begin
MediaSeeking.SetPositions(CurPos, AM_SEEKING_AbsolutePositioning, EndPos2, AM_SEEKING_NoPositioning);
End;
Else
Begin
MediaSeeking.SetTimeFormat(TIME_FORMAT_BYTE);
MediaSeeking.SetPositions(CurPos, AM_SEEKING_AbsolutePositioning, EndPos2, AM_SEEKING_NoPositioning);
End;
End;
end;
end;
U mnie dziala. Film przesuwa sie w okreslone miejsce - tylko teraz to "okreslone miejsce" trzeba dokladnie ustalic... na podstawie aktualnej pozycji, pozycji konca filmu.
Pozdr
Pepe
0
Super, dzięki :]. Już sobie to dokładnie wyliczyłem, i świetnie działa.
procedure przewin(czas : int64; var FilterGraph : TFilterGraph);
var
MediaSeeking: IMediaSeeking;
CurPos, EndPos2, caly: Int64;
begin
if FilterGraph.Active then
begin
with mediaseeking do
begin
FilterGraph.QueryInterface(IMediaSeeking, MediaSeeking);
GetDuration(EndPos2);
caly := round(endpos2 / 10000000);
Curpos := (caly - (caly - czas)) * 10000000;
if boolean(MediaSeeking.IsUsingTimeFormat(TIME_FORMAT_BYTE)) then
MediaSeeking.SetPositions(CurPos, AM_SEEKING_AbsolutePositioning, EndPos2, AM_SEEKING_NoPositioning)
else
begin
MediaSeeking.SetTimeFormat(TIME_FORMAT_BYTE);
MediaSeeking.SetPositions(CurPos, AM_SEEKING_AbsolutePositioning, EndPos2, AM_SEEKING_NoPositioning);
end;
end;
end;
end;
0
Czy może mi ktoś powiedzieć co to jest to MediaSeeking? U mnie to się nie kompiluje. Szukałem w DSPack, ale nic takiego tam nie ma.
0
Musisz dopisać do uses biblioteke DirectShow9 aby móc skorzystać z tej funkcji.