# HG changeset patch # User voroshil # Date 1195391820 0 # Node ID 4b14d188ed345465a93d435e9bcb0f9697255808 # Parent 5abe2c29b7d8ab6dd3367b33efceb8a6bf5dd978 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). diff -r 5abe2c29b7d8 -r 4b14d188ed34 stream/tvi_dshow.c --- a/stream/tvi_dshow.c Sun Nov 18 11:36:57 2007 +0000 +++ b/stream/tvi_dshow.c Sun Nov 18 13:17:00 2007 +0000 @@ -3090,6 +3090,7 @@ { int fcc, i; void* tmp; + int result = TVI_CONTROL_TRUE; if (priv->state) return TVI_CONTROL_FALSE; @@ -3102,7 +3103,31 @@ (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 @@ 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: {