|
Hi,
I am creating a filtergraph in DirectShow (windows).
How can I use libavcodec in my case?
Simulated filter graph is,
"MPEG-2 Multicast Receiver" --> "MPEG-2 Demultiplexer" --> "Video Decoder" --> "Video Renderer"
It is receiving H264 ASI Stream.
I am creating an output video pin 'v1' to "MPEG-2 Demultiplexer" with following settings,
<br />
VideoInfoHeader hdr = new VideoInfoHeader();<br />
hdr.BmiHeader = new BitmapInfoHeader();<br />
hdr.BmiHeader.Compression = 0x68323634;<br />
<br />
vid_media.majorType = MediaType.Video;<br />
vid_media.subType = ExtraFunctions.MediaSubTypeH264;<br />
vid_media.formatType = FormatType.Mpeg2Video;<br />
vid_media.fixedSizeSamples = false;<br />
vid_media.temporalCompression = false;<br />
vid_media.sampleSize = 0;<br />
vid_media.formatSize = Marshal.SizeOf(hdr);<br />
vid_media.formatPtr = Marshal.AllocCoTaskMem(vid_media.formatSize);<br />
Marshal.StructureToPtr(hdr, vid_media.formatPtr, false);
Pin 'v1' is not connecting to "ffdshow Video Decoder". I can connect pin 'v1' to "MainConecpt AVC/H.264 Video Decoder". "MainConecpt AVC/H.264 Video Decoder" is not having resolution setting, which I want to set as 'Quarter'.
Michael Schubert wrote: http://ffmpeg.mplayerhq.hu/index.html[^] ?
How can I use libavcodec?
Is there any onther video decoder?
Is there any thing wrong in video output settings?
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
Guid H264SubType = new Guid("8D2D71CB-243F-45E3-B2D8-5FD7967EC09B");
|
|
|
|
|
Aniket Salunkhe wrote: How can I use libavcodec?
I don't know, you have to get famliar with the API. I just know that many video tools use this library because it's open source and works apparently pretty well.
|
|
|
|
|
Hi,
I think I am missing some thing while creating H.264 video output pin to "MPEG-2 Demultiplexer". Because that pin is not connecting to most of the H264/AVC Video Decoder.
Please guide me to create video output pin (for H.264) to "MPEG-2 Demultiplexer".
Actually I want to render multiple multicast sources which are in H.264 format.
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
I checked the compiler command line,
only /Yu and /Fp there for pch,
and all works well.
But when I create an empty win32 project,
and try to enable the pch mechanism in the same way
(the same compiler command line, also add the default stdafx.h/cpp),
it doesn't work.
What is the problem?
BTW, it's tested in VS2008.
|
|
|
|
|
The /Yc option is set only for stdafx.cpp, over-writing the project default of /Yu.
Right-click on stdafx.cpp and check its properties - you'll see /Yc set.
You can do the same thing in your Win32 project (set /Yc for stdafx.cpp rather than /Yu).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
for (int l=0;l<5;l++)
{
DBGetText(hWndGet);
TextInfoSend(hWndSend, ts);
hTimer = CreateWaitableTimer(NULL, FALSE, NULL);
LARGE_INTEGER liDueTime;
liDueTime.QuadPart = -1000LL;
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, 0);
(WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0);
CancelWaitableTimer(hTimer);
All the above minus the for loop works when inserted in a command button.
HWND hWnd1;
hWndout = FindWindow("NotePad",NULL);
if (hWndout)
{
l=2;
}
}
After having done the for loop my data only refreshes when I exit the loop.
BTW I am using WM_COPYDATA inside TextInfoSend function to transmit data.
Can someone shed somelight as to what I have missed to get my data to refresh.
Thanks A Million.
|
|
|
|
|
I'm not completely sure what you are trying to accomplish there but my guess would be that your loop runs in your GUI thread, this means, no messages will be processed during the workings of the loop, thus the unrefreshed and unreponsive GUI (if your loop takes longer then windows will also consider your process unreponsive and you probably will get the nice "Not responding..." text in the titlebar of your main window - if you have one that is). To avoid this you can try putting your loop in a separate thread.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes. That is whats happening. I guess since i am new at this, there was nothing in the code that I have done wrong. My next dumb question is How do I create a new process from the GUI.
thanks a million.
|
|
|
|
|
I asusme you meant "tread", not "proccess", i recommend reading this[^] for starters and then checking out CreateThread[^]. After that, if you have questions, feel free to ask.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thank you. I found a prototype to use one too. That does work perfectly for about 10 minutes or so.
After the 10 minutes I get an error which says my buffer is too small.
Withinn other functions of the application, I know I am clearing all variables and closing and reopening the file in one function and as soon as the writing is done I am closing the file and clearing the variables.
Any suggetions as to where I could be going wrong?.
|
|
|
|
|
Well, without seeing your code it's hard to say...try finding out if your 'cleanup code' really gets called or not by placing breakpoints, or TRACE-es, or a message box, or or or...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Here is the section I am having problems with:
This is in a function of it's own:
Instead of using WindowFromPoint I am using hWnd that I have for the window
I am after since the user could have moved it.
POINT Textpt;
Textpt.x = a;
Textpt.y = c;
HDC DlgDC,MemDC,DeskDC;
int height, width;
HBRUSH hBrush;
HBITMAP hBitmap;
DlgDC = GetDC(hWnd);
DeskDC = GetDC(NULL);
hBrush = CreateSolidBrush(RGB(255,25,0));
width= 53;
height= 8;
MemDC = CreateCompatibleDC(DlgDC);
hBitmap = CreateCompatibleBitmap(DlgDC,width,height);
SelectObject(MemDC,hBitmap);
BitBlt(MemDC,0,0,width,height ,DeskDC,Textpt.x,Textpt.y,SRCCOPY);
////
Some processing....
Couple of If statements and geting color pixels.
////
after above is done processing->
ReleaseDC(NULL,MemDC);
DeleteObject(MemDC);
ReleaseDC(NULL,DlgDC);
DeleteObject(DlgDC);
ReleaseDC(NULL,DeskDC);
DeleteObject(DeskDC);
Please help if its wrong...
This is the only part that dies after 10 minutes. I ran this with the thread, I commented the rest of the app including the processing in between the above code.
I ran the thread own its own without the above it ran fine. All the thread was doing at that point was getting the handle to the window I am after.It ran for a long time.
Thanks a million.
|
|
|
|
|
This:
MemDC = CreateCompatibleDC(DlgDC);
must be "freed" like this:
DeleteDC(MemDC);
ReleaseDC does not need to be used for the memory DC, and DeleteObject is not for device contexts at all.
This:
DlgDC = GetDC(hWnd);
needs to be released like this:
ReleaseDC(hWnd, DlgDC);
ReleaseDC(NULL, DlgDC) is wrong, you need to specify the same window handle you used to get the DC. And once again, don't use DeleteObject for a DC.
Also note, when you select objects into a DC, may those be bitmaps or brushes or whatever, the original objects should be select back into the DC before you delete the DC or delete objects that were selected into the DC. To explain this a bit more clearly:
This is not complete:
HDC MemDC = CreateCompatibleDC(DlgDC);
HBITMAP bitmap = CreateCompatibleBitmap(MemDC, 100, 100);
SelectObject(MemDC, bitmap);
...
DeleteDC(MemDC);
DeleteObject(bitmap);
Should be done something like this:
HDC MemDC = CreateCompatibleDC(DlgDC);
HBITMAP bitmap = CreateCompatibleBitmap(MemDC, 100, 100);
HBITMAP originalbitmap = (HBITMAP)SelectObject(MemDC, bitmap);
...
SelectObject(MemDC, originalbitmap);
DeleteDC(MemDC);
DeleteObject(bitmap);
If you do not follow this "rule", your program will leak GDI resources...
Also one very important thing you should know about threads is that fiddling with GUI objects in other than the GUI thread is strongly not recommended.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
thanks a million. I will change a few things and give it a try.
|
|
|
|
|
Same thing in about 15 to 20 minutes at least it took a bit longer. I have a question. I am trying to capture text from an external app. the text on the app is being populated with WM_PAINT. Not sure even if a WM_PAINT hook to this application will help. What are my choices if this keeps not responding to the route I have taken.?
|
|
|
|
|
Oh,I'm sorry, my english is poor, how to use the in-place editing of microsoft?
example: Microsoft Word and Microsoft Equation Eidtor(in the word), what do it? ,in the program use word
thank you
|
|
|
|
|
what are you talking about. You are in the wrong forum.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hi, I have a problem when I want to use de XP/Vista Styles for Common Controls. As I'm using Visual Studio 2008, at the beggining of the code I put:
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
I read in the MSDN it is not neccesary add a manifest if I include that (if I use a manifest in XP the controls disappeard but the program works), but when I execute the program in XP, i get a error message, something like "Reinstallation of the program could solve the issue", on the other hand, in Vista works fine and the controls have the Vista style. ¿What is wrong?
Thanks
|
|
|
|
|
Did you call InitCommonControlsEx[^]? Aside of that, i believe "Reinstallation of the program could solce the issue" you usually get when your program uses a DLL the system cannot find...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
After trying to create the dialog use GetLastError to find out why it did not get created. I have seen behaviour like that in at least 3 cases:
-the resource of the dialog did not exist, since you say it works fine under Vista i'd say that is not the case
-the dialog had some control on it which could not be created because its class was not registered, like custom controls we forgot to explicitly register before trying to brign up the dialog.
-usage of an ActiveX control on the dialog which was not registered on the system.
There might be tonns of other reasons of course...could it be that you are using some "special" control (ActiveX?) on your dialog that needs explicit registering under XP but it is registered already/by default under Vista?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I've call GetLastError after create the dialog box, but it returns 0, and DialogBox returns -1. Looking at MSDN I saw 4 possible errors, althought none of them I think are the problem:
-an invalid parameter value
-the system class was registered by a different module
-The WH_CBT hook is installed and returns a failure code
-if one of the controls in the dialog template is not registered, or its window window procedure fails WM_CREATE or WM_NCCREATE
I don't understand why does not work, because the controls inside the dialog box are edit and buttons controls, only that. I put the code of the definition of the dialog box:
NewDialogBox DIALOGEX 170,70,250,150<br />
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU<br />
CAPTION "Nuevo"<br />
FONT 10, "Tahoma"<br />
BEGIN<br />
DEFPUSHBUTTON "Aceptar", IDOK | WS_TABSTOP, 95, 130, 50, 14<br />
PUSHBUTTON "Cancelar", IDCANCEL | WS_TABSTOP, 165, 130, 50, 14<br />
CONTROL "Anchura", IDS_WEIGHT, "static", <br />
SS_LEFT | WS_CHILD | WS_VISIBLE, <br />
20, 50, 150, 8<br />
CONTROL "", IDE_WEIGHT, "edit", <br />
SS_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, <br />
100, 50, 100, 12<br />
CONTROL "Altura", IDS_HEIGHT, "static", <br />
SS_LEFT | WS_CHILD | WS_VISIBLE, <br />
20, 70, 150, 8<br />
CONTROL "", IDE_HEIGHT, "edit", <br />
SS_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, <br />
100, 70, 100, 12<br />
END
Thanks.
|
|
|
|
|
Hmm...did you try stepping thorough the code (during runtime i mean by setting a breakpoint and using "Step into" and such tools) to see where it fails? Does the dialog show if you remove the controls from it? If yes, maybe try putting them back one by one and see when the dialog stops showing...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
No, I didn't try that, but when I can get a machine with XP, I'll debug it. Compiling the code with XP make the dialog box doesn't work, same problem that compiling it with Vista.
When I debug the code, I'll post the results.
Thanks.
EDIT: I've found the solution. As you said, we need to use the normal version of InitCommonControls at the beggining of the WinMain and link comctl32.lib and include the header commctrl.h. Putting the line:
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"") at the beggining of the file or including a manifest file all works fine in XP and Vista.
Thank you for all the help.
modified on Monday, March 23, 2009 5:26 PM
|
|
|
|
|