News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Displaying video with ffdshow MP4

Started by TouEnMasm, July 31, 2014, 10:23:23 PM

Previous topic - Next topic

TouEnMasm


I search source codes on the subject(asm or c++).
Internet seems to be very poor on this.
I know a few on graphedit and a few on those interfaces (strmif.h):
IFilterGraph,IGraphBuilder,IBaseFilter....
Fa is a musical note to play with CL

Tedd

You can consider it as just another DirectShow filter, and so any tutorial for using filters in DirectShow should be adequate.

This one looks fine: http://laganiere.name/directshowTut/
Potato2

TouEnMasm


I know this one,he is a perfect code to do what i want.
He play avi and MP3 has others.
The game is to add the ffdshow filters i have tried:

.data
CLSID_video_ffdshow GUID <04FE9017h,0F873H,410Eh,<87H,1EH,0ABH,91H,66H,1AH,4EH,0F7H>>
IID_IBaseFilter GUID <056A86895H,0AD4H,011CEH,<0B0H,03AH,0H,020H,0AFH,0BH,0A7H,070H>>
.code
invoke CoCreateInstance,addr CLSID_FilterGraph, NULL,CLSCTX_INPROC_SERVER,addr IID_IFilterGraph,addr ppvIFilterGraph ;ppv out
;eax S_OK réussite
.if ppvIFilterGraph == 0 ;failed
invoke MessageBox,NULL,TXT("IFilterGraph"),addr comfailed,MB_OK
jmp FindeGraph
.endif
invoke CoCreateInstance,addr CLSID_video_ffdshow, NULL,CLSCTX_INPROC_SERVER,\
addr IID_IBaseFilter,addr ppvIBaseFilter ;ppv out

IFilterGraph AddFilter,ppvIBaseFilter,NULL


all this work but haven't effect.
How add a filter,seem to be the question ?.




Fa is a musical note to play with CL

TouEnMasm

Fa is a musical note to play with CL

Zen

TOUTENMASM (Yves),
I had a book on DirectShow that I used to write some code a number of years ago. I found it VERY difficult, especially the part about how use a DirectShow filter from within a regular COM program. They are so complicated,...and, there is no function that will validate a DirectShow filter.
I had a bunch of C++ source code that I had downloaded from Cakewalk. They sell audio editing software, and several years ago they were trying to promote a DirectShow Audio Filter as a standard to be used in audio software.
As you have already found, you can learn alot just by playing around with the FilterGraph.
You might find this interesting: DirectShow Samples.

TouEnMasm

Thanks at all,
The sample sdk cutscene give the soluce.
Here the translate in asm.
he could play mp4,AVI and surely other format.
Can be stop by esc,space or return key.
View is full screen,he need a file as parameter to work.
Some modifies have been made in the headers,download
http://masm32.com/board/index.php?topic=563.msg4563#msg4563
Fa is a musical note to play with CL

Zen

TOUTENMASM (Yves),
You may also find this interesting: Media Player Classic. It's been around forever, and is Open Source (written in C++).
Source Code repository: Media Player Classic Source Code
As I recall, it used to have the capability to load a DirectShow Filter,...and, has the source code for a number of filters here: Filters

TouEnMasm


Here is he soluce To create an instance of a filter,translate from mapper
He give this sort of liste
Quote
ffdshow DXVA Video Decoder
ffdshow Video Decoder
ffdshow Audio Decoder
MPEG Video Decoder
MPEG Audio Decoder
MPEG Layer-3 Decoder
WMAudio Decoder DMO
LAV Splitter
LAV Audio Decoder
LAV Video Decoder
DirectVobSub (auto-loading version)
ACELP.net Sipro Lab Audio Decoder
Mpeg4s Decoder DMO
WMV Screen decoder DMO
WMVideo Decoder DMO
Mpeg43 Decoder DMO
Mpeg4 Decoder DMO
Windows Media Audio Decoder
Windows Media Video Decoder
Windows Media Video Decoder
Microsoft MPEG-4 Video Decompressor
DV Video Decoder
Microsoft Screen Video Decompressor
Indeo® video 4.4 Decompression Filter
Indeo® video 5.10 Decompression Filter
WMAPro over S/PDIF DMO
WMA Voice Decoder DMO
AVI Draw
Line 21 Decoder 2
TrueMotion 2.0 Decompressor
Video Port Manager
Windows Media Multiplexer
ASX file Parser
NSC file Parser
ACM Wrapper
Line 21 Decoder
WST Decoder
VBI Surface Allocator
MPEG-2 Demultiplexer
ASF DIB Handler
ASF ACM Handler
ASF ICM Handler
ASF URL Handler
ASF JPEG Handler
ASF DJPEG Handler
ASF embedded stuff Handler
AVI Decompressor
QuickTime Movie Parser
QT Decompressor
AVI Splitter
AC3 Parser Filter
MJPEG Decompressor
DV Splitter
MPEG-I Stream Splitter
Indeo® audio software
Color Space Converter
Haali Media Splitter (AR)
Overlay Mixer2
Wave Parser
MIDI Parser
Multi-file Parser
File stream renderer
VGA 16 Color Ditherer
SAMI (CC) Parser

Here the code
Re-use the upper code(asm) to made it run

.const
EXTERNDEF CLSID_FilterMapper2:GUID
EXTERNDEF IID_IFilterMapper2:GUID
;EXTERNDEF IID_IPropertyBag:GUID
EXTERNDEF IID_IBaseFilter:GUID
Mapper PROTO

.data
;---- ppv liste --------------
ppvIFilterMapper2 dd 0
ppvIEnumMoniker dd 0
ppvIMoniker dd 0
ppvIPropertyBag dd 0
ppvIBaseFilter dd 0
;----------------- fin de liste ------
endppv dd -1
CUNI(FriendlyName,"FriendlyName")

arrayInTypes GUID 2 dup(<>) ;guid null,all types
;wmcodecdsp dshow.h
IID_IPropertyBag GUID <055272A00H,042CBH,011CEH,<081H,035H,0H,0AAH,0H,04BH,0B8H,051H>>
.code
;################################################################
Mapper PROC
Local varName:VARIANT,aName[200h]:BYTE
Local  retour:DWORD,cFetched
         mov retour,1
;visu

invoke CoCreateInstance,addr CLSID_FilterMapper2,NULL,CLSCTX_INPROC,\
addr IID_IFilterMapper2,addr ppvIFilterMapper2
.if eax == S_OK
IFilterMapper2 AddRef ;ref = 0 a la création
;invoke MessageBox,NULL,TXT("FilterMapper2"),TXT("SUCCESS"),MB_OK
;IFilterMapper2 Release
;arrayInTypes[0] = MEDIATYPE_Video;
;arrayInTypes[1] = MEDIASUBTYPE_dvsd;
IFilterMapper2 EnumMatchingFilters,\
addr ppvIEnumMoniker,\
0,\                  ; Reserved.
TRUE,\               ; Use exact match?
MERIT_DO_NOT_USE+1,\ ; Minimum merit.
TRUE,\               ; At least one input pin?
1,\                  ; Number of major type/subtype pairs for input.
addr arrayInTypes,\  ; Array of major type/subtype pairs for input.
NULL,\               ; Input medium.
NULL,\               ; Input pin category.
FALSE,\              ; Must be a renderer?
TRUE,\               ; At least one output pin?
0,\                  ; Number of major type/subtype pairs for output.
NULL,\               ; Array of major type/subtype pairs for output.
NULL,\               ; Output medium.
NULL                 ; Output pin category.
.if eax == S_OK
;invoke MessageBox,NULL,TXT("EnumMatchingFilters"),TXT("SUCCESS"),MB_OK
EnumMoniker:
IEnumMoniker Next,1,addr ppvIMoniker,addr cFetched
.if eax == S_OK
mov ppvIPropertyBag,0
    IMoniker BindToStorage,0, 0,addr IID_IPropertyBag,addr ppvIPropertyBag
.if eax == S_OK
;To retrieve the friendly name of the filter, do the following:

invoke VariantInit,addr varName
IPropertyBag Read,addr FriendlyName, addr varName, 0
.if eax == S_OK
movzx edx,varName.n1.n2.vt ;,VT_BSTR
.if edx == VT_BSTR
invoke WideCharToMultiByte,CP_ACP,NULL,varName.n1.n2.n3.bstrVal,\
-1,addr aName,LENGTHOF aName,NULL,NULL
invoke SysFreeString,varName.n1.n2.n3.bstrVal
invoke o_printcrlf,addr aName

.endif
;Display the name in your UI somehow.
.endif
invoke VariantClear,addr varName
comment µ
;To create an instance of the filter, do the following:
IMoniker BindToObject,NULL, NULL,addr IID_IBaseFilter,addr ppvIBaseFilter
; Now add the filter to the graph. Remember to release pFilter later.
.if eax == S_OK
IBaseFilter Release
mov ppvIBaseFilter,0
.endif
µ

; Clean up.
IPropertyBag Release
mov ppvIPropertyBag,0
IMoniker Release
mov ppvIMoniker,0
.endif
jmp EnumMoniker
.endif
.endif

.endif

FindeMapper:
         mov eax,retour
         ret
Mapper endp

;################################################################




Fa is a musical note to play with CL

Zen

TOUTENMASM (Yves),
I'm amazed, really,...you are one of the few MASM assembly programmers (besides EDGAR and JAPHETH) that has conquered COM.  :dazzled:
...And, you've done so in spectacular fashion,...(I wish I knew how to say this in French).