diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-18 13:17:00 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-18 13:17:00 +0000 |
commit | 5f8294fb14ed1b5195e7e5f84bff2f233c06aee9 (patch) | |
tree | 5a674e85331daf80d9997a7d2c7c3ed621c3e9c6 | |
parent | a516b405d8647b625c336b6f5d2a439a4913b5fc (diff) |
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).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25096 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | stream/tvi_dshow.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 7ed2fa3547..1e7396a4f3 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -3090,6 +3090,7 @@ static int control(priv_t * priv, int cmd, void *arg) { 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 cmd, void *arg) (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 cmd, void *arg) 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: { |