SetMediaType problem

This is a discussion on SetMediaType problem within the Windows Programming forums, part of the Platform Specific Boards category; Code: this->MediaType.majortype = MEDIATYPE_Video; this->MediaType.subtype = MEDIASUBTYPE_RGB24; this->MediaType.formattype = FORMAT_VideoInfo; printf("SetMediaType..."); hr = this->pGrabber->SetMediaType(&this->MediaType); if(FAILED(hr)){ printf("FAILED.\n"); return; } printf("done.\n"); crashes ...

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189

    SetMediaType problem

    Code:
    this->MediaType.majortype = MEDIATYPE_Video;
    this->MediaType.subtype = MEDIASUBTYPE_RGB24;
    this->MediaType.formattype = FORMAT_VideoInfo;
     
    printf("SetMediaType...");
    hr = this->pGrabber->SetMediaType(&this->MediaType);
    if(FAILED(hr)){
       printf("FAILED.\n");
       return;
       }
    printf("done.\n");
    crashes during the call to set media type. pGrabber is valid from a previous call. The problem is I dont even get the report of FAILED. It literally crashes during the call.

    This might be associated with my using 2008 express and having to put in the MS recommended hack for Qedit.h, so i will try compiling it under codeblocks or something if I get time to install it. If I just skip setting the media type, then it works fine, but this same code works fine when compiled under 2005 (full version). Right now I am workign with a cheap camer that only supports 24 bit so its not an issue, but I plan on gettign a better camera that supports more fromats, so I need to be able to set the mediatype
    Last edited by abachler; 05-31-2008 at 08:32 AM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    Does it crash in a debug build? If so, step through and see if the value of "this" or "pGrabber" changes at some point prior to the crash.

    Treat each crash as new and exciting opportunity to hone your debugging skillz

    gg

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    I tested it in a debug build, and it doesnt crash, but the method still fails. I hate to spend $800 on VS.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    >> I tested it in a debug build, and it doesnt crash...
    Ohhh, those are my favorite

    >> but the method still fails
    and hr is.....

    gg

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Quote Originally Posted by abachler View Post
    I hate to spend $800 on VS.
    And why would you have to spend $800 on VS?
    At best, the Express edition can provide all debugging capabilities than Standard+ can.
    Besides, even if it crashes in Release, you can track down where it crashes. Although you may have to look at some assembly to know WTH is going on since it sometimes caches things in registers. VS is excellent at showing assembly, though.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by Elysia View Post
    And why would you have to spend $800 on VS?
    At best, the Express edition can provide all debugging capabilities than Standard+ can.
    Besides, even if it crashes in Release, you can track down where it crashes. Although you may have to look at some assembly to know WTH is going on since it sometimes caches things in registers. VS is excellent at showing assembly, though.
    apparently you didnt read the thread elysia. Its crashing on express edition and runs fine when compiled on the full version.

    Quote Originally Posted by codeplug
    and hr = ?
    ok code, sorry about that. the HR it is returning on failure in the debug version is
    E_OUTOFMEMORY, which doesnt make any sense.
    Last edited by abachler; 05-31-2008 at 12:11 PM. Reason: didnt have my coffee this mornign yet
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Quote Originally Posted by abachler View Post
    hahaha, aparently you didnt read the thread elysia. Its crashing on express edition and runs fine when compiled on the full version so run along and play now.
    The only thing I see is that it runs fine on 2005 and not on 2008.
    Standard or not doesn't really matter.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21