locked
DirectShow Video Rotation RRS feed

  • السؤال

  • Hi,

    I have an application that uses DirectShow to capture video into a file. The application is running in windows mobile. I'm new to DirectShow and with lack of knowledge in this kind of application development.

    I have 2 terminals and in both the video capture runs fine.

    However in one of the terminals (Samsung Omnia) the video is being capture with a rotation of 90º and the other one is ok.

    I have tried to access via the IAMStreamConfig interface to the landscape/portrait flag but without any success.

    I noticed in the MSDN documentation that there another interesting interface named IAMVideoTransform that can perform rotations based on an input angle. How can use it? Can anyone provide me a code snippet?

    Besides these interfaces mentioned, what can I do to make video rotation by 90º?

     

    Thanks in advance,

    - P

     

    15/جمادى الثانية/1431 02:39 م

الإجابات

  • On Sat, 29 May 2010 21:25:53 +0000, _Pedro_ wrote:
     
    > pAsfMultiplexer
     
    This is a mux not a renderer. AFAIK, in WM, IAMVideoTransform is only
    implemented on the video renderer filter.
     
    If you need to write a rotated stream, not present it to the user with
    the video renderer, you will need to write a transform filter instead,
    unless one exists already in WM. I'm not that familiar with WM since
    I don't use it.
     

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • تم وضع علامة كإجابة بواسطة The March Hare 23/جمادى الثانية/1431 06:35 م
    15/جمادى الثانية/1431 10:38 م

جميع الردود

  • On Sat, 29 May 2010 14:39:12 +0000, _Pedro_ wrote:
     
    > I noticed in the MSDN documentation that there another interesting interface named
    > IAMVideoTransform that can perform rotations based on an input angle. How can use it? Can anyone
    > provide me a code snippet?
     
    [ note that this interface is only available on WM; I know that's what
    you're using but others who are using a desktop version of Windows may
    stumble upon this thread ]
     
    CComQIPtr<IAMVideoTransform> rotate(renderer); // renderer is an
    interface your video renderer filter (IBaseFilter will do)
     
    if (!rotate)
      return E_NOINTERFACE;
     
    DWORD rotation_caps = 0;
    hr = rotate.GetRotationCaps(&rotation_caps);
    if (SUCCEEDED(hr) && (rotation_caps & <find the appropriate flag in
    the header file here>)) {
      AM_ROTATION_ANGLE angle = <get enum the value from the header file>;
      hr = rotate.SetDestinationRotation(angle);
    }
     
    > Besides these interfaces mentioned, what can I do to make video
    > rotation by 90º?
     
    You can write your own transform filter. This has been covered
    before. Try using Search.
     

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    15/جمادى الثانية/1431 05:41 م
  • Hi,

    Thanks for your answer!

    Yes, I'm only focused on Windows Mobile. I have used search and I haven't found anything relevant that could help me out to write some code. Do you know some articles by any chance? The MSDN tutorial is quite confused and I'm not managing to help myself. Does somebody has a sample project that could provide me?

     

    I was trying out your code (exactly like this):

    -----------------------------------------------------------------------------------------

    CComPtr<IBaseFilter> m_pVideoCaptureFilter;

    m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture )

    CComQIPtr<IAMVideoTransform> rotate(m_pVideoCaptureFilter);

    if (!rotate) return E_NOINTERFACE;

    DWORD rotation_caps = 0;

    HRESULT hr = rotate.GetRotationCaps(&rotation_caps);

    ----------------------------------------------------------------------------------------

    and an the following error message occurred:

    error C2039: 'GetRotationCaps' : is not a member of 'ATL::CComQIPtr<T>'

     

    Thanks in advance,

    - Pedro

     

    15/جمادى الثانية/1431 06:16 م
  • Try rotate->GetRotationCaps()
    15/جمادى الثانية/1431 07:56 م
  • On Sat, 29 May 2010 19:56:10 +0000, Geraint Davies wrote:
     
    > Try rotate->GetRotationCaps()
     
    Yep, getting too dependent on Visual AssistX in my old age :) Maybe
    it's time to put this hare out to pasture.  Also need to use -> on the next use of "rotate."
     

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    15/جمادى الثانية/1431 08:20 م
  • Hi,

    Thanks for your inputs. I'm always getting a null pointer to the interface with the previous instruction reported and with the following one too:

    m_pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, pVideoEncoder, pAsfMultiplexer );

    The render variable that I have used was pAsfMultiplexer.Can you please tell me what am I doing wrong?

    Thanks,

    - P

    15/جمادى الثانية/1431 09:25 م
  • On Sat, 29 May 2010 21:25:53 +0000, _Pedro_ wrote:
     
    > pAsfMultiplexer
     
    This is a mux not a renderer. AFAIK, in WM, IAMVideoTransform is only
    implemented on the video renderer filter.
     
    If you need to write a rotated stream, not present it to the user with
    the video renderer, you will need to write a transform filter instead,
    unless one exists already in WM. I'm not that familiar with WM since
    I don't use it.
     

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • تم وضع علامة كإجابة بواسطة The March Hare 23/جمادى الثانية/1431 06:35 م
    15/جمادى الثانية/1431 10:38 م