Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DirectShow not showing mp4 & WndProc Not working

DirectShow not showing mp4 & WndProc Not working

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiocomjsonquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AmbiguousName
    wrote on last edited by
    #1

    Hello. I am trying to play video file using DirectShow found on this MSDN reference. I am facing two problems. 1- local H264 video doesn't get rendered properly. A frame shows and them some blocks keep showing. 2- Can not get notifications on my dialog window using WndProc. Using this sample. I am using following code for getting events.

    void CDShowPlayerSampleDlg::OnStartPlay()
    {
    CPlayer::m_hWndPlayerDlg = this->m_hWnd; // MainDlg->m_hWnd
    BOOL bResult = m_objPlayer.StartPlay(); // CPlayer m_objPlayer;
    }

    LRESULT CDShowPlayerSampleDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch(wParam) // lParam or wParam ?????????
    {
    case WM_GRAPHNOTIFY:
    }
    /* rest of the code here*/
    }

    Now I am setting the event notifications on the IGraphBuilder like this (in CPlayer).

    HRESULT hResult = m\_pGraphBuilder->QueryInterface(IID\_IMediaEventEx, (void\*\*)&m\_pEvent);
    hResult = m\_pEvent->SetNotifyWindow((OAHWND)m\_hWndPlayerDlg, WM\_GRAPHNOTIFY, 0);
    

    1- So why can not I get notifications in CDShowPlayerSampleDlg::WindowProc? 2- And why is that Windows Media Video (.wmv) file plays correctly but H264 does not. What could I do for smooth H264 playback? Thanks for any pointers.

    This world is going to explode due to international politics, SOON.

    L 1 Reply Last reply
    0
    • A AmbiguousName

      Hello. I am trying to play video file using DirectShow found on this MSDN reference. I am facing two problems. 1- local H264 video doesn't get rendered properly. A frame shows and them some blocks keep showing. 2- Can not get notifications on my dialog window using WndProc. Using this sample. I am using following code for getting events.

      void CDShowPlayerSampleDlg::OnStartPlay()
      {
      CPlayer::m_hWndPlayerDlg = this->m_hWnd; // MainDlg->m_hWnd
      BOOL bResult = m_objPlayer.StartPlay(); // CPlayer m_objPlayer;
      }

      LRESULT CDShowPlayerSampleDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
      {
      switch(wParam) // lParam or wParam ?????????
      {
      case WM_GRAPHNOTIFY:
      }
      /* rest of the code here*/
      }

      Now I am setting the event notifications on the IGraphBuilder like this (in CPlayer).

      HRESULT hResult = m\_pGraphBuilder->QueryInterface(IID\_IMediaEventEx, (void\*\*)&m\_pEvent);
      hResult = m\_pEvent->SetNotifyWindow((OAHWND)m\_hWndPlayerDlg, WM\_GRAPHNOTIFY, 0);
      

      1- So why can not I get notifications in CDShowPlayerSampleDlg::WindowProc? 2- And why is that Windows Media Video (.wmv) file plays correctly but H264 does not. What could I do for smooth H264 playback? Thanks for any pointers.

      This world is going to explode due to international politics, SOON.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      switch(wParam) // will never work, the wParam and lParam variables hold other data

      // you need to check the message number like:
      switch(message)

      A 1 Reply Last reply
      0
      • L Lost User

        switch(wParam) // will never work, the wParam and lParam variables hold other data

        // you need to check the message number like:
        switch(message)

        A Offline
        A Offline
        AmbiguousName
        wrote on last edited by
        #3

        Yes. it solved my problem. On a different note, as you can see in my code OnStartPlay(), I am storing my MainDlg's HWND in the CPlayer. What if I don't have a window and I still want to process these kind of messages from CPlayer? Thanks

        This world is going to explode due to international politics, SOON.

        L 1 Reply Last reply
        0
        • A AmbiguousName

          Yes. it solved my problem. On a different note, as you can see in my code OnStartPlay(), I am storing my MainDlg's HWND in the CPlayer. What if I don't have a window and I still want to process these kind of messages from CPlayer? Thanks

          This world is going to explode due to international politics, SOON.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You must have a Window, in order to receive the WM_ messages. However, you can create a Window but not make it visible if necessary.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups