Changeset 1b88d65cb040ba6a0dbf9eb885d4e7e3fb71daac

Show
Ignore:
Timestamp:
01/09/03 00:06:17 (5 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1062367577 +0000
git-parent:

[5dfa0cffd6382f22f6289c762b87198bb0d14a0b]

git-author:
Gildas Bazin <gbazin@videolan.org> 1062367577 +0000
Message:

* modules/access/dshow/*: always try to get the video in I420 chroma if supported.

Implemented a ":size=" and ":chroma=" option.

Files:

Legend:

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

    rf57a2f3 r1b88d65  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: dshow.cpp,v 1.6 2003/08/27 12:59:11 gbazin Exp $ 
     5 * $Id: dshow.cpp,v 1.7 2003/08/31 22:06:17 gbazin Exp $ 
    66 * 
    77 * Author: Gildas Bazin <gbazin@netcourrier.com> 
     
    3333#include <vlc/vout.h> 
    3434 
    35 #ifndef _MSC_VER 
    36 #   include <wtypes.h> 
    37 #   include <unknwn.h> 
    38 #   include <ole2.h> 
    39 #   include <limits.h> 
    40 #   define _WINGDI_ 1 
    41 #   define AM_NOVTABLE 
    42 #   define _OBJBASE_H_ 
    43 #   undef _X86_ 
    44 #   define _I64_MAX LONG_LONG_MAX 
    45 #   define LONGLONG long long 
    46 #endif 
    47  
    48 #include <dshow.h> 
    49  
    5035#include "filter.h" 
    5136 
     
    6449static IBaseFilter *FindCaptureDevice( vlc_object_t *, string *, 
    6550                                       list<string> *, vlc_bool_t ); 
    66 static bool ConnectFilters( IFilterGraph *p_graph, IBaseFilter *p_filter, 
    67                             IPin *p_input_pin ); 
     51static AM_MEDIA_TYPE EnumDeviceCaps( vlc_object_t *, IBaseFilter *, 
     52                                     vlc_bool_t, int, int, int ); 
     53static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * ); 
    6854 
    6955/***************************************************************************** 
     
    174160    int            i_streams; 
    175161    int            i_current_stream; 
     162 
     163    /* misc properties */ 
     164    int            i_width; 
     165    int            i_height; 
     166    int            i_chroma; 
    176167}; 
    177168 
     
    189180    psz_parser = psz_dup; 
    190181    string vdevname, adevname; 
     182    int i_width = 0, i_height = 0, i_chroma = VLC_FOURCC('I','4','2','0'); 
    191183 
    192184    while( *psz_parser && *psz_parser != ':' ) 
     
    234226 
    235227                psz_parser += i_len; 
     228            } 
     229            else if( !strncmp( psz_parser, "size=", strlen( "size=" ) ) ) 
     230            { 
     231                psz_parser += strlen( "size=" ); 
     232                if( !strncmp( psz_parser, "subqcif", strlen( "subqcif" ) ) ) 
     233                { 
     234                    i_width  = 128; 
     235                    i_height = 96; 
     236                } 
     237                else if( !strncmp( psz_parser, "qsif", strlen( "qsif" ) ) ) 
     238                { 
     239                    i_width  = 160; 
     240                    i_height = 120; 
     241                } 
     242                else if( !strncmp( psz_parser, "qcif", strlen( "qcif" ) ) ) 
     243                { 
     244                    i_width  = 176; 
     245                    i_height = 144; 
     246                } 
     247                else if( !strncmp( psz_parser, "sif", strlen( "sif" ) ) ) 
     248                { 
     249                    i_width  = 320; 
     250                    i_height = 240; 
     251                } 
     252                else if( !strncmp( psz_parser, "cif", strlen( "cif" ) ) ) 
     253                { 
     254                    i_width  = 352; 
     255                    i_height = 288; 
     256                } 
     257                else if( !strncmp( psz_parser, "vga", strlen( "vga" ) ) ) 
     258                { 
     259                    i_width  = 640; 
     260                    i_height = 480; 
     261                } 
     262                else 
     263                { 
     264                    /* widthxheight */ 
     265                    i_width = strtol( psz_parser, &psz_parser, 0 ); 
     266                    if( *psz_parser == 'x' || *psz_parser == 'X') 
     267                    { 
     268                        i_height = strtol( psz_parser + 1, &psz_parser, 0 ); 
     269                    } 
     270                    msg_Dbg( p_input, "WidthxHeight %dx%d", i_width, i_height ); 
     271                } 
     272            } 
     273            else if( !strncmp( psz_parser, "chroma=", strlen( "chroma=" ) ) ) 
     274            { 
     275                psz_parser += strlen( "chroma=" ); 
     276                if( strlen( psz_parser ) >= 4 ) 
     277                { 
     278                    i_chroma = VLC_FOURCC( psz_parser[0],psz_parser[1], 
     279                                           psz_parser[2],psz_parser[3] ); 
     280                } 
    236281            } 
    237282            else 
     
    278323    p_sys->i_streams = 0; 
    279324    p_sys->pp_streams = (dshow_stream_t **)malloc( 1 ); 
     325    p_sys->i_width = i_width; 
     326    p_sys->i_height = i_height; 
     327    p_sys->i_chroma = i_chroma; 
    280328 
    281329    /* Create header */ 
     
    419467    } 
    420468 
     469    AM_MEDIA_TYPE media_type = 
     470        EnumDeviceCaps( (vlc_object_t *)p_input, p_device_filter, b_audio, 
     471                        p_sys->i_chroma, p_sys->i_width, p_sys->i_height ); 
     472 
    421473    /* Create and add our capture filter */ 
    422     CaptureFilter *p_capture_filter = new CaptureFilter( p_input ); 
     474    CaptureFilter *p_capture_filter = new CaptureFilter( p_input, media_type ); 
    423475    p_sys->p_graph->AddFilter( p_capture_filter, 0 ); 
    424476 
     
    442494            msg_Dbg( p_input, "MEDIATYPE_Video"); 
    443495 
     496            /* Packed RGB formats */ 
     497            if( dshow_stream.mt.subtype == MEDIASUBTYPE_RGB1 ) 
     498                dshow_stream.i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '1' ); 
     499            if( dshow_stream.mt.subtype == MEDIASUBTYPE_RGB4 ) 
     500                dshow_stream.i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '4' ); 
    444501            if( dshow_stream.mt.subtype == MEDIASUBTYPE_RGB8 ) 
    445                 dshow_stream.i_fourcc = VLC_FOURCC( 'G', 'R', 'E', 'Y' ); 
     502                dshow_stream.i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '8' ); 
    446503            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_RGB555 ) 
    447504                dshow_stream.i_fourcc = VLC_FOURCC( 'R', 'V', '1', '5' ); 
     
    454511            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_ARGB32 ) 
    455512                dshow_stream.i_fourcc = VLC_FOURCC( 'R', 'G', 'B', 'A' ); 
    456              
     513 
     514            /* Packed YUV formats */ 
     515            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YVYU ) 
     516                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'V', 'Y', 'U' ); 
    457517            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YUYV ) 
    458518                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'U', 'Y', 'V' ); 
    459519            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_Y411 ) 
    460520                dshow_stream.i_fourcc = VLC_FOURCC( 'I', '4', '1', 'N' ); 
     521            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_Y211 ) 
     522                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', '2', '1', '1' ); 
     523            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YUY2 || 
     524                     dshow_stream.mt.subtype == MEDIASUBTYPE_UYVY ) 
     525                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'U', 'Y', '2' ); 
     526 
     527            /* Planar YUV formats */ 
     528            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_I420 ) 
     529                dshow_stream.i_fourcc = VLC_FOURCC( 'I', '4', '2', '0' ); 
    461530            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_Y41P ) 
    462531                dshow_stream.i_fourcc = VLC_FOURCC( 'I', '4', '1', '1' ); 
    463             else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YUY2 ) 
    464                 dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'U', 'Y', '2' ); 
    465             else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YVYU ) 
    466                 dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'V', 'Y', 'U' ); 
    467             else if( dshow_stream.mt.subtype == MEDIASUBTYPE_Y411 ) 
    468                 dshow_stream.i_fourcc = VLC_FOURCC( 'I', '4', '1', 'N' ); 
    469             else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YV12 ) 
     532            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YV12 || 
     533                     dshow_stream.mt.subtype == MEDIASUBTYPE_IYUV ) 
    470534                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'V', '1', '2' ); 
     535            else if( dshow_stream.mt.subtype == MEDIASUBTYPE_YVU9 ) 
     536                dshow_stream.i_fourcc = VLC_FOURCC( 'Y', 'V', 'U', '9' ); 
     537 
    471538            else goto fail; 
    472539 
     
    477544 
    478545            /* Check if the image is inverted (bottom to top) */ 
    479             if( dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'V', '1', '5' ) || 
     546            if( dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'G', 'B', '1' ) || 
     547                dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'G', 'B', '4' ) || 
     548                dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'G', 'B', '8' ) || 
     549                dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'V', '1', '5' ) || 
    480550                dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'V', '1', '6' ) || 
    481551                dshow_stream.i_fourcc == VLC_FOURCC( 'R', 'V', '2', '4' ) || 
     
    662732} 
    663733 
     734static AM_MEDIA_TYPE EnumDeviceCaps( vlc_object_t *p_this, 
     735                                     IBaseFilter *p_filter, vlc_bool_t b_audio, 
     736                                     int i_chroma, int i_width, int i_height ) 
     737{ 
     738    IEnumPins *p_enumpins; 
     739    IPin *p_output_pin; 
     740    IEnumMediaTypes *p_enummt; 
     741 
     742    AM_MEDIA_TYPE media_type; 
     743    media_type.majortype = GUID_NULL; 
     744    media_type.subtype = GUID_NULL; 
     745    media_type.formattype = GUID_NULL; 
     746    media_type.pUnk = NULL; 
     747    media_type.cbFormat = 0; 
     748    media_type.pbFormat = NULL; 
     749 
     750    if( S_OK != p_filter->EnumPins( &p_enumpins ) ) return media_type; 
     751 
     752    /*while*/if( p_enumpins->Next( 1, &p_output_pin, NULL ) == S_OK ) 
     753    { 
     754        /* Probe pin */ 
     755        if( !b_audio && 
     756            SUCCEEDED( p_output_pin->EnumMediaTypes( &p_enummt ) ) ) 
     757        { 
     758            AM_MEDIA_TYPE *p_mt; 
     759            while( p_enummt->Next( 1, &p_mt, NULL ) == S_OK ) 
     760            { 
     761                int i_fourcc = VLC_FOURCC(' ', ' ', ' ', ' '); 
     762 
     763                /* Packed RGB formats */ 
     764                if( p_mt->subtype == MEDIASUBTYPE_RGB1 ) 
     765                    i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '1' ); 
     766                if( p_mt->subtype == MEDIASUBTYPE_RGB4 ) 
     767                    i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '4' ); 
     768                if( p_mt->subtype == MEDIASUBTYPE_RGB8 ) 
     769                    i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '8' ); 
     770                else if( p_mt->subtype == MEDIASUBTYPE_RGB555 ) 
     771                    i_fourcc = VLC_FOURCC( 'R', 'V', '1', '5' ); 
     772                else if( p_mt->subtype == MEDIASUBTYPE_RGB565 ) 
     773                    i_fourcc = VLC_FOURCC( 'R', 'V', '1', '6' ); 
     774                else if( p_mt->subtype == MEDIASUBTYPE_RGB24 ) 
     775                    i_fourcc = VLC_FOURCC( 'R', 'V', '2', '4' ); 
     776                else if( p_mt->subtype == MEDIASUBTYPE_RGB32 ) 
     777                    i_fourcc = VLC_FOURCC( 'R', 'V', '3', '2' ); 
     778                else if( p_mt->subtype == MEDIASUBTYPE_ARGB32 ) 
     779                    i_fourcc = VLC_FOURCC( 'R', 'G', 'B', 'A' ); 
     780                else i_fourcc = *((int *)&p_mt->subtype); 
     781 
     782                int i_current_width = p_mt->pbFormat ? 
     783                  ((VIDEOINFOHEADER *)p_mt->pbFormat)->bmiHeader.biWidth : 0; 
     784                int i_current_height = p_mt->pbFormat ? 
     785                  ((VIDEOINFOHEADER *)p_mt->pbFormat)->bmiHeader.biHeight : 0; 
     786 
     787                msg_Dbg( p_this, "EnumDeviceCaps: input pin " 
     788                         "accepts chroma: %4.4s, width:%i, height:%i", 
     789                         (char *)&i_fourcc, i_current_width, 
     790                         i_current_height ); 
     791 
     792                if( i_fourcc == i_chroma ) 
     793                { 
     794                    media_type.subtype = p_mt->subtype; 
     795                } 
     796 
     797                if( i_fourcc == i_chroma && p_mt->pbFormat && 
     798                    i_width && i_height && i_width == i_current_width && 
     799                    i_height == i_current_height ) 
     800                { 
     801                    media_type = *p_mt; 
     802                } 
     803                else 
     804                { 
     805                    FreeMediaType( *p_mt ); 
     806                } 
     807                CoTaskMemFree( (PVOID)p_mt ); 
     808            } 
     809            p_enummt->Release(); 
     810        } 
     811        p_output_pin->Release(); 
     812    } 
     813 
     814    p_enumpins->Release(); 
     815    return media_type; 
     816} 
     817 
    664818/***************************************************************************** 
    665819 * Read: reads from the device into PES packets. 
  • modules/access/dshow/filter.cpp

    ref700f0 r1b88d65  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: filter.cpp,v 1.4 2003/08/27 07:31:26 gbazin Exp $ 
     5 * $Id: filter.cpp,v 1.5 2003/08/31 22:06:17 gbazin Exp $ 
    66 * 
    77 * Author: Gildas Bazin <gbazin@netcourrier.com> 
     
    3333#include <vlc/vout.h> 
    3434 
    35 #ifndef _MSC_VER 
    36 #   include <wtypes.h> 
    37 #   include <unknwn.h> 
    38 #   include <ole2.h> 
    39 #   include <limits.h> 
    40 #   define _WINGDI_ 1 
    41 #   define AM_NOVTABLE 
    42 #   define _OBJBASE_H_ 
    43 #   undef _X86_ 
    44 #   define _I64_MAX LONG_LONG_MAX 
    45 #   define LONGLONG long long 
    46 #endif 
    47  
    48 #include <dshow.h> 
    49  
    5035#include "filter.h" 
    5136 
     
    8065const GUID MEDIATYPE_Video = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    8166 
     67/* Packed RGB formats */ 
     68const GUID MEDIASUBTYPE_RGB1 = {0xe436eb78, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; 
     69const GUID MEDIASUBTYPE_RGB4 = {0xe436eb79, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; 
    8270const GUID MEDIASUBTYPE_RGB8 = {0xe436eb7a, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; 
    8371const GUID MEDIASUBTYPE_RGB565 = {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; 
     
    8775const GUID MEDIASUBTYPE_ARGB32 = {0x773c9ac0, 0x3274, 0x11d0, {0xb7, 0x24, 0x0, 0xaa, 0x0, 0x6c, 0x1a, 0x1}}; 
    8876 
     77/* Packed YUV formats */ 
    8978const GUID MEDIASUBTYPE_YUYV = {0x56595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9079const GUID MEDIASUBTYPE_Y411 = {0x31313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    91 const GUID MEDIASUBTYPE_Y41P = {0x50313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
     80const GUID MEDIASUBTYPE_Y211 = {0x31313259, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9281const GUID MEDIASUBTYPE_YUY2 = {0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9382const GUID MEDIASUBTYPE_YVYU = {0x55595659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9483const GUID MEDIASUBTYPE_UYVY = {0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    95 const GUID MEDIASUBTYPE_Y211 = {0x31313259, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
     84 
     85/* Planar YUV formats */ 
     86const GUID MEDIASUBTYPE_YVU9 = {0x39555659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9687const GUID MEDIASUBTYPE_YV12 = {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
     88const GUID MEDIASUBTYPE_IYUV = {0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; /* identical to YV12 */ 
     89const GUID MEDIASUBTYPE_Y41P = {0x50313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
     90const GUID MEDIASUBTYPE_I420 = {0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9791 
    9892const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
    9993const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; 
    10094const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 
     95 
     96const GUID GUID_NULL = {0x0000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; 
    10197 
    10298void WINAPI FreeMediaType( AM_MEDIA_TYPE& mt ) 
     
    145141 ****************************************************************************/ 
    146142 
    147 CapturePin::CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter ) 
     143CapturePin::CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter, 
     144                        AM_MEDIA_TYPE mt ) 
    148145  : p_input( _p_input ), p_filter( _p_filter ), p_connected_pin( NULL ), 
    149     i_ref( 1 ) 
     146    media_type( mt ), i_ref( 1 ) 
    150147{ 
    151148} 
     
    233230#endif 
    234231 
     232    if( pmt->majortype == MEDIATYPE_Video ) 
     233    { 
     234        if( media_type.subtype != GUID_NULL && 
     235            media_type.subtype != pmt->subtype ) 
     236            return VFW_E_TYPE_NOT_ACCEPTED; 
     237 
     238        if( media_type.pbFormat && 
     239            ((VIDEOINFOHEADER *)media_type.pbFormat)->bmiHeader.biHeight && 
     240            ((VIDEOINFOHEADER *)media_type.pbFormat)->bmiHeader.biHeight != 
     241            ((VIDEOINFOHEADER *)pmt->pbFormat)->bmiHeader.biHeight ) 
     242            return VFW_E_TYPE_NOT_ACCEPTED; 
     243 
     244        if( media_type.pbFormat && 
     245            ((VIDEOINFOHEADER *)media_type.pbFormat)->bmiHeader.biWidth && 
     246            ((VIDEOINFOHEADER *)media_type.pbFormat)->bmiHeader.biWidth != 
     247            ((VIDEOINFOHEADER *)pmt->pbFormat)->bmiHeader.biWidth ) 
     248            return VFW_E_TYPE_NOT_ACCEPTED; 
     249    } 
     250 
    235251    p_connected_pin = pConnector; 
    236252    p_connected_pin->AddRef(); 
     253 
     254    FreeMediaType( media_type ); 
    237255    return CopyMediaType( &media_type, pmt ); 
    238256} 
     
    436454 ****************************************************************************/ 
    437455 
    438 CaptureFilter::CaptureFilter( input_thread_t * _p_input
    439   : p_input( _p_input ), p_pin( new CapturePin( _p_input, this ) ), 
    440     i_ref( 1 ) 
     456CaptureFilter::CaptureFilter( input_thread_t * _p_input, AM_MEDIA_TYPE mt
     457  : p_input( _p_input ), p_pin( new CapturePin( _p_input, this, mt ) ), 
     458    media_type( mt ), i_ref( 1 ) 
    441459{ 
    442460} 
     
    752770 
    753771    /* Are we creating a new enumerator */ 
    754  
    755772    if( pEnumMediaTypes == NULL ) 
    756773    { 
     
    817834#endif 
    818835 
    819     *pcFetched = 0; 
    820  
    821 #if 0 
    822     if( i_position < 1 && cMediaTypes > 0 ) 
    823     { 
    824         IPin *pPin = p_pin->CustomGetPin(); 
    825         *ppMediaTypes = pPin; 
    826         pPin->AddRef(); 
    827         *pcFetched = 1; 
    828         i_position++; 
    829         return NOERROR; 
    830     } 
    831 #endif 
    832  
     836    if( pcFetched ) *pcFetched = 0; 
    833837    return S_FALSE; 
    834838}; 
     
    839843#endif 
    840844 
    841     if( cMediaTypes > 0 ) 
    842     { 
    843         return S_FALSE; 
    844     } 
    845  
    846     i_position += cMediaTypes; 
    847     return NOERROR; 
     845    return S_FALSE; 
    848846}; 
    849847STDMETHODIMP CaptureEnumMediaTypes::Reset() 
  • modules/access/dshow/filter.h

    rb34227c r1b88d65  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: filter.h,v 1.1 2003/08/24 11:17:39 gbazin Exp $ 
     5 * $Id: filter.h,v 1.2 2003/08/31 22:06:17 gbazin Exp $ 
    66 * 
    77 * Author: Gildas Bazin <gbazin@netcourrier.com> 
     
    3030using namespace std; 
    3131 
     32#ifndef _MSC_VER 
     33#   include <wtypes.h> 
     34#   include <unknwn.h> 
     35#   include <ole2.h> 
     36#   include <limits.h> 
     37#   define _WINGDI_ 1 
     38#   define AM_NOVTABLE 
     39#   define _OBJBASE_H_ 
     40#   undef _X86_ 
     41#   define _I64_MAX LONG_LONG_MAX 
     42#   define LONGLONG long long 
     43#endif 
     44 
     45#include <dshow.h> 
     46 
     47extern const GUID MEDIASUBTYPE_I420; 
     48 
    3249typedef struct VLCMediaSample 
    3350{ 
     
    4865class CapturePin: public IPin, public IMemInputPin 
    4966{ 
    50     input_thread_t * p_input; 
    51  
    52     CaptureFilter *p_filter; 
     67    input_thread_t *p_input; 
     68    CaptureFilter  *p_filter; 
    5369 
    5470    IPin *p_connected_pin; 
     
    6076 
    6177  public: 
    62     CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter ); 
     78    CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter, 
     79                AM_MEDIA_TYPE mt ); 
    6380    virtual ~CapturePin(); 
    6481 
     
    107124class CaptureFilter : public IBaseFilter 
    108125{ 
    109     input_thread_t * p_input; 
    110     CapturePin *p_pin; 
    111     IFilterGraph * p_graph; 
     126    input_thread_t *p_input; 
     127    CapturePin     *p_pin; 
     128    IFilterGraph   *p_graph; 
     129    AM_MEDIA_TYPE  media_type; 
    112130 
    113131    int i_ref; 
    114132 
    115133  public: 
    116     CaptureFilter( input_thread_t * _p_input ); 
     134    CaptureFilter( input_thread_t * _p_input, AM_MEDIA_TYPE mt ); 
    117135    virtual ~CaptureFilter(); 
    118136 
     
    150168{ 
    151169    input_thread_t * p_input; 
     170    CaptureFilter  *p_filter; 
     171 
    152172    int i_position; 
    153     CaptureFilter *p_filter; 
    154  
    155173    int i_ref; 
    156174 
     
    178196{ 
    179197    input_thread_t * p_input; 
     198    CapturePin     *p_pin; 
     199 
    180200    int i_position; 
    181     CapturePin *p_pin; 
    182  
    183201    int i_ref; 
    184202