Better video overlay?
Moderators:X05, Dreamer, FredB
I'm in the process of writing an EPG module which mimics the style of the 7MC guide and reads data from an XMLTV file. All of the components are there I just need to bring everything together to finish it off.
The main limitation though is that the EPG has a separate window and I guess won't play nice with fullscreen DD. It would be really nice if DD had some method of enabling a decent video overlay, by which I mean the possibility to do hardware accelerated full frame rate rendering over the video surface with an alpha channel... surely this is something that the VMR and EVR should be able to handle?
The main limitation though is that the EPG has a separate window and I guess won't play nice with fullscreen DD. It would be really nice if DD had some method of enabling a decent video overlay, by which I mean the possibility to do hardware accelerated full frame rate rendering over the video surface with an alpha channel... surely this is something that the VMR and EVR should be able to handle?
Re: Better video overlay?
hi sgs, DD doesnt support Alpha channels /transparency for now. You have 2 options using OSD (without alpha). Or just minimizing / resizing DD window on your EPG window, just like EPGPlus. I recommend the 2nd method for now, a lot easier. OSD API can change in future to support alpha channel etc.
I will answer how to do this and your other question later today. will also post latest ModuleAPI SDK .
I will answer how to do this and your other question later today. will also post latest ModuleAPI SDK .
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
Here is the code part to do that (Delphi code piece, but you can see ModuleAPI & WinAPI functions to do that and use in your code)
This code is used in EPGPlus, Sets DVBDream in TVWindow mode, then places it (by setting window position) at top left on the EPG window.
Please download latest SDK here http://www.dvbdream.org/forum/viewtopic ... 985#p13985
This code is used in EPGPlus, Sets DVBDream in TVWindow mode, then places it (by setting window position) at top left on the EPG window.
Please download latest SDK here http://www.dvbdream.org/forum/viewtopic ... 985#p13985
Code: Select all
var
hTVWindow: HWND = 0;
previous_display_mode: Integer;
lPreviousStyle: DWORD = 0;
TVWindowEnabled: boolean;
env: TEnvironment;
hwndDDt: HWND;
rTVWindow: TRect;
procedure Tfmain.SetTVWindow();
var
lStyle: DWORD;
begin
if TVWindowEnabled then exit;
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_GET_DISPLAY_MODE, Integer(@previous_display_mode));
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_SET_DISPLAY_MODE, DISPLAYMODE_TVWINDOW);
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_GET_DISPLAY_OWNER_HANDLE, Integer(@hTVWindow));
GetWindowRect(hTVWindow, rTVWindow);
// SetWindowPos(hTVWindow, fmain.Handle, fmain.Left + 10, fmain.Top + 30, 188, 100,0);
SetWindowPos(hTVWindow, fmain.Handle, 0, 0, 188, 100, 0);
lPreviousStyle := GetWindowLong(hTVWindow, GWL_STYLE);
lStyle := lPreviousStyle and (not (WS_CAPTION or WS_THICKFRAME or WS_MINIMIZE or WS_MAXIMIZE or WS_SYSMENU));
SetWindowLong(hTVWindow, GWL_STYLE, lStyle);
windows.SetParent(hTVWindow, fmain.Handle);
SetWindowPos(hTVWindow, fmain.Handle, 30, 30, 188, 100, 0);
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_FREEZE_TVWINDOW, 0);
TVWindowEnabled := true;
end;
procedure Tfmain.FreeTVWindow();
begin
if not TVWindowEnabled then exit;
TVWindowEnabled := false;
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_UNFREEZE_TVWINDOW, 0);
windows.SetParent(hTVWindow, 0);
SetWindowLong(hTVWindow, GWL_STYLE, lPreviousStyle);
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_SET_DISPLAY_MODE, previous_display_mode);
if previous_display_mode <> DISPLAYMODE_TVWINDOW then
ShowWindow(hTVWindow, SW_HIDE);
application.ProcessMessages;
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_SET_DISPLAY_MODE, previous_display_mode);
SetWindowPos(hTVWindow, fmain.Handle, rTVWindow.Left, rTVWindow.Top, rTVWindow.Right - rTVWindow.Left, rTVWindow.Bottom - rTVWindow.Top, 0);
end;
procedure Tfmain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tag := 0;
FreeTVWindow();
timer1.Enabled := false;
end;
procedure Tfmain.UpdateTVBoxSize();
begin
if not TVWindowEnabled then exit;
TVBOX_WIDTH := round(s.tvbox_height / 3 * 4);
SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_GET_DISPLAY_OWNER_HANDLE, Integer(@hTVWindow));
SetWindowPos(hTVWindow, 0, 2, 2, TVBOX_WIDTH - 4, s.tvbox_height - 4, SWP_NOZORDER);
end;
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
Ah, thanks, I will give it a go.
How likely is it for Alpha blending to be implemented in DD? I think It's impossible to create a really slick looking interface without it.
I guess I could switch DD to renderless mode, grab the stream and render the video myself though, maybe worth a shot if I can find the time.
My epg works.. but getting Qt into DLL is not really nice, I think I'll have to replace it with something else.
Thanks for the help.
How likely is it for Alpha blending to be implemented in DD? I think It's impossible to create a really slick looking interface without it.
I guess I could switch DD to renderless mode, grab the stream and render the video myself though, maybe worth a shot if I can find the time.
My epg works.. but getting Qt into DLL is not really nice, I think I'll have to replace it with something else.
Thanks for the help.
Re: Better video overlay?
Alpha blending is not soon, maybe in 6 months / 1 year etc. (need to change architecture considerably)
Share your EPG for us to test here please. I can help with little API extensions etc if you need anything, let me know
Share your EPG for us to test here please. I can help with little API extensions etc if you need anything, let me know
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
Well it's not going to happen this week but I will upload it at some point.
It's extremely rough at the moment and requires quite a few Qt dll's. I would upload it to sourceforge or something but I think it needs rewriting without Qt first.
I was thinking that another alternative to the alpha blending overlay would be to create my own directshow renderer that wraps the EVR (which is what I use). Any idea if the directshow filter could access the DD API directly since it's inside the same process?
It's extremely rough at the moment and requires quite a few Qt dll's. I would upload it to sourceforge or something but I think it needs rewriting without Qt first.
I was thinking that another alternative to the alpha blending overlay would be to create my own directshow renderer that wraps the EVR (which is what I use). Any idea if the directshow filter could access the DD API directly since it's inside the same process?
Re: Better video overlay?
I think you can call DD API functions inside directshow filter.
You will need to take DD into renderless mode, and build all the things like TS demultiplexer etc. A lot of time taking work.
I thought exposing DD's internal graph to you (as a pointer) but DD resets / recreates its directshow graph on channel changes when there are changes in stream format (some codecs need that) Between channel changes a few second would be without OSD.
You will need to take DD into renderless mode, and build all the things like TS demultiplexer etc. A lot of time taking work.
I thought exposing DD's internal graph to you (as a pointer) but DD resets / recreates its directshow graph on channel changes when there are changes in stream format (some codecs need that) Between channel changes a few second would be without OSD.
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
I noticed that the documentation for the SDK states:
- access to DirectShow graph
Does this include access to the renderer? and if so how would one get access to this?
The only likely command I can see is DDMODAPI_GET_BDA_FILTERS but this sounds like it only provides access to the capture filters.
- access to DirectShow graph
Does this include access to the renderer? and if so how would one get access to this?
The only likely command I can see is DDMODAPI_GET_BDA_FILTERS but this sounds like it only provides access to the capture filters.
Re: Better video overlay?
That function was removed, I'll add API funtions to return DirectShow graph pointer for you, and maybe another to return renderer pointer as well.
I'll send test version / patch soon here for your tests
I'll send test version / patch soon here for your tests
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
Thanks,
I think I can do what I want if I can get the renderer and then query for IVMRMixerBitmap9 or IMFVideoMixerBitmap.
If I can find the time I would like to have a go at creating a custom EVR mixer or presenter to do the overlay although I'm not sure which one I need. I guess either one could in theory render to the video surface. This would allow pretty effects over the video surface like blurring which would be fun.
My epg is now working so I'll upload it at the weekend, here's a screen shot:
Still need to:
- Tweak colours (yellow selected cell is ugly, better contrast for fonts)
- Add channel images
- Improve configuration
- Use DD API for now/next since this should be more up to date?
- Remove Qt dependency.. this will mean rewriting for something like GDI or Direct2D
Currently configuration means placing an XMLTV file named 'TVGuide.xml' and a file called 'mappingfile' into the DD directory. The 'mappingfile' maps XMLTV channel ID's to DD channel id's and also defines channel images, I would like to do this automatically and allow the path of the XMLTV file to be configurable.
In theory the layout of the guide should be configurable, e.g, the size of all of the elements and number of visible channels/time window and colours.
One more question: the module API allows a type to be specified, e.g, 'EPG'. Does this do anything other than associate it with the shortcut? Just wondering what type an OSD EPG would be..
I think I can do what I want if I can get the renderer and then query for IVMRMixerBitmap9 or IMFVideoMixerBitmap.
If I can find the time I would like to have a go at creating a custom EVR mixer or presenter to do the overlay although I'm not sure which one I need. I guess either one could in theory render to the video surface. This would allow pretty effects over the video surface like blurring which would be fun.
My epg is now working so I'll upload it at the weekend, here's a screen shot:
Still need to:
- Tweak colours (yellow selected cell is ugly, better contrast for fonts)
- Add channel images
- Improve configuration
- Use DD API for now/next since this should be more up to date?
- Remove Qt dependency.. this will mean rewriting for something like GDI or Direct2D
Currently configuration means placing an XMLTV file named 'TVGuide.xml' and a file called 'mappingfile' into the DD directory. The 'mappingfile' maps XMLTV channel ID's to DD channel id's and also defines channel images, I would like to do this automatically and allow the path of the XMLTV file to be configurable.
In theory the layout of the guide should be configurable, e.g, the size of all of the elements and number of visible channels/time window and colours.
One more question: the module API allows a type to be specified, e.g, 'EPG'. Does this do anything other than associate it with the shortcut? Just wondering what type an OSD EPG would be..
Re: Better video overlay?
Also plan to add extra programme information from the XMLTV data and colour programme cells based on category.
Re: Better video overlay?
I have made a patch, please use DDMODAPI_GET_DS_POINTERS to get working direct show graph's pointers.
You should get the DS pointers after every channel change, and delete your instances before every channel change. (DD will renew graph often / though not always) Otherwise there will be pointer errors and crashes.
You need to control IVMRMixerControl9 and provide it with OSD images
You can get current DD API to get now/next. Module type has no other functionality other than shortcut (for keyboard and remote control). For your tests you can assign MODTYPE_NONE for now.
Here are channel logos used by EPGPlus, I dont know if applicable to your work.
http://www.dvbdream.org/forum/viewtopic.php?f=1&t=3739
Mixing OSD image or just enabling direct show mixer might cause reduction in image quality.
VMR and EVR renderer probably have different OSD method (mixer), it is up to you test.
here is Delphi code piece I've used to test the function.
You should get the DS pointers after every channel change, and delete your instances before every channel change. (DD will renew graph often / though not always) Otherwise there will be pointer errors and crashes.
You need to control IVMRMixerControl9 and provide it with OSD images
You can get current DD API to get now/next. Module type has no other functionality other than shortcut (for keyboard and remote control). For your tests you can assign MODTYPE_NONE for now.
Here are channel logos used by EPGPlus, I dont know if applicable to your work.
http://www.dvbdream.org/forum/viewtopic.php?f=1&t=3739
Mixing OSD image or just enabling direct show mixer might cause reduction in image quality.
VMR and EVR renderer probably have different OSD method (mixer), it is up to you test.
here is Delphi code piece I've used to test the function.
Code: Select all
var
dsp: tds_pointers;
r: integer;
begin
zeromemory(@dsp, sizeof(dsp));
dsp.dwSize := sizeof(dsp);
r := SendMessage(fmain.Handle, WM_MODULE_MSG, DDMODAPI_GET_DS_POINTERS, Integer(pointer(@dsp)));
showmessage(inttostr(r)+ ' '+format('%0.8x %0.8x', [DWORD(dsp.pGraph), DWORD(dsp.pFltVRenderer)]));
- Attachments
-
- dd patch for ModAPI exposing DS filters.rar
- extract dvbdream.exe and ds_mng.dll into DVB Dream root folder / overwrite
- (1.31MiB)Downloaded 862 times
DVB Dream - because I have to dream about having time to code it
Re: Better video overlay?
Thanks I will have a play, although having read more of the documentation for the mixer it seems that the bitmaps only get updated with new frames.. I guess this will be a problem when DD can't tune a channel for whatever reason.
Re: Better video overlay?
I haven't had time to try DDMODAPI_GET_DS_POINTERS yet but I did manage to get a similar effect (windows 7) by using DwmEnableBlurBehindWindow to make the background transparent. gives the video a nice blurred effect when the epg is overlaid too... of course I have a clear (white) glass effect on my win7 machine, might not look so nice with other colours.
Re: Better video overlay?
I've been reading the API for MadVR (which I am currently using with DD) and It looks like this will allow me to get the graphics surface and render to it directly which is what I want. Looking forward to getting the time to try this!
To do this with EVR or VMR9 I guess would require creating a custom allocator/presenter. I can see how difficult it is to provide a decent OSD interface in DD when you would need to implement a specific solution for every different renderer :\ At least if MadVR works for me I'm not worried about the others.
To do this with EVR or VMR9 I guess would require creating a custom allocator/presenter. I can see how difficult it is to provide a decent OSD interface in DD when you would need to implement a specific solution for every different renderer :\ At least if MadVR works for me I'm not worried about the others.
Return to “Module / Plugin Programming”
Who is online
Users browsing this forum: No registered users and 1 guest