Commit b7e2456f authored by Jean-Paul Saman's avatar Jean-Paul Saman

Patch by Paul Sokolovsky <pmsicml _AT_ gmail _dot_ com>.

Remove unconditionally enforcing of "preferred" media type upon the capture devices. Some devices don't handle this properly, which often results in a BSOD. By not setting a preferred media type the problem dissappears. Please check this with other type of devices for any regression.
parent edf8b67b
...@@ -832,84 +832,9 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys, ...@@ -832,84 +832,9 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
p_sys->i_width, p_sys->i_height, p_sys->i_width, p_sys->i_height,
0, 0, 0, media_types, MAX_MEDIA_TYPES ); 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( size_t i = 0; i < media_count; i++ )
{
if( media_types[i].majortype == MEDIATYPE_Stream )
{
b_stream_type = VLC_TRUE;
break;
}
}
size_t mt_count = 0; size_t mt_count = 0;
AM_MEDIA_TYPE *mt = NULL; AM_MEDIA_TYPE *mt = NULL;
if( !b_stream_type && !b_audio )
{
// Insert prefered video media type
AM_MEDIA_TYPE mtr;
VIDEOINFOHEADER vh;
mtr.majortype = MEDIATYPE_Video;
mtr.subtype = MEDIASUBTYPE_I420;
mtr.bFixedSizeSamples = TRUE;
mtr.bTemporalCompression = FALSE;
mtr.pUnk = NULL;
mtr.formattype = FORMAT_VideoInfo;
mtr.cbFormat = sizeof(vh);
mtr.pbFormat = (BYTE *)&vh;
memset(&vh, 0, sizeof(vh));
vh.bmiHeader.biSize = sizeof(vh.bmiHeader);
vh.bmiHeader.biWidth = p_sys->i_width > 0 ? p_sys->i_width : 320;
vh.bmiHeader.biHeight = p_sys->i_height > 0 ? p_sys->i_height : 240;
vh.bmiHeader.biPlanes = 3;
vh.bmiHeader.biBitCount = 12;
vh.bmiHeader.biCompression = VLC_FOURCC('I','4','2','0');
vh.bmiHeader.biSizeImage = vh.bmiHeader.biWidth * 12 *
vh.bmiHeader.biHeight / 8;
mtr.lSampleSize = vh.bmiHeader.biSizeImage;
mt_count = 1;
mt = (AM_MEDIA_TYPE *)malloc( sizeof(AM_MEDIA_TYPE)*mt_count );
CopyMediaType(mt, &mtr);
}
else if( !b_stream_type )
{
// Insert prefered audio media type
AM_MEDIA_TYPE mtr;
WAVEFORMATEX wf;
mtr.majortype = MEDIATYPE_Audio;
mtr.subtype = MEDIASUBTYPE_PCM;
mtr.bFixedSizeSamples = TRUE;
mtr.bTemporalCompression = FALSE;
mtr.lSampleSize = 0;
mtr.pUnk = NULL;
mtr.formattype = FORMAT_WaveFormatEx;
mtr.cbFormat = sizeof(wf);
mtr.pbFormat = (BYTE *)&wf;
memset(&wf, 0, sizeof(wf));
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = 2;
wf.nSamplesPerSec = 44100;
wf.wBitsPerSample = 16;
wf.nBlockAlign = wf.nSamplesPerSec * wf.wBitsPerSample / 8;
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
wf.cbSize = 0;
mt_count = 1;
mt = (AM_MEDIA_TYPE *)malloc( sizeof(AM_MEDIA_TYPE)*mt_count );
CopyMediaType(mt, &mtr);
}
if( media_count > 0 ) if( media_count > 0 )
{ {
mt = (AM_MEDIA_TYPE *)realloc( mt, sizeof(AM_MEDIA_TYPE) * mt = (AM_MEDIA_TYPE *)realloc( mt, sizeof(AM_MEDIA_TYPE) *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment