quartz: Implement IBasicVideo get_AvgTimePerFrame.
authorMaarten Lankhorst <m.b.lankhorst@gmail.com>
Mon, 17 May 2010 19:32:32 +0000 (21:32 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 18 May 2010 06:50:47 +0000 (08:50 +0200)
dlls/quartz/videorenderer.c

index b31959eed21c26ece972ce1182257cd716c8bab6..ed8f24eec6944efebbe5f772bf64c669fe9e86bf 100644 (file)
@@ -1176,10 +1176,25 @@ static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
 /*** IBasicVideo methods ***/
 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
                                                     REFTIME *pAvgTimePerFrame) {
+    AM_MEDIA_TYPE *pmt;
     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
 
-    FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
+    if (!This->pInputPin->pin.pConnectedTo)
+        return VFW_E_NOT_CONNECTED;
 
+    TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
+
+    pmt = &This->pInputPin->pin.mtCurrent;
+    if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
+        VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+        *pAvgTimePerFrame = vih->AvgTimePerFrame;
+    } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
+        VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
+        *pAvgTimePerFrame = vih->AvgTimePerFrame;
+    } else {
+        ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
+        *pAvgTimePerFrame = 0;
+    }
     return S_OK;
 }