Changeset e1935dc3b8ba57fa26f7b32221d051443424526d

Show
Ignore:
Timestamp:
14/01/06 10:36:16 (3 years ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1137231376 +0000
git-parent:

[73a9dbadc3f3fa3537a8543f8e589de98eccf28e]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1137231376 +0000
Message:

Revert revision 13903. It is implemented in a different way by checking if the option --dshow-chroma is set. If it is set then the chroma is forced, otherwise it is not. This should solve the regression of previous commit, by letting users specify the chroma type to use. To get the previous default behaviour specify IV420 as preferred chroma type either on the commandline or in the Capture Device advanced tab.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/dshow/common.h

    r2cb472d re1935dc  
    9191    int            i_height; 
    9292    int            i_chroma; 
     93    vlc_bool_t     b_chroma; /* Force a specific chroma on the dshow input */ 
    9394}; 
  • modules/access/dshow/dshow.cpp

    r2cb472d re1935dc  
    207207 
    208208    vlc_bool_t      b_pts; 
    209  
    210209} dshow_stream_t; 
    211210 
     
    283282    var_Create( p_this, "dshow-config", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 
    284283    var_Create( p_this, "dshow-tuner", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 
    285  
    286284    var_Create( p_this, "dshow-vdev", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 
    287285    var_Get( p_this, "dshow-vdev", &val ); 
     
    326324    if( val.psz_string ) free( val.psz_string ); 
    327325 
     326    p_sys->b_chroma = VLC_FALSE; 
    328327    var_Create( p_this, "dshow-chroma", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 
    329328    var_Get( p_this, "dshow-chroma", &val ); 
     
    332331        i_chroma = VLC_FOURCC( val.psz_string[0], val.psz_string[1], 
    333332                               val.psz_string[2], val.psz_string[3] ); 
     333        p_sys->b_chroma = VLC_TRUE; 
    334334    } 
    335335    if( val.psz_string ) free( val.psz_string ); 
     
    836836    AM_MEDIA_TYPE *mt = NULL; 
    837837 
     838    /* Only force the chroma setting if it is specified by the user. */ 
     839    if( p_sys->b_chroma ) 
     840    { 
     841        /* Find out if the pin handles MEDIATYPE_Stream, in which case we 
     842        * won't add a prefered media type as this doesn't seem to work well 
     843        * -- to investigate. */ 
     844        vlc_bool_t b_stream_type = VLC_FALSE; 
     845        for( size_t i = 0; i < media_count; i++ ) 
     846        { 
     847            if( media_types[i].majortype == MEDIATYPE_Stream ) 
     848            { 
     849                b_stream_type = VLC_TRUE; 
     850                break; 
     851            } 
     852        } 
     853 
     854        if( !b_stream_type && !b_audio ) 
     855        { 
     856            // Insert prefered video media type 
     857            AM_MEDIA_TYPE mtr; 
     858            VIDEOINFOHEADER vh; 
     859 
     860            mtr.majortype            = MEDIATYPE_Video; 
     861            mtr.subtype              = MEDIASUBTYPE_I420; 
     862            mtr.bFixedSizeSamples    = TRUE; 
     863            mtr.bTemporalCompression = FALSE; 
     864            mtr.pUnk                 = NULL; 
     865            mtr.formattype           = FORMAT_VideoInfo; 
     866            mtr.cbFormat             = sizeof(vh); 
     867            mtr.pbFormat             = (BYTE *)&vh; 
     868 
     869            memset(&vh, 0, sizeof(vh)); 
     870 
     871            vh.bmiHeader.biSize   = sizeof(vh.bmiHeader); 
     872            vh.bmiHeader.biWidth  = p_sys->i_width > 0 ? p_sys->i_width : 320; 
     873            vh.bmiHeader.biHeight = p_sys->i_height > 0 ? p_sys->i_height : 240; 
     874            vh.bmiHeader.biPlanes      = 3; 
     875            vh.bmiHeader.biBitCount    = 12; 
     876            vh.bmiHeader.biCompression = VLC_FOURCC('I','4','2','0'); 
     877            vh.bmiHeader.biSizeImage   = vh.bmiHeader.biWidth * 12 * 
     878                vh.bmiHeader.biHeight / 8; 
     879            mtr.lSampleSize            = vh.bmiHeader.biSizeImage; 
     880 
     881            mt_count = 1; 
     882            mt = (AM_MEDIA_TYPE *)malloc( sizeof(AM_MEDIA_TYPE)*mt_count ); 
     883            CopyMediaType(mt, &mtr); 
     884        } 
     885        else if( !b_stream_type ) 
     886        { 
     887            // Insert prefered audio media type 
     888            AM_MEDIA_TYPE mtr; 
     889            WAVEFORMATEX wf; 
     890 
     891            mtr.majortype            = MEDIATYPE_Audio; 
     892            mtr.subtype              = MEDIASUBTYPE_PCM; 
     893            mtr.bFixedSizeSamples    = TRUE; 
     894            mtr.bTemporalCompression = FALSE; 
     895            mtr.lSampleSize          = 0; 
     896            mtr.pUnk                 = NULL; 
     897            mtr.formattype           = FORMAT_WaveFormatEx; 
     898            mtr.cbFormat             = sizeof(wf); 
     899            mtr.pbFormat             = (BYTE *)&wf; 
     900 
     901            memset(&wf, 0, sizeof(wf)); 
     902 
     903            wf.wFormatTag = WAVE_FORMAT_PCM; 
     904            wf.nChannels = 2; 
     905            wf.nSamplesPerSec = 44100; 
     906            wf.wBitsPerSample = 16; 
     907            wf.nBlockAlign = wf.nSamplesPerSec * wf.wBitsPerSample / 8; 
     908            wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign; 
     909            wf.cbSize = 0; 
     910 
     911            mt_count = 1; 
     912            mt = (AM_MEDIA_TYPE *)malloc( sizeof(AM_MEDIA_TYPE)*mt_count ); 
     913            CopyMediaType(mt, &mtr); 
     914        } 
     915    } 
     916 
    838917    if( media_count > 0 ) 
    839918    {