Jump to content
  • Advertisement

Frankie68

Member
  • Content Count

    89
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Frankie68

  • Rank
    Member
  1. Hi guys, What can be the cause of the following: When connecting two pins, it fails during program execution: - When using Connect(out, in), it gives 0x80040217 ("Couldn't find intermediate filters needed to connect") - When using ConnectDirect(out, in, NULL), it gives 0x80070491 (Unknown error) The funny thing is this: just before I try to connect it in code, I export the graph to a .grf-file and when I open this one in GraphEdit, they connect directly (no intermediate filters requered). It happens in both the debug-build as well as the release build and inside and outside of the debugger (some filters don't like it when the debugger runs). The output pin is one of a Hauppauge PVR 350 ("Preview Audio") and the input pin is of the standard sound renderer. Hope someone can help me with this...
  2. Frankie68

    DirectShow: how to play MPEG2 files

    OK, that was a long day... thank you both for helping me. I have tried a lot of things, even writing code that would build the graph the same way as graphedit does. Registering the graph with ROT was maybe the best idea, not even because it gave me new information (I already had copied the SaveGraph function from the DS sdk docs, so I could already see that only the source filter, and the two rendering filters were added). But for some reason I also tried it outside of the debugger. When testing if my code works, I always run it inside the debugger, because pressing F5 is simpler than opening the .exe via windows explorer. When I tried it now outside the debugger (I wanted to see if connecting to a graph then also works), it worked. So... some codecs don't work when used in the debugger. NeVideo.ax (mpeg encoder for Nero, Ahead Software) shows a message box ("Debugger detected"), but this particular codec just doesn't work. Lesson learned today: when it doesn't seem work: also try it outside of the debugger. Even thought it may cost you some more time, it can help you excluding the influence of your debugger. Thank you guys for helping me, I hope I can do the same for you one day. :)
  3. Frankie68

    DirectShow: how to play MPEG2 files

    Alright, because I know what the policy is on posting code (don't post 27 pages of it), I have stepped through the execution of my code and written down every DS related line. Important note: even though it doesn't show in this code, every line returns an HRESULT and as soon it doesn't pass SUCCEEDED(...), I end the function and return FALSE. Because of that, I know for sure the first call that fails is RenderFile(bstrFileName, NULL), I just removed all the error checing code to please your eyes. :) /* * Defined in class interface (in .h file): * * - IGraphBuilder * m_pRenderGraph; * - IMediaControl * m_pRenderControl; * - IMediaEvent * m_pRenderEvent; * - IMediaSeeking * m_pRenderSeeking; * - IBaseFilter * m_pVideoRenderer; * - IBaseFilter * m_pAudioRenderer; * - IBasicAudio * m_pAudioControl; * */ // In .cpp file: CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&m_pRenderGraph); m_pRenderGraph->QueryInterface(IID_IMediaControl, (void **)&m_pRenderControl); m_pRenderGraph->QueryInterface(IID_IMediaEvent, (void **)&m_pRenderEvent); m_pRenderGraph->QueryInterface(IID_IMediaSeeking, (void **)&m_pRenderSeeking); CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&m_pVideoRenderer); CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&m_pAudioRenderer); m_pAudioRenderer->QueryInterface(IID_IBasicAudio, (void **)&m_pAudioControl); m_pRenderGraph->AddFilter(m_pVideoRenderer, L"Video Renderer"); m_pRenderGraph->AddFilter(m_pAudioRenderer, L"Audio Renderer"); // ^^ Those all pass SUCCEEDED(...) // sFileName is a CString (remember: this works with .avi files) CComBSTR bstrFileName((LPCSTR)sFileName); m_pRenderGraph->RenderFile(bstrFileName, NULL); // this one fails
  4. Frankie68

    DirectShow: how to play MPEG2 files

    Thanks for replying and sorry for the late reaction, but it returns 0x80040111. I was unable to find this error code in the directx docs and VC.NET thinks it means "0x80040111: ClassFactory cannot supply requested class", this seems highly unlikely, to say the least. Any help is strongly appreciated. :)
  5. Hi guys, Short question: when I use GraphEdit, I can render an MPEG2 file very simple: with File->Render Media File..., but when I do the same programatically, IGraphBuilder::RenderFile(...) fails. The used filters in graphedit are: "MPEG2 demultiplexer", "Intervideo noncss audio decoder for hauppauge" and "intervideo video decoder". I don't know what can be the problem, especially because calling RenderFile(...) with an AVI file works great. Also MPEG1 files can be rendered. I have spend a lot of time searching with google, also searching on this and other sites, all fruitless. So I am afraid that this is something that happens only on my computer. Has anyone experience with MPEG2 playback with DirectShow? And how did you do it? Thanks up front...
  6. Hi, quick and simple question: how can I let the desktop redraw the showed bitmap? I know how to use GetDesktopWindow and how to send messages to a window. And because I named the background bitmap "ThisFileShouldEndUpInTheWindowsRegistryOnlyOnce.bmp", I also know what key is responsible for the filename of the displayed image as Wallpaper. InvalidateRect and SendMessage(WM_PAINT,...) didn't work. The application is simple: I have got a number of images of female wannebee singers and want to let them appear on the desktop, but no longer than 10 minutes each. This will help me through those lonely nights behind the computer when I should be out, meeting real people. ;) Anyway, google wasn't very helpful and I couldn't find anything on this forum. So, can you help me? Thanks up front!
  7. you're both right, if I just had spend some more time on running the app and checking the stack... ;) Anyways, thanks :)
  8. Alright, this all might seem a bit theoretical, but at the end, I will give a good reason to think about this. First something small about the typical windows-system way of emptying the message queue and transforming them into events. It's not that I consider myself such a great teacher, but letting me explain might point out some things I have missed. Here it goes: There are two threads of interest here: 1. The OS thread that reads out the mouse position, renders the mouse on the screen en fills the message queue of my window with messages. This can (and will be most likely) be implemented using interrupts, but seeing it as a thread makes it a bit more simple. 2. My process, checking the message queue continuously for some user activity. When there is a message, it sometimes needs some action: when the user clicked on a button, it will read the WM_COMMAND, find the function that is defined as the OnClick-handler and execute that code. When the code is executed, it returns to the the main procedure (the message queue checking code) and checks for new messages. This is more of less the system as I understand it, and I feel I am not far from the truth, but again: if I am wrong, please correct me. Now, my problem: what happens if the OnClick-code contains a call to `MessageBox(...)'? The function will be called, it will call the routine, which will display the MODAL dialog, and it will wait until the user clicks OK. My process (the second thread) is blocked, until the messagebox closed. The OS thread (number 1) still can add new messages to my queue, but they will have to wait until the OnClick function returns. Or will they? As it turns out, it doesn't work this way. To test it (and to let you experience it), I did the following: 1. Using VC, I created a new dialog based MFC project (as simple as possible, we don't need much) 2. I created a button 3. The onclick of the button contains the following code: SetTimer(1000, 1000, NULL); 4. I created an OnTimer event for the window containing this code: CString sOutput; m_iTestInt++; sOutput.Format("%d", m_iTestInt); AfxMessageBox(sOutput); m_iTestInt--; CDialog::OnTimer(nIDEvent); 5. The Dlg-class also needs an int named "m_iTestInt" and I set it to 0 in the ctor 6. I started the app and clicked on the button. I expected to see one messagebox (after about a second) and then the application should be blocked until I pressed its OK button. Then there would be directly an other message box. They all would show the value "1". This didn't happen. What did happen was this: a messagebox appeared showing "1", a second later one that showed "2", second later "3", etc... When I closed one, the next one showed a value one lower than its order (for example: 4 instead of 5). This is hard to explain using my view of the world of the two threads. One explanation might be that there is a thread started for every WM_TIMER message. Seems OK (yet a bit like resources spoiling), but by adding "Sleep(2000)" to the OnTimer, we see that the entire application gets locked for 2 seconds, not just a single thread (in that case the messageboxes would continue uninterrupted). Maybe it exits MessageBox directly? It only shows the dialog and ignores all input to other windows? This seems to make sense, except for one thing: the "m_iTestInt--;". If the system worked like this, the messageboxes all would display the same number ("1"). My hunch is that the stack gets stored somewhere and restored when the user clicks OK (when the modal dialog box is closed). This explains the displayed value and als the behaviour of the Sleep(2000). But I have no idea how this should be implemented. I really, really would like your input on this, I have been thinking about it for a while now and I would really like to find out how this is done. Now, as I promised, my reason: not only is this interesting behaviour, it can also be useful in some fields. I am creating a GUI using OpenGL, and I want to draw the entire Gui every frame (that way the rest of the game can move on, without wainting for the user input). But I also want everything to be in one thread (game logic+GUI+mouse/keyboard handling), so implementing modal dialogs is kind of tricky. I am currently doing it by returning a value to the class that called the ShowModal method. So the calling function needs to leave the class in a coherent way, and the class needs to process the user input (he clicked OK, entered a single value, or whatever), in a special function for all GUI returned actions. A typical example of something that is very simple in MFC and hard in my GUI is this: 1. Ask for connection info to the server (its IP, connection type), user clicks ok 2. Check the IP to find out that he entered an invalid value. 3. Show a messagebox and keep the original window open (with the values). In my case, I need to define a value IPNOTCORRECT_OK that is returned to the GUI handling function and implement the rest of the code in that function (or a function that is being called by the GUI function). The MFC way is way simpler, obviously. Thanx for reading and I hope you can help me with this... :)
  9. Hi there! What is the best way to let two (independent) MFC-apps use the same (dialog-)resource? I have found one interesting article in the MSDN, but it still doesn't work: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfcnotes_tn035.asp Since this seems to me like a rather simple problem (you first create a project and later decide to share some resources), I think many of you may have already a solution to this problem. My current status: after I had split the original resource.h file in two and included the shared part into the locally used one, my program crashes as soon as I try to Create an instance of the dialog. This seems logical, since a number (134 in this case) is not enough to build the resource. I then started poking around in the .rc-file. I also splitted it and included the shared part into the original part, but it then starts wining about an unexpected end of file. I then tried it using good old notepad but ran into an other problem: it doesn't know the values of the used IDC_*'s, so I had to make them up for myself, but how does Visual C know (and my collegues how also will have to make up their values) that there will be no nameclashing (ID-clashing)? (meant sarcastically ;)) Anyhow, a nice website would be enough for me right now, but I am hoping for a thorough explanation. :) Thanks up front
  10. Thank you for answering, but it still doesn't work: on the line "New(bar);"(38) it says "Incompatible types". Is there something wrong with my compiler settings? BTW: I need classes for inheriting (this was just a simple example)
  11. My last four hours were real shitty. I wanted to do something that is really simple in C, but Delphi doesn't allow it. Here it goes: I want to keep a list of pointers (TList). I new them and add them to the list (A form with to buttons): unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type PBlaat = ^TBlaat; TBlaat = class public foo : integer; end; TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormCreate(Sender: TObject); private TheList : TList; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var bar : PBlaat; begin New(bar); bar^.foo := 12; TheLIst.Add(bar); end; procedure TForm1.Button2Click(Sender: TObject); var foobar : PBlaat; begin foobar := PBlaat(TheList[0]); ShowMessage(IntToStr(foobar^.foo)); end; procedure TForm1.FormCreate(Sender: TObject); begin TheList := TList.Create; end; end. anyway, I got an Access violation (reading of 'nil'). I hope someone can explain this this to me (pointers in delphi in general...)
  12. Fixed the problem: installed newer version of visual assist. :)
  13. This is really the strangest thing. All the time VC++6 with MSDN worked perfectly, but suddenly opening MSDN from VC++ (by pressing F1 or just Help->Contents) will cause this: when MSDN needs to open a window (when I press About... or when a selected topic has multiple pages linked to it) MSDN crashes and Visual C also. I did a lot of things, I reinstalled Windows this morning, but the problem still exists. The only thing I did change was my videocard, but I don't think that that can cause it, now can it? Hopefully someone can help me, because I love the MSDN too much to miss it... :(
  14. Thanks for the reactions. One could say that we are sending simple 'struct's, although because of our COM architecture, things got a little out of hand, but the most important feature that we want is ease of programming. It would be nice to be able to simple register some callbacks as soon as a certain 'event' is triggered some code is executed. Shared memory isn't really needed, but if it makes things a lot easier, I am going for that. I just figured that this seems a common problem and therefor I expected a 'magic bullit' solution, but it seems as if it is not that simple. COM+ looks great and it works good (even though creating and registering events is a lot of work). But when you want to upgrade the previous version on the computer of the customer, unregistering of the old COM+ events is not possible (using our install generator). For now we simple ask the end-user to do it for him/herself, but needless to say, this is only a temporary solution. So please let the reactions flowing...
  15. I am working on a project that has three exe's that run most of the time together. For sending messages I have used COM+ so far, but I don't like all the extra work that it is causing. What is a better alternative? thanks up front
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!