Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Shader media times access #162

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

on-situ-repos
Copy link
Contributor

Add media status access from shader, add current video time and length in the const registers.

#if 1
D3DSURFACE_DESC desc;
m_pVideoTexture[m_nCurSurface]->GetLevelDesc(0, &desc);

float fConstData[][4] = {
{(float)desc.Width, (float)desc.Height, (float)(counter++), (float)diff / CLOCKS_PER_SEC},
{1.0f / desc.Width, 1.0f / desc.Height, 0, 0},
{ (float)desc.Width, (float)desc.Height, (float)(counter++), (float)diff / CLOCKS_PER_SEC },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these, use contrib/run_astyle.bat for formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do run it before pushing, but it doesn't correct it. I use AStyle 5.5.8 unicode, is this correct ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That version is for Inno Setup, not astyle. Personally, I'm still in 2.05.1, no idea if there's any newer, but you shouldn't do manual corrections in style since they will be overwritten the next time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sorry, it's 2.05.1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue might have been already fixed in their trunk branch, but you can try reporting it to astyle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sur if it's a bug : --unpad-paren seems to be about parenthesis only, not brackets.

Yes I guess the method is intrusive, but we didn't see other way to retrieve the information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, gathering stream position information on timer is way too imprecise. And calling IMediaSeeking from rendering loop would cause deadlock, if I remember DirectShow quirks correctly. But video renderer should have segment position for each to be presented frame, and that can be used.

@on-situ-repos
Please clarify why do you need this in the first place, I think it's getting out of scope of what video renderer shaders were supposed to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look at the segment position.
It's to have effects based on the timeline (custom fadeoff / transitions / ...).
We are working on adding an external .json to set custom shader attributes (textures & others), not sure if it should be pushed too, it'll be on github anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are working on adding an external .json to set custom shader attributes (textures & others), not sure if it should be pushed too, it'll be on github anyway.

If you can wrap it into an interface that could be used by external video renderers such as madVR, then by all means yes.

@XhmikosR
Copy link
Contributor

XhmikosR commented Mar 4, 2016

You do not need the merge commits; just rebase your branch.

@on-situ-repos
Copy link
Contributor Author

Ok, I haven't used "rebase" for now, thanks for the tip.

@on-situ-repos
Copy link
Contributor Author

Ok, latest commit is better.
Here is a sample shader for testing :

float4 consts0 : register(c0);
float4 consts1 : register(c1);

float4 main(float2 tex : TEXCOORD0) : COLOR
{
return float4(consts1.z/4.0, (consts1.w-consts1.z)/4.0, 0.0, 1.0);
}

@@ -183,7 +183,8 @@ public IUnknown {
STDMETHOD_(bool, Paint)(bool bAll) PURE;

STDMETHOD_(void, SetTime)(REFERENCE_TIME rtNow) PURE;
STDMETHOD_(void, SetSubtitleDelay)(int delayMs) PURE;
STDMETHOD_(void, SetDuration)(REFERENCE_TIME rtDuration) PURE;
STDMETHOD_(void, SetSubtitleDelay)(int delayMs) PURE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs -> spaces
Maybe run AStyle if you haven't already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISubPic.h is excluded by astyle.ini

sh0wTuan2016 referenced this pull request Mar 19, 2016
… to get the icons for the toolbar (play, pause, etc) buttons; else it uses built-in icons.

"Toolbar.bmp" can be of bitdepth <= 24, in which case RGB(255, 0, 255) is considered transparent or of bitdepth 32, in which case the alpha channel is used for transparency / gradients; 32 bit bitmaps mustn't use any compression in order to load properly; its resolution should be 15h x h to load, each icon being h x h in size for bigger toolbar.bmp files, the player minimum width is set so that all icons remain visible.
The volume slider isn't modified yet - it keeps its size.

Patch by foxx1337

git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1706 10f7b99b-c216-0410-bff0-8a66a9350fd8
@sh0wTuan2016 sh0wTuan2016 mentioned this pull request Mar 19, 2016
stdedos pushed a commit to stdedos/mpc-hc that referenced this pull request Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants