View Full Version : directshow Bluray disc navigator filter base on libbluray
Pages :
1
2
3
4
5
6
7
[
8]
9
10
ddjmagic
12th April 2014, 14:07
Did you have any luck getting the previous samples to work? (one with missing files)
dukey
12th April 2014, 14:18
nope, need the missing files :p
ddjmagic
12th April 2014, 14:29
nope, need the missing files :p
For Here Comes The Boom you can just need to add 2 blank m2ts files and name them:
00033.m2ts
00034.m2ts
00031.m2ts & 00032.m2ts are both already blank so you can copy and rename those if you wanted.
Once those two files are added it should work in PowerDVD :)
Note: PowerDVD still plays the blank files as if they were full length files (it will look like a blank screen) so you will have to manually skip these parts to get to the menu.
dukey
12th April 2014, 18:40
Here comes the boom is almost missing the 2nd file .. link doesn't point anywhere
dukey
12th April 2014, 18:57
If you can see any unimplmented functions on the console, print them out and I'll give it a go :)
ddjmagic
12th April 2014, 18:59
Here comes the boom is almost missing the 2nd file .. link doesn't point anywhere
Sorry part 2 link fixed :)
ddjmagic
12th April 2014, 19:29
If you can see any unimplmented functions on the console, print them out and I'll give it a go :)
Here's a screenshot of what the console shows for those broken samples (if its any help to you at all)
Here Come The Boom (http://i.imgur.com/cvaC1YC.png)
Cabin In The Woods (http://i.imgur.com/1c5Zfuj.png)
dukey
12th April 2014, 19:35
Do you have that config.xml that cabin the woods can't find ?
ddjmagic
12th April 2014, 19:43
Do you have that config.xml that cabin the woods can't find ?
No the config.xml isn't present - I have loaded the original disc with AnyDVD disabled and browsed in that location but it doesn't seem to exist.
dukey
12th April 2014, 19:44
Okay thanks
ddjmagic
13th April 2014, 11:10
I tried about about 50 more BD's (with build 262) and these are the only ones that I couldn't get to load to the menu -
Disturbia (UK Region B)
Gets stuck after the studio introduction and warnings- Console (http://i.imgur.com/KRY4c1i.png)
Sample (http://www.mediafire.com/download/cb7f8em4sm48i8a/DISTURBIA.zip)
Friday The 13th (US Region A)
Doesn't seem to load anything (just a blank screen) - Console (http://i.imgur.com/550Hwhs.png)
Sample (http://www.mediafire.com/download/7qki5kex8fp58u0/FRIDAY_THE_13TH.zip)
Ice Age (US Region A)
Sample (http://www.mediafire.com/download/162kd6gro9zr877/ICE_AGE.zip)
This disc loads the menu fine, but the menu buttons appear too early - see Screenshot (http://i.imgur.com/YpttifS.png).
I'm really surprised that this hasn't been added as at least an option to any of the free video players yet, the last few builds have improved BD-J playback drastically and HDMV menus seem pretty much perfect.
dukey
13th April 2014, 13:30
Thanks for the samples. The first two should be easy enough to fix, they are both missing the same functions, and it's not a lot of code I don't think :)
Casshern
21st April 2014, 19:12
This thingie works great. I tried numerous Blurays and most of them worked right away and much , much , much faster than with PowerDVD. On one BD though I got a region code warning, is there any place to change the region code of the demo player? Is there anything i must do to install BD-J support? I just extracted the folder, ran the register batch inside and use the demo player? Keep up the great work, can't wait for the day i can finally ditch PowerDVD. The BD menus and the frame-packed 3D playback are the only things keeping me from finally being free of cyberlinks bloatware.
dukey
21st April 2014, 21:43
is there any place to change the region code of the demo player
Not yet in the demo player, but the filter has methods which you can call to do this. By default I think it's set to US English
Is there anything i must do to install BD-J support?
For java support you must have desktop java installed. Version 8 isn't yet supported in the code .. but should be soon. But any older versions from 5-7 should be fine.
http://javadl.sun.com/webapps/download/AutoDL?BundleId=86895
haha01haha01
6th June 2014, 15:51
Hi haha01haha01,
did you make the mpc custom presenter thread safe with regards to d3d ? Normally this isn't required because in evr the mixer uses straight dxva so doesn't share with d3d. But our own mixer uses d3d so it is required. I might try and write a pure dxva path, but it needs new hardware since older hardware lacks being able to do alpha blend or some mode I forgot about in dxva.
You need to use these functions
http://msdn.microsoft.com/en-us/library/windows/desktop/ms697056%28v=vs.85%29.aspx
Just lock and unlock the device when you are using it.
Also because they are both using d3d, the presenter might set some d3d state that interfears with the mixer. I tried to make the mixer restore all states that it changed, but I only really checked for compatibility with my own presenter. If there are states you see that are conflicting get in contact and maybe we can sort something out.
As for mf_e_transform_need_more_input that should be fine. That's normal for interlaced video when waiting for complete frames etc. But I can double check it
Hi again,
I've worked a bit on this today and added locks around functions that use the D3DDevice, however I ran into some nasty deadlocks. Even when wrapping only the EVR Presenter's Paint function with lock\unlock, whenever the function is called the device is already locked, causing a deadlock. My addition to this function is the only time in the whole sources of MPC-HC where LockDevice is called, so it cannot be a different MPC module interfering with it. Is it possible that the mixer does not unlock the device properly, or that I need to tell it to unlock the device when I want to use it myself?
EDIT: I have researched the issue more in-depth, debugging both MPC-HC and EVRMixer at the same time. As I suspected, the deadlock is caused by a synchronization bug in EVRMixer - in the function EVRCustomMixer::OnProcessOutput, the function always locks the D3DDevice. However, if m_hnsFrame < 0, the function will return with MF_E_TRANSFORM_NEED_MORE_INPUT immediately, without freeing the D3DDevice.
On a side note, I found it very interesting that this bug went undetected for so long (since it seems like EVRMixer should always deadlock after MF_E_TRANSFORM_NEED_MORE_INPUT has been returned once, on all applications, providing a non-working library), and researched further to check why is it working correctly in the demo player, and found that the key is in your reference counting system in EVRCustomMixer::LockD3DDevice. Is there a particular reason you chose to implement it like that? Because at first glance, this seems like a horrible idea. By implementing reference counting you are eliminating the whole purpose of the exclusive locks (since now 2 different threads can successfully LockD3DDevice and use the device simultaneously, merely increasing its reference count to 2) AND you miss out on deadlocks like this one (since forgetting to release a lock will just increment the refcount and cause no actual bug).
Cheers,
haha01haha01
dukey
6th June 2014, 18:58
http://sourceforge.net/p/dslibbluray/code/HEAD/
should fix it
I didn't write the ref counting code, but perhaps I should simply remove it.
haha01haha01
6th June 2014, 20:12
http://sourceforge.net/p/dslibbluray/code/HEAD/
should fix it
I didn't write the ref counting code, but perhaps I should simply remove it.
Yea, I did pretty much the same patch in my own code. It does cause the screen to flip though, probably because of some initialization settings that get reset when unlocking and locking the D3DDevice. I do not know the code of EVRMixer well enough to find where you set that, it would be nice if you could fix that as well.
Also, do you know of any problems specific to ffdshow? I seem to get a blank screen in MPC whenever I use this mixer with ffdshow video decoder (LAV works fine).
dukey
6th June 2014, 23:22
I haven't tested ffdshow in a long time, but it worked fine last I tested. Probably not in dxva mode though.
haha01haha01
7th June 2014, 09:24
I haven't tested ffdshow in a long time, but it worked fine last I tested. Probably not in dxva mode though.Alright, I'll deal with that later. Do you have any guess about the flipped screen, though?
EDIT: Nevermind, found it. Remove the minus from the height calculation of the orthogonal matrix in EVRCustomMixer::InitD3D.
edison
7th June 2014, 13:21
Is that possible use this filter without JAVA ? If yes, then it will be much easy to integration to the player or LAV filter ?
nevcairiel
7th June 2014, 15:21
If a Blu-ray uses Java menus, you need Java to use them.
whurlston
26th June 2014, 18:11
I had some trouble getting PlayAtTime (REFERENCE_TIME *pTime) to work (probably just an error in my the way I'm invoking it in C#) but I was able to get it working with DVD_HMSF_TIMECODE instead.
If anyone is interested, here is a patch that changes PlayAtTime(REFERENCE_TIME *pTime) to PlayAtTime(DVD_HMSF_TIMECODE *pTime) and changes GetCurrentLocation(BDPlaybackLocation *pLocation) to GetCurrentLocation(BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode)
Index: BDSource.cpp
===================================================================
--- BDSource.cpp (revision 265)
+++ BDSource.cpp (working copy)
@@ -1131,6 +1131,7 @@
return S_OK;
}
+/*
STDMETHODIMP CBDSource::PlayAtTime(REFERENCE_TIME *pTime)
{
CAutoLock cObjectLock(&m_InterfaceLock);
@@ -1142,7 +1143,20 @@
bd_seek_time(m_pBluray,RT2PTS(*(REFERENCE_TIME*)pTime));
return S_OK;
}
+*/
+STDMETHODIMP CBDSource::PlayAtTime(DVD_HMSF_TIMECODE *pTime)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(m_pBluray==NULL) return E_FAIL;
+ if(m_State==State_Stopped) return VFW_E_DVD_INVALIDDOMAIN;
+ if(pTime==NULL) return E_POINTER;
+
+ bd_seek_time(m_pBluray,HMSFToPTS(pTime));
+ return S_OK;
+}
+
STDMETHODIMP CBDSource::PlayAtTimeInTitle(ULONG uiTitle, REFERENCE_TIME *pTime)
{
CAutoLock cObjectLock(&m_InterfaceLock);
@@ -1390,6 +1404,7 @@
return S_OK;
}
+/*
STDMETHODIMP CBDSource::GetCurrentLocation(BDPlaybackLocation *pLocation)
{
CAutoLock cObjectLock(&m_InterfaceLock);
@@ -1410,7 +1425,30 @@
return S_OK;
}
+*/
+STDMETHODIMP CBDSource::GetCurrentLocation(BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pLocation==NULL)
+ {
+ return E_POINTER;
+ }
+
+ if(m_Chapter==-1 || m_Title==-1)
+ {
+ return E_FAIL;
+ }
+
+ pLocation->ChapterNum = m_Chapter;
+ pLocation->TitleNum = m_Title;
+ LONGLONG pts = BDGetPlayListTime();
+ PTSToHMSF(pts, pTimeCode);
+ pLocation->TimeCode = PTS2RT(pts);
+ return S_OK;
+}
+
STDMETHODIMP CBDSource::SelectParentalCountry(BYTE bCountry[2])
{
if(m_State!=State_Stopped)
Index: BDSource.h
===================================================================
--- BDSource.h (revision 265)
+++ BDSource.h (working copy)
@@ -333,7 +333,23 @@
return CBaseFilter::Stop();
}
-
+/*
+ STDMETHODIMP JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
+ {
+ if (pGraph)
+ {
+ IBaseFilter *pNpvrbd = NULL;
+ HRESULT hr2 = CoCreateInstance(CLSID_NPVRBD, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pNpvrbd);
+ if (SUCCEEDED(hr2)) { hr2 = pGraph->AddFilter(pNpvrbd, L"NPVR BD Controller"); }
+ if (pNpvrbd)
+ {
+ pNpvrbd->Release();
+ pNpvrbd = NULL;
+ }
+ }
+ return CBaseFilter::JoinFilterGraph(pGraph, pName);
+ }
+*/
// IFileSourceFilter
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
@@ -368,7 +384,8 @@
STDMETHODIMP SelectAngle (ULONG ulAngle);
STDMETHODIMP GetCurrentAngle (ULONG *pulAnglesAvailable, ULONG *pulCurrentAngle);
STDMETHODIMP GetTotalTitleTime (REFERENCE_TIME *pTotalTime);
- STDMETHODIMP PlayAtTime (REFERENCE_TIME *pTime);
+ //STDMETHODIMP PlayAtTime (REFERENCE_TIME *pTime);
+ STDMETHODIMP PlayAtTime (DVD_HMSF_TIMECODE *pTime);
STDMETHODIMP PlayAtTimeInTitle (ULONG uiTitle,REFERENCE_TIME *pTime);
STDMETHODIMP GetCurrentAudio (ULONG *pulStreamsAvailable, ULONG *pulCurrentStream);
STDMETHODIMP SelectAudioStream (ULONG ulAudio);
@@ -384,7 +401,8 @@
STDMETHODIMP GetDefaultMenuLanguage (LCID *pLanguage);
STDMETHODIMP GetDefaultSubpictureLanguage (LCID *pLanguage);
STDMETHODIMP GetCurrentDomain (BDDomain *pDomain);
- STDMETHODIMP GetCurrentLocation (BDPlaybackLocation *pLocation);
+ //STDMETHODIMP GetCurrentLocation (BDPlaybackLocation *pLocation);
+ STDMETHODIMP GetCurrentLocation (BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode);
STDMETHODIMP SelectParentalCountry (BYTE bCountry[2]);
STDMETHODIMP SelectParentalLevel (BYTE bParentalLevel);
};
Index: IBDNav.h
===================================================================
--- IBDNav.h (revision 265)
+++ IBDNav.h (working copy)
@@ -179,8 +179,11 @@
virtual HRESULT STDMETHODCALLTYPE GetTotalTitleTime(
/* [out] */ REFERENCE_TIME *pTotalTime) = 0;
+ //virtual HRESULT STDMETHODCALLTYPE PlayAtTime(
+ // /* [in] */ REFERENCE_TIME *pTime) = 0;
+
virtual HRESULT STDMETHODCALLTYPE PlayAtTime(
- /* [in] */ REFERENCE_TIME *pTime) = 0;
+ /* [in] */ DVD_HMSF_TIMECODE *pTime) = 0;
virtual HRESULT STDMETHODCALLTYPE PlayAtTimeInTitle(
/* [in] */ ULONG uiTitle,
@@ -233,8 +236,12 @@
virtual HRESULT STDMETHODCALLTYPE GetCurrentDomain(
/* [out] */ BDDomain *pDomain) = 0;
+ //virtual HRESULT STDMETHODCALLTYPE GetCurrentLocation(
+ // /* [out] */ BDPlaybackLocation *pLocation) = 0;
+
virtual HRESULT STDMETHODCALLTYPE GetCurrentLocation(
- /* [out] */ BDPlaybackLocation *pLocation) = 0;
+ /* [out] */ BDPlaybackLocation *pLocation,
+ /* [out] */ DVD_HMSF_TIMECODE *pTimeCode) = 0;
virtual HRESULT STDMETHODCALLTYPE SelectParentalCountry(
/* [in] */ BYTE bCountry[2]) = 0;
whurlston
26th June 2014, 18:39
@dukey, did you ever figure out the issue with Cabin In the Woods and not finding config.xml? I have a couple of other movies with the same issue:
Hunger Games: Catching Fire
Ender's Game
Both have their config.xml located in \BDMV\JAR\00005 instead of \BDMV\JAR\030000
dukey
27th June 2014, 10:04
I know what the bug is. It's resolving the config.xml to the wrong path. I think a bunch of discs are suffering from resource related loading bugs. I did look into fixing it, then i switched my desktop java to .. version 8. And 8 apparently causes more problems as they've changed some stuff. The libbluray code relies on hooking the IO to remap the directories and stuff. Anyway the hooking fails under java 8 so makes this problem even worse. The phoneme code is not very stable also right now, and the latest drawing patch by HPI has messed up the drawing code for a bunch of discs :o
Libbluray just needs more devs, only has a few (2-3) guys working on it with very limited spare time.
whurlston
27th June 2014, 18:32
No worries. I appreciate all you've done so far. I wish I could be of help with Libbluray but it's beyond my capabilities.
haha01haha01
28th June 2014, 16:11
@whurlston
Did you find seeking via PlayAtTime to be working well? I have recently implemented seeking in my attempt to integrate bluray into MPC, and every time I seek it takes a few seconds for the video to start playing, which also puts video and audio out of sync.
whurlston
28th June 2014, 22:59
I've found skipping is very video decoder dependent, whether it's using PlayAtTime or Next/PreviousChapter.
MS DTV decoder: Instant skips with no audio sync issues. Win 8 requires Media Center Pack for MPEG2.
LAV DXVA Native: Instant skips with no audio sync issues.
LAV Quicksync: Crashes whenever I try to use it so couldn't test.
ArcSoft TMT3: Stutters constantly. Unwatchable even without skipping.
Cyberlink Video Decoder (PDVD 12): Stutters after skipping and audio sync issues. Pause/Unpause sometimes resolves it.
Cyberlink Video/SP decoder: Doesn't work.
Haven't tested MPC filters.
I do set the the sync source to the audio renderer when building the graph:
_gb.SetDefaultSyncSource(); // _gb is an IGraphBuilder instance.
IReferenceClock clock;
audioRenderer1.GetSyncSource(out clock);
((IMediaFilter)_gb).SetSyncSource(clock);
whurlston
30th June 2014, 06:18
Error in CBDSource::GetCurrentAudio and CBDSource::SelectAudioStream (in BDSource.cpp):
if(m_PlayItem<1 || m_pPlayList==NULL)
Should be:
if(m_PlayItem<0 || m_pPlayList==NULL)
dukey
30th June 2014, 10:55
I'll try test out PlayAtTime later this evening. Libluray should fire a BD_EVENT_SEEK event which should flush downstream.
AS for decoder compatability, only tested LAV and FFDshow
I can't test quicksync but both CUVID mode, software mode, and DXVA mode work. Maybe quicksync has some bugs related to changing streams. Ask nev.
whurlston
2nd July 2014, 12:55
@whurlston
Did you find seeking via PlayAtTime to be working well? I have recently implemented seeking in my attempt to integrate bluray into MPC, and every time I seek it takes a few seconds for the video to start playing, which also puts video and audio out of sync.
I'll try test out PlayAtTime later this evening. Libluray should fire a BD_EVENT_SEEK event which should flush downstream.
The flush seems to be what was causing the issue.
@haha01haha01: try removing BeginFlush() and EndFlush() from the BD_EVENT_SEEK case in CBDSource::ThreadProc() :
case BD_EVENT_SEEK:
if (m_eState == STATE_PLAYING)
{
//BeginFlush();
BDPause();
BDPlay();
//EndFlush();
}
break;
dukey
2nd July 2014, 13:08
can you skip chapters without issue?
nevcairiel
2nd July 2014, 13:48
You need to flush the decoders when seeking, or who knows what can happen.
whurlston
2nd July 2014, 14:05
Skipping chapters has the same sync issues as PlayAtTime (at least for me).
whurlston
2nd July 2014, 23:54
You need to flush the decoders when seeking, or who knows what can happen.
Would calling m_pVideoDemuxer/m_pAudioDemuxer->Flush() work? (Which just releases the samples.)
nevcairiel
3rd July 2014, 03:57
If you break a continous stream and start decoding from some other position, you need to send a flush to the decoder, or you will end up having problems. You need to call BeginFlush/EndFlush/NewSegment, usually in that order.
whurlston
3rd July 2014, 12:40
Thanks for the explanation.
With that knowledge, I decided to look at it again and the fix turned out to be even simpler: Issuing BDStop() instead of BDPause() results in instant skips and also fixes the audio sync issue:
case BD_EVENT_SEEK:
if (m_eState == STATE_PLAYING)
{
BeginFlush();
BDStop(); // BDPause();
BDPlay();
EndFlush();
}
break;
dukey
3rd July 2014, 13:50
Which decoder you using ? Calling stop will attach a new media type for negotiation with the decoder, which I guess is fine. But I didn't think was required for simply seeking in the same stream, but I am sure nevcairiel can shed light on the issue.
whurlston
3rd July 2014, 14:29
That's for the Cyberlink decoder. Nev's video decoder works just fine for me with BDPause ().
whurlston
7th July 2014, 19:44
I had to put a Sleep(10) command in BDSource.cpp ThreadProc's BD_EVENT_END_OF_TITLE case after BDStop() to fix an END_OF_TITLE loop issue. It's rare and highly configuration dependent. Conditions where it could occur are:
Java disc with AnyDVD's SpeedMenu enabled and "Keep original menu" option selected.
"Remove annoying adverts and trailers" and/or "Remove video sequences shorter than ..." are selected in AnyDVD.
User selects "Original Menu" from the speed menu selections.
Only happens with certain discs (eg: Babylon A.D.)
Only happens with certain video decoders (eg: Cyberlink)
case BD_EVENT_END_OF_TITLE:
{
CAutoLock cObjectLock(&m_InterfaceLock);
m_llPlayItemCurrent = m_llPlayItemOut;
m_Chapter = m_PlayItem = -1;
}
BDStop();
Sleep(10);
break;
All in all, I am really satisfied with the progress of this filter (many, many thanks cb2000/dukey). It's time for an open beta for NextPVR. :D
whurlston
11th July 2014, 04:22
Patch to remove GC_ERROR in libbluray on forced subtitles (they actually work):
Index: libbluray/src/libbluray/decoders/graphics_controller.c
===================================================================
--- libbluray/src/libbluray/decoders/graphics_controller.c (revision 270)
+++ libbluray/src/libbluray/decoders/graphics_controller.c (working copy)
@@ -1174,9 +1174,6 @@
/* render objects */
for (ii = 0; ii < pcs->num_composition_objects; ii++) {
BD_PG_COMPOSITION_OBJECT *cobj = &pcs->composition_object[ii];
- if (cobj->forced_on_flag) {
- GC_ERROR("_render_pg(): forced_on_flag not implemented\n");
- }
if (cobj->forced_on_flag || display_flag) {
_render_pg_composition_object(gc, pcs->pts, cobj, palette);
}
whurlston
11th July 2014, 04:41
dslibbluray patch (apologies for any screw-ups on naming conventions):
Fix E_NOTIMPL returned on GetCurrentSubpicture()
Add ability to set default region code
Add additional methods (some were of use to me but may not be relevant to the main project):
STDMETHODIMP SelectPlayerRegion (UINT32 uRegion);
STDMETHODIMP GetTitleInfo (ULONG ulTitle, BLURAY_TITLE_INFO *pInfo);
STDMETHODIMP GetClipInfo (ULONG ulTitle, ULONG ulClip, BLURAY_CLIP_INFO *pInfo);
STDMETHODIMP GetChapterInfo (ULONG ulTitle, ULONG ulChapter, BLURAY_TITLE_CHAPTER *pInfo);
STDMETHODIMP GetVideoInfo (BLURAY_STREAM_INFO *pInfo);
STDMETHODIMP GetAudioInfo (ULONG ulStream, BLURAY_STREAM_INFO *pInfo);
STDMETHODIMP GetSubpictureInfo (ULONG ulStream, BLURAY_STREAM_INFO *pInfo);
STDMETHODIMP GetCurrentDVDLocation (BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode);
STDMETHODIMP PlayAtDVDTime (DVD_HMSF_TIMECODE *pTime);
Index: dslibbluray/BDSource.cpp
===================================================================
--- dslibbluray/BDSource.cpp (revision 270)
+++ dslibbluray/BDSource.cpp (working copy)
@@ -141,7 +141,7 @@
(disc_info->bdplus_detected && !disc_info->bdplus_handled))
goto error;
- bd_set_player_setting(m_pBluray, BLURAY_PLAYER_SETTING_REGION_CODE, 1);
+ bd_set_player_setting(m_pBluray, BLURAY_PLAYER_SETTING_REGION_CODE, m_regionCode);
bd_set_player_setting(m_pBluray, BLURAY_PLAYER_SETTING_DECODE_PG, 1);
bd_set_player_setting_str(m_pBluray, BLURAY_PLAYER_SETTING_COUNTRY_CODE,m_countryCode);
@@ -1255,7 +1255,7 @@
*pulCurrentStream = m_PG-1;
*pbIsDisabled = !m_PGEnable;
- return E_NOTIMPL;
+ return S_OK;
}
STDMETHODIMP CBDSource::SelectSubpictureStream(ULONG ulSubPicture)
@@ -1438,5 +1438,172 @@
return E_NOTIMPL;
}
+STDMETHODIMP CBDSource::GetClipInfo(ULONG ulTitle, ULONG ulClip, BLURAY_CLIP_INFO *pInfo)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+ if(pInfo==NULL)
+ {
+ return E_POINTER;
+ }
+ BLURAY_TITLE_INFO *bto = bd_get_title_info(m_pBluray,ulTitle,0);
+
+ if(bto==NULL)
+ {
+ return E_FAIL;
+ }
+
+ *pInfo = bto->clips[ulClip];
+
+ bd_free_title_info(bto);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::SelectPlayerRegion(UINT32 uRegion)
+{
+ if(m_State!=State_Stopped)
+ {
+ return VFW_E_DVD_INVALIDDOMAIN;
+ }
+
+ if(uRegion==NULL)
+ {
+ return E_POINTER;
+ }
+
+ m_regionCode = uRegion;
+
+ // validate country code ?
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::GetTitleInfo(ULONG ulTitle, BLURAY_TITLE_INFO *pInfo)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pInfo==NULL)
+ {
+ return E_POINTER;
+ }
+
+ BLURAY_TITLE_INFO *bto = bd_get_title_info(m_pBluray,ulTitle,0);
+
+ if(bto==NULL)
+ {
+ return E_FAIL;
+ }
+
+ *pInfo = *bto;
+
+ bd_free_title_info(bto);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::GetChapterInfo(ULONG ulTitle, ULONG ulChapter, BLURAY_TITLE_CHAPTER *pInfo)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pInfo==NULL)
+ {
+ return E_POINTER;
+ }
+
+ BLURAY_TITLE_INFO *bto = bd_get_title_info(m_pBluray,ulTitle,0);
+
+ if(bto==NULL)
+ {
+ return E_FAIL;
+ }
+
+ *pInfo = bto->chapters[ulChapter - 1];
+
+ bd_free_title_info(bto);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::GetVideoInfo(bd_stream_info *pInfo)
+{
+ if (m_pPlayList->clips[m_PlayItem].video_stream_count > 0)
+ {
+ *pInfo = m_pPlayList->clips[m_PlayItem].video_streams[0];
+ return S_OK;
+ }
+ return E_PENDING;
+}
+
+STDMETHODIMP CBDSource::GetAudioInfo(ULONG ulStream, bd_stream_info *pInfo)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pInfo==NULL) return E_POINTER;
+ if(m_pPlayList==NULL) return E_FAIL;
+ if(m_PlayItem<0) return E_FAIL;
+
+ if(ulStream+1 > m_pPlayList->clips[m_PlayItem].audio_stream_count)
+ {
+ return E_INVALIDARG;
+ }
+
+ *pInfo = m_pPlayList->clips[m_PlayItem].audio_streams[ulStream];
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::GetSubpictureInfo(ULONG ulStream, bd_stream_info *pInfo)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pInfo==NULL) return E_POINTER;
+ if(m_pPlayList==NULL) return E_FAIL;
+ if(m_PlayItem<0) return E_FAIL;
+
+ if(ulStream+1 > m_pPlayList->clips[m_PlayItem].pg_stream_count)
+ {
+ return E_INVALIDARG;
+ }
+
+ *pInfo = m_pPlayList->clips[m_PlayItem].pg_streams[ulStream];
+
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::GetCurrentDVDLocation(BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(pLocation==NULL)
+ {
+ return E_POINTER;
+ }
+
+ if(m_pPlayList==NULL || m_pPlayList->idx == -1 || m_pPlayList->chapters->idx == -1)
+ {
+ return E_FAIL;
+ }
+
+ pLocation->ChapterNum = m_pPlayList->chapters->idx;
+ pLocation->TitleNum = m_pPlayList->idx;
+ LONGLONG pts = BDGetPlayListTime();
+ PTSToHMSF(pts, pTimeCode);
+ pLocation->TimeCode = PTS2RT(pts);
+ return S_OK;
+}
+
+STDMETHODIMP CBDSource::PlayAtDVDTime(DVD_HMSF_TIMECODE *pTime)
+{
+ CAutoLock cObjectLock(&m_InterfaceLock);
+
+ if(m_pBluray==NULL) return E_FAIL;
+ if(m_State==State_Stopped) return VFW_E_DVD_INVALIDDOMAIN;
+ if(pTime==NULL) return E_POINTER;
+ uint64_t t = HMSFToPTS(pTime);
+ uint64_t t2 = bd_seek_time(m_pBluray,t);
+ //BeginFlush();
+ //BDPause();
+ return S_OK;
+}
Index: dslibbluray/BDSource.h
===================================================================
--- dslibbluray/BDSource.h (revision 270)
+++ dslibbluray/BDSource.h (working copy)
@@ -85,6 +85,7 @@
CCritSec m_InterfaceLock; // for locking above
+ uint32_t m_regionCode;
char m_countryCode[3];
char m_defaultAudioLanguage[4];
char m_defaultMenuLanguage[4];
@@ -184,6 +185,7 @@
m_pVideoDemuxer = new CBDVideoDemuxer(this, m_VideoPin);
m_pAudioDemuxer = new CBDAudioDemuxer(this, m_AudioPin);
+ m_regionCode = 1;
strcpy_s(m_countryCode,"us");
strcpy_s(m_defaultAudioLanguage,"eng");
strcpy_s(m_defaultMenuLanguage,"eng");
@@ -387,6 +389,15 @@
STDMETHODIMP GetCurrentLocation (BDPlaybackLocation *pLocation);
STDMETHODIMP SelectParentalCountry (BYTE bCountry[2]);
STDMETHODIMP SelectParentalLevel (BYTE bParentalLevel);
+ STDMETHODIMP SelectPlayerRegion (UINT32 uRegion);
+ STDMETHODIMP GetTitleInfo (ULONG ulTitle, BLURAY_TITLE_INFO *pInfo);
+ STDMETHODIMP GetClipInfo (ULONG ulTitle,ULONG ulClip, BLURAY_CLIP_INFO *pInfo);
+ STDMETHODIMP GetChapterInfo (ULONG ulTitle,ULONG ulChapter, BLURAY_TITLE_CHAPTER *pInfo);
+ STDMETHODIMP GetVideoInfo (BLURAY_STREAM_INFO *pInfo);
+ STDMETHODIMP GetAudioInfo (ULONG ulStream, BLURAY_STREAM_INFO *pInfo);
+ STDMETHODIMP GetSubpictureInfo (ULONG ulStream, BLURAY_STREAM_INFO *pInfo);
+ STDMETHODIMP GetCurrentDVDLocation (BDPlaybackLocation *pLocation, DVD_HMSF_TIMECODE *pTimeCode);
+ STDMETHODIMP PlayAtDVDTime (DVD_HMSF_TIMECODE *pTime);
};
#endif // _BDSOURCE_
Index: dslibbluray/IBDNav.h
===================================================================
--- dslibbluray/IBDNav.h (revision 270)
+++ dslibbluray/IBDNav.h (working copy)
@@ -242,6 +242,41 @@
virtual HRESULT STDMETHODCALLTYPE SelectParentalLevel(
/* [in] */ BYTE bParentalLevel) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SelectPlayerRegion(
+ /* [in] */ UINT32 uRegion) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetTitleInfo(
+ /* [in] */ ULONG ulTitle,
+ /* [out] */ BLURAY_TITLE_INFO *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetClipInfo(
+ /* [in] */ ULONG ulTitle,
+ /* [in] */ ULONG ulClip,
+ /* [out] */ BLURAY_CLIP_INFO *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetChapterInfo(
+ /* [in] */ ULONG ulTitle,
+ /* [in] */ ULONG ulChapter,
+ /* [out] */ BLURAY_TITLE_CHAPTER *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetVideoInfo(
+ /* [out] */ BLURAY_STREAM_INFO *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetAudioInfo(
+ /* [in] */ ULONG ulStream,
+ /* [out] */ BLURAY_STREAM_INFO *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetSubpictureInfo(
+ /* [in] */ ULONG ulStream,
+ /* [out] */ BLURAY_STREAM_INFO *pInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentDVDLocation(
+ /* [out] */ BDPlaybackLocation *pLocation,
+ /* [out] */ DVD_HMSF_TIMECODE *pTimeCode) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE PlayAtDVDTime(
+ /* [in] */ DVD_HMSF_TIMECODE *pTime) = 0;
+
};
#else /* C style interface */
whurlston
11th July 2014, 18:17
Missing a file in libbluray: libbluray\src\libbluray\bdj\java\org\videolan\media\content\PlayerManager.java
/*
* This file is part of libbluray
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
package org.videolan.media.content;
import java.util.ArrayList;
public class PlayerManager {
private static PlayerManager instance = new PlayerManager();
public static PlayerManager getInstance() {
return instance;
}
/*
*
*/
private ArrayList registeredPlayers = new ArrayList(1);
private BDHandler playlistPlayer = null;
private BDHandler videoDripPlayer = null;
private ArrayList audioPlayerList = new ArrayList(8);
private Object playlistPlayerLock = new Object();
private Object videoDripPlayerLock = new Object();
private Object audioPlayerLock = new Object();
public void releaseAllPlayers(boolean unconditional) {
BDHandler[] players = null;
synchronized (registeredPlayers) {
players = (BDHandler[])registeredPlayers.toArray(new BDHandler[0]);
}
for (int i = 0; i < players.length; i++) {
if (unconditional) {
players[i].close();
} else if (players[i].getOwnerContext() != null && players[i].getOwnerContext().isReleased()) {
players[i].close();
}
}
}
protected void releaseResource(BDHandler player) {
if (player instanceof org.videolan.media.content.playlist.Handler) {
synchronized (playlistPlayerLock) {
if (player == playlistPlayer) {
playlistPlayer = null;
}
}
return;
}
if (player instanceof org.videolan.media.content.sound.Handler) {
return;
}
System.err.println("unknown player type: " + player.getClass().getName());
}
protected boolean allocateResource(BDHandler player) {
if (player instanceof org.videolan.media.content.playlist.Handler) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null && player != playlistPlayer) {
playlistPlayer.stop();
playlistPlayer.deallocate();
}
playlistPlayer = player;
}
return true;
}
if (player instanceof org.videolan.media.content.sound.Handler) {
return true;
}
System.err.println("unknown player type: " + player.getClass().getName());
return false;
}
protected void unregisterPlayer(BDHandler player)
{
synchronized (registeredPlayers) {
if (registeredPlayers.contains(player)) {
registeredPlayers.remove(player);
}
}
}
protected void registerPlayer(BDHandler player)
{
synchronized (registeredPlayers) {
if (!registeredPlayers.contains(player)) {
registeredPlayers.add(player);
}
}
}
/*
*
*/
public void onPlaylistEnd(int playlist) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.endOfMedia(playlist);
}
}
public void onPlaylistTime(int pts) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.updateTime(pts);
}
}
public void onChapterReach(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doChapterReach(param);
}
}
public void onMarkReach(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doMarkReach(param);
}
}
public void onPlaylistStart(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPlaylistStart(param);
}
}
public void onPlayItemReach(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPlayItemReach(param);
}
}
public void onAngleChange(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doAngleChange(param);
}
}
public void onRateChange(float rate) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.updateRate(rate);
}
}
public void onSubtitleChange(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doSubtitleChange(param);
}
}
public void onPiPChange(int param) {
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPiPChange(param);
}
}
}
dukey
11th July 2014, 19:26
Will check it out when in back at my pc. You actually compiling the java code
whurlston
11th July 2014, 21:15
GetCurrentLocation keeps returning the wrong title/chapter for me (timecode is correct). I had to change it to:
STDMETHODIMP CBDSource::GetCurrentLocation(BDPlaybackLocation *pLocation)
{
CAutoLock cObjectLock(&m_InterfaceLock);
if(pLocation==NULL)
{
return E_POINTER;
}
if(m_pPlayList==NULL || m_pPlayList->idx == -1 || m_pPlayList->chapters->idx == -1)
{
return E_FAIL;
}
pLocation->ChapterNum = m_pPlayList->chapters->idx;
pLocation->TitleNum = m_pPlayList->idx;
pLocation->TimeCode = PTS2RT(BDGetPlayListTime());
return S_OK;
}
Edit: Might be better to update m_Title/m_Chapter on a PlayList event in ThreadProc() instead of changing GetCurrentLocation()?
Edit2: Nope, setting it in ThreadProc doesn't work quite right. It always returns 1 as the current chapter instead of 0 when the playlist first starts. Doesn't get changed until we hit the third chapter (idx of 2).
whurlston
11th July 2014, 21:18
Will check it out when in back at my pc. You actually compiling the java code
Yup. Java code is compiling good for me (once I added that file). I get some warnings about "ArrayList/Class (etc) is a raw type..." but no errors. Haven't run into any problems playing known working discs (I haven't tested any non working discs yet to see if they work now).
Blight
23rd July 2014, 08:15
I'd like to see if I can integrate support for this filter into Zoom Player.
Is there a Delphi translation of the filter's API? If none is planned, which header file should I look at?
Also, does bluray playback require a custom EVR filter as renderer? what about supporting madVR?
dukey
23rd July 2014, 09:24
Is there a Delphi translation of the filter's API? If none is planned, which header file should I look at?
Everything you need should be in the IBDNav.h file, there is no delphi translation, but there is a C api available. Dunno if that helps.
I will look at madVR support sometime in the future, but right now my time is tied up with other projects. I also might bundle some java version with later versions of dslibbluray, and not rely on whatever versions the user has installed.
huhn
23rd July 2014, 12:37
I'd like to see if I can integrate support for this filter into Zoom Player.
Is there a Delphi translation of the filter's API? If none is planned, which header file should I look at?
Also, does bluray playback require a custom EVR filter as renderer? what about supporting madVR?
have a look at this: http://forum.doom9.org/showthread.php?t=170811
if Madshi finds time to add support for the PG IG "stream" we get MadVR with Blu ray menu support
The code inside dslibluray to control the mixer is literally a few lines. I am sure it could be swapped out with something else if needed. Someone could write some custom mixer that does the same that sits in between the filter and madVR. The 2nd pin needs to be able to render full frame rate over the main video. Overlays also still need to be able to render even when the main video pin is turned off. Bluray is a pain in the ass like that.
madshi
23rd July 2014, 16:08
I will look at madVR support sometime in the future, but right now my time is tied up with other projects.
FWIW, if there's anything madVR related I can you with, just let me know. You can contact me via PM or eMail, if you like. I'm willing to add custom interfaces to madVR, if that makes your life easier. Such interfaces should ideally be "final", though. Don't want to change such interfaces all the time.
dukey
23rd July 2014, 17:13
Can you add support for multiple input pins ? I am sure the dvd navigator would benefit from this also.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.