summaryrefslogtreecommitdiffstats
path: root/vlc/build/vlc-1.0.3_ieee1394.diff
blob: ecad123a22b67e247c0e93584059ab44adc622bc (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
Based on the following commits in 1.1.git and backported to 1.0.3:

From: Jean-Paul Saman <jean-paul.saman@m2x.nl>
Date: Mon, 27 Apr 2009 10:40:50 +0000 (+0200)
Subject: Use pkg-config to detect libraw1394 and libavc1394
X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=9f0d65737e7d810205b25cbb40f0eac4c758b951

Use pkg-config to detect libraw1394 and libavc1394
---
From: Jean-Paul Saman <jean-paul.saman@m2x.nl>
Date: Tue, 12 May 2009 11:20:37 +0000 (+0200)
Subject: dc1394 and dv1394: cleanup detection in configure.ac
X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=d6cc0b79ef3c7f15df5ef524b76bbbafe01e84eb

dc1394 and dv1394: cleanup detection in configure.ac
---
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Tue, 10 Nov 2009 10:00:01 +0000 (+0100)
Subject: dc1394: update to v2 API
X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=577ce5a67c51c812f7ad97bf3e7f7f38913b72d3

dc1394: update to v2 API

This patch needs more testing, I think.
---

diff -uar vlc-1.0.3.orig/configure.ac vlc-1.0.3/configure.ac
--- vlc-1.0.3.orig/configure.ac	2009-10-29 20:04:31.000000000 +0100
+++ vlc-1.0.3/configure.ac	2009-12-10 17:39:13.000000000 +0100
@@ -2031,28 +2031,28 @@
   [  --enable-dc1394         dc1394 access module (default disabled)])
 if test "${enable_dc1394}" = "yes"
 then
-  AC_CHECK_HEADERS(libraw1394/raw1394.h, [
-    AC_CHECK_LIB( raw1394, raw1394_get_nodecount, [
-        AC_CHECK_HEADERS(libdc1394/dc1394_control.h , [
-dnl         AC_CHECK_LIB( dc1394_control, dc1394_setup_capture, [
-              VLC_ADD_PLUGIN([dc1394])
-              VLC_ADD_LIBS([dc1394],[-ldc1394_control -lraw1394])
-dnl         ],
-dnl         [
-dnl           AC_MSG_ERROR([libdc1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-dnl         ])
-      ],
-      [
-        AC_MSG_ERROR([libdc1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-      ])
+  dnl
+  dnl Check for libraw1394
+  dnl
+  PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 2.0.1,
+    [
+      VLC_ADD_LIBS([dc1394],[`${PKG_CONFIG} --libs libraw1394`])
+      VLC_ADD_CPPFLAGS([dc1394],[`${PKG_CONFIG} --cflags libraw1394`])
     ],
+    [AC_MSG_ERROR([Couldn't find libraw1394 >= 2.0.1, install libraw1394 development package])]
+  )
+
+  dnl
+  dnl Check for libdc1394
+  dnl
+  PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 >= 2.1.0,
     [
-      AC_MSG_ERROR([libraw1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-    ])
-  ],
-  [
-    AC_MSG_ERROR([libraw1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-  ])
+      VLC_ADD_PLUGIN([dc1394])
+      VLC_ADD_LIBS([dc1394],[`${PKG_CONFIG} --libs libdc1394-2`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libdc1394-2`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libdc1394 >= 2.1.0, install libdc1394 development package])]
+  )
 fi
 
 dnl
@@ -2062,120 +2062,28 @@
 [  --enable-dv             dv input module (default disabled)])
 if test "${enable_dv}" = "yes"
 then
-  AC_ARG_WITH(dv-raw1394,
-  [    --with-dv-raw1394=PATH   libraw1394 headers and libraries])
-  AC_ARG_WITH(dv-raw1394-tree,
-  [    --with-dv-raw1394=PATH   libraw1394 tree for static linking])
-
-  if test -z "${with_dv_raw1394}" -a "${with_dv_raw1394}" != ""
-  then
-    AC_MSG_CHECKING(for raw1394 headers in ${with_dv_raw1394})
-    if test -f ${with_dv_raw1394}/include/libraw1394/raw1394.h
-    then
-      dnl  Use ${with_dv_raw1394}/include/libraw1394/raw1394.h
-      AC_MSG_RESULT(yes)
-      VLC_ADD_PLUGIN([access_dv])
-      VLC_ADD_LIBS([access_dv],[-L${with_dv_raw1394}/lib -lraw1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${with_dv_raw1394}/include])
-    else
-      dnl  No libraw1394 could be found, sorry
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${with_dv_raw1394}/include/libraw1394/raw1394.h])
-    fi
-  else
-    AC_CHECK_HEADERS(libraw1394/raw1394.h,
-    [ VLC_ADD_PLUGIN([access_dv])
-        VLC_ADD_LIBS([access_dv],[-lraw1394 -lavc1394])
-    ],[
-        if test -n "${enable_dv}"
-        then
-          AC_MSG_ERROR([cannot find libraw1394 headers])
-        fi
-    ])
-  fi
-
-  dnl Check for static linking of libraw1394
-  if test -z "${with_dv_raw1394_tree}" -a "${with_dv_raw1394_tree}" != ""
-  then
-    AC_MSG_CHECKING(for libraw1394.a in ${with_dv_raw1394_tree})
-    real_dv_raw1394_tree="`cd ${with_dv_raw1394_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dv_raw1394_tree}"
-    then
-      dnl  The given directory can't be found
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot cd to ${real_dv_raw1394_tree}])
-    fi
-    if test -f "${real_dv_raw1394_tree}/src/.libs/libraw1394.a"
-    then
-      dnl  Use a custom libraw1394
-      AC_MSG_RESULT(${real_dv_raw1394_tree}/src/.libs/libraw1394.a)
-      VLC_ADD_PLUGIN([access_dv])
-      VLC_ADD_LIBS([access_dv],[-L${real_dv_raw1394_tree}/src/.libs -lraw1394])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_raw1394_tree}])
-    else
-      dnl  The given libraw1394 wasn't built
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_dv_raw1394_tree}/src/.libs/libraw1394.a, make sure you compiled libraw1394 in ${with_dv_raw1394_tree}])
-    fi
-  fi
+  dnl
+  dnl Check for libraw1394
+  dnl
+  PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 2.0.1,
+    [
+      VLC_ADD_LIBS([access_dv],[`${PKG_CONFIG} --libs libraw1394`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libraw1394`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libraw1394 >= 2.0.1, install libraw1394 development package])]
+  )
 
   dnl
   dnl Check for libavc1394
   dnl
-
-  AC_ARG_WITH(dv-avc1394,
-  [    --with-dv-avc1394=PATH   libavc1394 headers and libraries])
-  AC_ARG_WITH(dv-avc1394-tree,
-  [    --with-dv-avc1394=PATH   libavc1394 tree for static linking])
-
-  if test -z "${with_dv_avc1394}" -a "${with_dv_avc1394}" != ""
-  then
-    AC_MSG_CHECKING(for avc1394 headers in ${with_dv_avc1394})
-    if test -f ${with_dv_avc1394}/include/libavc1394/avc1394.h
-    then
-      dnl  Use ${with_dv_avc1394}/include/libavc1394/avc1394.h
-      AC_MSG_RESULT(yes)
-      VLC_ADD_LIBS([access_dv],[-L${with_dv_avc1394}/lib -lavc1394 -lrom1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${with_avc1394}/include])
-    else
-      dnl  No libavc1394 could be found, sorry
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${with_dv_avc1394}/include/libavc1394/avc1394.h])
-    fi
-  else
-    AC_CHECK_HEADERS(libavc1394/avc1394.h,
-    [ VLC_ADD_LIBS([access_dv],[-lavc1394 -lrom1394 -lpthread])
-    ],[
-        if test -n "${enable_dv}"
-        then
-          AC_MSG_ERROR([cannot find libavc1394 headers])
-        fi
-    ])
-  fi
-
-  dnl Check for static linking of libavc1394
-  if test -z "${with_dv_avc1394_tree}" -a "${with_dv_avc1394_tree}" != ""
-  then
-    AC_MSG_CHECKING(for libavc1394.a in ${with_dv_avc1394_tree})
-    real_dv_avc1394_tree="`cd ${with_dv_avc1394_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dv_avc1394_tree}"
-    then
-      dnl  The given directory can't be found
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot cd to ${real_dv_avc1394_tree}])
-    fi
-    if test -f "${real_dv_avc1394_tree}/src/.libs/libavc1394.a"
-    then
-      dnl  Use a custom libavc1394
-      AC_MSG_RESULT(${real_dv_avc1394_tree}/src/.libs/libavc1394.a)
-      VLC_ADD_LIBS([access_dv],[-L${real_dv_avc1394_tree}/src/.libs -lavc1394 -lrom1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_avc1394_tree}])
-    else
-      dnl  The given libavc1394 wasn't built
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_dv_avc1394_tree}/src/.libs/libavc1394.a, make sure you compiled libavc1394 in ${with_dv_avc1394_tree}])
-    fi
-  fi
+  PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.3,
+    [
+      VLC_ADD_PLUGIN([access_dv])
+      VLC_ADD_LIBS([access_dv],[`${PKG_CONFIG} --libs libavc1394`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libavc1394`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libavc1394 >= 0.5.1, install libavc1394 development package])]
+  )
 fi
 
 dnl
diff -uar vlc-1.0.3.orig/modules/access/dc1394.c vlc-1.0.3/modules/access/dc1394.c
--- vlc-1.0.3.orig/modules/access/dc1394.c	2009-05-11 01:03:54.000000000 +0200
+++ vlc-1.0.3/modules/access/dc1394.c	2009-12-10 17:42:35.000000000 +0100
@@ -1,9 +1,11 @@
 /*****************************************************************************
  * dc1394.c: firewire input module
  *****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2009 VideoLAN
  *
  * Authors: Xant Majere <xant@xant.net>
+ *          Rob Shortt <rob@tvcentric.com> - libdc1394 V2 API updates
+ *          Frederic Benoist <fridorik@gmail.com> - updates from Rob's work
  *
  *****************************************************************************
  * This library is free software; you can redistribute it and/or
@@ -35,6 +37,7 @@
 #include <vlc_input.h>
 #include <vlc_vout.h>
 #include <vlc_demux.h>
+/* #include <vlc_picture.h> */
 
 
 #ifdef HAVE_FCNTL_H
@@ -50,7 +53,7 @@
 #include <sys/soundcard.h>
 
 #include <libraw1394/raw1394.h>
-#include <libdc1394/dc1394_control.h>
+#include <dc1394/dc1394.h>
 
 #define MAX_IEEE1394_HOSTS 32
 #define MAX_CAMERA_NODES 32
@@ -70,39 +73,31 @@
     set_callbacks( Open, Close )
 vlc_module_end ()
 
-typedef struct __dc_camera
+struct demux_sys_t
 {
-    int port;
-    nodeid_t node;
-    u_int64_t uid;
-} dc_camera;
-
-typedef struct demux_sys_t
-{
-    dc1394_cameracapture camera;
-    picture_t            pic;
-    int                  dma_capture;
-#define DMA_OFF 0
-#define DMA_ON 1
-    int                 num_ports;
-    int                 num_cameras;
+    /* camera info */
+    dc1394_t            *p_dccontext;
+    uint32_t            num_cameras;
+    dc1394camera_t      *camera;
     int                 selected_camera;
-    u_int64_t           selected_uid;
-
-    dc_camera           *camera_nodes;
-    dc1394_camerainfo   camera_info;
-    dc1394_miscinfo     misc_info;
-    raw1394handle_t     fd_video;
+    uint64_t            selected_uid;
+    picture_t           pic;
+    uint32_t            dma_buffers;
+    dc1394featureset_t  features;
     quadlet_t           supported_framerates;
+    bool                reset_bus;
 
+    /* video info */
+    char                *video_device;
+    dc1394video_mode_t  video_mode;
     int                 width;
     int                 height;
     int                 frame_size;
     int                 frame_rate;
     unsigned int        brightness;
     unsigned int        focus;
-    char                *dma_device;
     es_out_id_t         *p_es_video;
+    dc1394video_frame_t *frame;
 
     /* audio stuff */
     int                 i_sample_rate;
@@ -114,7 +109,7 @@
 #define ROTATION_LEFT 1
 #define ROTATION_RIGHT 2
     es_out_id_t         *p_es_audio;
-} dc1394_sys;
+};
 
 /*****************************************************************************
  * Local prototypes
@@ -126,82 +121,84 @@
 static int process_options( demux_t *p_demux);
 
 /*****************************************************************************
- * ScanCameras
+ * FindCameras
  *****************************************************************************/
-static void ScanCameras( dc1394_sys *sys, demux_t *p_demux )
+static int FindCamera( demux_sys_t *sys, demux_t *p_demux )
 {
-    struct raw1394_portinfo portinfo[MAX_IEEE1394_HOSTS];
-    raw1394handle_t tempFd;
-    dc1394_camerainfo  info;
-    dc_camera *node_list = NULL;
-    nodeid_t  *nodes = NULL;
-    int num_ports = 0;
-    int num_cameras = 0;
-    int nodecount;
-    int i, n;
-
-    memset( &portinfo, 0, sizeof(portinfo) );
+    dc1394camera_list_t *list;
 
     msg_Dbg( p_demux, "Scanning for ieee1394 ports ..." );
 
-    tempFd = raw1394_new_handle();
-    if( !tempFd )
+    if( dc1394_camera_enumerate (sys->p_dccontext, &list) != DC1394_SUCCESS )
+    {
+        msg_Err(p_demux, "Can not ennumerate cameras");
+        dc1394_camera_free_list (list);
+        dc1394_free( sys->p_dccontext );
+        free( sys );
+        p_demux->p_sys = NULL;
         return VLC_EGENERIC;
-    raw1394_get_port_info( tempFd, portinfo, MAX_IEEE1394_HOSTS);
-    raw1394_destroy_handle( tempFd );
+    }
 
-    for( i=0; i < MAX_IEEE1394_HOSTS; i++ )
+    if( list->num == 0 )
     {
-        /* check if port exists and has at least one node*/
-        if( !portinfo[i].nodes )
-            continue;
-        nodes = NULL;
-        nodecount = 0;
-        tempFd = dc1394_create_handle( i );
-
-        /* skip this port if we can't obtain a valid handle */
-        if( !tempFd )
-            continue;
-        msg_Dbg( p_demux, "Found ieee1394 port %d (%s) ... "
-                          "checking for camera nodes",
-                          i, portinfo[i].name );
-        num_ports++;
-
-        nodes = dc1394_get_camera_nodes( tempFd, &nodecount, 0 );
-        if( nodecount )
-        {
-            msg_Dbg( p_demux, "Found %d dc1394 cameras on port %d (%s)",
-                     nodecount, i, portinfo[i].name );
+        msg_Err(p_demux, "Can not find cameras");
+        dc1394_camera_free_list (list);
+        dc1394_free( sys->p_dccontext );
+        free( sys );
+        p_demux->p_sys = NULL;
+        return VLC_EGENERIC;
+    }
 
-            if( node_list )
-                node_list = realloc( node_list, sizeof(dc_camera) * (num_cameras+nodecount) );
-            else
-                node_list = malloc( sizeof(dc_camera) * nodecount);
+    sys->num_cameras = list->num;
+    msg_Dbg( p_demux, "Found %d dc1394 cameras.", list->num);
 
-            for( n = 0; n < nodecount; n++ )
+    if( sys->selected_uid )
+    {
+        int found = 0;
+        for( unsigned i = 0; i < sys->num_cameras; i++ )
+        {
+            if( list->ids[i].guid == sys->selected_uid )
             {
-                int result = 0;
-
-                result = dc1394_get_camera_info( tempFd, nodes[n], &info );
-                if( result == DC1394_SUCCESS )
-                {
-                    node_list[num_cameras+n].uid = info.euid_64;
-                }
-                node_list[num_cameras+n].node = nodes[n];
-                node_list[num_cameras+n].port = i;
+                sys->camera = dc1394_camera_new(sys->p_dccontext,
+                                                list->ids[i].guid);
+                found++;
+                break;
             }
-            num_cameras += nodecount;
         }
-        else
-            msg_Dbg( p_demux, "no cameras found  on port %d (%s)",
-                     i, portinfo[i].name );
-
-        if( tempFd )
-            dc1394_destroy_handle( tempFd );
+        if( !found )
+        {
+            msg_Err( p_demux, "Can't find camera with uid : 0x%llx.",
+                     sys->selected_uid );
+            dc1394_camera_free_list (list);
+            dc1394_free( sys->p_dccontext );
+            free( sys );
+            p_demux->p_sys = NULL;
+            return VLC_EGENERIC;
+        }
+    }
+    else if( sys->selected_camera >= (int)list->num )
+    {
+        msg_Err( p_demux, "There are not this many cameras. (%d/%d)",
+                 sys->selected_camera, sys->num_cameras );
+        dc1394_camera_free_list (list);
+        dc1394_free( sys->p_dccontext );
+        free( sys );
+        p_demux->p_sys = NULL;
+        return VLC_EGENERIC;
+    }
+    else if( sys->selected_camera >= 0 )
+    {
+        sys->camera = dc1394_camera_new(sys->p_dccontext,
+                    list->ids[sys->selected_camera].guid);
+    }
+    else
+    {
+        sys->camera = dc1394_camera_new(sys->p_dccontext,
+                                          list->ids[0].guid);
     }
-    sys->num_ports = num_ports;
-    sys->num_cameras = num_cameras;
-    sys->camera_nodes = node_list;
+
+    dc1394_camera_free_list (list);
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -209,14 +206,15 @@
  *****************************************************************************/
 static int Open( vlc_object_t *p_this )
 {
-    demux_t     *p_demux = (demux_t*)p_this;
-    demux_sys_t *p_sys;
-    es_format_t fmt;
-    int i;
-    int i_width;
-    int i_height;
-    int i_aspect;
-    int result = 0;
+    demux_t      *p_demux = (demux_t*)p_this;
+    demux_sys_t  *p_sys;
+    es_format_t   fmt;
+    dc1394error_t res;
+    int           i;
+    int           i_width;
+    int           i_height;
+    int           i_aspect;
+    int           result = 0;
 
     if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
         return VLC_EGENERIC;
@@ -231,22 +229,22 @@
     p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
+
     memset( &fmt, 0, sizeof( es_format_t ) );
 
     /* DEFAULTS */
-    p_sys->frame_size = MODE_640x480_YUV422;
-    p_sys->width      = 640;
-    p_sys->height     = 480;
-    p_sys->frame_rate = FRAMERATE_30;
-    p_sys->brightness = 200;
-    p_sys->focus      = 0;
-    p_sys->dma_capture = DMA_ON; /* defaults to VIDEO1394 capture mode */
-    p_sys->fd_audio   = -1;
-    p_sys->fd_video   = NULL;
-    p_sys->camera_nodes = NULL;
-    p_sys->selected_camera = 0;
-    p_sys->dma_device = NULL;
-    p_sys->selected_uid = 0;
+    p_sys->video_mode      = DC1394_VIDEO_MODE_640x480_YUV422;
+    p_sys->width           = 640;
+    p_sys->height          = 480;
+    p_sys->frame_rate      = DC1394_FRAMERATE_15;
+    p_sys->brightness      = 200;
+    p_sys->focus           = 0;
+    p_sys->fd_audio        = -1;
+    p_sys->p_dccontext     = NULL;
+    p_sys->camera          = NULL;
+    p_sys->selected_camera = -1;
+    p_sys->dma_buffers     = 1;
+    p_sys->reset_bus       = 0;
 
     /* PROCESS INPUT OPTIONS */
     if( process_options(p_demux) != VLC_SUCCESS )
@@ -259,223 +257,145 @@
         return VLC_EGENERIC;
     }
 
-    msg_Dbg( p_demux, "Selected camera %d", p_sys->selected_camera );
-    msg_Dbg( p_demux, "Selected uid 0x%llx", p_sys->selected_uid );
+    p_sys->p_dccontext = dc1394_new();
+    if( !p_sys->p_dccontext )
+    {
+        msg_Err( p_demux, "Failed to initialise libdc1394");
+        free(p_demux->p_sys);
+        p_demux->p_sys = NULL;
+        return VLC_EGENERIC;
+    }
+
+    if( FindCamera( p_sys, p_demux ) != VLC_SUCCESS )
+        return VLC_EGENERIC;
 
-    ScanCameras( p_sys, p_demux );
-    if( !p_sys->camera_nodes )
+    if( !p_sys->camera )
     {
         msg_Err( p_demux, "No camera found !!" );
+        dc1394_free( p_sys->p_dccontext );
         free( p_sys );
         p_demux->p_sys = NULL;
         return VLC_EGENERIC;
     }
 
-    if( p_sys->selected_uid )
+    if( p_sys->reset_bus )
     {
-        int found = 0;
-        for( i=0; i < p_sys->num_cameras; i++ )
+        if( dc1394_reset_bus( p_sys->camera ) != DC1394_SUCCESS )
         {
-            if( p_sys->camera_nodes[i].uid == p_sys->selected_uid )
-            {
-                p_sys->selected_camera = i;
-                found++;
-                break;
-            }
-        }
-        if( !found )
-        {
-            msg_Err( p_demux, "Can't find camera with uid : 0x%llx.",
-                     p_sys->selected_uid );
+            msg_Err( p_demux, "Unable to reset IEEE 1394 bus");
             Close( p_this );
             return VLC_EGENERIC;
         }
-    }
-    else if( p_sys->selected_camera >= p_sys->num_cameras )
-    {
-        msg_Err( p_demux, "there are not this many cameras. (%d/%d)",
-                          p_sys->selected_camera, p_sys->num_cameras );
-        Close( p_this );
-        return VLC_EGENERIC;
+        else msg_Dbg( p_demux, "Successfully reset IEEE 1394 bus");
     }
 
-    p_sys->fd_video = dc1394_create_handle(
-                        p_sys->camera_nodes[p_sys->selected_camera].port );
-    if( (int)p_sys->fd_video < 0 )
+    if( dc1394_camera_reset( p_sys->camera ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "Can't init dc1394 handle" );
+        msg_Err( p_demux, "Unable to reset camera");
         Close( p_this );
         return VLC_EGENERIC;
     }
 
-    /* get camera info */
-    result = dc1394_get_camera_info( p_sys->fd_video,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        &p_sys->camera_info );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_camera_print_info( p_sys->camera,
+                  stderr ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux ,"unable to get camera info" );
+        msg_Err( p_demux, "Unable to print camera info");
         Close( p_this );
         return VLC_EGENERIC;
     }
 
-    dc1394_print_camera_info( &p_sys->camera_info );
-    result = dc1394_get_camera_misc_info( p_sys->fd_video,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        &p_sys->misc_info );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_feature_get_all( p_sys->camera,
+                &p_sys->features ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to get camera misc info" );
+        msg_Err( p_demux, "Unable to get feature set");
         Close( p_this );
         return VLC_EGENERIC;
     }
+    // TODO: only print features if verbosity increased
+    dc1394_feature_print_all(&p_sys->features, stderr);
 
-    /* init camera and set some video options  */
-    result = dc1394_init_camera( p_sys->camera_info.handle,
-                                 p_sys->camera_info.id );
-    if( result != DC1394_SUCCESS )
+#if 0 //"Note that you need to execute this function only if you use exotic video1394 device names. /dev/video1394, /dev/video1394/* and /dev/video1394-* are automatically recognized." http://damien.douxchamps.net/ieee1394/libdc1394/v2.x/api/capture/
+    if( p_sys->video_device )
     {
-        msg_Err( p_demux, "unable to get init dc1394 camera" );
-        Close( p_this );
-        return VLC_EGENERIC;
+        if( dc1394_capture_set_device_filename( p_sys->camera,
+                        p_sys->video_device ) != DC1394_SUCCESS )
+        {
+            msg_Err( p_demux, "Unable to set video device");
+            Close( p_this );
+            return VLC_EGENERIC;
+        }
     }
+#endif
 
     if( p_sys->focus )
     {
-        result = dc1394_set_focus( p_sys->camera_info.handle,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        p_sys->focus );
-        if( result != DC1394_SUCCESS )
+        if( dc1394_feature_set_value( p_sys->camera,
+                      DC1394_FEATURE_FOCUS,
+                      p_sys->focus ) != DC1394_SUCCESS )
         {
-            msg_Err( p_demux, "unable to set initial focus to %u",
+            msg_Err( p_demux, "Unable to set initial focus to %u",
                      p_sys->focus );
         }
         msg_Dbg( p_demux, "Initial focus set to %u", p_sys->focus );
     }
 
-    result = dc1394_set_brightness( p_sys->camera_info.handle,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        p_sys->brightness );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_feature_set_value( p_sys->camera,
+                  DC1394_FEATURE_FOCUS,
+                  p_sys->brightness ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to set init brightness to %d",
-                 p_sys->brightness);
-        Close( p_this );
-        return VLC_EGENERIC;
+        msg_Err( p_demux, "Unable to set initial brightness to %u",
+                 p_sys->brightness );
     }
+    msg_Dbg( p_demux, "Initial brightness set to %u", p_sys->brightness );
 
-    result = dc1394_set_video_framerate( p_sys->camera_info.handle,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        p_sys->frame_rate );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_video_set_framerate( p_sys->camera,
+                    p_sys->frame_rate ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to set framerate to %d",
-                 p_sys->frame_rate );
+        msg_Err( p_demux, "Unable to set framerate");
         Close( p_this );
         return VLC_EGENERIC;
     }
-    p_sys->misc_info.framerate = p_sys->frame_rate;
 
-    result = dc1394_set_video_format( p_sys->camera_info.handle,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        FORMAT_VGA_NONCOMPRESSED );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_video_set_mode( p_sys->camera,
+                   p_sys->video_mode ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to set video format to VGA_NONCOMPRESSED" );
+        msg_Err( p_demux, "Unable to set video mode");
         Close( p_this );
         return VLC_EGENERIC;
     }
-    p_sys->misc_info.format = FORMAT_VGA_NONCOMPRESSED;
 
-    result = dc1394_set_video_mode( p_sys->camera_info.handle,
-                        p_sys->camera_nodes[p_sys->selected_camera].node,
-                        p_sys->frame_size );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_video_set_iso_speed( p_sys->camera,
+                    DC1394_ISO_SPEED_400 ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to set video mode" );
+        msg_Err( p_demux, "Unable to set iso speed");
         Close( p_this );
         return VLC_EGENERIC;
     }
-    p_sys->misc_info.mode = p_sys->frame_size;
-
-    /* reprobe everything */
-    result = dc1394_get_camera_info( p_sys->camera_info.handle,
-                                     p_sys->camera_info.id,
-                                     &p_sys->camera_info );
-    if( result != DC1394_SUCCESS )
-    {
-        msg_Err( p_demux, "Could not get camera basic information!" );
-        Close( p_this );
-        return VLC_EGENERIC;
-    }
-
-    result = dc1394_get_camera_misc_info( p_sys->camera_info.handle,
-                                          p_sys->camera_info.id,
-                                          &p_sys->misc_info );
-    if( result != DC1394_SUCCESS )
-    {
-        msg_Err( p_demux, "Could not get camera misc information!" );
-        Close( p_this );
-        return VLC_EGENERIC;
-    }
-
-    /* set iso_channel */
-    result = dc1394_set_iso_channel_and_speed( p_sys->camera_info.handle,
-                                               p_sys->camera_info.id,
-                                               p_sys->selected_camera,
-                                               SPEED_400 );
-    if( result != DC1394_SUCCESS )
-    {
-        msg_Err( p_demux, "Could not set iso channel!" );
-        Close( p_this );
-        return VLC_EGENERIC;
-    }
-    msg_Dbg( p_demux, "Using ISO channel %d", p_sys->misc_info.iso_channel );
-    p_sys->misc_info.iso_channel = p_sys->selected_camera;
 
     /* and setup capture */
-    if( p_sys->dma_capture )
+    res = dc1394_capture_setup( p_sys->camera,
+                    p_sys->dma_buffers,
+                DC1394_CAPTURE_FLAGS_DEFAULT);
+    if( res != DC1394_SUCCESS )
     {
-        result = dc1394_dma_setup_capture( p_sys->camera_info.handle,
-                        p_sys->camera_info.id,
-                        p_sys->misc_info.iso_channel,
-                        p_sys->misc_info.format,
-                        p_sys->misc_info.mode,
-                        SPEED_400,
-                        p_sys->misc_info.framerate,
-                        10, 0,
-                        p_sys->dma_device,
-                        &p_sys->camera );
-        if( result != DC1394_SUCCESS )
+        if( res == DC1394_NO_BANDWIDTH )
         {
-            msg_Err( p_demux ,"unable to setup camera" );
-            Close( p_this );
-            return VLC_EGENERIC;
+            msg_Err( p_demux ,"No bandwidth: try adding the "
+             "\"resetbus\" option" );
         }
-    }
-    else
-    {
-        result = dc1394_setup_capture( p_sys->camera_info.handle,
-                    p_sys->camera_info.id,
-                    p_sys->misc_info.iso_channel,
-                    p_sys->misc_info.format,
-                    p_sys->misc_info.mode,
-                    SPEED_400,
-                    p_sys->misc_info.framerate,
-                    &p_sys->camera );
-        if( result != DC1394_SUCCESS)
+        else
         {
-            msg_Err( p_demux ,"unable to setup camera" );
-            Close( p_this );
-            return VLC_EGENERIC;
+            msg_Err( p_demux ,"Unable to setup capture" );
         }
+        Close( p_this );
+        return VLC_EGENERIC;
     }
 
     /* TODO - UYV444 chroma converter is missing, when it will be available
      * fourcc will become variable (and not just a fixed value for UYVY)
      */
-    i_width = p_sys->camera.frame_width;
-    i_height = p_sys->camera.frame_height;
+    i_width = p_sys->width;
+    i_height = p_sys->height;
 
     i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic,
                     VLC_FOURCC('U', 'Y', 'V', 'Y'),
@@ -487,7 +407,7 @@
     fmt.video.i_width = i_width;
     fmt.video.i_height = i_height;
 
-    msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
+    msg_Dbg( p_demux, "Added new video es %4.4s %dx%d",
              (char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height );
 
     p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
@@ -508,7 +428,7 @@
             fmt.i_bitrate = fmt.audio.i_channels * fmt.audio.i_rate *
                             fmt.audio.i_bitspersample;
 
-            msg_Dbg( p_demux, "new audio es %d channels %dHz",
+            msg_Dbg( p_demux, "New audio es %d channels %dHz",
             fmt.audio.i_channels, fmt.audio.i_rate );
 
             p_sys->p_es_audio = es_out_Add( p_demux->out, &fmt );
@@ -516,23 +436,16 @@
     }
 
     /* have the camera start sending us data */
-    result = dc1394_start_iso_transmission( p_sys->camera_info.handle,
-                                            p_sys->camera_info.id );
-    if( result != DC1394_SUCCESS )
+    if( dc1394_video_set_transmission( p_sys->camera,
+                       DC1394_ON ) != DC1394_SUCCESS )
     {
-        msg_Err( p_demux, "unable to start camera iso transmission" );
-        if( p_sys->dma_capture )
-        {
-            dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
-        }
-        else
-        {
-            dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
-        }
+        msg_Err( p_demux, "Unable to start camera iso transmission" );
+        dc1394_capture_stop( p_sys->camera );
         Close( p_this );
         return VLC_EGENERIC;
     }
-    p_sys->misc_info.is_iso_on = DC1394_TRUE;
+    msg_Dbg( p_demux, "Set iso transmission" );
+    // TODO: reread camera
     return VLC_SUCCESS;
 }
 
@@ -546,7 +459,7 @@
     p_sys->fd_audio = open( psz_device, O_RDONLY | O_NONBLOCK );
     if( p_sys->fd_audio  < 0 )
     {
-        msg_Err( p_demux, "cannot open audio device (%s)", psz_device );
+        msg_Err( p_demux, "Cannot open audio device (%s)", psz_device );
         CloseAudioDev( p_demux );
     }
 
@@ -556,7 +469,7 @@
     result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SETFMT, &i_format );
     if( (result  < 0) || (i_format != AFMT_S16_LE) )
     {
-        msg_Err( p_demux, "cannot set audio format (16b little endian) "
+        msg_Err( p_demux, "Cannot set audio format (16b little endian) "
                           "(%d)", i_format );
         CloseAudioDev( p_demux );
     }
@@ -564,7 +477,7 @@
     result = ioctl( p_sys->fd_audio, SNDCTL_DSP_CHANNELS, &p_sys->channels );
     if( result < 0 )
     {
-        msg_Err( p_demux, "cannot set audio channels count (%d)",
+        msg_Err( p_demux, "Cannot set audio channels count (%d)",
                  p_sys->channels );
         CloseAudioDev( p_demux );
     }
@@ -572,11 +485,12 @@
     result = ioctl( p_sys->fd_audio, SNDCTL_DSP_SPEED, &p_sys->i_sample_rate );
     if( result < 0 )
     {
-        msg_Err( p_demux, "cannot set audio sample rate (%s)", p_sys->i_sample_rate );
+        msg_Err( p_demux, "Cannot set audio sample rate (%d)",
+         p_sys->i_sample_rate );
         CloseAudioDev( p_demux );
     }
 
-    msg_Dbg( p_demux, "opened adev=`%s' %s %dHz",
+    msg_Dbg( p_demux, "Opened adev=`%s' %s %dHz",
              psz_device,
              (p_sys->channels > 1) ? "stereo" : "mono",
              p_sys->i_sample_rate );
@@ -603,37 +517,27 @@
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
-    int result = 0;
 
     /* Stop data transmission */
-    result = dc1394_stop_iso_transmission( p_sys->fd_video,
-                                           p_sys->camera.node );
-    if( result != DC1394_SUCCESS )
-    {
-        msg_Err( p_demux, "couldn't stop the camera" );
-    }
+    if( dc1394_video_set_transmission( p_sys->camera,
+                       DC1394_OFF ) != DC1394_SUCCESS )
+        msg_Err( p_demux, "Unable to stop camera iso transmission" );
 
     /* Close camera */
-    if( p_sys->dma_capture )
-    {
-        dc1394_dma_unlisten( p_sys->fd_video, &p_sys->camera );
-        dc1394_dma_release_camera( p_sys->fd_video, &p_sys->camera );
-    }
-    else
-    {
-        dc1394_release_camera( p_sys->fd_video, &p_sys->camera );
-    }
+    dc1394_capture_stop( p_sys->camera );
 
-    if( p_sys->fd_video )
-        dc1394_destroy_handle( p_sys->fd_video );
     CloseAudioDev( p_demux );
 
-    free( p_sys->camera_nodes );
-    free( p_sys->audio_device );
+    dc1394_camera_free(p_sys->camera);
+    dc1394_free(p_sys->p_dccontext);
+
+    if( p_sys->audio_device )
+        free( p_sys->audio_device );
 
     free( p_sys );
 }
 
+#if 0
 static void MovePixelUYVY( void *src, int spos, void *dst, int dpos )
 {
     char u,v,y;
@@ -665,6 +569,7 @@
         dc[1] = y;
     }
 }
+#endif
 
 /*****************************************************************************
  * Demux:
@@ -673,49 +578,35 @@
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     block_t     *p_block = NULL;
-    int result = 0;
 
-    if( p_sys->dma_capture )
+    if( dc1394_capture_dequeue( p_sys->camera,
+                DC1394_CAPTURE_POLICY_WAIT,
+                &p_sys->frame ) != DC1394_SUCCESS )
     {
-        result = dc1394_dma_single_capture( &p_sys->camera );
-        if( result != DC1394_SUCCESS )
-        {
-            msg_Err( p_demux, "unable to capture a frame" );
-            return NULL;
-        }
-    }
-    else
-    {
-        result = dc1394_single_capture( p_sys->camera_info.handle,
-                                        &p_sys->camera );
-        if( result != DC1394_SUCCESS )
-        {
-            msg_Err( p_demux, "unable to capture a frame" );
-            return NULL;
-        }
+        msg_Err( p_demux, "Unable to capture a frame" );
+        return NULL;
     }
 
-    p_block = block_New( p_demux, p_sys->camera.frame_width *
-                                  p_sys->camera.frame_height * 2 );
+    p_block = block_New( p_demux, p_sys->frame->size[0] *
+                                  p_sys->frame->size[1] * 2 );
     if( !p_block )
     {
-        msg_Err( p_demux, "cannot get block" );
+        msg_Err( p_demux, "Can not get block" );
         return NULL;
     }
 
-    if( !p_sys->camera.capture_buffer )
+    if( !p_sys->frame->image )
     {
-        msg_Err (p_demux, "caputer buffer empty");
+        msg_Err (p_demux, "Capture buffer empty");
         block_Release( p_block );
         return NULL;
     }
 
-    memcpy( p_block->p_buffer, (const char *)p_sys->camera.capture_buffer,
-            p_sys->camera.frame_width * p_sys->camera.frame_height * 2 );
+    memcpy( p_block->p_buffer, (const char *)p_sys->frame->image,
+            p_sys->width * p_sys->height * 2 );
 
     p_block->i_pts = p_block->i_dts = mdate();
-    if( p_sys->dma_capture )
-        dc1394_dma_done_with_buffer( &p_sys->camera );
+    dc1394_capture_enqueue( p_sys->camera, p_sys->frame );
     return p_block;
 }
 
@@ -731,7 +622,7 @@
     p_block = block_New( p_demux, p_sys->i_audio_max_frame_size );
     if( !p_block )
     {
-        msg_Warn( p_demux, "cannot get buffer" );
+        msg_Warn( p_demux, "Cannot get buffer" );
         return NULL;
     }
 
@@ -766,8 +657,7 @@
         p_blocka = GrabAudio( p_demux );
 
     /* Try grabbing video frame */
-    if( (int)p_sys->fd_video > 0 )
-        p_blockv = GrabVideo( p_demux );
+    p_blockv = GrabVideo( p_demux );
 
     if( !p_blocka && !p_blockv )
     {
@@ -800,6 +690,7 @@
     bool *pb;
     int64_t    *pi64;
 
+    VLC_UNUSED( p_demux );
     switch( i_query )
     {
         /* Special for access_demux */
@@ -835,8 +726,13 @@
     char *psz_parser;
     char *token = NULL;
     char *state = NULL;
+    const char *in_size = NULL;
+    const char *in_fmt = NULL;
     float rate_f;
 
+    if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
+        return VLC_EGENERIC;
+
     psz_dup = strdup( p_demux->psz_path );
     psz_parser = psz_dup;
     for( token = strtok_r( psz_parser,":",&state); token;
@@ -851,26 +747,26 @@
                     * video size of 160x120 is temporarily disabled
                     */
                 msg_Err( p_demux,
-                    "video size of 160x120 is actually disabled for lack of chroma "
-                    "support. It will relased ASAP, until then try an higher size "
-                    "(320x240 and 640x480 are fully supported)" );
-                free( psz_dup );
+                    "video size of 160x120 is actually disabled for lack of"
+                    "chroma support. It will relased ASAP, until then try "
+                    "an higher size (320x240 and 640x480 are fully supported)" );
+                free(psz_dup);
                 return VLC_EGENERIC;
 #if 0
-                p_sys->frame_size = MODE_160x120_YUV444;
+                in_size = "160x120";
                 p_sys->width = 160;
                 p_sys->height = 120;
 #endif
             }
             else if( strncmp( token, "320x240", 7 ) == 0 )
             {
-                p_sys->frame_size = MODE_320x240_YUV422;
+                in_size = "320x240";
                 p_sys->width = 320;
                 p_sys->height = 240;
             }
             else if( strncmp( token, "640x480", 7 ) == 0 )
             {
-                p_sys->frame_size = MODE_640x480_YUV422;
+                in_size = "640x480";
                 p_sys->width = 640;
                 p_sys->height = 480;
             }
@@ -881,27 +777,62 @@
                     " 160x120, 320x240, and 640x480. "
                     "Please specify one of them. You have specified %s.",
                     token );
-                free( psz_dup );
+                free(psz_dup);
                 return VLC_EGENERIC;
             }
             msg_Dbg( p_demux, "Requested video size : %s",token );
         }
+        if( strncmp( token, "format=", strlen("format=") ) == 0 )
+        {
+            token += strlen("format=");
+            if( strncmp( token, "YUV411", 6 ) == 0 )
+            {
+                in_fmt = "YUV411";
+            }
+            else if( strncmp( token, "YUV422", 6 ) == 0 )
+            {
+                in_fmt = "YUV422";
+            }
+            else if( strncmp( token, "YUV444", 6 ) == 0 )
+            {
+                in_fmt = "YUV444";
+            }
+            else if( strncmp( token, "RGB8", 4 ) == 0 )
+            {
+                in_fmt = "RGB8";
+            }
+            else if( strncmp( token, "MONO8", 5 ) == 0 )
+            {
+                in_fmt = "MONO8";
+            }
+            else if( strncmp( token, "MONO16", 6 ) == 0 )
+            {
+                in_fmt = "MONO16";
+            }
+            else
+            {
+                msg_Err( p_demux, "Invalid format %s.", token );
+                free(psz_dup);
+                return VLC_EGENERIC;
+            }
+            msg_Dbg( p_demux, "Requested video format : %s", token );
+        }
         else if( strncmp( token, "fps=", strlen( "fps=" ) ) == 0 )
         {
             token += strlen("fps=");
             sscanf( token, "%g", &rate_f );
             if( rate_f == 1.875 )
-                p_sys->frame_rate = FRAMERATE_1_875;
+                p_sys->frame_rate = DC1394_FRAMERATE_1_875;
             else if( rate_f == 3.75 )
-                p_sys->frame_rate = FRAMERATE_3_75;
+                p_sys->frame_rate = DC1394_FRAMERATE_3_75;
             else if( rate_f == 7.5 )
-                p_sys->frame_rate = FRAMERATE_7_5;
+                p_sys->frame_rate = DC1394_FRAMERATE_7_5;
             else if( rate_f == 15 )
-                p_sys->frame_rate = FRAMERATE_15;
+                p_sys->frame_rate = DC1394_FRAMERATE_15;
             else if( rate_f == 30 )
-                p_sys->frame_rate = FRAMERATE_30;
+                p_sys->frame_rate = DC1394_FRAMERATE_30;
             else if( rate_f == 60 )
-                p_sys->frame_rate = FRAMERATE_60;
+                p_sys->frame_rate = DC1394_FRAMERATE_60;
             else
             {
                 msg_Err( p_demux ,
@@ -909,11 +840,16 @@
                     " 1.875, 3.75, 7.5, 15, 30, 60. "
                     "Please specify one of them. You have specified %s.",
                     token);
-                free( psz_dup );
+                free(psz_dup);
                 return VLC_EGENERIC;
             }
             msg_Dbg( p_demux, "Requested frame rate : %s",token );
         }
+        else if( strncmp( token, "resetbus", strlen( "resetbus" ) ) == 0 )
+        {
+            token += strlen("resetbus");
+            p_sys->reset_bus = 1;
+        }
         else if( strncmp( token, "brightness=", strlen( "brightness=" ) ) == 0 )
         {
             int nr = 0;
@@ -924,11 +860,27 @@
                 msg_Err( p_demux, "Bad brightness value '%s', "
                                   "must be an unsigned integer.",
                                   token );
-                free( psz_dup );
+                free(psz_dup);
+                return VLC_EGENERIC;
+            }
+        }
+        else if( strncmp( token, "buffers=", strlen( "buffers=" ) ) == 0 )
+        {
+            int nr = 0;
+            int in_buf = 0;
+            token += strlen("buffers=");
+            nr = sscanf( token, "%d", &in_buf);
+            if( nr != 1 || in_buf < 1 )
+            {
+                msg_Err( p_demux, "DMA buffers must be 1 or greater." );
+                free(psz_dup);
                 return VLC_EGENERIC;
             }
+            else p_sys->dma_buffers = in_buf;
         }
 #if 0
+        // NOTE: If controller support is added back, more logic will needed to be added
+        //       after the cameras are scanned.
         else if( strncmp( token, "controller=", strlen( "controller=" ) ) == 0 )
         {
             int nr = 0;
@@ -953,31 +905,15 @@
                 msg_Err( p_demux, "Bad camera number '%s', "
                                   "must be an unsigned integer.",
                                   token );
-                free( psz_dup );
+                free(psz_dup);
                 return VLC_EGENERIC;
             }
         }
-        else if( strncmp( token, "capture=", strlen( "capture=" ) ) == 0)
+        else if( strncmp( token, "vdev=", strlen( "vdev=" ) ) == 0)
         {
-            token += strlen("capture=");
-            if( strncmp(token, "raw1394",7) == 0 )
-            {
-                msg_Dbg( p_demux, "DMA capture disabled!" );
-                p_sys->dma_capture = DMA_OFF;
-            }
-            else if( strncmp(token,"video1394",9) == 0 )
-            {
-                msg_Dbg( p_demux, "DMA capture enabled!" );
-                p_sys->dma_capture = DMA_ON;
-            }
-            else
-            {
-                msg_Err(p_demux, "Bad capture method value '%s', "
-                                 "it can be 'raw1394' or 'video1394'.",
-                                token );
-                free( psz_dup );
-                return VLC_EGENERIC;
-            }
+            token += strlen("vdev=");
+            p_sys->video_device = strdup(token);
+            msg_Dbg( p_demux, "Using video device '%s'.", token );
         }
         else if( strncmp( token, "adev=", strlen( "adev=" ) ) == 0 )
         {
@@ -997,8 +933,17 @@
         }
         else if( strncmp( token, "focus=", strlen("focus=" ) ) == 0)
         {
+            int nr = 0;
             token += strlen("focus=");
-            sscanf( token, "%u", &p_sys->focus );
+            nr = sscanf( token, "%u", &p_sys->focus );
+            if( nr != 1 )
+            {
+                msg_Err( p_demux, "Bad focus value '%s', "
+                                  "must be an unsigned integer.",
+                                  token );
+                free(psz_dup);
+                return VLC_EGENERIC;
+            }
         }
         else if( strncmp( token, "uid=", strlen("uid=") ) == 0)
         {
@@ -1006,7 +951,41 @@
             sscanf( token, "0x%llx", &p_sys->selected_uid );
         }
     }
-    free( psz_dup );
+
+    // The mode is a combination of size and format and not every format
+    // is supported by every size.
+    if( in_size)
+    {
+        if( strcmp( in_size, "160x120") == 0)
+        {
+            if( in_fmt && (strcmp( in_fmt, "YUV444") != 0) )
+                msg_Err(p_demux, "160x120 only supports YUV444 - forcing");
+            p_sys->video_mode = DC1394_VIDEO_MODE_160x120_YUV444;
+        }
+        else if( strcmp( in_size, "320x240") == 0)
+        {
+            if( in_fmt && (strcmp( in_fmt, "YUV422") != 0) )
+                msg_Err(p_demux, "320x240 only supports YUV422 - forcing");
+            p_sys->video_mode = DC1394_VIDEO_MODE_320x240_YUV422;
+        }
+    }
+    else
+    { // 640x480 default
+        if( in_fmt )
+        {
+            if( strcmp( in_fmt, "RGB8") == 0)
+                p_sys->video_mode = DC1394_VIDEO_MODE_640x480_RGB8;
+            else if( strcmp( in_fmt, "MONO8") == 0)
+                p_sys->video_mode = DC1394_VIDEO_MODE_640x480_MONO8;
+            else if( strcmp( in_fmt, "MONO16") == 0)
+                p_sys->video_mode = DC1394_VIDEO_MODE_640x480_MONO16;
+            else if( strcmp( in_fmt, "YUV411") == 0)
+                p_sys->video_mode = DC1394_VIDEO_MODE_640x480_YUV411;
+            else // YUV422 default
+                p_sys->video_mode = DC1394_VIDEO_MODE_640x480_YUV422;
+        }
+        else // YUV422 default
+            p_sys->video_mode = DC1394_VIDEO_MODE_640x480_YUV422;
+    }
     return VLC_SUCCESS;
 }
-