Zebediah Figura : quartz/memallocator: Avoid using a magic value for the start media time.

Alexandre Julliard julliard at winehq.org
Tue Jun 25 17:25:50 CDT 2019


Module: wine
Branch: master
Commit: f1c749239490eb3bb148d115709baa6f579019ab
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f1c749239490eb3bb148d115709baa6f579019ab

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun 24 20:05:17 2019 -0500

quartz/memallocator: Avoid using a magic value for the start media time.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/memallocator.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index 1d74c3c..b7dff8c 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -40,6 +40,7 @@ typedef struct StdMediaSample2
     struct list listentry;
     LONGLONG tMediaStart;
     LONGLONG tMediaEnd;
+    BOOL media_time_valid;
 } StdMediaSample2;
 
 typedef struct BaseMemAllocator
@@ -74,8 +75,6 @@ static inline StdMediaSample2 *unsafe_impl_from_IMediaSample(IMediaSample * ifac
 
 #define AM_SAMPLE2_PROP_SIZE_WRITABLE FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)
 
-#define INVALID_MEDIA_TIME (((ULONGLONG)0x7fffffff << 32) | 0xffffffff)
-
 static HRESULT BaseMemAllocator_Init(HRESULT (* fnAlloc)(IMemAllocator *),
                                      HRESULT (* fnFree)(IMemAllocator *),
                                      HRESULT (* fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *),
@@ -435,8 +434,7 @@ static HRESULT StdMediaSample2_Construct(BYTE * pbBuffer, LONG cbBuffer, IMemAll
     (*ppSample)->props.cbData = sizeof(AM_SAMPLE2_PROPERTIES);
     (*ppSample)->props.cbBuffer = (*ppSample)->props.lActual = cbBuffer;
     (*ppSample)->props.pbBuffer = pbBuffer;
-    (*ppSample)->tMediaStart = INVALID_MEDIA_TIME;
-    (*ppSample)->tMediaEnd = 0;
+    (*ppSample)->media_time_valid = FALSE;
 
     return S_OK;
 }
@@ -496,8 +494,7 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
             DeleteMediaType(This->props.pMediaType);
         This->props.pMediaType = NULL;
         This->props.dwSampleFlags = 0;
-        This->tMediaStart = INVALID_MEDIA_TIME;
-        This->tMediaEnd = 0;
+        This->media_time_valid = FALSE;
 
         if (This->pParent)
             IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
@@ -725,7 +722,7 @@ static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLO
 
     TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
 
-    if (This->tMediaStart == INVALID_MEDIA_TIME)
+    if (!This->media_time_valid)
         return VFW_E_MEDIA_TIME_NOT_SET;
 
     *pStart = This->tMediaStart;
@@ -745,9 +742,10 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON
         if (!end) return E_POINTER;
         sample->tMediaStart = *start;
         sample->tMediaEnd = *end;
+        sample->media_time_valid = TRUE;
     }
     else
-        sample->tMediaStart = INVALID_MEDIA_TIME;
+        sample->media_time_valid = FALSE;
 
     return S_OK;
 }




More information about the wine-cvs mailing list