[QUARTZ] MediaSample fixes

Christian Costa titan.costa at wanadoo.fr
Sun Dec 19 08:36:43 CST 2004


Hi,

Changelog:
Fixed MediaSample passing. This is the upstream filter that releases 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.

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: avidec.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/avidec.c,v
retrieving revision 1.10
diff -u -r1.10 avidec.c
--- avidec.c	29 Nov 2004 17:50:23 -0000	1.10
+++ avidec.c	19 Dec 2004 14:06:37 -0000
@@ -124,10 +124,7 @@
 	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 @@
     
     AVIDec_SendSampleData(This, pbSrcStream, cbSrcStream);
 
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
-        
     return S_OK;
 }
 
Index: avisplit.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/avisplit.c,v
retrieving revision 1.8
diff -u -r1.8 avisplit.c
--- avisplit.c	16 Dec 2004 14:25:15 -0000	1.8
+++ avisplit.c	19 Dec 2004 14:06:39 -0000
@@ -680,8 +680,7 @@
                     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: dsoundrender.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/dsoundrender.c,v
retrieving revision 1.3
diff -u -r1.3 dsoundrender.c
--- dsoundrender.c	8 Sep 2004 01:50:37 -0000	1.3
+++ dsoundrender.c	19 Dec 2004 14:06:40 -0000
@@ -184,7 +184,7 @@
 	  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 @@
 	}
     }
     DSoundRender_SendSampleData(This, pbSrcStream, cbSrcStream);
-  
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
     
     return S_OK;
 }
Index: memallocator.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/memallocator.c,v
retrieving revision 1.4
diff -u -r1.4 memallocator.c
--- memallocator.c	8 Sep 2004 01:50:37 -0000	1.4
+++ memallocator.c	19 Dec 2004 14:06:52 -0000
@@ -140,7 +140,7 @@
 {
     BaseMemAllocator *This = (BaseMemAllocator *)iface;
 
-    TRACE("()\n");
+    TRACE("(%p)->() AddRef from %ld\n", iface, This->ref);
 
     return InterlockedIncrement(&This->ref);
 }
@@ -149,7 +149,7 @@
 {
     BaseMemAllocator *This = (BaseMemAllocator *)iface;
 
-    TRACE("()\n");
+    TRACE("(%p)->() Release from %ld\n", iface, This->ref);
 
     if (!InterlockedDecrement(&This->ref))
     {
@@ -634,8 +634,12 @@
 
     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: videorenderer.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/videorenderer.c,v
retrieving revision 1.3
diff -u -r1.3 videorenderer.c
--- videorenderer.c	8 Sep 2004 01:50:37 -0000	1.3
+++ videorenderer.c	19 Dec 2004 14:06:57 -0000
@@ -222,8 +222,21 @@
                         *(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 @@
 
     VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
 
-    /* We have finished with the incoming sample, we must release it now */
-    IMediaSample_Release(pSample);
-    
     return S_OK;
 }
 


More information about the wine-patches mailing list