]> git.sesse.net Git - vlc/commitdiff
* modules/access/dshow/dshow.cpp: don't add a prefered media type when dealing with...
authorGildas Bazin <gbazin@videolan.org>
Mon, 1 Nov 2004 13:10:14 +0000 (13:10 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 1 Nov 2004 13:10:14 +0000 (13:10 +0000)
modules/access/dshow/dshow.cpp

index 56abcf0b36a2fe9ed5285e8dd4f710454094dba6..f0e05d887b652370c62f08cad7b589957147619e 100644 (file)
@@ -753,10 +753,30 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
         return VLC_EGENERIC;
     }
 
+    // Retreive acceptable media types supported by device
+    AM_MEDIA_TYPE media_types[MAX_MEDIA_TYPES];
+    size_t media_count =
+        EnumDeviceCaps( p_this, p_device_filter, p_sys->i_chroma,
+                        p_sys->i_width, p_sys->i_height,
+                        0, 0, 0, media_types, MAX_MEDIA_TYPES );
+
+    /* Find out if the pin handles MEDIATYPE_Stream, in which case we
+     * won't add a prefered media type as this doesn't seem to work well
+     * -- to investigate. */
+    vlc_bool_t b_stream_type = VLC_FALSE;
+    for( int i = 0; i < media_count; i++ )
+    {
+        if( media_types[i].majortype == MEDIATYPE_Stream )
+        {
+            b_stream_type = VLC_TRUE;
+            break;
+        }
+    }
+
     size_t mt_count = 0;
     AM_MEDIA_TYPE *mt = NULL;
 
-    if( !b_audio )
+    if( !b_stream_type && !b_audio )
     {
         // Insert prefered video media type
         AM_MEDIA_TYPE mtr;
@@ -787,7 +807,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
         mt = (AM_MEDIA_TYPE *)malloc( sizeof(AM_MEDIA_TYPE)*mt_count );
         CopyMediaType(mt, &mtr);
     }
-    else
+    else if( !b_stream_type )
     {
         // Insert prefered audio media type
         AM_MEDIA_TYPE mtr;
@@ -818,13 +838,6 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
         CopyMediaType(mt, &mtr);
     }
 
-    // Retreive acceptable media types supported by device
-    AM_MEDIA_TYPE media_types[MAX_MEDIA_TYPES];
-    size_t media_count =
-        EnumDeviceCaps( p_this, p_device_filter, p_sys->i_chroma,
-                        p_sys->i_width, p_sys->i_height,
-                        0, 0, 0, media_types, MAX_MEDIA_TYPES );
-
     if( media_count > 0 )
     {
         mt = (AM_MEDIA_TYPE *)realloc( mt, sizeof(AM_MEDIA_TYPE) *