Changeset 6c9013a9d8c430c0c91e38ff204e7db72183bf70
- Timestamp:
- 07/17/07 23:59:22
(1 year ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1184709562 +0000
- git-parent:
[2fd187de931769cef2128cd7f0ede41f71732fda]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1184709562 +0000
- Message:
Automatically load files with the following extension using the rawvid module (and set height, width, aspect ratio, chroma and fps correctly): sqcif, qcif, cif, 4cif, 16cif, yuv.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2fd187d |
r6c9013a |
|
| 65 | 65 | set_callbacks( Open, Close ); |
|---|
| 66 | 66 | add_shortcut( "rawvideo" ); |
|---|
| 67 | | add_float( "rawvid-fps", 25, 0, FPS_TEXT, FPS_LONGTEXT, VLC_FALSE ); |
|---|
| 68 | | add_integer( "rawvid-width", 176, 0, WIDTH_TEXT, WIDTH_LONGTEXT, 0 ); |
|---|
| 69 | | add_integer( "rawvid-height", 144, 0, HEIGHT_TEXT, HEIGHT_LONGTEXT, 0 ); |
|---|
| | 67 | add_float( "rawvid-fps", 0, 0, FPS_TEXT, FPS_LONGTEXT, VLC_FALSE ); |
|---|
| | 68 | add_integer( "rawvid-width", 0, 0, WIDTH_TEXT, WIDTH_LONGTEXT, 0 ); |
|---|
| | 69 | add_integer( "rawvid-height", 0, 0, HEIGHT_TEXT, HEIGHT_LONGTEXT, 0 ); |
|---|
| 70 | 70 | add_string( "rawvid-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, |
|---|
| 71 | 71 | VLC_TRUE ); |
|---|
| … | … | |
| 93 | 93 | static int Demux( demux_t * ); |
|---|
| 94 | 94 | static int Control( demux_t *, int i_query, va_list args ); |
|---|
| | 95 | |
|---|
| | 96 | struct preset_t |
|---|
| | 97 | { |
|---|
| | 98 | const char *psz_ext; |
|---|
| | 99 | int i_width; |
|---|
| | 100 | int i_height; |
|---|
| | 101 | double f_fps; |
|---|
| | 102 | const char *psz_aspect_ratio; |
|---|
| | 103 | const char *psz_chroma; |
|---|
| | 104 | }; |
|---|
| | 105 | |
|---|
| | 106 | static struct preset_t p_presets[] = |
|---|
| | 107 | { |
|---|
| | 108 | { "sqcif", 128, 96, 29.97, "4:3", "YV12" }, |
|---|
| | 109 | { "qcif", 176, 144, 29.97, "4:3", "YV12" }, |
|---|
| | 110 | { "cif", 352, 288, 29.97, "4:3", "YV12" }, |
|---|
| | 111 | { "4cif", 704, 576, 29.97, "4:3", "YV12" }, |
|---|
| | 112 | { "16cif", 1408, 1152, 29.97, "4:3", "YV12" }, |
|---|
| | 113 | { "yuv", 176, 144, 25, "4:3", "YV12" }, |
|---|
| | 114 | { "", 0, 0, 0., "", "" } |
|---|
| | 115 | }; |
|---|
| 95 | 116 | |
|---|
| 96 | 117 | /***************************************************************************** |
|---|
| … | … | |
| 107 | 128 | char *psz_aspect_ratio; |
|---|
| 108 | 129 | unsigned int i_aspect; |
|---|
| | 130 | struct preset_t *p_preset = NULL; |
|---|
| 109 | 131 | |
|---|
| 110 | 132 | /* Check for YUV file extension */ |
|---|
| 111 | 133 | psz_ext = strrchr( p_demux->psz_path, '.' ); |
|---|
| 112 | | if( ( !psz_ext || strcasecmp( psz_ext, ".yuv") ) && |
|---|
| | 134 | |
|---|
| | 135 | if( psz_ext ) |
|---|
| | 136 | { |
|---|
| | 137 | psz_ext++; |
|---|
| | 138 | for( p_preset = p_presets; *p_preset->psz_ext; p_preset++ ) |
|---|
| | 139 | if( !strcasecmp( psz_ext, p_preset->psz_ext ) ) |
|---|
| | 140 | break; |
|---|
| | 141 | } |
|---|
| | 142 | if( ( !p_preset || !*p_preset->psz_ext ) && |
|---|
| 113 | 143 | strcmp(p_demux->psz_demux, "rawvid") ) |
|---|
| 114 | 144 | { |
|---|
| … | … | |
| 123 | 153 | |
|---|
| 124 | 154 | p_sys->f_fps = var_CreateGetFloat( p_demux, "rawvid-fps" ); |
|---|
| 125 | | |
|---|
| 126 | 155 | i_width = var_CreateGetInteger( p_demux, "rawvid-width" ); |
|---|
| 127 | 156 | i_height = var_CreateGetInteger( p_demux, "rawvid-height" ); |
|---|
| | 157 | psz_chroma = var_CreateGetString( p_demux, "rawvid-chroma" ); |
|---|
| | 158 | psz_aspect_ratio = var_CreateGetString( p_demux, "rawvid-aspect-ratio" ); |
|---|
| | 159 | |
|---|
| | 160 | if( p_preset && *p_preset->psz_ext ) |
|---|
| | 161 | { |
|---|
| | 162 | if( !i_width ) i_width = p_preset->i_width; |
|---|
| | 163 | if( !i_height ) i_height = p_preset->i_height; |
|---|
| | 164 | if( !p_sys->f_fps ) p_sys->f_fps = p_preset->f_fps; |
|---|
| | 165 | if( !*psz_aspect_ratio ) |
|---|
| | 166 | { |
|---|
| | 167 | free( psz_aspect_ratio ); |
|---|
| | 168 | psz_aspect_ratio = strdup( psz_aspect_ratio ); |
|---|
| | 169 | } |
|---|
| | 170 | if( !*psz_chroma ) |
|---|
| | 171 | { |
|---|
| | 172 | free( psz_chroma ); |
|---|
| | 173 | psz_chroma = strdup( psz_chroma ); |
|---|
| | 174 | } |
|---|
| | 175 | } |
|---|
| | 176 | |
|---|
| 128 | 177 | if( i_width <= 0 || i_height <= 0 ) |
|---|
| 129 | 178 | { |
|---|
| 130 | 179 | msg_Err( p_demux, "width and height must be strictly positive." ); |
|---|
| | 180 | free( psz_aspect_ratio ); |
|---|
| | 181 | free( psz_chroma ); |
|---|
| 131 | 182 | free( p_sys ); |
|---|
| 132 | 183 | return VLC_EGENERIC; |
|---|
| 133 | 184 | } |
|---|
| 134 | | |
|---|
| 135 | | psz_chroma = var_CreateGetString( p_demux, "rawvid-chroma" ); |
|---|
| 136 | | psz_aspect_ratio = var_CreateGetString( p_demux, "rawvid-aspect-ratio" ); |
|---|
| 137 | 185 | |
|---|
| 138 | 186 | if( psz_aspect_ratio && *psz_aspect_ratio ) |
|---|