| 108 | | var_Create( p_demux, "rawvid-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT ); |
|---|
| 109 | | var_Get( p_demux, "rawvid-fps", &val ); |
|---|
| 110 | | p_sys->f_fps = val.f_float; |
|---|
| 111 | | var_Create( p_demux, "rawvid-width", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); |
|---|
| 112 | | var_Get( p_demux, "rawvid-width", &val ); |
|---|
| 113 | | i_width = val.i_int; |
|---|
| 114 | | var_Create( p_demux, "rawvid-height", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT); |
|---|
| 115 | | var_Get( p_demux, "rawvid-height", &val ); |
|---|
| 116 | | i_height = val.i_int; |
|---|
| 117 | | |
|---|
| 118 | | /* Only handle YV12 for now */ |
|---|
| 119 | | es_format_Init( &p_sys->fmt_video, VIDEO_ES, VLC_FOURCC('Y','V','1','2') ); |
|---|
| 120 | | p_sys->fmt_video.video.i_width = i_width; |
|---|
| 121 | | p_sys->fmt_video.video.i_height = i_height; |
|---|
| 122 | | p_sys->frame_size = i_width * i_height * 3 / 2; |
|---|
| | 124 | p_sys->f_fps = var_CreateGetFloat( p_demux, "rawvid-fps" ); |
|---|
| | 125 | |
|---|
| | 126 | i_width = var_CreateGetInteger( p_demux, "rawvid-width" ); |
|---|
| | 127 | i_height = var_CreateGetInteger( p_demux, "rawvid-height" ); |
|---|
| | 128 | if( i_width <= 0 || i_height <= 0 ) |
|---|
| | 129 | { |
|---|
| | 130 | msg_Err( p_demux, "width and height must be strictly positive." ); |
|---|
| | 131 | free( p_sys ); |
|---|
| | 132 | return VLC_EGENERIC; |
|---|
| | 133 | } |
|---|
| | 134 | |
|---|
| | 135 | psz_chroma = var_CreateGetString( p_demux, "rawvid-chroma" ); |
|---|
| | 136 | psz_aspect_ratio = var_CreateGetString( p_demux, "rawvid-aspect-ratio" ); |
|---|
| | 137 | |
|---|
| | 138 | if( psz_aspect_ratio && *psz_aspect_ratio ) |
|---|
| | 139 | { |
|---|
| | 140 | char *psz_parser = strchr( psz_aspect_ratio, ':' ); |
|---|
| | 141 | if( psz_parser ) |
|---|
| | 142 | { |
|---|
| | 143 | *psz_parser++ = '\0'; |
|---|
| | 144 | i_aspect = atoi( psz_aspect_ratio ) * VOUT_ASPECT_FACTOR |
|---|
| | 145 | / atoi( psz_parser ); |
|---|
| | 146 | } |
|---|
| | 147 | else |
|---|
| | 148 | { |
|---|
| | 149 | i_aspect = atof( psz_aspect_ratio ) * VOUT_ASPECT_FACTOR; |
|---|
| | 150 | } |
|---|
| | 151 | } |
|---|
| | 152 | else |
|---|
| | 153 | { |
|---|
| | 154 | i_aspect = i_width * VOUT_ASPECT_FACTOR / i_height; |
|---|
| | 155 | } |
|---|
| | 156 | free( psz_aspect_ratio ); |
|---|
| | 157 | |
|---|
| | 158 | if( psz_chroma && strlen( psz_chroma ) >= 4 ) |
|---|
| | 159 | { |
|---|
| | 160 | memcpy( &i_chroma, psz_chroma, 4 ); |
|---|
| | 161 | msg_Dbg( p_demux, "Forcing chroma to 0x%.8x (%4.4s)", i_chroma, |
|---|
| | 162 | (char*)&i_chroma ); |
|---|
| | 163 | } |
|---|
| | 164 | else |
|---|
| | 165 | { |
|---|
| | 166 | i_chroma = VLC_FOURCC('Y','V','1','2'); |
|---|
| | 167 | msg_Dbg( p_demux, "Using default chroma 0x%.8x (%4.4s)", i_chroma, |
|---|
| | 168 | (char*)&i_chroma ); |
|---|
| | 169 | } |
|---|
| | 170 | free( psz_chroma ); |
|---|
| | 171 | |
|---|
| | 172 | es_format_Init( &p_sys->fmt_video, VIDEO_ES, i_chroma ); |
|---|
| | 173 | vout_InitFormat( &p_sys->fmt_video.video, i_chroma, i_width, i_height, |
|---|
| | 174 | i_aspect ); |
|---|
| | 175 | if( !p_sys->fmt_video.video.i_bits_per_pixel ) |
|---|
| | 176 | { |
|---|
| | 177 | msg_Err( p_demux, "Unsupported chroma 0x%.8x (%4.4s)", i_chroma, |
|---|
| | 178 | (char*)&i_chroma ); |
|---|
| | 179 | free( p_sys ); |
|---|
| | 180 | return VLC_EGENERIC; |
|---|
| | 181 | } |
|---|
| | 182 | p_sys->frame_size = i_width * i_height |
|---|
| | 183 | * p_sys->fmt_video.video.i_bits_per_pixel / 8; |
|---|