"Size of the video that will be displayed by the " \
"DirectShow plugin. If you don't specify anything the default size for " \
"your device will be used. You can specify a standard size (cif, d1, ...) or <width>x<height>.")
+#define ASPECT_TEXT N_("Picture aspect-ratio n:m")
+#define ASPECT_LONGTEXT N_("Define input picture aspect-ratio to use. Default is 4:3" )
#define CHROMA_TEXT N_("Video input chroma format")
#define CHROMA_LONGTEXT N_( \
"Force the DirectShow video input to use a specific chroma format " \
add_string( "dshow-size", NULL, NULL, SIZE_TEXT, SIZE_LONGTEXT, false)
+ add_string( "dshow-aspect-ratio", "4:3", NULL, ASPECT_TEXT, ASPECT_LONGTEXT, false)
+
add_string( "dshow-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
add_float( "dshow-fps", 0.0f, NULL, FPS_TEXT, FPS_LONGTEXT, true )
var_Create( p_this, "dshow-video-output", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_this, "dshow-audio-output", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+
/* Initialize some data */
p_sys->i_streams = 0;
p_sys->pp_streams = NULL;
if( p_stream->mt.majortype == MEDIATYPE_Video )
{
+ char *psz_aspect = var_CreateGetString( p_this, "dshow-aspect-ratio" );
+ char *psz_delim = !EMPTY_STR( psz_aspect ) ? strchr( psz_aspect, ':' ) : NULL;
+
es_format_Init( &fmt, VIDEO_ES, p_stream->i_fourcc );
fmt.video.i_width = p_stream->header.video.bmiHeader.biWidth;
fmt.video.i_height = p_stream->header.video.bmiHeader.biHeight;
- fmt.video.i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
+
+ if( psz_delim )
+ {
+ fmt.video.i_sar_num = atoi( psz_aspect ) * fmt.video.i_height;
+ fmt.video.i_sar_den = atoi( psz_delim + 1 ) * fmt.video.i_width;
+ }
+ else
+ {
+ fmt.video.i_sar_num = 4 * fmt.video.i_height;
+ fmt.video.i_sar_den = 3 * fmt.video.i_width;
+ }
+ free( psz_aspect );
if( !p_stream->header.video.bmiHeader.biCompression )
{
/* Setup rgb mask for RGB formats */
if( p_stream->i_fourcc == VLC_CODEC_RGB24 )
{
- /* This is in BGR format */
- fmt.video.i_bmask = 0x00ff0000;
+ /* This is in RGB format
+ http://msdn.microsoft.com/en-us/library/dd407253%28VS.85%29.aspx?ppud=4
+ */
+ fmt.video.i_rmask = 0x00ff0000;
fmt.video.i_gmask = 0x0000ff00;
- fmt.video.i_rmask = 0x000000ff;
+ fmt.video.i_bmask = 0x000000ff;
}
if( p_stream->header.video.AvgTimePerFrame )
dshow_stream.p_device_filter = p_device_filter;
dshow_stream.p_capture_filter = p_capture_filter;
- p_sys->pp_streams = (dshow_stream_t **)realloc( p_sys->pp_streams,
- sizeof(dshow_stream_t *) * (p_sys->i_streams + 1) );
+ p_sys->pp_streams = (dshow_stream_t **)xrealloc( p_sys->pp_streams,
+ sizeof(dshow_stream_t *) * (p_sys->i_streams + 1) );
p_sys->pp_streams[p_sys->i_streams] = new dshow_stream_t;
*p_sys->pp_streams[p_sys->i_streams++] = dshow_stream;
while( 1 )
{
- if( !vlc_object_alive (p_access) || p_access->b_error ) return 0;
+ if( !vlc_object_alive (p_access) ) return NULL;
/* Get new sample/frame from the elementary stream (blocking). */
vlc_mutex_lock( &p_sys->lock );
*****************************************************************************/
static int AccessControl( access_t *p_access, int i_query, va_list args )
{
- bool *pb_bool;
- int *pi_int;
- int64_t *pi_64;
+ bool *pb_bool;
+ int64_t *pi_64;
switch( i_query )
{
/* */
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = (int64_t)var_GetInteger( p_access, "dshow-caching" ) * 1000;
+ *pi_64 = var_GetInteger( p_access, "dshow-caching" ) * 1000;
break;
/* */
****************************************************************************/
static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
{
- bool *pb;
- int64_t *pi64;
+ bool *pb;
+ int64_t *pi64;
switch( i_query )
{
case DEMUX_GET_PTS_DELAY:
pi64 = (int64_t*)va_arg( args, int64_t * );
- *pi64 = (int64_t)var_GetInteger( p_demux, "dshow-caching" ) * 1000;
+ *pi64 = var_GetInteger( p_demux, "dshow-caching" ) * 1000;
return VLC_SUCCESS;
case DEMUX_GET_TIME:
/* Uninitialize OLE/COM */
CoUninitialize();
- if( !list_devices.size() ) return VLC_SUCCESS;
+ if( list_devices.empty() ) return VLC_SUCCESS;
- p_item->ppsz_list =
- (char **)realloc( p_item->ppsz_list,
+ p_item->ppsz_list = (char**)xrealloc( p_item->ppsz_list,
(list_devices.size()+3) * sizeof(char *) );
- p_item->ppsz_list_text =
- (char **)realloc( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = (char**)xrealloc( p_item->ppsz_list_text,
(list_devices.size()+3) * sizeof(char *) );
list<string>::iterator iter;
/* Enumerate devices */
FindCaptureDevice( p_this, NULL, &list_devices, b_audio );
- if( !list_devices.size() )
+ if( list_devices.empty() )
{
CoUninitialize();
return VLC_EGENERIC;