[MPlayer-cvslog] r25096 - trunk/stream/tvi_dshow.c

voroshil subversion at mplayerhq.hu
Sun Nov 18 14:17:00 CET 2007


Author: voroshil
Date: Sun Nov 18 14:17:00 2007
New Revision: 25096

Log:
Add all passed to VID_SET_FORMAT formats to the end of
available format list (but report call as failed, to
continue checking formats).

This gives small chance to build graph even if device
does not report about particular format as supported.

This makes mplayer be able to work with PVR-150 card
(card's driver does not report about yuy2 format, but
accepts connection and works with it).



Modified:
   trunk/stream/tvi_dshow.c

Modified: trunk/stream/tvi_dshow.c
==============================================================================
--- trunk/stream/tvi_dshow.c	(original)
+++ trunk/stream/tvi_dshow.c	Sun Nov 18 14:17:00 2007
@@ -3090,6 +3090,7 @@ static int control(priv_t * priv, int cm
 	{
 	    int fcc, i;
 	    void* tmp;
+	    int result = TVI_CONTROL_TRUE;
 
 	    if (priv->state)
 		return TVI_CONTROL_FALSE;
@@ -3102,7 +3103,31 @@ static int control(priv_t * priv, int cm
 		    (priv->arpmtVideo[i], fcc, priv->width, priv->height))
 		    break;
 	    if (!priv->arpmtVideo[i])
-		return TVI_CONTROL_FALSE;
+	    {
+		int fps = 0;
+		VIDEOINFOHEADER* Vhdr = NULL;
+		AM_MEDIA_TYPE *pmt;
+
+		mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: will try also use undeclared video format: %dx%d, %s\n",priv->width, priv->height, vo_format_name(fcc));
+
+		if (priv->arpmtVideo[0])
+		    Vhdr = (VIDEOINFOHEADER *) priv->arpmtVideo[0]->pbFormat;
+
+		if(Vhdr && Vhdr->bmiHeader.biSizeImage)
+		    fps = Vhdr->dwBitRate / (8 * Vhdr->bmiHeader.biSizeImage);
+
+		pmt=create_video_format(fcc, priv->width, priv->height, fps);
+		if(!pmt)
+		{
+		    mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to create AM_MEDIA_TYPE structure for given format\n");
+		    return TVI_CONTROL_FALSE;
+		}
+		priv->arpmtVideo=realloc(priv->arpmtVideo, (i+2)*sizeof(AM_MEDIA_TYPE*));
+		priv->arpmtVideo[i+1] = NULL;
+		priv->arpmtVideo[i] = pmt;
+
+		result = TVI_CONTROL_FALSE;
+	    }
 
 	    tmp = priv->arpmtVideo[0];
 	    priv->arpmtVideo[0] = priv->arpmtVideo[i];
@@ -3125,7 +3150,7 @@ static int control(priv_t * priv, int cm
 	    extract_video_format(priv->arpmtVideo[priv->nVideoFormatUsed],
 				 &(priv->fcc), &(priv->width),
 				 &(priv->height));
-	    return TVI_CONTROL_TRUE;
+	    return result;
 	}
     case TVI_CONTROL_VID_GET_FORMAT:
 	{



More information about the MPlayer-cvslog mailing list