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 *****************************************************************************/
33 #include <vlc_common.h>
34 #include <vlc_plugin.h>
35 #include <vlc_input.h>
37 #include <vlc_demux.h>
45 #elif defined( WIN32 ) && !defined( UNDER_CE )
49 #include <sys/ioctl.h>
50 #include <sys/soundcard.h>
52 #include <libraw1394/raw1394.h>
53 #include <libdc1394/dc1394_control.h>
55 #define MAX_IEEE1394_HOSTS 32
56 #define MAX_CAMERA_NODES 32
58 /*****************************************************************************
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 );
67 set_description( N_("dc1394 input") )
68 set_capability( "access_demux", 10 )
69 add_shortcut( "dc1394" )
70 set_callbacks( Open, Close )
73 typedef struct __dc_camera
80 typedef struct demux_sys_t
82 dc1394_cameracapture camera;
90 u_int64_t selected_uid;
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;
102 unsigned int brightness;
105 es_out_id_t *p_es_video;
110 int i_audio_max_frame_size;
113 #define NO_ROTATION 0
114 #define ROTATION_LEFT 1
115 #define ROTATION_RIGHT 2
116 es_out_id_t *p_es_audio;
119 /*****************************************************************************
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);
128 /*****************************************************************************
130 *****************************************************************************/
131 static void ScanCameras( dc1394_sys *sys, demux_t *p_demux )
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;
143 memset( &portinfo, 0, sizeof(portinfo) );
145 msg_Dbg( p_demux, "Scanning for ieee1394 ports ..." );
147 tempFd = raw1394_new_handle();
150 raw1394_get_port_info( tempFd, portinfo, MAX_IEEE1394_HOSTS);
151 raw1394_destroy_handle( tempFd );
153 for( i=0; i < MAX_IEEE1394_HOSTS; i++ )
155 /* check if port exists and has at least one node*/
156 if( !portinfo[i].nodes )
160 tempFd = dc1394_create_handle( i );
162 /* skip this port if we can't obtain a valid handle */
165 msg_Dbg( p_demux, "Found ieee1394 port %d (%s) ... "
166 "checking for camera nodes",
167 i, portinfo[i].name );
170 nodes = dc1394_get_camera_nodes( tempFd, &nodecount, 0 );
173 msg_Dbg( p_demux, "Found %d dc1394 cameras on port %d (%s)",
174 nodecount, i, portinfo[i].name );
177 node_list = realloc( node_list, sizeof(dc_camera) * (num_cameras+nodecount) );
179 node_list = malloc( sizeof(dc_camera) * nodecount);
181 for( n = 0; n < nodecount; n++ )
185 result = dc1394_get_camera_info( tempFd, nodes[n], &info );
186 if( result == DC1394_SUCCESS )
188 node_list[num_cameras+n].uid = info.euid_64;
190 node_list[num_cameras+n].node = nodes[n];
191 node_list[num_cameras+n].port = i;
193 num_cameras += nodecount;
196 msg_Dbg( p_demux, "no cameras found on port %d (%s)",
197 i, portinfo[i].name );
200 dc1394_destroy_handle( tempFd );
202 sys->num_ports = num_ports;
203 sys->num_cameras = num_cameras;
204 sys->camera_nodes = node_list;
207 /*****************************************************************************
209 *****************************************************************************/
210 static int Open( vlc_object_t *p_this )
212 demux_t *p_demux = (demux_t*)p_this;
221 if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
225 p_demux->pf_demux = Demux;
226 p_demux->pf_control = Control;
227 p_demux->info.i_update = 0;
228 p_demux->info.i_title = 0;
229 p_demux->info.i_seekpoint = 0;
231 p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
234 memset( &fmt, 0, sizeof( es_format_t ) );
237 p_sys->frame_size = MODE_640x480_YUV422;
240 p_sys->frame_rate = FRAMERATE_30;
241 p_sys->brightness = 200;
243 p_sys->dma_capture = DMA_ON; /* defaults to VIDEO1394 capture mode */
244 p_sys->fd_audio = -1;
245 p_sys->fd_video = NULL;
246 p_sys->camera_nodes = NULL;
247 p_sys->selected_camera = 0;
248 p_sys->dma_device = NULL;
249 p_sys->selected_uid = 0;
251 /* PROCESS INPUT OPTIONS */
252 if( process_options(p_demux) != VLC_SUCCESS )
254 msg_Err( p_demux, "Bad MRL, please check the option line "
258 p_demux->p_sys = NULL;
262 msg_Dbg( p_demux, "Selected camera %d", p_sys->selected_camera );
263 msg_Dbg( p_demux, "Selected uid 0x%llx", p_sys->selected_uid );
265 ScanCameras( p_sys, p_demux );
266 if( !p_sys->camera_nodes )
268 msg_Err( p_demux, "No camera found !!" );
270 p_demux->p_sys = NULL;
274 if( p_sys->selected_uid )
277 for( i=0; i < p_sys->num_cameras; i++ )
279 if( p_sys->camera_nodes[i].uid == p_sys->selected_uid )
281 p_sys->selected_camera = i;
288 msg_Err( p_demux, "Can't find camera with uid : 0x%llx.",
289 p_sys->selected_uid );
294 else if( p_sys->selected_camera >= p_sys->num_cameras )
296 msg_Err( p_demux, "there are not this many cameras. (%d/%d)",
297 p_sys->selected_camera, p_sys->num_cameras );
302 p_sys->fd_video = dc1394_create_handle(
303 p_sys->camera_nodes[p_sys->selected_camera].port );
304 if( (int)p_sys->fd_video < 0 )
306 msg_Err( p_demux, "Can't init dc1394 handle" );
311 /* get camera info */
312 result = dc1394_get_camera_info( p_sys->fd_video,
313 p_sys->camera_nodes[p_sys->selected_camera].node,
314 &p_sys->camera_info );
315 if( result != DC1394_SUCCESS )
317 msg_Err( p_demux ,"unable to get camera info" );
322 dc1394_print_camera_info( &p_sys->camera_info );
323 result = dc1394_get_camera_misc_info( p_sys->fd_video,
324 p_sys->camera_nodes[p_sys->selected_camera].node,
326 if( result != DC1394_SUCCESS )
328 msg_Err( p_demux, "unable to get camera misc info" );
333 /* init camera and set some video options */
334 result = dc1394_init_camera( p_sys->camera_info.handle,
335 p_sys->camera_info.id );
336 if( result != DC1394_SUCCESS )
338 msg_Err( p_demux, "unable to get init dc1394 camera" );
345 result = dc1394_set_focus( p_sys->camera_info.handle,
346 p_sys->camera_nodes[p_sys->selected_camera].node,
348 if( result != DC1394_SUCCESS )
350 msg_Err( p_demux, "unable to set initial focus to %u",
353 msg_Dbg( p_demux, "Initial focus set to %u", p_sys->focus );
356 result = dc1394_set_brightness( p_sys->camera_info.handle,
357 p_sys->camera_nodes[p_sys->selected_camera].node,
359 if( result != DC1394_SUCCESS )
361 msg_Err( p_demux, "unable to set init brightness to %d",
367 result = dc1394_set_video_framerate( p_sys->camera_info.handle,
368 p_sys->camera_nodes[p_sys->selected_camera].node,
370 if( result != DC1394_SUCCESS )
372 msg_Err( p_demux, "unable to set framerate to %d",
377 p_sys->misc_info.framerate = p_sys->frame_rate;
379 result = dc1394_set_video_format( p_sys->camera_info.handle,
380 p_sys->camera_nodes[p_sys->selected_camera].node,
381 FORMAT_VGA_NONCOMPRESSED );
382 if( result != DC1394_SUCCESS )
384 msg_Err( p_demux, "unable to set video format to VGA_NONCOMPRESSED" );
388 p_sys->misc_info.format = FORMAT_VGA_NONCOMPRESSED;
390 result = dc1394_set_video_mode( p_sys->camera_info.handle,
391 p_sys->camera_nodes[p_sys->selected_camera].node,
393 if( result != DC1394_SUCCESS )
395 msg_Err( p_demux, "unable to set video mode" );
399 p_sys->misc_info.mode = p_sys->frame_size;
401 /* reprobe everything */
402 result = dc1394_get_camera_info( p_sys->camera_info.handle,
403 p_sys->camera_info.id,
404 &p_sys->camera_info );
405 if( result != DC1394_SUCCESS )
407 msg_Err( p_demux, "Could not get camera basic information!" );
412 result = dc1394_get_camera_misc_info( p_sys->camera_info.handle,
413 p_sys->camera_info.id,
415 if( result != DC1394_SUCCESS )
417 msg_Err( p_demux, "Could not get camera misc information!" );
422 /* set iso_channel */
423 result = dc1394_set_iso_channel_and_speed( p_sys->camera_info.handle,
424 p_sys->camera_info.id,
425 p_sys->selected_camera,
427 if( result != DC1394_SUCCESS )
429 msg_Err( p_demux, "Could not set iso channel!" );
433 msg_Dbg( p_demux, "Using ISO channel %d", p_sys->misc_info.iso_channel );
434 p_sys->misc_info.iso_channel = p_sys->selected_camera;
436 /* and setup capture */
437 if( p_sys->dma_capture )
439 result = dc1394_dma_setup_capture( p_sys->camera_info.handle,
440 p_sys->camera_info.id,
441 p_sys->misc_info.iso_channel,
442 p_sys->misc_info.format,
443 p_sys->misc_info.mode,
445 p_sys->misc_info.framerate,
449 if( result != DC1394_SUCCESS )
451 msg_Err( p_demux ,"unable to setup camera" );
458 result = dc1394_setup_capture( p_sys->camera_info.handle,
459 p_sys->camera_info.id,
460 p_sys->misc_info.iso_channel,
461 p_sys->misc_info.format,
462 p_sys->misc_info.mode,
464 p_sys->misc_info.framerate,
466 if( result != DC1394_SUCCESS)
468 msg_Err( p_demux ,"unable to setup camera" );
474 /* TODO - UYV444 chroma converter is missing, when it will be available
475 * fourcc will become variable (and not just a fixed value for UYVY)
477 i_width = p_sys->camera.frame_width;
478 i_height = p_sys->camera.frame_height;
480 i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic,
481 VLC_FOURCC('U', 'Y', 'V', 'Y'),
483 i_width * VOUT_ASPECT_FACTOR / i_height );
485 es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('U', 'Y', 'V', 'Y') );
487 fmt.video.i_width = i_width;
488 fmt.video.i_height = i_height;
490 msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
491 (char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height );
493 p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
495 if( p_sys->audio_device )
497 OpenAudioDev( p_demux );
498 if( p_sys->fd_audio >= 0 )
501 es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') );
503 fmt.audio.i_channels = p_sys->channels ? p_sys->channels : 1;
504 fmt.audio.i_rate = p_sys->i_sample_rate;
505 fmt.audio.i_bitspersample = 16; /* FIXME: hmm, ?? */
506 fmt.audio.i_blockalign = fmt.audio.i_channels *
507 fmt.audio.i_bitspersample / 8;
508 fmt.i_bitrate = fmt.audio.i_channels * fmt.audio.i_rate *
509 fmt.audio.i_bitspersample;
511 msg_Dbg( p_demux, "new audio es %d channels %dHz",
512 fmt.audio.i_channels, fmt.audio.i_rate );
514 p_sys->p_es_audio = es_out_Add( p_demux->out, &fmt );
518 /* have the camera start sending us data */
519 result = dc1394_start_iso_transmission( p_sys->camera_info.handle,
520 p_sys->camera_info.id );
521 if( result != DC1394_SUCCESS )
523 msg_Err( p_demux, "unable to start camera iso transmission" );
524 if( p_sys->dma_capture )
526 dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
530 dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
535 p_sys->misc_info.is_iso_on = DC1394_TRUE;
539 static void OpenAudioDev( demux_t *p_demux )
541 demux_sys_t *p_sys = p_demux->p_sys;
542 char *psz_device = p_sys->audio_device;
543 int i_format = AFMT_S16_LE;
546 p_sys->fd_audio = open( psz_device, O_RDONLY | O_NONBLOCK );
547 if( p_sys->fd_audio < 0 )
549 msg_Err( p_demux, "cannot open audio device (%s)", psz_device );
550 CloseAudioDev( p_demux );
553 if( !p_sys->i_sample_rate )
554 p_sys->i_sample_rate = 44100;
556 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SETFMT, &i_format );
557 if( (result < 0) || (i_format != AFMT_S16_LE) )
559 msg_Err( p_demux, "cannot set audio format (16b little endian) "
561 CloseAudioDev( p_demux );
564 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_CHANNELS, &p_sys->channels );
567 msg_Err( p_demux, "cannot set audio channels count (%d)",
569 CloseAudioDev( p_demux );
572 result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SPEED, &p_sys->i_sample_rate );
575 msg_Err( p_demux, "cannot set audio sample rate (%s)", p_sys->i_sample_rate );
576 CloseAudioDev( p_demux );
579 msg_Dbg( p_demux, "opened adev=`%s' %s %dHz",
581 (p_sys->channels > 1) ? "stereo" : "mono",
582 p_sys->i_sample_rate );
584 p_sys->i_audio_max_frame_size = 32 * 1024;
587 static inline void CloseAudioDev( demux_t *p_demux )
589 demux_sys_t *p_sys = NULL;
593 p_sys = p_demux->p_sys;
594 if( p_sys->fd_audio >= 0 )
595 close( p_sys->fd_audio );
599 /*****************************************************************************
601 *****************************************************************************/
602 static void Close( vlc_object_t *p_this )
604 demux_t *p_demux = (demux_t*)p_this;
605 demux_sys_t *p_sys = p_demux->p_sys;
608 /* Stop data transmission */
609 result = dc1394_stop_iso_transmission( p_sys->fd_video,
610 p_sys->camera.node );
611 if( result != DC1394_SUCCESS )
613 msg_Err( p_demux, "couldn't stop the camera" );
617 if( p_sys->dma_capture )
619 dc1394_dma_unlisten( p_sys->fd_video, &p_sys->camera );
620 dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
624 dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
627 if( p_sys->fd_video )
628 dc1394_destroy_handle( p_sys->fd_video );
629 CloseAudioDev( p_demux );
631 free( p_sys->camera_nodes );
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() - INT64_C(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:
808 case DEMUX_SET_PAUSE_STATE:
809 case DEMUX_CAN_CONTROL_PACE:
810 pb = (bool*)va_arg( args, bool * );
814 case DEMUX_GET_PTS_DELAY:
815 pi64 = (int64_t*)va_arg( args, int64_t * );
816 *pi64 = (int64_t)DEFAULT_PTS_DELAY;
820 pi64 = (int64_t*)va_arg( args, int64_t * );
824 /* TODO implement others */
831 static int process_options( demux_t *p_demux )
833 demux_sys_t *p_sys = p_demux->p_sys;
840 psz_dup = strdup( p_demux->psz_path );
841 psz_parser = psz_dup;
842 for( token = strtok_r( psz_parser,":",&state); token;
843 token = strtok_r( NULL, ":", &state ) )
845 if( strncmp( token, "size=", strlen("size=") ) == 0 )
847 token += strlen("size=");
848 if( strncmp( token, "160x120", 7 ) == 0 )
850 /* TODO - UYV444 chroma converter is needed ...
851 * video size of 160x120 is temporarily disabled
854 "video size of 160x120 is actually disabled for lack of chroma "
855 "support. It will relased ASAP, until then try an higher size "
856 "(320x240 and 640x480 are fully supported)" );
860 p_sys->frame_size = MODE_160x120_YUV444;
865 else if( strncmp( token, "320x240", 7 ) == 0 )
867 p_sys->frame_size = MODE_320x240_YUV422;
871 else if( strncmp( token, "640x480", 7 ) == 0 )
873 p_sys->frame_size = MODE_640x480_YUV422;
880 "This program currently suppots frame sizes of"
881 " 160x120, 320x240, and 640x480. "
882 "Please specify one of them. You have specified %s.",
887 msg_Dbg( p_demux, "Requested video size : %s",token );
889 else if( strncmp( token, "fps=", strlen( "fps=" ) ) == 0 )
891 token += strlen("fps=");
892 sscanf( token, "%g", &rate_f );
893 if( rate_f == 1.875 )
894 p_sys->frame_rate = FRAMERATE_1_875;
895 else if( rate_f == 3.75 )
896 p_sys->frame_rate = FRAMERATE_3_75;
897 else if( rate_f == 7.5 )
898 p_sys->frame_rate = FRAMERATE_7_5;
899 else if( rate_f == 15 )
900 p_sys->frame_rate = FRAMERATE_15;
901 else if( rate_f == 30 )
902 p_sys->frame_rate = FRAMERATE_30;
903 else if( rate_f == 60 )
904 p_sys->frame_rate = FRAMERATE_60;
908 "This program supports framerates of"
909 " 1.875, 3.75, 7.5, 15, 30, 60. "
910 "Please specify one of them. You have specified %s.",
915 msg_Dbg( p_demux, "Requested frame rate : %s",token );
917 else if( strncmp( token, "brightness=", strlen( "brightness=" ) ) == 0 )
920 token += strlen("brightness=");
921 nr = sscanf( token, "%u", &p_sys->brightness);
924 msg_Err( p_demux, "Bad brightness value '%s', "
925 "must be an unsigned integer.",
932 else if( strncmp( token, "controller=", strlen( "controller=" ) ) == 0 )
935 token += strlen("controller=");
936 nr = sscanf( token, "%u", &p_sys->controller );
939 msg_Err(p_demux, "Bad controller value '%s', "
940 "must be an unsigned integer.",
946 else if( strncmp( token, "camera=", strlen( "camera=" ) ) == 0 )
949 token += strlen("camera=");
950 nr = sscanf(token,"%u",&p_sys->selected_camera);
953 msg_Err( p_demux, "Bad camera number '%s', "
954 "must be an unsigned integer.",
960 else if( strncmp( token, "capture=", strlen( "capture=" ) ) == 0)
962 token += strlen("capture=");
963 if( strncmp(token, "raw1394",7) == 0 )
965 msg_Dbg( p_demux, "DMA capture disabled!" );
966 p_sys->dma_capture = DMA_OFF;
968 else if( strncmp(token,"video1394",9) == 0 )
970 msg_Dbg( p_demux, "DMA capture enabled!" );
971 p_sys->dma_capture = DMA_ON;
975 msg_Err(p_demux, "Bad capture method value '%s', "
976 "it can be 'raw1394' or 'video1394'.",
982 else if( strncmp( token, "adev=", strlen( "adev=" ) ) == 0 )
984 token += strlen("adev=");
985 p_sys->audio_device = strdup(token);
986 msg_Dbg( p_demux, "Using audio device '%s'.", token );
988 else if( strncmp( token, "samplerate=", strlen( "samplerate=" ) ) == 0 )
990 token += strlen("samplerate=");
991 sscanf( token, "%d", &p_sys->i_sample_rate );
993 else if( strncmp( token, "channels=", strlen("channels=" ) ) == 0 )
995 token += strlen("channels=");
996 sscanf( token, "%d", &p_sys->channels );
998 else if( strncmp( token, "focus=", strlen("focus=" ) ) == 0)
1000 token += strlen("focus=");
1001 sscanf( token, "%u", &p_sys->focus );
1003 else if( strncmp( token, "uid=", strlen("uid=") ) == 0)
1005 token += strlen("uid=");
1006 sscanf( token, "0x%llx", &p_sys->selected_uid );