Tuesday, February 24, 2009

WindowsMobile Microsoft video renderer crashes for Odd resolution width

 
 
WindowsMobile Microsoft video renderer crashes with the following error for RGB565 data with 179x99 video resolution:
 
Data Abort: Thread=8a66da00 Proc=88a8b8b0 'wmplayer'
AKY=00080001 PC=03fa0060(coredll.dll+0x00054060) RA=0305798c(quartz.dll+0x0007398c) BVA=29b9a01c FSR=00000007
Unhandled exception at 0x03fa0060 in wmplayer.exe: 0xC0000005: Access violation reading location 0x01b9a01c.

Unhandled exception at 0x03fa0060 in wmplayer.exe: 0xC0000005: Access violation reading location 0x01b9a01c.
 
Odd Resolution Clip: 179x99 resolution
DecideBufferSize () size as 179x99*2
SetActualDatalength() as 179x99 * 2

Solution :
--------------
if I modified the DecideBufferSize to 180x99*2 then it is working fine.
renderer is doing some alignment for odd resolution clip is it so ?

Before giving the output to the renderer from our decoder, we need to align width and height to multiple's 0f 4 or 2;
 
Alignment to 4 :
----------------
  if( nFrameWidth & 0x03)
  {
   nFrameWidth = nFrameWidth  - ( nFrameWidth & 0x03);
  }
Alignment to 2 :
-----------------
  if(nFrameWidth & 0x01)
  {
   nFrameWidth = nFrameWidth - 1;   
  }
 
Note: I also got the above error if I do the following:
i) allocating memory size as 179x99 in DecideBufferSize()  and set the Width and height as 180x100 .

Monday, February 23, 2009

fatal error LNK1104: cannot open file 'x0__ar10.lib'

problem:

fatal error LNK1104: cannot open file 'x0__ar10.lib'

Solution:
-------------------

Search this library in Visual studio 8 installation folder.In the
following path it has that library.
D:\Program Files\Microsoft Visual Studio 8\VC\ce\bin\x86_arm

Thursday, February 19, 2009

Regarding the how to set the relative path:

Regarding the how to set the relative path:
==================================================

D:\tech\code\fileformats\3gpp\reader

..\..\..\..\inc


it refers the path as follows:
excape from the four directories:

D:\tech\inc


My Current directory is as follows:
D:\tech\code\Apps\Mp4Propertybag_Source\Mp4PropertyPag

common.h file's Current Directory D:\NokiaPCFilters\tech\inc

Relative path: ..\..\..\..\inc

Target directory:

D:\tech\code\fileformats\3gpp\reader\inc


Relative path:
..\..\..\fileformats\3gpp\reader\inc


Target Dir:
-------------
D:\tech\code\fileformats\3gpp\inc

Relative path:
--------------
..\..\..\fileformats\3gpp\inc

Target dir:
--------------
D:\tech\code\filters\inc

Relative path:
--------------
..\..\..\filters\inc

Integer division by error with Audio Decoder filter

while delivering audio data, I got a problem as follows:

i) if I deliver it then I got a crash in Decoder as "Integer division by zero".

So I modified the AvgBytesPerSec member of WAVEFORMATEX structure as follows:


wfx.nBlockAlign = 1 ;
wfx.nAvgBytesPerSec = MP3hdr->bitrate * 1000 / 8;

Solution:
--------------
Assign the proper values for WAVEFORMATEX header.

Modified value as follows Now the Filter is working fine.

wfx.nBlockAlign = 2 * nchannels ;
wfx.nAvgBytesPerSec = pwfxout->wfx.nSamplesPerSec * pwfxout->wfx.nBlockAlign ;

Wednesday, February 18, 2009

How to do dynamic format change from the Decoder Filter?...


 How to do dynamic format change from the Decoder Filter?...


Scenario:
-------------
 Assume that we reading video data from the RTP or from real media file.
we will receive the video with 320x240 resolution. In the middle of the stream, it might give you video data with 640x480

resolution. How will u handle the situation ? we can do it with Dynamic format change.

 


what needs to be done at decoder level:
---------------------------------------
   For getting width and height, we will refer the config data from the Source filter's VIDEOINFOHEADER config data or from
the video frame itself have the config information .

 We have the Create the Decoder with current width and height( 320x240) resolution.


DecodeFrame() fn itself must have the ability to detect new config. if some new config arrived, the DecodeFrame () returns

E_NEW_CONFIG;
 
 
 when the new width and height found, we have to delete/release the decoder ( Not a decoder filter) and we have to
create the new decoder with new resolution and then try to decode the frame.

 Here we need to change Decoder filter's output pin media type as well as the reallocate renderer's allocator with new

resolution.

 Logic is as follows:

 if( DecodeFrame() == E_NEW_CONFIG)
 {
  DeleteDecoder();
  hr =CreateDecoder(newWidth,newHeight);

  //Change the output pin's media type resolution
  //Rellocate the renderer's allocator with new resolution (640x480)

  //DecodeFrame() once again and give it out.

 }
 


 if we want the dynamic format change, we have to use upstream filter's(video renderer) allocator .

 

 

For Windows mobile:
-------------------
  Microsoft video renderer doesnt have the dynamic format change support.
So we can develop the new video renderer.


 if( DecodeFrame() == E_NEW_CONFIG)
 {
  DeleteDecoder();
  hr =CreateDecoder(newWidth,newHeight);

  //Change the output pin's media type resolution
  //Rellocate the renderer's allocator with new resolution (640x480)

  hr = m_pInput->ReceiveConnection(m_pOutput,mediatypeWithNewRes); // m_pInput is just a pointer to upstream

filter's                // input pin ( video renderer input pin


  DecodeFrame();
  Deliver(pSample);
  
 }

 
 In Video renderer:
 -------------------
  upstream filter input pin (Renderer input Pin):

  we have to override the ReceiveConnection() fn;

 HRESULT ReceiveConnection(IPin* m_Connected, AM_MEDIA_TYPE* mtWithNewRes)
 {

  if( m_Connected)
  {
                   // this condition will be satisfied if ReceiveConnection() called from the Decoder manually (while    // the graph was running
   int Width  = getWidth(mtwithNewRes);
   int height = getHeight(mtWithNewRes);

   if( CheckMediaType(mtWithNewRes) != S_OK)
   {
    return E_FAIL;
   }
   SetMediaType(mtWithNewRes);


   m_pAllocator->Decommit();
   m_pAllocator->SetProperties(Width,height);
   m_pAllocator->Commit();
    
   
  }
  else
  {
   return CBasePin::ReceiveConnection();
  }
  
 }

  
 

 
For PC:
----------
 For PC, Video renderer has the support for dynamic format change.
 

 we will do as follows:

within Decoder:
  
  if( DecodeFrame() == E_NEW_CONFIG)
 {
  DeleteDecoder();
  hr =CreateDecoder(newWidth,newHeight);

  //Change the output pin's media type resolution
  //Rellocate the renderer's allocator with new resolution (640x480)

  hr = m_pInput->ReceiveConnection(mediatypeWithNewRes);

  m_pInput->m_pAllocator->Decommit();
  m_pInput->m_pAllocator->SetProperties(new Resolution Size);
  m_pInput->m_pAllocator->Commit();

  DecodeFrame();
  Deliver(pSample);
  
 }
Renderer have the ability to change to new allocated buffer;;

 

Tuesday, February 17, 2009

Kavithai

அவள் கூந்தலில் வழிந்தோடும் மல்லிகைப் பூக்கள் அவள் நடக்கும் போது அவள் கன்னத்தை முத்தமிடத் துடிக்கின்றன.