Fixed MediaSample passing. This is the upstream filter that releases
authorChristian Costa <titan.costa@wanadoo.fr>
Mon, 20 Dec 2004 17:07:17 +0000 (17:07 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 20 Dec 2004 17:07:17 +0000 (17:07 +0000)
it.
Set ppMediaType to NULL when returning S_FALSE in
IMediaSample_GetMediaType (required by native Quartz dll).
Added support for 32-bit depth source in video renderer.

dlls/quartz/avidec.c
dlls/quartz/avisplit.c
dlls/quartz/dsoundrender.c
dlls/quartz/memallocator.c
dlls/quartz/videorenderer.c

index 37aaaab..c438267 100644 (file)
@@ -124,10 +124,7 @@ static DWORD AVIDec_SendSampleData(AVIDecImpl* This, LPBYTE data, DWORD size)
        goto error;
     }
 
-    return S_OK;
-
 error:
-    /* If we have a sample that has not been delivered, release it */
     if (pSample)
         IMediaSample_Release(pSample);
 
@@ -174,9 +171,6 @@ static HRESULT AVIDec_Sample(LPVOID iface, IMediaSample * pSample)
     
     AVIDec_SendSampleData(This, pbSrcStream, cbSrcStream);
 
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
-        
     return S_OK;
 }
 
index 644ce7a..098ce00 100644 (file)
@@ -680,8 +680,7 @@ static HRESULT AVISplitter_Sample(LPVOID iface, IMediaSample * pSample)
                     ERR("Error sending sample (%lx)\n", hr);
             }
 
-            /* If we have a sample that has not been delivered, release it */
-            if (FAILED(hr) && This->pCurrentSample)
+            if (This->pCurrentSample)
                 IMediaSample_Release(This->pCurrentSample);
             
             This->pCurrentSample = NULL;
index 9191a7a..808ae21 100644 (file)
@@ -184,7 +184,7 @@ static DWORD DSoundRender_SendSampleData(DSoundRenderImpl* This, LPBYTE data, DW
          ERR("Unable to lock sound buffer !\n");
           break;
         }
-       TRACE("write_pos=%ld, size=%ld, sz1=%ld, sz2=%ld\n", This->write_pos, size2, dwsize1, dwsize2); 
+        /* TRACE("write_pos=%ld, size=%ld, sz1=%ld, sz2=%ld\n", This->write_pos, size2, dwsize1, dwsize2); */
 
         memcpy(lpbuf1, data, dwsize1);
         if (dwsize2) {
@@ -260,9 +260,6 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
        }
     }
     DSoundRender_SendSampleData(This, pbSrcStream, cbSrcStream);
-  
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
     
     return S_OK;
 }
index bddc9b0..7c8877d 100644 (file)
@@ -140,7 +140,7 @@ static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator * iface)
 {
     BaseMemAllocator *This = (BaseMemAllocator *)iface;
 
-    TRACE("()\n");
+    TRACE("(%p)->() AddRef from %ld\n", iface, This->ref);
 
     return InterlockedIncrement(&This->ref);
 }
@@ -149,7 +149,7 @@ static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface)
 {
     BaseMemAllocator *This = (BaseMemAllocator *)iface;
 
-    TRACE("()\n");
+    TRACE("(%p)->() Release from %ld\n", iface, This->ref);
 
     if (!InterlockedDecrement(&This->ref))
     {
@@ -634,8 +634,12 @@ static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 * iface, AM_MED
 
     TRACE("(%p)\n", ppMediaType);
 
-    if (!This->props.pMediaType)
+    if (!This->props.pMediaType) {
+        /* Make sure we return a NULL pointer (required by native Quartz dll) */
+        if (ppMediaType)
+            *ppMediaType = NULL;
         return S_FALSE;
+    }
 
     if (!(*ppMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
         return E_OUTOFMEMORY;
index 14cf573..0eb5af3 100644 (file)
@@ -222,8 +222,21 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
                         *(ptr + i*psz + 3 + j * sdesc.u1.lPitch) = 0xFF;
                 }
         }
+       else if (format->bmiHeader.biBitCount == 32)
+       {
+            int psz = sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32 ? 4 : 3;
+            for (j = 0; j < height; j++)
+                for (i = 0; i < width; i++)
+                {
+                    *(ptr + i*psz + 0 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 0);
+                    *(ptr + i*psz + 1 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 1);
+                    *(ptr + i*psz + 2 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 2);
+                   if (psz == 4)
+                        *(ptr + i*psz + 3 + j * sdesc.u1.lPitch) = 0xFF;
+                }
+       }
        else
-            FIXME("Source size with a depths other than paletted 8 bits are not yet supported\n");
+            FIXME("Source size with a depths other than paletted 8 or 32 bits are not yet supported\n");
     }
     else
         FIXME("Destination depths with a depth other than 24 or 32 bits are not yet supported\n");     
@@ -293,9 +306,6 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
 
     VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
 
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
-    
     return S_OK;
 }