Author Topic: KVideoPlayer API (madVR interface)  (Read 4509 times)

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
KVideoPlayer API (madVR interface)
« on: July 20, 2017, 09:51:08 am »
If you want you can test it how it work in W10.
by me it work without flicker or other on W7 to

if you want use the best VideoRenderer on the market you can load it here
http://madVR.madshi.net

VIDEOEXT = '.avi;.qt;.mov;.mpg;.mpeg;.m1v;.asf;.wma;.wmv;.flv;.mp4;.mkv;.dat;.rm;.3gp';

Attached file source include.

using following Lavfilter: EVR, VMR7, VMR9, MADVR.

greets
« Last Edit: August 30, 2017, 06:36:07 pm by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #1 on: August 04, 2017, 07:35:17 pm »
Emil

What is the API name (and parameters) to play a video from an URL ?

Depends on the Lav filter..
there is no additional Funktion.

Quote
0.49 - 2012/03/10
LAV Splitter
- Improved MKV demuxing performance from slow sources (network streaming, etc)
- Improved stream detection on Blu-rays
- Improved support for RealAudio (COOK, SIPR, etc) in MKV
- Support for streaming from HTTP URLs

Quote
0.67.0 - 2015/11/15
LAV Splitter
- NEW: Support for HTTPS URLs
- NEW: Automatic selection of the highest quality variant in HLS streams
- Changed: Reverted back to the old ASF demuxer
- Changed: Backported ASF seeking improvements to the old ASF demuxer
- Fixed: ASS in AVI did not work in recent versions
- Fixed: RTP/RTSP did not work properly in 0.66

You should understand the concept of Microsoft's DirectShow & the filters of DirectShow.
The LAV filters is a set of DirectShow filters - source filter, splitter filter, audio decoder filter & video decoder filter except audio/video renderer filter.

EVR, VMR7, VMR9, MADVR are video render filters.
Filter's should be connected according to stream flow as,

source filter -> splitter filter ----> audio decoder filter -> audio renderer filter video decoder filter -> video renderer filter
We may change some attributes of LAV filter by use property page but not included the routine for that in KVideoPlayer.dll.

please see Readme
what you can do and what do LAV Filters for you.

greets
« Last Edit: August 04, 2017, 07:41:50 pm by Emil Weiss »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #2 on: August 05, 2017, 12:49:51 am »
Yes, i have been also able to play with the LAV version i am working on (a modified version of MBox64).
I drop out the extra audio features from Media Foundation, keeping only Bass.dll.

is a great Player if not use my own, i am want use MBox64.
i have not see in the source to.

by the way the Events is not working in 64Bit no idea why i am work on it.
i think the Import of TPlayerEvent is wrong.
work on a fix how can Play without madvr (i want check is madvr installed on System)

greets
« Last Edit: August 05, 2017, 01:11:19 am by Emil Weiss »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #3 on: August 05, 2017, 08:23:32 am »
My last update.. not finish to so you can use any Infos from it.
i am go to bed now..

i want add your lib and Header later.

greets
« Last Edit: August 05, 2017, 08:36:57 am by Emil Weiss »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #4 on: August 06, 2017, 03:10:33 pm »
you tell me that the app Crash if madVr not installed do not use Error Handler?

see.. KVideo_GetLastError

greets
« Last Edit: August 06, 2017, 03:20:11 pm by Emil Weiss »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 508
    • zapsolution
Re: KVideoPlayer API (madVR interface)
« Reply #5 on: August 06, 2017, 06:15:42 pm »
Emil

What is the difference between KVideo_Stop and KVideo_CloseFile ?

...
« Last Edit: August 06, 2017, 06:52:47 pm by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #6 on: August 06, 2017, 07:20:10 pm »
Emil

What is the difference between KVideo_Stop and KVideo_CloseFile ?

...

KVideo_CloseFile destroy the Handle of the VideoFile and free it. (the Graph is then destroy = NULL in c++ to)
KVideo_Stop stop the file can then resume with KVideo_Play from beginning 0 Position. (the handle from File is NOT Destroy)
KVideo_Pause stop the file can then resume from current Position.

if your use KVideo_CloseFile resume over KVideo_Play not work the Graph is then NULL.
When you open a new file, it is recommended to use KVideo_CloseFile or increase your Memory.

greets
« Last Edit: August 06, 2017, 07:35:40 pm by Emil Weiss »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #7 on: August 07, 2017, 02:07:21 am »
fix issues with Stack Overflow.
fix issues with status_stack_buffer_overrun (if use KVideo_CloseFile();)
fix issues with madvr
fix issues with Memory corruption

Change Name of DLL.

i hope all works god now

you can use now SlowMotion like this..
// Checkbox
Code: [Select]
        case ID_CKB_SEARCH:
            {
                if (KVideo_GetPlayerState() != psNotReady)
                {
                    BOOL checked = IsDlgButtonChecked(hWnd, ID_CKB_SEARCH);
                    if (checked) {
                        CheckDlgButton(hWnd, ID_CKB_SEARCH, BST_UNCHECKED);
                    }
                    else
                    {
                        CheckDlgButton(hWnd, ID_CKB_SEARCH, BST_CHECKED);
                    }                   
                    KVideo_SetSearchMode(EnableWindow(hcbPlaybackRate, !checked));
                    break;
                }
            }
            break;

// Combo
Code: [Select]
            case ID_CBPLAYBACKRATE:
            {
                IntI = SendMessage(hcbPlaybackRate, CB_GETCURSEL, IntI, 0);
                if (IntI != CB_ERR)
                    SendMessage(hcbPlaybackRate, CB_GETLBTEXT, IntI, (WPARAM)(&Buffer));
               
                WCHAR * fIn = (WCHAR*)(&Buffer);
                float fOut = (float)wcstod(fIn, NULL);
               
                KVideo_SetPlaybackRate(fOut);
            }
            break;
            }

the first renderer is now EVR if not used madvr or madvr is not Installed.

PS:
now make finish my sample with Overlay Bitmap, Menu and capture.

remove attachment see last post

greets
« Last Edit: August 07, 2017, 09:41:21 am by Emil Weiss »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 508
    • zapsolution
Re: KVideoPlayer API (madVR interface)
« Reply #8 on: August 07, 2017, 08:52:08 am »
Emil

I have downloaded the new KVideoPlayer_x64.dll, i will use it with the new MediaBox project that i shall post into the WIP section (Work In Progress).
Then you will be able to test what i have done so far.

I had to do a lot of changes inside of the source code, because MF works in asynchronous mode, while LAV is not.
I have also removed the use of CoInitializeEx to avoid any potential conflict with the KVideoPlayer_x64.dll.

Quote
you can use now SlowMotion like this.
What is the purpose of using SlowMotion, that is not clear to me ?

Added
When using the new DLL, i have this message at startup when used on Creators
Library (d3dx9d_45.dll or older versions) for transparent overlay image is not present.
(i have already the latest DirectX version installed on my system, DirectX 9 is an old version...)

Note: this is not much of an issue for me, because i am already able to display transparent overlay image.
This popup warning dialog is also causing havoc with my GUI because it shows up at the time i am displaying the controls.
« Last Edit: August 07, 2017, 09:35:28 am by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #9 on: August 07, 2017, 09:07:09 am »
Quote
What is the purpose of using SlowMotion, that is not clear to me ?

Slow Motion..

i have create a Combo like this..
Code: [Select]
    // Combo PlaybackRate
    dwStyle = WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED;
    hcbPlaybackRate = CreateWindowEx(0, L"COMBOBOX", TEXT(""), dwStyle, 535, H + 32, 70, 22, hOwner, (HMENU)ID_CBPLAYBACKRATE, hInst, NULL);
    TCHAR PlaybackRateItems[21][22] = {
        TEXT("0.1"), TEXT("0.2"), TEXT("0.3"), TEXT("0.4"), TEXT("0.5"), TEXT("0.6"), TEXT("0.7"), TEXT("0.8"), TEXT("0.9"), TEXT("1"),
        TEXT("2"), TEXT("3"), TEXT("4"), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("12"), TEXT("16")
    };
    TCHAR B[22];
    IntI = 0;
    memset(&B, 0, sizeof(B));
    for (IntI = 0; IntI < 21; IntI++)
    {
        wcscpy_s(B, sizeof(B) / sizeof(TCHAR), (TCHAR*)PlaybackRateItems[IntI]);

        SendMessage(hcbPlaybackRate, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)B);
    }
    // Value 1 wird verwendet
    SendMessage(hcbPlaybackRate, CB_SETCURSEL, (WPARAM)9, (LPARAM)0);

    if (Font != 0)
    {
        SendMessage(hcbVRenderer, WM_SETFONT, (WPARAM)(Font), int(true));
        SendMessage(hcbPlaybackRate, WM_SETFONT, (WPARAM)(Font), int(true));
    }

you can see also the TEXT goes from 0.1 > 16 floating Point

also SlowMotion is you can Play the Video < 1/10 from 1 also 0.1 or from 1 (normal) to 16x field. (or 32x if your want LOL )
i hope you understand my bad english.

Quote
When using the new DLL, i have this message at startup when used on Creators
Library (d3dx9d_45.dll or older versions) for transparent overlay image is not present.

if that a Problem i can remove(deactivate) the message to..
that is the overlay Picture..

greets
« Last Edit: August 07, 2017, 09:44:00 am by Emil Weiss »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 508
    • zapsolution
Re: KVideoPlayer API (madVR interface)
« Reply #10 on: August 07, 2017, 12:26:58 pm »
Emil

Playing the same movie.

The LAV version use almost 15% of the CPU, and 392 Mb of ram.
While, the MF version use only 1.5% of the CPU, and 182 Mb of ram.

You should try to convert the DLL to C++ rather than Delphi to see if it makes any difference.  :-\

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #11 on: August 07, 2017, 12:32:06 pm »
Emil

Playing the same movie.

The LAV version use almost 15% of the CPU, and 392 Mb of ram.
While, the MF version use only 1.5% of the CPU, and 182 Mb of ram.

You should try to convert the DLL to C++ rather than Delphi to see if it makes any difference.  :-\

no idea what your do.
i have a simple core quad q9650 3GHZ a smal GForce GTX 780 TI

if Play 4K movies directly from Internet with no more then 13% of CPU. (2160p(4K hd)
on the other side i am use DTS and many other stuff which MF not used what your think is the difference?
MF Version do nothing, only Play the Video in poor Quality. ;)

No Problem my Application can eat 1GB Ram if needed, As long as the memory is released correctly afterwards.


greets
« Last Edit: August 07, 2017, 01:22:27 pm by Emil Weiss »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 508
    • zapsolution
Re: KVideoPlayer API (madVR interface)
« Reply #12 on: August 07, 2017, 01:34:38 pm »
Quote
no idea what your do
.

The CPU resource should stay below 10%

If i don't play a movie, my player uses only 0% of the CPU while playng animation.

I shall post the project with full C++ source code, then you will be to test it yourself.

The CPU resource seems to increase much when using the seek pointer to a new movie location.
Note: i am trying with a full HD movie 1920x1080 (Avatar)
with 720P the CPU is much lower.
« Last Edit: August 07, 2017, 01:40:40 pm by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 274
Re: KVideoPlayer API (madVR interface)
« Reply #13 on: August 07, 2017, 01:46:50 pm »
i am Play a  movie (2K)2560x1440 17% CPU and 380MB Ram that is not a Problem for me.
after stop it the ram goes to 21MB

greets
« Last Edit: August 07, 2017, 01:48:59 pm by Emil Weiss »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 508
    • zapsolution
Re: KVideoPlayer API (madVR interface)
« Reply #14 on: August 23, 2017, 05:25:56 pm »
Emil

I am using KVideoPlayer mostly to check that the function are working the same in your code and inside of MediaBox.
So far i have added the new zoom function, but i keep using my own subtitle function that do not requires the bloated XySubFilter.