1 /*****************************************************************************
2 * dc1394.c: firewire input module
3 *****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
6 * Authors: Xant Majere <xant@xant.net>
8 *****************************************************************************
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2 of the License.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
30 #include <vlc_input.h>
32 #include <vlc_demux.h>
42 #elif defined( WIN32 ) && !defined( UNDER_CE )
46 #include <sys/ioctl.h>
47 #include <sys/soundcard.h>
49 #include <libraw1394/raw1394.h>
50 #include <libdc1394/dc1394_control.h>
52 #define MAX_IEEE1394_HOSTS 32
53 #define MAX_CAMERA_NODES 32
55 /*****************************************************************************
57 *****************************************************************************/
58 static int Open ( vlc_object_t * );
59 static void Close( vlc_object_t * );
60 static void OpenAudioDev( demux_t *p_demux );
61 static inline void CloseAudioDev( demux_t *p_demux );
64 set_description( _("dc1394 input") );
65 set_capability( "access_demux", 10 );
66 add_shortcut( "dc1394" );
67 set_callbacks( Open, Close );
70 typedef struct __dc_camera
77 typedef struct demux_sys_t
79 dc1394_cameracapture camera;
87 u_int64_t selected_uid;
89 dc_camera *camera_nodes;
90 dc1394_camerainfo camera_info;
91 dc1394_miscinfo misc_info;
92 raw1394handle_t fd_video;
93 quadlet_t supported_framerates;
99 unsigned int brightness;
102 es_out_id_t *p_es_video;
107 int i_audio_max_frame_size;
110 #define NO_ROTATION 0
111 #define ROTATION_LEFT 1
112 #define ROTATION_RIGHT 2
113 es_out_id_t *p_es_audio;
116 /*****************************************************************************
118 *****************************************************************************/
119 static int Demux( demux_t *p_demux );
120 static int Control( demux_t *, int, va_list );
121 static block_t *GrabVideo( demux_t *p_demux );
122 static block_t *GrabAudio( demux_t *p_demux );
123 static int process_options( demux_t *p_demux);
125 /*****************************************************************************
127 *****************************************************************************/
128 static void ScanCameras( dc1394_sys *sys, demux_t *p_demux )
130 struct raw1394_portinfo portinfo[MAX_IEEE1394_HOSTS];
131 raw1394handle_t tempFd;
132 dc1394_camerainfo info;
133 dc_camera *node_list = NULL;
134 nodeid_t *nodes = NULL;
140 memset( &portinfo, 0, sizeof(portinfo) );
142 msg_Dbg( p_demux, "Scanning for ieee1394 ports ..." );
144 tempFd = raw1394_new_handle();
147 raw1394_get_port_info( tempFd, portinfo, MAX_IEEE1394_HOSTS);
148 raw1394_destroy_handle( tempFd );
150 for( i=0; i < MAX_IEEE1394_HOSTS; i++ )
152 /* check if port exists and has at least one node*/
153 if( !portinfo[i].nodes )
157 tempFd = dc1394_create_handle( i );
159 /* skip this port if we can't obtain a valid handle */
162 msg_Dbg( p_demux, "Found ieee1394 port %d (%s) ... "
163 "checking for camera nodes",
164 i, portinfo[i].name );
167 nodes = dc1394_get_camera_nodes( tempFd, &nodecount, 0 );
170 msg_Dbg( p_demux, "Found %d dc1394 cameras on port %d (%s)",
171 nodecount, i, portinfo[i].name );
174 node_list = realloc( node_list, sizeof(dc_camera) * (num_cameras+nodecount) );
176 node_list = malloc( sizeof(dc_camera) * nodecount);
178 for( n = 0; n < nodecount; n++ )
182 result = dc1394_get_camera_info( tempFd, nodes[n], &info );
183 if( result == DC1394_SUCCESS )
185 node_list[num_cameras+n].uid = info.euid_64;
187 node_list[num_cameras+n].node = nodes[n];
188 node_list[num_cameras+n].port = i;
190 num_cameras += nodecount;
193 msg_Dbg( p_demux, "no cameras found on port %d (%s)",
194 i, portinfo[i].name );
197 dc1394_destroy_handle( tempFd );
199 sys->num_ports = num_ports;
200 sys->num_cameras = num_cameras;
201 sys->camera_nodes = node_list;
204 /*****************************************************************************
206 *****************************************************************************/
207 static int Open( vlc_object_t *p_this )
209 demux_t *p_demux = (demux_t*)p_this;
219 p_demux->pf_demux = Demux;
220 p_demux->pf_control = Control;
221 p_demux->info.i_update = 0;
222 p_demux->info.i_title = 0;
223 p_demux->info.i_seekpoint = 0;
225 p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
228 msg_Err( p_demux, "not enough memory available" );
231 memset( p_sys, 0, sizeof( demux_sys_t ) );
232 memset( &fmt, 0, sizeof( es_format_t ) );
235 p_sys->frame_size = MODE_640x480_YUV422;
238 p_sys->frame_rate = FRAMERATE_30;
239 p_sys->brightness = 200;
241 p_sys->dma_capture = DMA_ON; /* defaults to VIDEO1394 capture mode */
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;
249 /* PROCESS INPUT OPTIONS */
250 if( process_options(p_demux) != VLC_SUCCESS )
252 msg_Err( p_demux, "Bad MRL, please check the option line "
256 p_demux->p_sys = NULL;
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 );
263 ScanCameras( p_sys, p_demux );
264 if( !p_sys->camera_nodes )
266 msg_Err( p_demux, "No camera found !!" );
268 p_demux->p_sys = NULL;
272 if( p_sys->selected_uid )
275 for( i=0; i < p_sys->num_cameras; i++ )
277 if( p_sys->camera_nodes[i].uid == p_sys->selected_uid )
279 p_sys->selected_camera = i;
286 msg_Err( p_demux, "Can't find camera with uid : 0x%llx.",
287 p_sys->selected_uid );
292 else if( p_sys->selected_camera >= p_sys->num_cameras )
294 msg_Err( p_demux, "there are not this many cameras. (%d/%d)",
295 p_sys->selected_camera, p_sys->num_cameras );
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 )
304 msg_Err( p_demux, "Can't init dc1394 handle" );
309 /* get camera info */
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 )
315 msg_Err( p_demux ,"unable to get camera info" );
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,
324 if( result != DC1394_SUCCESS )
326 msg_Err( p_demux, "unable to get camera misc info" );
331 /* init camera and set some video options */
332 result = dc1394_init_camera( p_sys->camera_info.handle,
333 p_sys->camera_info.id );
334 if( result != DC1394_SUCCESS )
336 msg_Err( p_demux, "unable to get init dc1394 camera" );
343 result = dc1394_set_focus( p_sys->camera_info.handle,
344 p_sys->camera_nodes[p_sys->selected_camera].node,
346 if( result != DC1394_SUCCESS )
348 msg_Err( p_demux, "unable to set initial focus to %u",
351 msg_Dbg( p_demux, "Initial focus set to %u", p_sys->focus );
354 result = dc1394_set_brightness( p_sys->camera_info.handle,
355 p_sys->camera_nodes[p_sys->selected_camera].node,
357 if( result != DC1394_SUCCESS )
359 msg_Err( p_demux, "unable to set init brightness to %d",
365 result = dc1394_set_video_framerate( p_sys->camera_info.handle,
366 p_sys->camera_nodes[p_sys->selected_camera].node,
368 if( result != DC1394_SUCCESS )
370 msg_Err( p_demux, "unable to set framerate to %d",
375 p_sys->misc_info.framerate = p_sys->frame_rate;
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 )
382 msg_Err( p_demux, "unable to set video format to VGA_NONCOMPRESSED" );
386 p_sys->misc_info.format = FORMAT_VGA_NONCOMPRESSED;
388 result = dc1394_set_video_mode( p_sys->camera_info.handle,
389 p_sys->camera_nodes[p_sys->selected_camera].node,
391 if( result != DC1394_SUCCESS )
393 msg_Err( p_demux, "unable to set video mode" );
397 p_sys->misc_info.mode = p_sys->frame_size;
399 /* reprobe everything */
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 )
405 msg_Err( p_demux, "Could not get camera basic information!" );
410 result = dc1394_get_camera_misc_info( p_sys->camera_info.handle,
411 p_sys->camera_info.id,
413 if( result != DC1394_SUCCESS )
415 msg_Err( p_demux, "Could not get camera misc information!" );
420 /* set iso_channel */
421 result = dc1394_set_iso_channel_and_speed( p_sys->camera_info.handle,
422 p_sys->camera_info.id,
423 p_sys->selected_camera,
425 if( result != DC1394_SUCCESS )
427 msg_Err( p_demux, "Could not set iso channel!" );
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;
434 /* and setup capture */
435 if( p_sys->dma_capture )
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,
443 p_sys->misc_info.framerate,
447 if( result != DC1394_SUCCESS )
449 msg_Err( p_demux ,"unable to setup camera" );
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,
462 p_sys->misc_info.framerate,
464 if( result != DC1394_SUCCESS)
466 msg_Err( p_demux ,"unable to setup camera" );
472 /* TODO - UYV444 chroma converter is missing, when it will be available
473 * fourcc will become variable (and not just a fixed value for UYVY)
475 i_width = p_sys->camera.frame_width;
476 i_height = p_sys->camera.frame_height;
478 i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic,
479 VLC_FOURCC('U', 'Y', 'V', 'Y'),
481 i_width * VOUT_ASPECT_FACTOR / i_height );
483 es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('U', 'Y', 'V', 'Y') );
485 fmt.video.i_width = i_width;
486 fmt.video.i_height = i_height;
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 );
491 p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
493 if( p_sys->audio_device )
495 OpenAudioDev( p_demux );
496 if( p_sys->fd_audio >= 0 )
499 es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') );
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; /* FIXME: hmm, ?? */
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;
509 msg_Dbg( p_demux, "new audio es %d channels %dHz",
510 fmt.audio.i_channels, fmt.audio.i_rate );
512 p_sys->p_es_audio = es_out_Add( p_demux->out, &fmt );
516 /* have the camera start sending us data */
517 result = dc1394_start_iso_transmission( p_sys->camera_info.handle,
518 p_sys->camera_info.id );
519 if( result != DC1394_SUCCESS )
521 msg_Err( p_demux, "unable to start camera iso transmission" );
522 if( p_sys->dma_capture )
524 dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
528 dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
533 p_sys->misc_info.is_iso_on = DC1394_TRUE;
537 static void OpenAudioDev( demux_t *p_demux )
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;
544 p_sys->fd_audio = open( psz_device, O_RDONLY | O_NONBLOCK );
545 if( p_sys->fd_audio < 0 )
547 msg_Err( p_demux, "cannot open audio device (%s)", psz_device );
548 CloseAudioDev( p_demux );
551 if( !p_sys->i_sample_rate )
552 p_sys->i_sample_rate = 44100;
554 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SETFMT, &i_format );
555 if( (result < 0) || (i_format != AFMT_S16_LE) )
557 msg_Err( p_demux, "cannot set audio format (16b little endian) "
559 CloseAudioDev( p_demux );
562 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_CHANNELS, &p_sys->channels );
565 msg_Err( p_demux, "cannot set audio channels count (%d)",
567 CloseAudioDev( p_demux );
570 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SPEED, &p_sys->i_sample_rate );
573 msg_Err( p_demux, "cannot set audio sample rate (%s)", p_sys->i_sample_rate );
574 CloseAudioDev( p_demux );
577 msg_Dbg( p_demux, "openened adev=`%s' %s %dHz",
579 (p_sys->channels > 1) ? "stereo" : "mono",
580 p_sys->i_sample_rate );
582 p_sys->i_audio_max_frame_size = 32 * 1024;
585 static inline void CloseAudioDev( demux_t *p_demux )
587 demux_sys_t *p_sys = NULL;
591 p_sys = p_demux->p_sys;
592 if( p_sys->fd_audio >= 0 )
593 close( p_sys->fd_audio );
597 /*****************************************************************************
599 *****************************************************************************/
600 static void Close( vlc_object_t *p_this )
602 demux_t *p_demux = (demux_t*)p_this;
603 demux_sys_t *p_sys = p_demux->p_sys;
606 /* Stop data transmission */
607 result = dc1394_stop_iso_transmission( p_sys->fd_video,
608 p_sys->camera.node );
609 if( result != DC1394_SUCCESS )
611 msg_Err( p_demux, "couldn't stop the camera" );
615 if( p_sys->dma_capture )
617 dc1394_dma_unlisten( p_sys->fd_video, &p_sys->camera );
618 dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
622 dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
625 if( p_sys->fd_video )
626 dc1394_destroy_handle( p_sys->fd_video );
627 CloseAudioDev( p_demux );
629 if( p_sys->camera_nodes )
630 free( p_sys->camera_nodes );
631 if( p_sys->audio_device )
632 free( p_sys->audio_device );
637 static void MovePixelUYVY( void *src, int spos, void *dst, int dpos )
643 sc = (u_char *)src + (spos*2);
656 dc = (u_char *)dst+(dpos*2);
669 /*****************************************************************************
671 *****************************************************************************/
672 static block_t *GrabVideo( demux_t *p_demux )
674 demux_sys_t *p_sys = p_demux->p_sys;
675 block_t *p_block = NULL;
678 if( p_sys->dma_capture )
680 result = dc1394_dma_single_capture( &p_sys->camera );
681 if( result != DC1394_SUCCESS )
683 msg_Err( p_demux, "unable to capture a frame" );
689 result = dc1394_single_capture( p_sys->camera_info.handle,
691 if( result != DC1394_SUCCESS )
693 msg_Err( p_demux, "unable to capture a frame" );
698 p_block = block_New( p_demux, p_sys->camera.frame_width *
699 p_sys->camera.frame_height * 2 );
702 msg_Err( p_demux, "cannot get block" );
706 if( !p_sys->camera.capture_buffer )
708 msg_Err (p_demux, "caputer buffer empty");
709 block_Release( p_block );
713 memcpy( p_block->p_buffer, (const char *)p_sys->camera.capture_buffer,
714 p_sys->camera.frame_width * p_sys->camera.frame_height * 2 );
716 p_block->i_pts = p_block->i_dts = mdate();
717 if( p_sys->dma_capture )
718 dc1394_dma_done_with_buffer( &p_sys->camera );
722 static block_t *GrabAudio( demux_t *p_demux )
724 demux_sys_t *p_sys = p_demux->p_sys;
725 struct audio_buf_info buf_info;
726 block_t *p_block = NULL;
731 p_block = block_New( p_demux, p_sys->i_audio_max_frame_size );
734 msg_Warn( p_demux, "cannot get buffer" );
738 i_read = read( p_sys->fd_audio, p_block->p_buffer,
739 p_sys->i_audio_max_frame_size );
744 p_block->i_buffer = i_read;
746 /* Correct the date because of kernel buffering */
748 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_GETISPACE, &buf_info );
750 i_correct += buf_info.bytes;
752 p_block->i_pts = p_block->i_dts =
753 mdate() - I64C(1000000) * (mtime_t)i_correct /
754 2 / p_sys->channels / p_sys->i_sample_rate;
758 static int Demux( demux_t *p_demux )
760 demux_sys_t *p_sys = p_demux->p_sys;
761 block_t *p_blocka = NULL;
762 block_t *p_blockv = NULL;
764 /* Try grabbing audio frames first */
765 if( p_sys->fd_audio > 0 )
766 p_blocka = GrabAudio( p_demux );
768 /* Try grabbing video frame */
769 if( (int)p_sys->fd_video > 0 )
770 p_blockv = GrabVideo( p_demux );
772 if( !p_blocka && !p_blockv )
774 /* Sleep so we do not consume all the cpu, 10ms seems
775 * like a good value (100fps)
783 es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_blocka->i_pts );
784 es_out_Send( p_demux->out, p_sys->p_es_audio, p_blocka );
789 es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_blockv->i_pts );
790 es_out_Send( p_demux->out, p_sys->p_es_video, p_blockv );
795 /*****************************************************************************
797 *****************************************************************************/
798 static int Control( demux_t *p_demux, int i_query, va_list args )
805 /* Special for access_demux */
806 case DEMUX_CAN_PAUSE:
807 case DEMUX_SET_PAUSE_STATE:
808 case DEMUX_CAN_CONTROL_PACE:
809 pb = (vlc_bool_t*)va_arg( args, vlc_bool_t * );
813 case DEMUX_GET_PTS_DELAY:
814 pi64 = (int64_t*)va_arg( args, int64_t * );
815 *pi64 = (int64_t)DEFAULT_PTS_DELAY;
819 pi64 = (int64_t*)va_arg( args, int64_t * );
823 /* TODO implement others */
830 static int process_options( demux_t *p_demux )
832 demux_sys_t *p_sys = p_demux->p_sys;
839 if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
842 psz_dup = strdup( p_demux->psz_path );
843 psz_parser = psz_dup;
844 for( token = strtok_r( psz_parser,":",&state); token;
845 token = strtok_r( NULL, ":", &state ) )
847 if( strncmp( token, "size=", strlen("size=") ) == 0 )
849 token += strlen("size=");
850 if( strncmp( token, "160x120", 7 ) == 0 )
852 /* TODO - UYV444 chroma converter is needed ...
853 * video size of 160x120 is temporarily disabled
856 "video size of 160x120 is actually disabled for lack of chroma "
857 "support. It will relased ASAP, until then try an higher size "
858 "(320x240 and 640x480 are fully supported)" );
862 p_sys->frame_size = MODE_160x120_YUV444;
867 else if( strncmp( token, "320x240", 7 ) == 0 )
869 p_sys->frame_size = MODE_320x240_YUV422;
873 else if( strncmp( token, "640x480", 7 ) == 0 )
875 p_sys->frame_size = MODE_640x480_YUV422;
882 "This program currently suppots frame sizes of"
883 " 160x120, 320x240, and 640x480. "
884 "Please specify one of them. You have specified %s.",
889 msg_Dbg( p_demux, "Requested video size : %s",token );
891 else if( strncmp( token, "fps=", strlen( "fps=" ) ) == 0 )
893 token += strlen("fps=");
894 sscanf( token, "%g", &rate_f );
895 if( rate_f == 1.875 )
896 p_sys->frame_rate = FRAMERATE_1_875;
897 else if( rate_f == 3.75 )
898 p_sys->frame_rate = FRAMERATE_3_75;
899 else if( rate_f == 7.5 )
900 p_sys->frame_rate = FRAMERATE_7_5;
901 else if( rate_f == 15 )
902 p_sys->frame_rate = FRAMERATE_15;
903 else if( rate_f == 30 )
904 p_sys->frame_rate = FRAMERATE_30;
905 else if( rate_f == 60 )
906 p_sys->frame_rate = FRAMERATE_60;
910 "This program supports framerates of"
911 " 1.875, 3.75, 7.5, 15, 30, 60. "
912 "Please specify one of them. You have specified %s.",
917 msg_Dbg( p_demux, "Requested frame rate : %s",token );
919 else if( strncmp( token, "brightness=", strlen( "brightness=" ) ) == 0 )
922 token += strlen("brightness=");
923 nr = sscanf( token, "%u", &p_sys->brightness);
926 msg_Err( p_demux, "Bad brightness value '%s', "
927 "must be an unsigned integer.",
934 else if( strncmp( token, "controller=", strlen( "controller=" ) ) == 0 )
937 token += strlen("controller=");
938 nr = sscanf( token, "%u", &p_sys->controller );
941 msg_Err(p_demux, "Bad controller value '%s', "
942 "must be an unsigned integer.",
948 else if( strncmp( token, "camera=", strlen( "camera=" ) ) == 0 )
951 token += strlen("camera=");
952 nr = sscanf(token,"%u",&p_sys->selected_camera);
955 msg_Err( p_demux, "Bad camera number '%s', "
956 "must be an unsigned integer.",
962 else if( strncmp( token, "capture=", strlen( "capture=" ) ) == 0)
964 token += strlen("capture=");
965 if( strncmp(token, "raw1394",7) == 0 )
967 msg_Dbg( p_demux, "DMA capture disabled!" );
968 p_sys->dma_capture = DMA_OFF;
970 else if( strncmp(token,"video1394",9) == 0 )
972 msg_Dbg( p_demux, "DMA capture enabled!" );
973 p_sys->dma_capture = DMA_ON;
977 msg_Err(p_demux, "Bad capture method value '%s', "
978 "it can be 'raw1394' or 'video1394'.",
984 else if( strncmp( token, "adev=", strlen( "adev=" ) ) == 0 )
986 token += strlen("adev=");
987 p_sys->audio_device = strdup(token);
988 msg_Dbg( p_demux, "Using audio device '%s'.", token );
990 else if( strncmp( token, "samplerate=", strlen( "samplerate=" ) ) == 0 )
992 token += strlen("samplerate=");
993 sscanf( token, "%d", &p_sys->i_sample_rate );
995 else if( strncmp( token, "channels=", strlen("channels=" ) ) == 0 )
997 token += strlen("channels=");
998 sscanf( token, "%d", &p_sys->channels );
1000 else if( strncmp( token, "focus=", strlen("focus=" ) ) == 0)
1002 token += strlen("focus=");
1003 sscanf( token, "%u", &p_sys->focus );
1005 else if( strncmp( token, "uid=", strlen("uid=") ) == 0)
1007 token += strlen("uid=");
1008 sscanf( token, "0x%llx", &p_sys->selected_uid );
1011 if( psz_dup ) free( psz_dup );