Jump to content
Tuts 4 You

MediaPlayer


fearless

Recommended Posts

jackyjask
Posted
9 hours ago, fearless said:

I set the string table to english_us, as it shouldnt matter when using LoadString

OK, got you

I was underd imporeession that each resource should have a correct language set (also we have that oportunity so basically the question was about why for non-english strings there is a English lang set

 

Another question (just imagine if lots of users will start loving your great sw, I have no doubts on that matter :)

so naturally they would like to invest their time into translating text lexems into their language...

do you have some plans or considerations to make it happen?

I guess the easiest way would be to keep localized materials as files on disk?

  • Like 1
Posted

If someone wants a language supported then they can translate the following information and send it to me, posted on the forum or on github or DM, whichever works for them. I can then add it into the MediaPlayer itself.

Translation Strings:
 

Main Menu:
----------
File
Open File...
Exit
Media Controls
Stop Playback
Pause Playback
Start Playing
Frame Step
Step Backward 10 Seconds
Step Forward 10 Seconds
Fullscreen Toggle
Video Aspect
Stretch
Normal
Playback Speed
Slower
Faster
Language

Help
About

Context Menu:
-------------
Open File...
Stop Playback
Pause Playback
Start Playing
Frame Step
Toggle Fullscreen
Exit Application
Volume Mute Toggle
Video Aspect
About MediaPlayer
Step Forward 10 Seconds
Step Backward 10 Seconds
Faster Play Speed
Slower Play Speed
Clear Recent Files

Tooltips strings:
-----------------
Open a media file to play
Stop Playback
Pause Playback
Play/Pause Toggle
Frame Step
Toggle Fullscreen
Exit Application
Volume Mute Toggle
Video Aspect
About MediaPlayer
Step Forward 10 Seconds
Step Backward 10 Seconds
Faster Play Speed
Slower Play Speed

Other:
------
Clear Recent Files

 

  • Like 2
  • Thanks 1
Posted

Hey again,

I tried adding the MediaPlayerSeekBar.asm file + some includes and now I get some compiling error...

/SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 "/LIBPATH:...\masm32\Lib" "...\WinAsm\MFPlayer_Test\bones.obj" "...\WinAsm\MFPlayer_Test\bones.res" "/OUT:...\WinAsm\MFPlayer_Test\bones.exe" 
bones.obj : error LNK2019: unresolved external symbol _MPPaintGradient@20 referenced in function __MPSBPaint@4
...\WinAsm\MFPlayer_Test\bones.exe : fatal error LNK1120: 1 unresolved externals

...so I have that proc added into include file...

MPPaintGradient             PROTO hdc:DWORD, lpGradientRect:DWORD, GradientColorFrom:DWORD, GradientColorTo:DWORD, HorzVertGradient:DWORD

..in my main asm file I have this..

include		MFPlayer.inc
includelib	MFPlayer.lib

include MPLAY.inc				; MPPaintGradient into and more
include MPLAY.asm				; Init N stuff of player
include MediaPlayerSeekBar.asm			; Seek Bar Control

...how to resolve that error now?

greetz

  • Like 1
jackyjask
Posted

MPPaintGradient   routine body is iniside the MediaPlayer.asm  file

 

  • Like 2
  • Thanks 1
Posted

Thanks @jackyjask so this was it. :) Just forgot adding that routine in my source.

Good news, I got the player working so far with seek bar jumping / play / pause / stop. :) So that seek bar control is so good. I love it. :) Has taken long time to get all somehow connected and working but now it works.

greetz

  • Like 2
  • Haha 1
Posted (edited)

v1.0.0.3

https://github.com/mrfearless/MediaPlayer/releases/tag/1.0.0.3

  • Limit play speed to between x0.125 and x4.
  • Adjusted German translation (thanks to Biterider).
  • Added Spanish language menu resources (thanks to Biterider).
  • Added Spanish language tooltips (thanks to Biterider).
  • Reduced size of resources with sorcery and dark magic.
  • Step 10 now only works at normal play speed or below.
  • MediaPlayer Engine restart on every media file load.
  • Fix video freeze/engine kill when opening a media file with a different codec than previous media file (MediaPlayer Engine restart).
  • The i (info/about) button tooltip shows media information for streams when a media file is loaded, otherwise it just displays "About MediaPlayer".
  • i button tooltip prepends stream number if total streams > 1
  • i button tooltip prepends stream selection ([*] or [-]) if total streams > 2

MediaPlayer-x86.zip

MediaPlayer-x64.zip

Edited by fearless
  • Like 3
  • Thanks 1
Posted

Thanks for new release!

interesting observatino: the x64 exe shrinks down from 240KB into 150 KB!

any ideas ... :)

  • Like 1
Posted
1 hour ago, jackyjask said:

interesting observatino: the x64 exe shrinks down from 240KB into 150 KB!

any ideas ... :)

Yes, its sorcery and dark magic 😉

2 hours ago, fearless said:

Reduced size of resources with sorcery and dark magic.

 

  • Like 2
  • Haha 1
Posted

Hey @fearless,

so I have a little problem with my static control (player area) + using SS_NOTIFY style. I'm using this because of handling play / pause via mouse click too. So my static control is empty and when I click on it then notify action works (did test with messagebox) and when I start to play a video on it then the notify still works BUT only so long til the video is finished or till I press the STOP button. Now the static control gets cleared / empty again as before = OK, but now the notify action does no more work. It only works again when I play anything new but I also want to be able to start the media file with just a mouse click on static control what also works for first time only.

So I tried using SetWindowLong function with my original static control GWL_STYLE putting the function there when I press STOP button and it seems to work BUT the static control gets not cleared and I see the last video image on it. So my question now is how to handle it to keep my static control STYLE original when the video is finished playing or after pressing STOP etc and or how to clear the static control to make it visually empty again?

Example: When I do this just when I press STOP button then I do restore my static style and notify of it does work again (without any loaded media) but the last video image keeps on the static control = bad. How to make it work to unload the static control / pixels / image etc?

		.elseif ax == IDC_MFP_STOP
			.IF pMI != 0
				Invoke MFPMediaPlayer_Stop, pMP
			.ENDIF	
			invoke GetDlgItem,hWin,IDC_PLAYERSTATIC
			Invoke SetWindowLong, eax, GWL_STYLE,STATICPLAYERWINDOW_STYLE_PRE

greetz

  • Like 1
Posted

I dont know any way to do that. Thats why i opted for a specific window created for the video rendering. When it is playing, i show that video window. When it is stopped, i hide that video window. That workaround gets round that issue of the last video shown or a black screen shown. And i also handle  the wm_lbuttonup for toggling play/pause when the user 'clicks' on the video window, plus other stuff as well.

  • Like 2
Posted

Ah OK. Just hiding it, so I thought that already. :) Good OK. Now I have some issues with slower & faster playing. Somehow its not working good. First problem I have is that the slower button makes video also faster like faster button. Not sure why!

IDC_MFP_SLOWER			equ 8007
IDC_MFP_FASTER			equ 8008

		.elseif ax == IDC_MFP_SLOWER	
			.IF pMI != 0
				mov eax, dwCurrentRate
				shr eax, 1 ; /2
				.IF eax >= MPF_MIN_RATE
					Invoke MFPMediaPlayer_SetRate, pMP, eax
					Invoke GUISetPositionTime, dwPositionTimeMS
				.ENDIF
			.ENDIF
		.elseif ax == IDC_MFP_FASTER	
			.IF pMI != 0
				mov eax, dwCurrentRate
				shl eax, 1 ; x2
				.IF sdword ptr eax <= MPF_MAX_RATE
					Invoke MFPMediaPlayer_SetRate, pMP, eax
					Invoke GUISetPositionTime, dwPositionTimeMS
				.ENDIF
			.ENDIF	

Also the video is not playing same smooth as in your player. In my case its like stop / go not liquid.

PS: Can you try adding a exception catcher / logger in your app just to test it for yourself. In the past I told you already that the MPayer thing does trigger exceptions when starting to play any video (do you remember?). Now with your source / new stuff I get same exceptions again. Below my info....

Spoiler
14.09.2024 01:01:44

Exception: E06D7363 (Unknown exception)

regEax 05D5F7E8
regEcx 00000003
regEdx 00000000
regEbx 05D5F8C0
regEsp 05D5F7E8
regEbp 05D5F844
regEsi 77763DA8
regEdi 6C2BCD40
regEip 76F21072 Exception Address

......\bones.exe
BaseAddress:    00401000
AllocationBase: 00400000

BaseAddress:    76DE1000
AllocationBase: 76DE0000

Exception occurs into module: KERNELBASE.dll

API address and name at or before Exception: 76F21010 RaiseException

Stack: 76F21072
------------------------------
00000000 | 05D5F7E8 | E06D7363 
00000004 | 05D5F7EC | 00000001 
00000008 | 05D5F7F0 | 00000000 
0000000C | 05D5F7F4 | 76F21072 KERNELBASE.dll
00000010 | 05D5F7F8 | 00000003 KERNELBASE.dll
00000014 | 05D5F7FC | 19930520 KERNELBASE.dll
00000018 | 05D5F800 | 05D5F8C0 
0000001C | 05D5F804 | 6C2BCD40 evr.dll
00000020 | 05D5F808 | 00000000 evr.dll
00000024 | 05D5F80C | 02280000 
00000028 | 05D5F810 | 04B40A30 
0000002C | 05D5F814 | 00000020 
00000030 | 05D5F818 | 05D5F838 
00000034 | 05D5F81C | 77B15F2E ntdll.dll
00000038 | 05D5F820 | 00000021 ntdll.dll
0000003C | 05D5F824 | 77B15F2E ntdll.dll
00000040 | 05D5F828 | 00000000 ntdll.dll
00000044 | 05D5F82C | 00000000 ntdll.dll
00000048 | 05D5F830 | 00000021 ntdll.dll
0000004C | 05D5F834 | 00000020 ntdll.dll
00000050 | 05D5F838 | 05D5F858 
00000054 | 05D5F83C | 20FE77BF 
00000058 | 05D5F840 | 02280000 
0000005C | 05D5F844 | 05D5F888 
00000060 | 05D5F848 | 7779A718 msvcrt.dll
00000064 | 05D5F84C | E06D7363 
00000068 | 05D5F850 | 00000001 
0000006C | 05D5F854 | 00000003 
00000070 | 05D5F858 | 05D5F87C 
00000074 | 05D5F85C | 00000000 
00000078 | 05D5F860 | 04B2CFF0 
0000007C | 05D5F864 | 04B2CF50 
00000080 | 05D5F868 | E06D7363 
00000084 | 05D5F86C | 00000001 
00000088 | 05D5F870 | 00000000 
0000008C | 05D5F874 | 00000000 
00000090 | 05D5F878 | 00000003 
00000094 | 05D5F87C | 19930520 
00000098 | 05D5F880 | 05D5F8C0 
0000009C | 05D5F884 | 6C2BCD40 evr.dll
000000A0 | 05D5F888 | 05D5F928 
000000A4 | 05D5F88C | 6C28745F evr.dll
000000A8 | 05D5F890 | 05D5F8C0 
000000AC | 05D5F894 | 6C2BCD40 evr.dll
000000B0 | 05D5F898 | 3094AD1D evr.dll
000000B4 | 05D5F89C | 04B2CF50 
000000B8 | 05D5F8A0 | 04B2CFF0 
000000BC | 05D5F8A4 | 04A48680 
000000C0 | 05D5F8A8 | 04B408F8 
000000C4 | 05D5F8AC | 00000064 
000000C8 | 05D5F8B0 | 05D5F8D0 
000000CC | 05D5F8B4 | 77B15F2E ntdll.dll
000000D0 | 05D5F8B8 | 0000000C ntdll.dll
000000D4 | 05D5F8BC | 77B15F2E ntdll.dll
000000D8 | 05D5F8C0 | 6C2433D4 evr.dll
000000DC | 05D5F8C4 | 0315B338 
000000E0 | 05D5F8C8 | 00000001 
000000E4 | 05D5F8CC | 8000FFFF 
000000E8 | 05D5F8D0 | 05D5F800 
000000EC | 05D5F8D4 | 777A7580 msvcrt.dll
000000F0 | 05D5F8D8 | 02280000 
000000F4 | 05D5F8DC | 00000000 
000000F8 | 05D5F8E0 | 0000000C 
000000FC | 05D5F8E4 | 04B2CFF0 
00000100 | 05D5F8E8 | 04A48680 
00000104 | 05D5F8EC | 04B2CFF0 
00000108 | 05D5F8F0 | 05D5F900 
0000010C | 05D5F8F4 | 04B2CF50 
00000110 | 05D5F8F8 | 0000000C 
00000114 | 05D5F8FC | 04B2CFF0 
00000118 | 05D5F900 | 05D5F90C 
0000011C | 05D5F904 | 6C287A57 evr.dll
00000120 | 05D5F908 | 0000000C evr.dll
00000124 | 05D5F90C | 05D5F91C 
00000128 | 05D5F910 | 6C282A24 evr.dll
0000012C | 05D5F914 | 04A48680 
00000130 | 05D5F918 | 05D5F898 
00000134 | 05D5F91C | 05D5F94C 
00000138 | 05D5F920 | 6C256958 evr.dll
0000013C | 05D5F924 | 00000001 evr.dll
00000140 | 05D5F928 | 05D5F958 
00000144 | 05D5F92C | 6C286575 evr.dll
00000148 | 05D5F930 | 3094AD6D evr.dll
0000014C | 05D5F934 | 00000000 evr.dll
00000150 | 05D5F938 | 04A43708 
00000154 | 05D5F93C | 04A436E0 
00000158 | 05D5F940 | 04A43708 
0000015C | 05D5F944 | 04B2CFF0 
00000160 | 05D5F948 | 05D5F930 
00000164 | 05D5F94C | 05D5F97C 
00000168 | 05D5F950 | 6C25676F evr.dll
0000016C | 05D5F954 | 00000001 evr.dll
00000170 | 05D5F958 | 05D5F988 
00000174 | 05D5F95C | 6C28BBE4 evr.dll
00000178 | 05D5F960 | 04A436E0 
0000017C | 05D5F964 | 3094ADBD 
00000180 | 05D5F968 | 00000000 
00000184 | 05D5F96C | 04B2CFF0 
00000188 | 05D5F970 | 04B2D0AC 
0000018C | 05D5F974 | 04A43708 

76F21072   MOV ECX , DWORD PTR [ESP+54H]
76F21076   XOR ECX , ESP
76F21078   CALL 76F2638CH
76F2107D   MOV ESP , EBP
76F2107F   POP EBP
76F21080   RETN 0010H
76F21083   AND DWORD PTR [ESP+10H] , 00H
76F21088   JMP 76F21068H
76F2108A   PUSH 0FH
76F2108C   POP EAX
------------------------------

 

..its unknown exception which seems to come from evr.dll video renderer module. Not sure whether its important or not but with my active exception logger it get logged every time. Maybe you can have a look whether you got this too or whether its an system thing whatever what you know.

greetz

  • Like 1
Posted

is  evr.dll part of MS OS?

 

Posted

evr is probably referring to the Enhanced Video Renderer which is part of the Media Foundation, which the MFPlay api ultimately uses.

@LCF_AT, Im not getting any exceptions in my own MediaPlayer program so cant comment on how that is happening in some other code.

  • Like 2
Posted

maybe exception depends on media being played?

@LCF-AT  is it possible to share you sample file?

  • Like 1
Posted

Hi guys,

OK, I attached a simple short player version playing just the same video file name I did include just for testing. So in my case I always get that exception when I start playing the video. Just test it too and see whether my app does create also an ExceptionLog.txt file with that "E06D7363 (Unknown exception)" or any else or nothing maybe. I'm using Windows 10 x64. No idea what the problem is for this exception. Seems that this exception just happens once when the EMR stuff gets loaded / init = Every time when you run the app new. Just test it.

MFPlayer_Test.zip

greetz

Posted

This is funny effect:  it does write the exception file when play then exit the app, but it does NOT when being debugged under debugger (eg Olly 2.01)

 

  • Like 1
Posted

What now? Just wanna prevent getting this exception every time to prevent creating the exception log file and blow it up with them even want to prevent that logging for Windows event log itsef. Otherwise I have to remove / disable the exception logger in the app I normally keep included. Also the exception (unknown) seems to make no trouble but it's annoying of course and there should be an reason for that.

By the way, I also get same exception when using the compiled media player from @fearless in OllyDBG 1.10...

ESI: Access violation - no RTTI data!

Log data, item 2
 Address=75B51072
 Message=Exception E06D7363

...so it's not a problem of the compiled app itself. Does anyone get same exception problem when trying to play anything? Just disable all exception to handle (plugins too) and see whether you stop on it. So the question is why I / we get that exception and how to fix it?

greetz

Posted

I"ve just tried your steps in Olly v1

issue #1 - I do not see rendered video, just audio play!?!

image.png.2a333201ffffb2f5f742a3c6e6598506.png

#2 - I"m not able to reproudce your exception - I did not see it, eg:

image.png.c85589cdd8c29a0933fb9b79d28ed369.png

  • Like 2
Posted (edited)

well, nice, great video-ing abilities! :)

Yes - I"m still using Win7, isn't it insane in almost 2025? :)

 

the error

"Access Violation - no RTTI data!"

it seems to be a C++ only error (eg wrong data inside dynamic_cast<>()  or so)

 

tell me, are you using some C++ librires or are you using C++ compiler itself to build up your demo player?

BTW, it has a typo in its name, please fix! :)

 

Edited by jackyjask
Posted

@LCF-AT  could you also scroll down a bit the Stack Pane?

it might show some interesting info though!

(new video pls)

Posted
26 minutes ago, jackyjask said:

"Access Violation - no RTTI data!"

No idea what that means.

27 minutes ago, jackyjask said:

tell me, are you using some C++ librires or are you using C++ compiler itself to build up your demo player?

Uhmmm, no clue. As I said, I also get that error when using the media player executable from @fearless. Same thing.

11 minutes ago, jackyjask said:

could you also scroll down a bit the Stack Pane?

So a longer log you can see in my post above (spoiler). Just evr module and before some MF module you can see etc nothing from main app. Also not in call stack.

35 minutes ago, jackyjask said:

BTW, it has a typo in its name, please fix!

What?! :slap:Now it's correctly, right! :yes:

  • Like 1
Posted

hey @LCF-AT

how do you do!

what meal for the lunch today :)

 

I was able to see your notorious exception in the evr.dll

it is there indeed, but only on video files, not observed on audio tracks though...

I tried to understand the root cause, but seems this is some deep down kitchen by MFP stack itself

not sure you could influence it somehow as the calling stack is too big

 

  • Like 2
Posted

Its probably using the exceptions to check if a module is loaded, and if its not to then load that module. Or if there is no media notification callback implemented, and a command is issued to set the media item and play it before the engine is ready then to try again when the engine is ready, hence the reason for the media notification callback.

  • Like 2
Posted

Exception caused because 

6E7C9794                 | 837B 64 01               | cmp dword ptr ds:[ebx+64],1                                         
6E7C9798                 | 0F85 71020000            | jne evr.6E7C9A0F 

first time when start the video, value is zero.

So exception.

Second is 1.

this value is very close to Digicert Signature.

Just a thought.

                                                

Untitled.jpg

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...