| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
#ifdef HAVE_CONFIG_H |
|---|
| 30 |
# include "config.h" |
|---|
| 31 |
#endif |
|---|
| 32 |
|
|---|
| 33 |
#include <vlc_common.h> |
|---|
| 34 |
#include <vlc_plugin.h> |
|---|
| 35 |
#include <vlc_input.h> |
|---|
| 36 |
#include <vlc_vout.h> |
|---|
| 37 |
#include <vlc_demux.h> |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
#ifdef HAVE_FCNTL_H |
|---|
| 41 |
# include <fcntl.h> |
|---|
| 42 |
#endif |
|---|
| 43 |
#ifdef HAVE_UNISTD_H |
|---|
| 44 |
# include <unistd.h> |
|---|
| 45 |
#elif defined( WIN32 ) && !defined( UNDER_CE ) |
|---|
| 46 |
# include <io.h> |
|---|
| 47 |
#endif |
|---|
| 48 |
|
|---|
| 49 |
#include <sys/ioctl.h> |
|---|
| 50 |
#include <sys/soundcard.h> |
|---|
| 51 |
|
|---|
| 52 |
#include <libraw1394/raw1394.h> |
|---|
| 53 |
#include <libdc1394/dc1394_control.h> |
|---|
| 54 |
|
|---|
| 55 |
#define MAX_IEEE1394_HOSTS 32 |
|---|
| 56 |
#define MAX_CAMERA_NODES 32 |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
static int Open ( vlc_object_t * ); |
|---|
| 62 |
static void Close( vlc_object_t * ); |
|---|
| 63 |
static void OpenAudioDev( demux_t *p_demux ); |
|---|
| 64 |
static inline void CloseAudioDev( demux_t *p_demux ); |
|---|
| 65 |
|
|---|
| 66 |
vlc_module_begin(); |
|---|
| 67 |
set_description( N_("dc1394 input") ); |
|---|
| 68 |
set_capability( "access_demux", 10 ); |
|---|
| 69 |
add_shortcut( "dc1394" ); |
|---|
| 70 |
set_callbacks( Open, Close ); |
|---|
| 71 |
vlc_module_end(); |
|---|
| 72 |
|
|---|
| 73 |
typedef struct __dc_camera |
|---|
| 74 |
{ |
|---|
| 75 |
int port; |
|---|
| 76 |
nodeid_t node; |
|---|
| 77 |
u_int64_t uid; |
|---|
| 78 |
} dc_camera; |
|---|
| 79 |
|
|---|
| 80 |
typedef struct demux_sys_t |
|---|
| 81 |
{ |
|---|
| 82 |
dc1394_cameracapture camera; |
|---|
| 83 |
picture_t pic; |
|---|
| 84 |
int dma_capture; |
|---|
| 85 |
#define DMA_OFF 0 |
|---|
| 86 |
#define DMA_ON 1 |
|---|
| 87 |
int num_ports; |
|---|
| 88 |
int num_cameras; |
|---|
| 89 |
int selected_camera; |
|---|
| 90 |
u_int64_t selected_uid; |
|---|
| 91 |
|
|---|
| 92 |
dc_camera *camera_nodes; |
|---|
| 93 |
dc1394_camerainfo camera_info; |
|---|
| 94 |
dc1394_miscinfo misc_info; |
|---|
| 95 |
raw1394handle_t fd_video; |
|---|
| 96 |
quadlet_t supported_framerates; |
|---|
| 97 |
|
|---|
| 98 |
int width; |
|---|
| 99 |
int height; |
|---|
| 100 |
int frame_size; |
|---|
| 101 |
int frame_rate; |
|---|
| 102 |
unsigned int brightness; |
|---|
| 103 |
unsigned int focus; |
|---|
| 104 |
char *dma_device; |
|---|
| 105 |
es_out_id_t *p_es_video; |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
int i_sample_rate; |
|---|
| 109 |
int channels; |
|---|
| 110 |
int i_audio_max_frame_size; |
|---|
| 111 |
int fd_audio; |
|---|
| 112 |
char *audio_device; |
|---|
| 113 |
#define NO_ROTATION 0 |
|---|
| 114 |
#define ROTATION_LEFT 1 |
|---|
| 115 |
#define ROTATION_RIGHT 2 |
|---|
| 116 |
es_out_id_t *p_es_audio; |
|---|
| 117 |
} dc1394_sys; |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
static int Demux( demux_t *p_demux ); |
|---|
| 123 |
static int Control( demux_t *, int, va_list ); |
|---|
| 124 |
static block_t *GrabVideo( demux_t *p_demux ); |
|---|
| 125 |
static block_t *GrabAudio( demux_t *p_demux ); |
|---|
| 126 |
static int process_options( demux_t *p_demux); |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
static void ScanCameras( dc1394_sys *sys, demux_t *p_demux ) |
|---|
| 132 |
{ |
|---|
| 133 |
struct raw1394_portinfo portinfo[MAX_IEEE1394_HOSTS]; |
|---|
| 134 |
raw1394handle_t tempFd; |
|---|
| 135 |
dc1394_camerainfo info; |
|---|
| 136 |
dc_camera *node_list = NULL; |
|---|
| 137 |
nodeid_t *nodes = NULL; |
|---|
| 138 |
int num_ports = 0; |
|---|
| 139 |
int num_cameras = 0; |
|---|
| 140 |
int nodecount; |
|---|
| 141 |
int i, n; |
|---|
| 142 |
|
|---|
| 143 |
memset( &portinfo, 0, sizeof(portinfo) ); |
|---|
| 144 |
|
|---|
| 145 |
msg_Dbg( p_demux, "Scanning for ieee1394 ports ..." ); |
|---|
| 146 |
|
|---|
| 147 |
tempFd = raw1394_new_handle(); |
|---|
| 148 |
if( !tempFd ) |
|---|
| 149 |
return VLC_EGENERIC; |
|---|
| 150 |
raw1394_get_port_info( tempFd, portinfo, MAX_IEEE1394_HOSTS); |
|---|
| 151 |
raw1394_destroy_handle( tempFd ); |
|---|
| 152 |
|
|---|
| 153 |
for( i=0; i < MAX_IEEE1394_HOSTS; i++ ) |
|---|
| 154 |
{ |
|---|
| 155 |
|
|---|
| 156 |
if( !portinfo[i].nodes ) |
|---|
| 157 |
continue; |
|---|
| 158 |
nodes = NULL; |
|---|
| 159 |
nodecount = 0; |
|---|
| 160 |
tempFd = dc1394_create_handle( i ); |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
if( !tempFd ) |
|---|
| 164 |
continue; |
|---|
| 165 |
msg_Dbg( p_demux, "Found ieee1394 port %d (%s) ... " |
|---|
| 166 |
"checking for camera nodes", |
|---|
| 167 |
i, portinfo[i].name ); |
|---|
| 168 |
num_ports++; |
|---|
| 169 |
|
|---|
| 170 |
nodes = dc1394_get_camera_nodes( tempFd, &nodecount, 0 ); |
|---|
| 171 |
if( nodecount ) |
|---|
| 172 |
{ |
|---|
| 173 |
msg_Dbg( p_demux, "Found %d dc1394 cameras on port %d (%s)", |
|---|
| 174 |
nodecount, i, portinfo[i].name ); |
|---|
| 175 |
|
|---|
| 176 |
if( node_list ) |
|---|
| 177 |
node_list = realloc( node_list, sizeof(dc_camera) * (num_cameras+nodecount) ); |
|---|
| 178 |
else |
|---|
| 179 |
node_list = malloc( sizeof(dc_camera) * nodecount); |
|---|
| 180 |
|
|---|
| 181 |
for( n = 0; n < nodecount; n++ ) |
|---|
| 182 |
{ |
|---|
| 183 |
int result = 0; |
|---|
| 184 |
|
|---|
| 185 |
result = dc1394_get_camera_info( tempFd, nodes[n], &info ); |
|---|
| 186 |
if( result == DC1394_SUCCESS ) |
|---|
| 187 |
{ |
|---|
| 188 |
node_list[num_cameras+n].uid = info.euid_64; |
|---|
| 189 |
} |
|---|
| 190 |
node_list[num_cameras+n].node = nodes[n]; |
|---|
| 191 |
node_list[num_cameras+n].port = i; |
|---|
| 192 |
} |
|---|
| 193 |
num_cameras += nodecount; |
|---|
| 194 |
} |
|---|
| 195 |
else |
|---|
| 196 |
msg_Dbg( p_demux, "no cameras found on port %d (%s)", |
|---|
| 197 |
i, portinfo[i].name ); |
|---|
| 198 |
|
|---|
| 199 |
if( tempFd ) |
|---|
| 200 |
dc1394_destroy_handle( tempFd ); |
|---|
| 201 |
} |
|---|
| 202 |
sys->num_ports = num_ports; |
|---|
| 203 |
sys->num_cameras = num_cameras; |
|---|
| 204 |
sys->camera_nodes = node_list; |
|---|
| 205 |
} |
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
static int Open( vlc_object_t *p_this ) |
|---|
| 211 |
{ |
|---|
| 212 |
demux_t *p_demux = (demux_t*)p_this; |
|---|
| 213 |
demux_sys_t *p_sys; |
|---|
| 214 |
es_format_t fmt; |
|---|
| 215 |
int i; |
|---|
| 216 |
int i_width; |
|---|
| 217 |
int i_height; |
|---|
| 218 |
int i_aspect; |
|---|
| 219 |
int result = 0; |
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
p_demux->pf_demux = Demux; |
|---|
| 223 |
p_demux->pf_control = Control; |
|---|
| 224 |
p_demux->info.i_update = 0; |
|---|
| 225 |
p_demux->info.i_title = 0; |
|---|
| 226 |
p_demux->info.i_seekpoint = 0; |
|---|
| 227 |
|
|---|
| 228 |
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); |
|---|
| 229 |
if( !p_sys ) |
|---|
| 230 |
return VLC_ENOMEM; |
|---|
| 231 |
memset( p_sys, 0, sizeof( demux_sys_t ) ); |
|---|
| 232 |
memset( &fmt, 0, sizeof( es_format_t ) ); |
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
p_sys->frame_size = MODE_640x480_YUV422; |
|---|
| 236 |
p_sys->width = 640; |
|---|
| 237 |
p_sys->height = 480; |
|---|
| 238 |
p_sys->frame_rate = FRAMERATE_30; |
|---|
| 239 |
p_sys->brightness = 200; |
|---|
| 240 |
p_sys->focus = 0; |
|---|
| 241 |
p_sys->dma_capture = DMA_ON; |
|---|
| 242 |
p_sys->fd_audio = -1; |
|---|
| 243 |
p_sys->fd_video = NULL; |
|---|
| 244 |
p_sys->camera_nodes = NULL; |
|---|
| 245 |
p_sys->selected_camera = 0; |
|---|
| 246 |
p_sys->dma_device = NULL; |
|---|
| 247 |
p_sys->selected_uid = 0; |
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
if( process_options(p_demux) != VLC_SUCCESS ) |
|---|
| 251 |
{ |
|---|
| 252 |
msg_Err( p_demux, "Bad MRL, please check the option line " |
|---|
| 253 |
"(MRL was: %s)", |
|---|
| 254 |
p_demux->psz_path ); |
|---|
| 255 |
free( p_sys ); |
|---|
| 256 |
p_demux->p_sys = NULL; |
|---|
| 257 |
return VLC_EGENERIC; |
|---|
| 258 |
} |
|---|
| 259 |
|
|---|
| 260 |
msg_Dbg( p_demux, "Selected camera %d", p_sys->selected_camera ); |
|---|
| 261 |
msg_Dbg( p_demux, "Selected uid 0x%llx", p_sys->selected_uid ); |
|---|
| 262 |
|
|---|
| 263 |
ScanCameras( p_sys, p_demux ); |
|---|
| 264 |
if( !p_sys->camera_nodes ) |
|---|
| 265 |
{ |
|---|
| 266 |
msg_Err( p_demux, "No camera found !!" ); |
|---|
| 267 |
free( p_sys ); |
|---|
| 268 |
p_demux->p_sys = NULL; |
|---|
| 269 |
return VLC_EGENERIC; |
|---|
| 270 |
} |
|---|
| 271 |
|
|---|
| 272 |
if( p_sys->selected_uid ) |
|---|
| 273 |
{ |
|---|
| 274 |
int found = 0; |
|---|
| 275 |
for( i=0; i < p_sys->num_cameras; i++ ) |
|---|
| 276 |
{ |
|---|
| 277 |
if( p_sys->camera_nodes[i].uid == p_sys->selected_uid ) |
|---|
| 278 |
{ |
|---|
| 279 |
p_sys->selected_camera = i; |
|---|
| 280 |
found++; |
|---|
| 281 |
break; |
|---|
| 282 |
} |
|---|
| 283 |
} |
|---|
| 284 |
if( !found ) |
|---|
| 285 |
{ |
|---|
| 286 |
msg_Err( p_demux, "Can't find camera with uid : 0x%llx.", |
|---|
| 287 |
p_sys->selected_uid ); |
|---|
| 288 |
Close( p_this ); |
|---|
| 289 |
return VLC_EGENERIC; |
|---|
| 290 |
} |
|---|
| 291 |
} |
|---|
| 292 |
else if( p_sys->selected_camera >= p_sys->num_cameras ) |
|---|
| 293 |
{ |
|---|
| 294 |
msg_Err( p_demux, "there are not this many cameras. (%d/%d)", |
|---|
| 295 |
p_sys->selected_camera, p_sys->num_cameras ); |
|---|
| 296 |
Close( p_this ); |
|---|
| 297 |
return VLC_EGENERIC; |
|---|
| 298 |
} |
|---|
| 299 |
|
|---|
| 300 |
p_sys->fd_video = dc1394_create_handle( |
|---|
| 301 |
p_sys->camera_nodes[p_sys->selected_camera].port ); |
|---|
| 302 |
if( (int)p_sys->fd_video < 0 ) |
|---|
| 303 |
{ |
|---|
| 304 |
msg_Err( p_demux, "Can't init dc1394 handle" ); |
|---|
| 305 |
Close( p_this ); |
|---|
| 306 |
return VLC_EGENERIC; |
|---|
| 307 |
} |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
result = dc1394_get_camera_info( p_sys->fd_video, |
|---|
| 311 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 312 |
&p_sys->camera_info ); |
|---|
| 313 |
if( result != DC1394_SUCCESS ) |
|---|
| 314 |
{ |
|---|
| 315 |
msg_Err( p_demux ,"unable to get camera info" ); |
|---|
| 316 |
Close( p_this ); |
|---|
| 317 |
return VLC_EGENERIC; |
|---|
| 318 |
} |
|---|
| 319 |
|
|---|
| 320 |
dc1394_print_camera_info( &p_sys->camera_info ); |
|---|
| 321 |
result = dc1394_get_camera_misc_info( p_sys->fd_video, |
|---|
| 322 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 323 |
&p_sys->misc_info ); |
|---|
| 324 |
if( result != DC1394_SUCCESS ) |
|---|
| 325 |
{ |
|---|
| 326 |
msg_Err( p_demux, "unable to get camera misc info" ); |
|---|
| 327 |
Close( p_this ); |
|---|
| 328 |
return VLC_EGENERIC; |
|---|
| 329 |
} |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
result = dc1394_init_camera( p_sys->camera_info.handle, |
|---|
| 333 |
p_sys->camera_info.id ); |
|---|
| 334 |
if( result != DC1394_SUCCESS ) |
|---|
| 335 |
{ |
|---|
| 336 |
msg_Err( p_demux, "unable to get init dc1394 camera" ); |
|---|
| 337 |
Close( p_this ); |
|---|
| 338 |
return VLC_EGENERIC; |
|---|
| 339 |
} |
|---|
| 340 |
|
|---|
| 341 |
if( p_sys->focus ) |
|---|
| 342 |
{ |
|---|
| 343 |
result = dc1394_set_focus( p_sys->camera_info.handle, |
|---|
| 344 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 345 |
p_sys->focus ); |
|---|
| 346 |
if( result != DC1394_SUCCESS ) |
|---|
| 347 |
{ |
|---|
| 348 |
msg_Err( p_demux, "unable to set initial focus to %u", |
|---|
| 349 |
p_sys->focus ); |
|---|
| 350 |
} |
|---|
| 351 |
msg_Dbg( p_demux, "Initial focus set to %u", p_sys->focus ); |
|---|
| 352 |
} |
|---|
| 353 |
|
|---|
| 354 |
result = dc1394_set_brightness( p_sys->camera_info.handle, |
|---|
| 355 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 356 |
p_sys->brightness ); |
|---|
| 357 |
if( result != DC1394_SUCCESS ) |
|---|
| 358 |
{ |
|---|
| 359 |
msg_Err( p_demux, "unable to set init brightness to %d", |
|---|
| 360 |
p_sys->brightness); |
|---|
| 361 |
Close( p_this ); |
|---|
| 362 |
return VLC_EGENERIC; |
|---|
| 363 |
} |
|---|
| 364 |
|
|---|
| 365 |
result = dc1394_set_video_framerate( p_sys->camera_info.handle, |
|---|
| 366 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 367 |
p_sys->frame_rate ); |
|---|
| 368 |
if( result != DC1394_SUCCESS ) |
|---|
| 369 |
{ |
|---|
| 370 |
msg_Err( p_demux, "unable to set framerate to %d", |
|---|
| 371 |
p_sys->frame_rate ); |
|---|
| 372 |
Close( p_this ); |
|---|
| 373 |
return VLC_EGENERIC; |
|---|
| 374 |
} |
|---|
| 375 |
p_sys->misc_info.framerate = p_sys->frame_rate; |
|---|
| 376 |
|
|---|
| 377 |
result = dc1394_set_video_format( p_sys->camera_info.handle, |
|---|
| 378 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 379 |
FORMAT_VGA_NONCOMPRESSED ); |
|---|
| 380 |
if( result != DC1394_SUCCESS ) |
|---|
| 381 |
{ |
|---|
| 382 |
msg_Err( p_demux, "unable to set video format to VGA_NONCOMPRESSED" ); |
|---|
| 383 |
Close( p_this ); |
|---|
| 384 |
return VLC_EGENERIC; |
|---|
| 385 |
} |
|---|
| 386 |
p_sys->misc_info.format = FORMAT_VGA_NONCOMPRESSED; |
|---|
| 387 |
|
|---|
| 388 |
result = dc1394_set_video_mode( p_sys->camera_info.handle, |
|---|
| 389 |
p_sys->camera_nodes[p_sys->selected_camera].node, |
|---|
| 390 |
p_sys->frame_size ); |
|---|
| 391 |
if( result != DC1394_SUCCESS ) |
|---|
| 392 |
{ |
|---|
| 393 |
msg_Err( p_demux, "unable to set video mode" ); |
|---|
| 394 |
Close( p_this ); |
|---|
| 395 |
return VLC_EGENERIC; |
|---|
| 396 |
} |
|---|
| 397 |
p_sys->misc_info.mode = p_sys->frame_size; |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
result = dc1394_get_camera_info( p_sys->camera_info.handle, |
|---|
| 401 |
p_sys->camera_info.id, |
|---|
| 402 |
&p_sys->camera_info ); |
|---|
| 403 |
if( result != DC1394_SUCCESS ) |
|---|
| 404 |
{ |
|---|
| 405 |
msg_Err( p_demux, "Could not get camera basic information!" ); |
|---|
| 406 |
Close( p_this ); |
|---|
| 407 |
return VLC_EGENERIC; |
|---|
| 408 |
} |
|---|
| 409 |
|
|---|
| 410 |
result = dc1394_get_camera_misc_info( p_sys->camera_info.handle, |
|---|
| 411 |
p_sys->camera_info.id, |
|---|
| 412 |
&p_sys->misc_info ); |
|---|
| 413 |
if( result != DC1394_SUCCESS ) |
|---|
| 414 |
{ |
|---|
| 415 |
msg_Err( p_demux, "Could not get camera misc information!" ); |
|---|
| 416 |
Close( p_this ); |
|---|
| 417 |
return VLC_EGENERIC; |
|---|
| 418 |
} |
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
result = dc1394_set_iso_channel_and_speed( p_sys->camera_info.handle, |
|---|
| 422 |
p_sys->camera_info.id, |
|---|
| 423 |
p_sys->selected_camera, |
|---|
| 424 |
SPEED_400 ); |
|---|
| 425 |
if( result != DC1394_SUCCESS ) |
|---|
| 426 |
{ |
|---|
| 427 |
msg_Err( p_demux, "Could not set iso channel!" ); |
|---|
| 428 |
Close( p_this ); |
|---|
| 429 |
return VLC_EGENERIC; |
|---|
| 430 |
} |
|---|
| 431 |
msg_Dbg( p_demux, "Using ISO channel %d", p_sys->misc_info.iso_channel ); |
|---|
| 432 |
p_sys->misc_info.iso_channel = p_sys->selected_camera; |
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
if( p_sys->dma_capture ) |
|---|
| 436 |
{ |
|---|
| 437 |
result = dc1394_dma_setup_capture( p_sys->camera_info.handle, |
|---|
| 438 |
p_sys->camera_info.id, |
|---|
| 439 |
p_sys->misc_info.iso_channel, |
|---|
| 440 |
p_sys->misc_info.format, |
|---|
| 441 |
p_sys->misc_info.mode, |
|---|
| 442 |
SPEED_400, |
|---|
| 443 |
p_sys->misc_info.framerate, |
|---|
| 444 |
10, 0, |
|---|
| 445 |
p_sys->dma_device, |
|---|
| 446 |
&p_sys->camera ); |
|---|
| 447 |
if( result != DC1394_SUCCESS ) |
|---|
| 448 |
{ |
|---|
| 449 |
msg_Err( p_demux ,"unable to setup camera" ); |
|---|
| 450 |
Close( p_this ); |
|---|
| 451 |
return VLC_EGENERIC; |
|---|
| 452 |
} |
|---|
| 453 |
} |
|---|
| 454 |
else |
|---|
| 455 |
{ |
|---|
| 456 |
result = dc1394_setup_capture( p_sys->camera_info.handle, |
|---|
| 457 |
p_sys->camera_info.id, |
|---|
| 458 |
p_sys->misc_info.iso_channel, |
|---|
| 459 |
p_sys->misc_info.format, |
|---|
| 460 |
p_sys->misc_info.mode, |
|---|
| 461 |
SPEED_400, |
|---|
| 462 |
p_sys->misc_info.framerate, |
|---|
| 463 |
&p_sys->camera ); |
|---|
| 464 |
if( result != DC1394_SUCCESS) |
|---|
| 465 |
{ |
|---|
| 466 |
msg_Err( p_demux ,"unable to setup camera" ); |
|---|
| 467 |
Close( p_this ); |
|---|
| 468 |
return VLC_EGENERIC; |
|---|
| 469 |
} |
|---|
| 470 |
} |
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 |
i_width = p_sys->camera.frame_width; |
|---|
| 476 |
i_height = p_sys->camera.frame_height; |
|---|
| 477 |
|
|---|
| 478 |
i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic, |
|---|
| 479 |
VLC_FOURCC('U', 'Y', 'V', 'Y'), |
|---|
| 480 |
i_width, i_height, |
|---|
| 481 |
i_width * VOUT_ASPECT_FACTOR / i_height ); |
|---|
| 482 |
|
|---|
| 483 |
es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('U', 'Y', 'V', 'Y') ); |
|---|
| 484 |
|
|---|
| 485 |
fmt.video.i_width = i_width; |
|---|
| 486 |
fmt.video.i_height = i_height; |
|---|
| 487 |
|
|---|
| 488 |
msg_Dbg( p_demux, "added new video es %4.4s %dx%d", |
|---|
| 489 |
(char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height ); |
|---|
| 490 |
|
|---|
| 491 |
p_sys->p_es_video = es_out_Add( p_demux->out, &fmt ); |
|---|
| 492 |
|
|---|
| 493 |
if( p_sys->audio_device ) |
|---|
| 494 |
{ |
|---|
| 495 |
OpenAudioDev( p_demux ); |
|---|
| 496 |
if( p_sys->fd_audio >= 0 ) |
|---|
| 497 |
{ |
|---|
| 498 |
es_format_t fmt; |
|---|
| 499 |
es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') ); |
|---|
| 500 |
|
|---|
| 501 |
fmt.audio.i_channels = p_sys->channels ? p_sys->channels : 1; |
|---|
| 502 |
fmt.audio.i_rate = p_sys->i_sample_rate; |
|---|
| 503 |
fmt.audio.i_bitspersample = 16; |
|---|
| 504 |
fmt.audio.i_blockalign = fmt.audio.i_channels * |
|---|
| 505 |
fmt.audio.i_bitspersample / 8; |
|---|
| 506 |
fmt.i_bitrate = fmt.audio.i_channels * fmt.audio.i_rate * |
|---|
| 507 |
fmt.audio.i_bitspersample; |
|---|
| 508 |
|
|---|
| 509 |
msg_Dbg( p_demux, "new audio es %d channels %dHz", |
|---|
| 510 |
fmt.audio.i_channels, fmt.audio.i_rate ); |
|---|
| 511 |
|
|---|
| 512 |
p_sys->p_es_audio = es_out_Add( p_demux->out, &fmt ); |
|---|
| 513 |
} |
|---|
| 514 |
} |
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
result = dc1394_start_iso_transmission( p_sys->camera_info.handle, |
|---|
| 518 |
p_sys->camera_info.id ); |
|---|
| 519 |
if( result != DC1394_SUCCESS ) |
|---|
| 520 |
{ |
|---|
| 521 |
msg_Err( p_demux, "unable to start camera iso transmission" ); |
|---|
| 522 |
if( p_sys->dma_capture ) |
|---|
| 523 |
{ |
|---|
| 524 |
dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera ); |
|---|
| 525 |
} |
|---|
| 526 |
else |
|---|
| 527 |
{ |
|---|
| 528 |
dc1394_release_camera( p_sys->fd_video, &p_sys->camera ); |
|---|
| 529 |
} |
|---|
| 530 |
Close( p_this ); |
|---|
| 531 |
return VLC_EGENERIC; |
|---|
| 532 |
} |
|---|
| 533 |
p_sys->misc_info.is_iso_on = DC1394_TRUE; |
|---|
| 534 |
return VLC_SUCCESS; |
|---|
| 535 |
} |
|---|
| 536 |
|
|---|
| 537 |
static void OpenAudioDev( demux_t *p_demux ) |
|---|
| 538 |
{ |
|---|
| 539 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 540 |
char *psz_device = p_sys->audio_device; |
|---|
| 541 |
int i_format = AFMT_S16_LE; |
|---|
| 542 |
int result; |
|---|
| 543 |
|
|---|
| 544 |
p_sys->fd_audio = open( psz_device, O_RDONLY | O_NONBLOCK ); |
|---|
| 545 |
if( p_sys->fd_audio < 0 ) |
|---|
| 546 |
{ |
|---|
| 547 |
msg_Err( p_demux, "cannot open audio device (%s)", psz_device ); |
|---|
| 548 |
CloseAudioDev( p_demux ); |
|---|
| 549 |
} |
|---|
| 550 |
|
|---|
| 551 |
if( !p_sys->i_sample_rate ) |
|---|
| 552 |
p_sys->i_sample_rate = 44100; |
|---|
| 553 |
|
|---|
| 554 |
result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SETFMT, &i_format ); |
|---|
| 555 |
if( (result < 0) || (i_format != AFMT_S16_LE) ) |
|---|
| 556 |
{ |
|---|
| 557 |
msg_Err( p_demux, "cannot set audio format (16b little endian) " |
|---|
| 558 |
"(%d)", i_format ); |
|---|
| 559 |
CloseAudioDev( p_demux ); |
|---|
| 560 |
} |
|---|
| 561 |
|
|---|
| 562 |
result = ioctl( p_sys->fd_audio, SNDCTL_DSP_CHANNELS, &p_sys->channels ); |
|---|
| 563 |
if( result < 0 ) |
|---|
| 564 |
{ |
|---|
| 565 |
msg_Err( p_demux, "cannot set audio channels count (%d)", |
|---|
| 566 |
p_sys->channels ); |
|---|
| 567 |
CloseAudioDev( p_demux ); |
|---|
| 568 |
} |
|---|
| 569 |
|
|---|
| 570 |
result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SPEED, &p_sys->i_sample_rate ); |
|---|
| 571 |
if( result < 0 ) |
|---|
| 572 |
{ |
|---|
| 573 |
msg_Err( p_demux, "cannot set audio sample rate (%s)", p_sys->i_sample_rate ); |
|---|
| 574 |
CloseAudioDev( p_demux ); |
|---|
| 575 |
} |
|---|
| 576 |
|
|---|
| 577 |
msg_Dbg( p_demux, "opened adev=`%s' %s %dHz", |
|---|
| 578 |
psz_device, |
|---|
| 579 |
(p_sys->channels > 1) ? "stereo" : "mono", |
|---|
| 580 |
p_sys->i_sample_rate ); |
|---|
| 581 |
|
|---|
| 582 |
p_sys->i_audio_max_frame_size = 32 * 1024; |
|---|
| 583 |
} |
|---|
| 584 |
|
|---|
| 585 |
static inline void CloseAudioDev( demux_t *p_demux ) |
|---|
| 586 |
{ |
|---|
| 587 |
demux_sys_t *p_sys = NULL; |
|---|
| 588 |
|
|---|
| 589 |
if( p_demux ) |
|---|
| 590 |
{ |
|---|
| 591 |
p_sys = p_demux->p_sys; |
|---|
| 592 |
if( p_sys->fd_audio >= 0 ) |
|---|
| 593 |
close( p_sys->fd_audio ); |
|---|
| 594 |
} |
|---|
| 595 |
} |
|---|
| 596 |
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
static void Close( vlc_object_t *p_this ) |
|---|
| 601 |
{ |
|---|
| 602 |
demux_t *p_demux = (demux_t*)p_this; |
|---|
| 603 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 604 |
int result = 0; |
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 |
result = dc1394_stop_iso_transmission( p_sys->fd_video, |
|---|
| 608 |
p_sys->camera.node ); |
|---|
| 609 |
if( result != DC1394_SUCCESS ) |
|---|
| 610 |
{ |
|---|
| 611 |
msg_Err( p_demux, "couldn't stop the camera" ); |
|---|
| 612 |
} |
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
if( p_sys->dma_capture ) |
|---|
| 616 |
{ |
|---|
| 617 |
dc1394_dma_unlisten( p_sys->fd_video, &p_sys->camera ); |
|---|
| 618 |
dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera ); |
|---|
| 619 |
} |
|---|
| 620 |
else |
|---|
| 621 |
{ |
|---|
| 622 |
dc1394_release_camera( p_sys->fd_video, &p_sys->camera ); |
|---|
| 623 |
} |
|---|
| 624 |
|
|---|
| 625 |
if( p_sys->fd_video ) |
|---|
| 626 |
dc1394_destroy_handle( p_sys->fd_video ); |
|---|
| 627 |
CloseAudioDev( p_demux ); |
|---|
| 628 |
|
|---|
| 629 |
free( p_sys->camera_nodes ); |
|---|
| 630 |
free( p_sys->audio_device ); |
|---|
| 631 |
|
|---|
| 632 |
free( p_sys ); |
|---|
| 633 |
} |
|---|
| 634 |
|
|---|
| 635 |
static void MovePixelUYVY( void *src, int spos, void *dst, int dpos ) |
|---|
| 636 |
{ |
|---|
| 637 |
char u,v,y; |
|---|
| 638 |
u_char *sc; |
|---|
| 639 |
u_char *dc; |
|---|
| 640 |
|
|---|
| 641 |
sc = (u_char *)src + (spos*2); |
|---|
| 642 |
if( spos % 2 ) |
|---|
| 643 |
{ |
|---|
| 644 |
v = sc[0]; |
|---|
| 645 |
y = sc[1]; |
|---|
| 646 |
u = *(sc -2); |
|---|
| 647 |
} |
|---|
| 648 |
else |
|---|
| 649 |
{ |
|---|
| 650 |
u = sc[0]; |
|---|
| 651 |
y = sc[1]; |
|---|
| 652 |
v = sc[2]; |
|---|
| 653 |
} |
|---|
| 654 |
dc = (u_char *)dst+(dpos*2); |
|---|
| 655 |
if( dpos % 2 ) |
|---|
| 656 |
{ |
|---|
| 657 |
dc[0] = v; |
|---|
| 658 |
dc[1] = y; |
|---|
| 659 |
} |
|---|
| 660 |
else |
|---|
| 661 |
{ |
|---|
| 662 |
dc[0] = u; |
|---|
| 663 |
dc[1] = y; |
|---|
| 664 |
} |
|---|
| 665 |
} |
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 |
static block_t *GrabVideo( demux_t *p_demux ) |
|---|
| 671 |
{ |
|---|
| 672 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 673 |
block_t *p_block = NULL; |
|---|
| 674 |
int result = 0; |
|---|
| 675 |
|
|---|
| 676 |
if( p_sys->dma_capture ) |
|---|
| 677 |
{ |
|---|
| 678 |
result = dc1394_dma_single_capture( &p_sys->camera ); |
|---|
| 679 |
if( result != DC1394_SUCCESS ) |
|---|
| 680 |
{ |
|---|
| 681 |
msg_Err( p_demux, "unable to capture a frame" ); |
|---|
| 682 |
return NULL; |
|---|
| 683 |
} |
|---|
| 684 |
} |
|---|
| 685 |
else |
|---|
| 686 |
{ |
|---|
| 687 |
result = dc1394_single_capture( p_sys->camera_info.handle, |
|---|
| 688 |
&p_sys->camera ); |
|---|
| 689 |
if( result != DC1394_SUCCESS ) |
|---|
| 690 |
{ |
|---|
| 691 |
msg_Err( p_demux, "unable to capture a frame" ); |
|---|
| 692 |
return NULL; |
|---|
| 693 |
} |
|---|
| 694 |
} |
|---|
| 695 |
|
|---|
| 696 |
p_block = block_New( p_demux, p_sys->camera.frame_width * |
|---|
| 697 |
p_sys->camera.frame_height * 2 ); |
|---|
| 698 |
if( !p_block ) |
|---|
| 699 |
{ |
|---|
| 700 |
msg_Err( p_demux, "cannot get block" ); |
|---|
| 701 |
return NULL; |
|---|
| 702 |
} |
|---|
| 703 |
|
|---|
| 704 |
if( !p_sys->camera.capture_buffer ) |
|---|
| 705 |
{ |
|---|
| 706 |
msg_Err (p_demux, "caputer buffer empty"); |
|---|
| 707 |
block_Release( p_block ); |
|---|
| 708 |
return NULL; |
|---|
| 709 |
} |
|---|
| 710 |
|
|---|
| 711 |
memcpy( p_block->p_buffer, (const char *)p_sys->camera.capture_buffer, |
|---|
| 712 |
p_sys->camera.frame_width * p_sys->camera.frame_height * 2 ); |
|---|
| 713 |
|
|---|
| 714 |
p_block->i_pts = p_block->i_dts = mdate(); |
|---|
| 715 |
if( p_sys->dma_capture ) |
|---|
| 716 |
dc1394_dma_done_with_buffer( &p_sys->camera ); |
|---|
| 717 |
return p_block; |
|---|
| 718 |
} |
|---|
| 719 |
|
|---|
| 720 |
static block_t *GrabAudio( demux_t *p_demux ) |
|---|
| 721 |
{ |
|---|
| 722 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 723 |
struct audio_buf_info buf_info; |
|---|
| 724 |
block_t *p_block = NULL; |
|---|
| 725 |
int i_read = 0; |
|---|
| 726 |
int i_correct = 0; |
|---|
| 727 |
int result = 0; |
|---|
| 728 |
|
|---|
| 729 |
p_block = block_New( p_demux, p_sys->i_audio_max_frame_size ); |
|---|
| 730 |
if( !p_block ) |
|---|
| 731 |
{ |
|---|
| 732 |
msg_Warn( p_demux, "cannot get buffer" ); |
|---|
| 733 |
return NULL; |
|---|
| 734 |
} |
|---|
| 735 |
|
|---|
| 736 |
i_read = read( p_sys->fd_audio, p_block->p_buffer, |
|---|
| 737 |
p_sys->i_audio_max_frame_size ); |
|---|
| 738 |
|
|---|
| 739 |
if( i_read <= 0 ) |
|---|
| 740 |
return NULL; |
|---|
| 741 |
|
|---|
| 742 |
p_block->i_buffer = i_read; |
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 |
i_correct = i_read; |
|---|
| 746 |
result = ioctl( p_sys->fd_audio, SNDCTL_DSP_GETISPACE, &buf_info ); |
|---|
| 747 |
if( result == 0 ) |
|---|
| 748 |
i_correct += buf_info.bytes; |
|---|
| 749 |
|
|---|
| 750 |
p_block->i_pts = p_block->i_dts = |
|---|
| 751 |
mdate() - INT64_C(1000000) * (mtime_t)i_correct / |
|---|
| 752 |
2 / p_sys->channels / p_sys->i_sample_rate; |
|---|
| 753 |
return p_block; |
|---|
| 754 |
} |
|---|
| 755 |
|
|---|
| 756 |
static int Demux( demux_t *p_demux ) |
|---|
| 757 |
{ |
|---|
| 758 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 759 |
block_t *p_blocka = NULL; |
|---|
| 760 |
block_t *p_blockv = NULL; |
|---|
| 761 |
|
|---|
| 762 |
|
|---|
| 763 |
if( p_sys->fd_audio > 0 ) |
|---|
| 764 |
p_blocka = GrabAudio( p_demux ); |
|---|
| 765 |
|
|---|
| 766 |
|
|---|
| 767 |
if( (int)p_sys->fd_video > 0 ) |
|---|
| 768 |
p_blockv = GrabVideo( p_demux ); |
|---|
| 769 |
|
|---|
| 770 |
if( !p_blocka && !p_blockv ) |
|---|
| 771 |
{ |
|---|
| 772 |
|
|---|
| 773 |
|
|---|
| 774 |
|
|---|
| 775 |
msleep( 10000 ); |
|---|
| 776 |
return 1; |
|---|
| 777 |
} |
|---|
| 778 |
|
|---|
| 779 |
if( p_blocka ) |
|---|
| 780 |
{ |
|---|
| 781 |
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_blocka->i_pts ); |
|---|
| 782 |
es_out_Send( p_demux->out, p_sys->p_es_audio, p_blocka ); |
|---|
| 783 |
} |
|---|
| 784 |
|
|---|
| 785 |
if( p_blockv ) |
|---|
| 786 |
{ |
|---|
| 787 |
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_blockv->i_pts ); |
|---|
| 788 |
es_out_Send( p_demux->out, p_sys->p_es_video, p_blockv ); |
|---|
| 789 |
} |
|---|
| 790 |
return 1; |
|---|
| 791 |
} |
|---|
| 792 |
|
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 |
|
|---|
| 796 |
static int Control( demux_t *p_demux, int i_query, va_list args ) |
|---|
| 797 |
{ |
|---|
| 798 |
bool *pb; |
|---|
| 799 |
int64_t *pi64; |
|---|
| 800 |
|
|---|
| 801 |
switch( i_query ) |
|---|
| 802 |
{ |
|---|
| 803 |
|
|---|
| 804 |
case DEMUX_CAN_PAUSE: |
|---|
| 805 |
case DEMUX_CAN_SEEK: |
|---|
| 806 |
case DEMUX_SET_PAUSE_STATE: |
|---|
| 807 |
case DEMUX_CAN_CONTROL_PACE: |
|---|
| 808 |
pb = (bool*)va_arg( args, bool * ); |
|---|
| 809 |
*pb = false; |
|---|
| 810 |
return VLC_SUCCESS; |
|---|
| 811 |
|
|---|
| 812 |
case DEMUX_GET_PTS_DELAY: |
|---|
| 813 |
pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| 814 |
*pi64 = (int64_t)DEFAULT_PTS_DELAY; |
|---|
| 815 |
return VLC_SUCCESS; |
|---|
| 816 |
|
|---|
| 817 |
case DEMUX_GET_TIME: |
|---|
| 818 |
pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| 819 |
*pi64 = mdate(); |
|---|
| 820 |
return VLC_SUCCESS; |
|---|
| 821 |
|
|---|
| 822 |
|
|---|
| 823 |
default: |
|---|
| 824 |
return VLC_EGENERIC; |
|---|
| 825 |
} |
|---|
| 826 |
return VLC_EGENERIC; |
|---|
| 827 |
} |
|---|
| 828 |
|
|---|
| 829 |
static int process_options( demux_t *p_demux ) |
|---|
| 830 |
{ |
|---|
| 831 |
demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 832 |
char *psz_dup; |
|---|
| 833 |
char *psz_parser; |
|---|
| 834 |
char *token = NULL; |
|---|
| 835 |
char *state = NULL; |
|---|
| 836 |
float rate_f; |
|---|
| 837 |
|
|---|
| 838 |
if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 ) |
|---|
| 839 |
return VLC_EGENERIC; |
|---|
| 840 |
|
|---|
| 841 |
psz_dup = strdup( p_demux->psz_path ); |
|---|
| 842 |
psz_parser = psz_dup; |
|---|
| 843 |
for( token = strtok_r( psz_parser,":",&state); token; |
|---|
| 844 |
token = strtok_r( NULL, ":", &state ) ) |
|---|
| 845 |
{ |
|---|
| 846 |
if( strncmp( token, "size=", strlen("size=") ) == 0 ) |
|---|
| 847 |
{ |
|---|
| 848 |
token += strlen("size="); |
|---|
| 849 |
if( strncmp( token, "160x120", 7 ) == 0 ) |
|---|
| 850 |
{ |
|---|
| 851 |
|
|---|
| 852 |
|
|---|
| 853 |
|
|---|
| 854 |
msg_Err( p_demux, |
|---|
| 855 |
"video size of 160x120 is actually disabled for lack of chroma " |
|---|
| 856 |
"support. It will relased ASAP, until then try an higher size " |
|---|
| 857 |
"(320x240 and 640x480 are fully supported)" ); |
|---|
| 858 |
free( psz_dup ); |
|---|
| 859 |
return VLC_EGENERIC; |
|---|
| 860 |
#if 0 |
|---|
| 861 |
p_sys->frame_size = MODE_160x120_YUV444; |
|---|
| 862 |
p_sys->width = 160; |
|---|
| 863 |
p_sys->height = 120; |
|---|
| 864 |
#endif |
|---|
| 865 |
} |
|---|
| 866 |
else if( strncmp( token, "320x240", 7 ) == 0 ) |
|---|
| 867 |
{ |
|---|
| 868 |
p_sys->frame_size = MODE_320x240_YUV422; |
|---|
| 869 |
p_sys->width = 320; |
|---|
| 870 |
p_sys->height = 240; |
|---|
| 871 |
} |
|---|
| 872 |
else if( strncmp( token, "640x480", 7 ) == 0 ) |
|---|
| 873 |
{ |
|---|
| 874 |
p_sys->frame_size = MODE_640x480_YUV422; |
|---|
| 875 |
p_sys->width = 640; |
|---|
| 876 |
p_sys->height = 480; |
|---|
| 877 |
} |
|---|
| 878 |
else |
|---|
| 879 |
{ |
|---|
| 880 |
msg_Err( p_demux, |
|---|
| 881 |
"This program currently suppots frame sizes of" |
|---|
| 882 |
" 160x120, 320x240, and 640x480. " |
|---|
| 883 |
"Please specify one of them. You have specified %s.", |
|---|
| 884 |
token ); |
|---|
| 885 |
free( psz_dup ); |
|---|
| 886 |
return VLC_EGENERIC; |
|---|
| 887 |
} |
|---|
| 888 |
msg_Dbg( p_demux, "Requested video size : %s",token ); |
|---|
| 889 |
} |
|---|
| 890 |
else if( strncmp( token, "fps=", strlen( "fps=" ) ) == 0 ) |
|---|
| 891 |
{ |
|---|
| 892 |
token += strlen("fps="); |
|---|
| 893 |
sscanf( token, "%g", &rate_f ); |
|---|
| 894 |
if( rate_f == 1.875 ) |
|---|
| 895 |
p_sys->frame_rate = FRAMERATE_1_875; |
|---|
| 896 |
else if( rate_f == 3.75 ) |
|---|
| 897 |
p_sys->frame_rate = FRAMERATE_3_75; |
|---|
| 898 |
else if( rate_f == 7.5 ) |
|---|
| 899 |
p_sys->frame_rate = FRAMERATE_7_5; |
|---|
| 900 |
else if( rate_f == 15 ) |
|---|
| 901 |
p_sys->frame_rate = FRAMERATE_15; |
|---|
| 902 |
else if( rate_f == 30 ) |
|---|
| 903 |
p_sys->frame_rate = FRAMERATE_30; |
|---|
| 904 |
else if( rate_f == 60 ) |
|---|
| 905 |
p_sys->frame_rate = FRAMERATE_60; |
|---|
| 906 |
else |
|---|
| 907 |
{ |
|---|
| 908 |
msg_Err( p_demux , |
|---|
| 909 |
"This program supports framerates of" |
|---|
| 910 |
" 1.875, 3.75, 7.5, 15, 30, 60. " |
|---|
| 911 |
"Please specify one of them. You have specified %s.", |
|---|
| 912 |
token); |
|---|
| 913 |
free( psz_dup ); |
|---|
| 914 |
return VLC_EGENERIC; |
|---|
| 915 |
} |
|---|
| 916 |
msg_Dbg( p_demux, "Requested frame rate : %s",token ); |
|---|
| 917 |
} |
|---|
| 918 |
else if( strncmp( token, "brightness=", strlen( "brightness=" ) ) == 0 ) |
|---|
| 919 |
{ |
|---|
| 920 |
int nr = 0; |
|---|
| 921 |
token += strlen("brightness="); |
|---|
| 922 |
nr = sscanf( token, "%u", &p_sys->brightness); |
|---|
| 923 |
if( nr != 1 ) |
|---|
| 924 |
{ |
|---|
| 925 |
msg_Err( p_demux, "Bad brightness value '%s', " |
|---|
| 926 |
"must be an unsigned integer.", |
|---|
| 927 |
token ); |
|---|
| 928 |
free( psz_dup ); |
|---|
| 929 |
|
|---|