|
Writing your own renderer is one option. The sample base classes included with the DirectShow
SDK make it relatively simple.
The Texture3D9 Sample[^] in the DirectShow SDK may help for rendering video to a Direct3D surface.
|
|
|
|
|
I've tried looking through that sample but can't really make heads or tails of it, mainly because I don't really have a clue about how DirectShow actually works. I have searched everywhere for a good tutorial, but everone I can find does things that I don't need and doesn't do the things that I do.
I've got a file loading and playing just fine with full control over playback, but that's where my success ends. I need to be able to load multiple videos and play them back based on events generated by the interface. The problem is I don't know how the videos are actually stored. Do I need to create a multiple IVMRWindowlessControl9 or IGraphBuilder. Which interfaces can be reused and which cannot.
If anybody knows of a good tutorial that would teach me all this I would very much appreciate it. It seems DirectShow is far less popular than the other DirectX APIs.
Thanks for your help,
Dustin
|
|
|
|
|
Using the VMR in windowless mode is not too helpful since you only have control at the window
(HWND) level.
Using the VMR in renderless mode provides almost exactly what you need to do except the Direct3D
surfaces are created to match the video stream. If you're already managing the surfaces and the
video is secondary then this is (in a sense) the reverse of what you need.
If you have code running with direct show and the only problem is flicker then I still think the
easiest route would be to write your own renderer instead of the VMR (unless you're really using
the mixing features of the renderer).
I personally found the Windows Media Format SDK to be more flexible, although I work mainly with
ASF files (.wma, .wmv, etc.) and prefer to write my own renderers. If you can work with ASF files
then it's fairly simple (and there's decent sample code in the SDK) to read streams from a file.
Using the asynchronous reader you can set up to read a file and you'll get a callback called for
each frame of video, at the right time, and in the right order. What you do with the frame is up
to you. If you work with 24-bit RGB video, it's a fairly simple blt to a Direct3D surface, GDI
device context, or whatever.
A downside is, besides mpeg-4, the only video codes included for free are the windows media
codecs.
Might be worth taking a look at the Windows Media Format SDK[^]
|
|
|
|
|
Thank you very much for the advice. You're right, I do not need most of the features in VMR and I can work with any format I want as I am authoring the videos. I will give it a go, although there may be more questions coming.
Thanks for always being so helpful Mark,
Dustin
|
|
|
|
|
Mark,
I just wanted to let you know I fixed the problem. All I did was take the '9' off of everything regarding VMR so that I am now using the original version VMR7. I have no idea why this fixed the problem or even what inspired me to try it, but it now works. I just LOVE Microsoft.
Thanks for the help,
Dustin
|
|
|
|
|
Cool! I'll note that for future reference, thanks!
Cheers!
Mark
|
|
|
|
|
I have created a new button with CreateWindow() and option WS_VISIBLE | WS_CHILD.
How can I modify these options later in the code ? Is it possible?
For example, How can I tell the button that it is WS_OVERLAPPEDWINDOW now?
|
|
|
|
|
You want a button with WS_OVERLAPPED (title bar and border), WS_CAPTION, WS_SYSMENU,
WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles?
Check out the SetWindowLong()/SetWindowLongPtr() APIs.
Mark
|
|
|
|
|
I will look for them, thanks.
If you have a short example , it would be great.
|
|
|
|
|
LONG lCurrentStyle = ::SetWindowLong(hwnd, GWL_STYLE);
lCurrentStyle |= WS_OVERLAPPEDWINDOW;
::SetWindowLong(hwnd, GWL_STYLE, lCurrentStyle);
Check out the docs for SetWindowLong(). You may need to call SetWindowPos() or other API
after setting certain styles.
|
|
|
|
|
Thank you for help!
I understand how it works now. And it works well
Problem solved.
|
|
|
|
|
You can use ModifyStyle , too.
ModifyStyle(0,WS_OVERLAPPEDWINDOW );
|
|
|
|
|
It looks like what I was searching for, but... I can't find it.
I'm not using MFC, CView Cstatic etc...
I'm using "windows.h" with HWND etc...
Where can I find this method or something similar ?
|
|
|
|
|
You need to use SetWindowLong then.
e.g. If you want to add WS_CHILD style to a window you can do like this,
SetWindowLong(hWnd,GWL_STYLE,WS_CHILD);
|
|
|
|
|
Thank you
|
|
|
|
|
Hi people,
Code C++ with header files included after compile in visual studio 6?
I would like see this code.
Somebody help me?
Thx!!
|
|
|
|
|
John Shaft wrote: Code C++ with header files included after compile in visual studio 6?
I don't understand what you are asking ?
code what ?
|
|
|
|
|
I would like to see source code of header files and pragmas used in my source, when I compile in Visual Studio 6. I wanna see complete source code. Intermediate files?
It's possible?
Sorry by my English.
Thx!
|
|
|
|
|
ok, I get it.
I'm not certain you can do it from WITHIN VC6, or if the command line CL.exe ( or whatever it's called ) can do this.
with G++ ( gnu/linux compiler ) you can call the compiler with the -E switch to preprocess the file.
The keyword here is preprocess, this will "expand all the headers, #defines and other stuff.
for your information this can create a BIG file.
I created the following program :
#include <iostream>
int main()
{
std::cout << "tata";
return 1;
}
and generated the preprocessed file and the file is 600+ K. ( 24000 lines )
have a look at the CL.exe documentation on MSDN to see if there's a switch to preprocess the file.
|
|
|
|
|
hi all
how to create and terminate a process using WMI
Can i have c++ code for it
Thanks
abhi
|
|
|
|
|
Hi,
I have my own file format and a program loading those files.
Under Windows XP i got the automatic file asssignment working, but it doesn't work under windows Vista. So i think i didn't do it correctly under XP, maybe it only works there by accident .
Do you guys know how to automatically assign (what to write into registry) a file format to a program (which also works under Windows Vista)?
Here is how i do it:
<br />
void RegisterFileType(const String& extension,<br />
const String& fileRegisterName,<br />
const String& fileExplorerName)<br />
{<br />
TCHAR buffer[1024];<br />
GetModuleFileName(NULL, buffer, 1024);<br />
CString applicationFileName = buffer;<br />
<br />
CRegistry keyFileExtension;<br />
keyFileExtension.CreateKey(HKEY_CLASSES_ROOT, extension.AsChar());<br />
CString standard = _T(fileRegisterName.AsChar());<br />
keyFileExtension.SetValue("", standard);<br />
keyFileExtension.CloseKey();<br />
<br />
CRegistry LMFile;<br />
CString fileName = _T(fileExplorerName.AsChar());<br />
LMFile.CreateKey(HKEY_CLASSES_ROOT, standard);<br />
LMFile.SetValue("", fileName);<br />
LMFile.CloseKey();<br />
<br />
CRegistry keyDefaultIcon;<br />
CString defaultIcon = standard;<br />
defaultIcon += "\\DefaultIcon";<br />
keyDefaultIcon.CreateKey(HKEY_CLASSES_ROOT, defaultIcon);<br />
CString iconPath = applicationFileName + ", 0";<br />
keyDefaultIcon.SetValue("", iconPath);<br />
keyDefaultIcon.CloseKey();<br />
<br />
CRegistry shell;<br />
CString shellPath = standard;<br />
shellPath += "\\shell";<br />
shell.CreateKey(HKEY_CLASSES_ROOT, shellPath);<br />
shell.CloseKey();<br />
<br />
CRegistry open;<br />
CString openPath = standard;<br />
openPath += "\\shell\\open";<br />
open.CreateKey(HKEY_CLASSES_ROOT, openPath);<br />
open.CloseKey();<br />
<br />
CRegistry command;<br />
CString commandPath = standard;<br />
commandPath += "\\shell\\open\\command";<br />
command.CreateKey(HKEY_CLASSES_ROOT, commandPath);<br />
CString a = "\"";<br />
CString cs = a + applicationFileName + a + CString(" ") + a + CString("%1") + a;<br />
command.SetValue("", cs);<br />
command.CloseKey();<br />
}<br />
Do i miss anything? Or do i do something incorrectly?
Hope you guys can help me!
Thanks a lot in advance and i hope to hear from you soon.
- Ben
|
|
|
|
|
Can anyone please help me? I would really appreciate it!!!
Anyone already got the file assignment working under xp? Maybe i just do it wrong?
|
|
|
|
|
Maybe I'm reading your code incorrectly (i'm still in my first cup-o-tea this morning) but
it looks like youi create the extension key in HKEY_CLASSES_ROOT which is fine but all the
rest of the keys are created off HKEY_CLASSES_ROOT as well instead of under the extension key.
Am I reading it wrong?
This article may help...
Associate File Extension with Shell OPEN command and Application[^]
|
|
|
|
|
Can anyone help provide a method to add checkbox controls programatically. I would like to read in a file that contains the names of the checkboxes to be created and displayed. The file contents will not stay the same thus the need to create these at runtime. Thanks.
sd
|
|
|
|
|