Witam! Mam pytanie: Która funkcja w IDvdControl2 odpowiada za podświetlanie napisów/przycisków w menu DVD po najechaniu kursorem lub kliknięciu, bo "SelectAtPosition" nie podświetla... Mam na myśli taki efekt jak w MPC lub VLC:
Pomoże ktoś? ;-(
Juz odpowiadam.
Problemem jest to, ze przy automatycznym uzyciu funkcji
HR := FilterGraph.RenderDvd(Status, FileName);
Linia subpicture nie jest połączona prawidłowo.
Tak wygląda render automatyczny:
Tak wygląda sam fix:
// Render DVD
HR := FilterGraph.RenderDvd(Status, FileName);
// -------------------------- fix na subpicture ----------
if not failed(hr) then
begin
//znajdz 'DVD Navigator '
(FilterGraph as IGraphBuilder).FindFilterByName('DVD Navigator', temp);
hr := temp.FindPin(stringtoolestr('SubPicture'),inpin);
//odlacz pin 'SubPicture'
(FilterGraph as IGraphBuilder).Disconnect(inpin);
//znajdz 'MPV Decoder Filter'
hr := (FilterGraph as IGraphBuilder).FindFilterByName('MPV Decoder Filter', mpv);
hr:=(mpv as IBaseFilter).Enumpins(Iep);
if failed(hr) then showmessage('cant do') else
begin
npins := 0;
while IEp.Next(1,opin,nil)=S_OK do
begin
inc(npins);
if npins = 3 then outpin := opin;
end;
end;
//polacz linie subpicture 'MPV Decoder Filter' z 'DVD Navigator'
hr := (FilterGraph as IGraphBuilder).Connect(outpin, inpin);
end else showmessage('didnt load ' + filename);
//-------------------------- end fix na subpicture
Tak wygląda zmodyfikowany kod aplikacji DVDPlay z pakietu DSPACK:
procedure TFormDVDPlayer.PlayDVD(FileName: WideString);
var
Status : TAMDVDRenderStatus;
DvdCmd: IDvdCmd;
HR: HRESULT;
temp,mpv : IBaseFilter;
inpin,opin,outpin : IPin;
Iep: IEnumPins;
npins: cardinal;
begin
// Activate the filter Graph
if not FilterGraph.Active then
begin
FilterGraph.Active := true;
// Render DVD
HR := FilterGraph.RenderDvd(Status, FileName);
// -------------------------- fix na subpicture ----------
if not failed(hr) then
begin
//znajdz 'DVD Navigator '
(FilterGraph as IGraphBuilder).FindFilterByName('DVD Navigator', temp);
hr := temp.FindPin(stringtoolestr('SubPicture'),inpin);
//odlacz pin 'SubPicture'
(FilterGraph as IGraphBuilder).Disconnect(inpin);
//znajdz 'MPV Decoder Filter'
hr := (FilterGraph as IGraphBuilder).FindFilterByName('MPV Decoder Filter', mpv);
hr:=(mpv as IBaseFilter).Enumpins(Iep);
if failed(hr) then showmessage('cant do') else
begin
npins := 0;
while IEp.Next(1,opin,nil)=S_OK do
begin
inc(npins);
if npins = 3 then outpin := opin;
end;
end;
//polacz linie subpicture 'MPV Decoder Filter' z 'DVD Navigator'
hr := (FilterGraph as IGraphBuilder).Connect(outpin, inpin);
end else showmessage('didnt load ' + filename);
//-------------------------- end fix na subpicture
if HR <> S_OK then
begin
case HR of
HRESULT(E_INVALIDARG): Application.MessageBox('Invalid Argument.','Error', mb_ok);
HRESULT(S_FALSE) : begin
if Status.hrVPEStatus <> 0 then Application.MessageBox(PChar(GetErrorString(Status.hrVPEStatus)), 'Error', mb_OK);
if Status.bDvdVolInvalid then Application.MessageBox('The specified DVD volume to be played does not exist.', 'Error', mb_OK);
if Status.bDvdVolUnknown then Application.MessageBox('No DVD volume is specified or isn''t found.', 'Error', mb_OK);
if Status.bNoLine21In then Application.MessageBox('The video decoder doesn''t produce line 21 (closed captioning) data.', 'Error', mb_OK);
if Status.bNoLine21Out then Application.MessageBox('The video decoder can''t be shown as closed captioning on video due to a problem with graph building.', 'Error', mb_OK);
if status.iNumStreamsFailed > 0 then Application.MessageBox('Can''t render one or more stream.', 'Error', mb_OK);
end;
HRESULT(VFW_E_DVD_DECNOTENOUGH) : Application.MessageBox('There isn''t enough hardware or software decoders to decode all streams.','Error', mb_OK);
HRESULT(VFW_E_DVD_RENDERFAIL) : Application.MessageBox('Some basic error occurred in building the graph.'#13'Possibilities include the DVD Navigator filter or the video or audio renderer not instantiating,'#13'a trivial connection or pin enumeration failing, or none of the streams rendering.','Error', mb_OK);
end;
FilterGraph.ClearGraph;
exit;
end;
FilterGraph.Play;
with FilterGraph as IDVDControl2 do
begin
SetOption(DVD_NotifyParentalLevelChange,false); //not notify us when parental level changes
SetOption(DVD_HMSF_TimeCodeEvents, true); // use new HMSF timecode format
end;
end
else
begin
FilterGraph.Play;
with FilterGraph as IDvdControl2 do PlayForwards(1.0,DVD_CMD_FLAG_None, DvdCmd);
end;
end;
A tak po zastosowaniu fixa wygląda graf:
Pozdrawiam.
Wielkie dzięki za pomoc ;-)
Uuuu.... :| ale jest kolejny problem.... Podczas odtwarzania DVD (kiedy startuje - jeszcze przed otwarciem menu DVD) wyskakuje mi Access Violation.... :-/ .... Podczas debugowania daję na "break" i odsyła mnie do linijki:
hr:=(mpv as IBaseFilter).Enumpins(Iep);
Co może być nie tak??
Zmien na takie linie:
hr := (FilterGraph as IGraphBuilder).FindFilterByName('MPV Decoder Filter', mpv);
if FAILED(hr) then raise Exception.Create('MPV Decoder Filter not found!!!'); <---- tu sie dowiesz czy 'MPV Decoder Filter' znaleziony
hr:=(mpv as IBaseFilter).Enumpins(Iep);
Wygląda jakby nie umiało ci znaleźć dekodera "'MPV Decoder Filter".
No tak, sprawdziłem, to nie jest systemowy dekoder - sprawa się komplikuje.
Masz dwa rozwiązania.
-
Proste, które nie jest najlepsze. Poszukaj na internecie dekodera "Mpeg2DecFilter.ax" - to on sie nazywa "'MPV Decoder Filter".
Ściągnij i zainstaluj. ale wtedy aplikacja będzie prawidłowo działać tylko z tym dekoderem!!!
Będziesz musiał go dołączać do programu... -
Trudniejsze, ale też nie koniecznie skuteczniejsze . Sprawdzasz jakie dekodery mpg2 są w systemie i ręcznie dodajesz do grafu dekoder i łączysz jego linie. Problem będzie, gdy użytkownik nie posiada żadnego dekodera (nie instalował żadnej aplikacji do DVD)
dekoder Mpeg2DecFilter.ax jest rozprowadzany na licencji bodajże GPL, więc swobodnie możesz go do swej aplikacj dołączyć.
link do dekodera:
http://www.free-codecs.com/download/MPV_Decoder.htm
instalacja:
Unzip and copy "Mpeg2DecFilter.ax" to c:\Windows\System32\
Click Start->Run and type in:
regsvr32 c:\windows\system32\Mpeg2DecFilter.ax
Jest SUPER!!!! Wszystko pięknie chodzi ;-) Wielkie dzięki za pomoc. [browar]