|
ooh the Memory DC, it's useful 
|
|
|
|
|
|
The lowest level API that you can work with, while still using GDI, is DIBSections. DIBSections allow you to update the pixels of a bitmap manually and draw that bitmap using an HDC. They have always been fast enough, and are many times faster than using the SetPixel method. Hope this helps.
|
|
|
|
|
Hi All,
I want to extract frames from a compressed AVI video file.
I have used WIN32 Apis such as "AVIStreamGetFrameOpen" to extract frames from a uncompressed AVI video file.But for a compressed AVI video file the API "AVIStreamGetFrameOpen" returns NULL.Are there APIs to extract frames from a compressed AVI as well as uncompressed AVI file.
Please let me know.
Thanking in advance,
ashwath.
|
|
|
|
|
Maybe this[^] will help you ...
|
|
|
|
|
HI,
I saw the link but it is not helping me.I have to first decompress the compressed AVI file and then extract individual frames from that decompressed AVI file.
Could you please help me in this.
Thanking in advance,
Ashwath.
|
|
|
|
|
Hi, Ashwath. If you are allowed to use ffmpeg in your project then the solution code becomes trivial. Else you will need to check the documentation for the ICDecompress function. You are using the win32 apis to load your avi file, they are very slow and require you to use COM interfaces to decompress your files - these rely on installed codecs on your machine. Using ffmpeg gives you a solution which comes with its codecs built right into the library. Hope this helps.
|
|
|
|
|
Hi ,
Thanks for your reply.
My aim is to decompress the AVI file and extract each frames pixel values into an array for futher processing.
Is it possible with FFMPEG or using IDecompress function?
Please do let me know.
Thanks,
ashwath.
|
|
|
|
|
Hi, it is possible to do this using both methods:, but it is easier using ffmpeg. I would recommend you Google ffmpeg and check their examples, you could accomplish your task in about 60 lines of code. Happy coding
|
|
|
|
|
Thanks a lot for your reply.
|
|
|
|
|
Hi ,
Thanks for ur suggestion.I have two AVI files.One is compressed and the other is uncompressed.I want to extract the frames from both the AVI files.Will the FFMPEG library work for both compressed and uncompressed AVI files?
Please suggest me on this.
Thanking you in advance,
Ashwath.
|
|
|
|
|
Hi Ashwath, the FFMPEG library will work for both files. As a side note, the library comes with pre built executables which you could use to immediately extract the frames you need, there are tons of articles online about how to do this - just download the library an programs from here and check their online documentation for the parameters you need to extract the frames.
|
|
|
|
|
Hi ,
Actually what i am doing is that i have created a MFC dialog based GUI.And i want to extract the frame buffer from the compressed AVI file by decompressing it first and then copying the buffer values to unsigned char array and display on a picture control as a bitmap image.And i want to extract all the files in the compressed AVI file in this way and display one by one on the picture control on the MFC GUI.
Is it possible to do the above.
Please guide me on this.
Thanking in advance,
ashwath.
|
|
|
|
|
You can get an image from the avi stream using ffmpeg, into an av_picture structure, then use the libswscale functions to scale and convert the image into different resolutions or formats, and finally draw the buffer to a control on your mfc gui. You should really Google for code samples.
|
|
|
|
|
Hi,
In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called.
What may be the problem?
Pls help me.
Anu
|
|
|
|
|
Anu_Bala wrote: What may be the problem? There is a bug in the code.
Use the best guess
|
|
|
|
|
Hi Anu, we will not be able to help you much if you do not post some relevant code, perhaps your constructor and the context from which it is called.
|
|
|
|
|
Normally, the CMainFrame object is constructed in the InitInstance method using the call -
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSDIDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CSDIView));
Do you see this call in InitInstance?
If you don't see this, it means that the construction is being done elsewhere; your app class constructor perhaps.
If you do see the above code and you still have the behavior you mentioned, it could mean that some other CMainFrame instance is being constructed.
Whatever the case, it is not the correct way to do it.
|
|
|
|
|
Does, by chance, your InitInstance method return FALSE ?
Veni, vidi, vici.
|
|
|
|
|
That would stop execution in its tracks...
|
|
|
|
|
Hi guys, I'm using WinHttp in a regular Win32 app (Windows SDK in C++, no MFC) and I want to prevent automatic redirects. The only thing I could find is WinHttpRequestOption but I have no idea how to set that or if that's what I need to do.
I want my code to check for a redirect before proceeding.
Thank you.
|
|
|
|
|
This fix applies to VS2012 MFC projects that use the Windows7 Visual Manager style. It causes active button caption text to draw in color 0,0,0 and not the same color as inactive.
This restores VS2010/2008 Feature Pack behavior.
Hello, I thought to post this to CP in case others had this issue. In 2012 MFC was 'fixed' to draw text using TextNormal as specified in Style.xml resource (I suspect that TextNormal should have been 0,0,0 in 2010 but it went unoticed).
class CFixMFCVisualManagerWindows7 : public CMFCVisualManagerWindows7
{
COLORREF OnDrawRibbonPanel(CDC* pDC, CMFCRibbonPanel* pPanel, CRect rectPanel, CRect rectCaption);
DECLARE_DYNCREATE(CFixMFCVisualManagerWindows7)
};
IMPLEMENT_DYNCREATE(CFixMFCVisualManagerWindows7, CMFCVisualManagerWindows7)
COLORREF CFixMFCVisualManagerWindows7::OnDrawRibbonPanel(CDC* pDC, CMFCRibbonPanel* pPanel, CRect rectPanel, CRect rectCaption)
{
CMFCVisualManagerWindows7::OnDrawRibbonPanel(pDC, pPanel, rectPanel, rectCaption);
return GetGlobalData()->clrBarText;
}
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CFixMFCVisualManagerWindows7));
rsf - Interscape
|
|
|
|
|
If you find a bug with Microsoft's software then it would be a good idea to report it to Microsoft.
Use the best guess
|
|
|
|
|
People, I found that CFileDialog class causes serious problem.
I had a large free memory block in the address space of my prog: 1200 MB
Then I create CFileDialog and delete it:
CFileDialog *pdlg=new CFileDialog(TRUE);
pdlg->DoModal();
delete pdlg;
I check address space again and found only 700 MB:
The reason was very simple: I found some dlls in the address space of my process like urlmon.dll, netapi.dll, modemInst.dll and so on. These dlls was loaded into my address space by CFileDialog class and was not unloaded by its destructor. As a result, I couldn't allocate memory for a large file- address space had been fragmented. Any idea how to solve this situation? I think to create CFileDialog in a separate process. May be, there are better variants?
|
|
|
|
|
If you're sure the memory is being taken up by those dlls, why not try unloading them yourself with
FreeLibrary() ?
How are you trying to allocate the memory? Have you tried the VirtualAlloc() function?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|