]> git.sesse.net Git - mlt/commitdiff
Provide sensible defaults for HD SDI.
authorDan Dennedy <dan@dennedy.org>
Wed, 16 Jun 2010 04:54:45 +0000 (21:54 -0700)
committerDan Dennedy <dan@dennedy.org>
Wed, 16 Jun 2010 04:54:45 +0000 (21:54 -0700)
Also, now blanking may also be set to 0 or 1 to be consistent with other
boolean MLT properties.

src/modules/linsys/consumer_SDIstream.c

index 47af4aec5d076fa5addec3e073be06f81b66ea8d..9f0e09365409a6727ffefdec130ea3797195926f 100644 (file)
 #include <pthread.h>
 #include <stdint.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #ifdef WITH_JPEG
 // for JPEG output
@@ -339,21 +341,6 @@ static void *consumer_thread(void *arg) {
 
        int counter = 0; // each second we save a Jpeg
 
-       // set blanking flag; is not nessary we write no own blanking(HANC) for HD board ASSY 193
-       if (mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking") != NULL) {
-               // set value
-               if (strcmp(strdup(mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking")), "false")) {
-                       this->blanking = 1;
-               } else if (strcmp(strdup(mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking")), "true")) {
-                       this->blanking = 0;
-               } else {
-                       this->blanking = 1;
-               }
-       } else {
-               // set default value without HD board, also with blanking
-               this->blanking = 1;
-       }
-
        // set properties (path) for device files
        if (mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "dev_video") != NULL) {
                this->device_file_video = strdup(mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "dev_video"));
@@ -367,6 +354,48 @@ static void *consumer_thread(void *arg) {
                }
        }
 
+       // Set additional device file defaults
+       struct stat st;
+       int fd = stat(this->device_file_video, &st);
+       if (fd == -1) {
+               if (this->device_file_video)
+                       free(this->device_file_video);
+               this->device_file_video = strdup("/dev/sdivideotx0");
+       } else {
+               close(fd);
+       }
+       if (this->device_file_audio) {
+               fd = stat(this->device_file_audio, &st);
+               if (fd == -1) {
+                       if (this->device_file_audio)
+                               free(this->device_file_audio);
+                       this->device_file_audio = strdup("/dev/sdiaudiotx0");
+               } else {
+                       close(fd);
+               }
+       } else if (strstr(this->device_file_video, "sdivideotx")) {
+               if (this->device_file_audio)
+                       free(this->device_file_audio);
+               this->device_file_audio = strdup("/dev/sdiaudiotx0");
+       }
+
+       // set blanking flag; is not nessary we write no own blanking(HANC) for HD board ASSY 193
+       if (mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking")) {
+               // set value
+               if (!strcmp( mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking"), "false")) {
+                       this->blanking = 0;
+               } else if (!strcmp( mlt_properties_get(MLT_CONSUMER_PROPERTIES( consumer ), "blanking"), "true")) {
+                       this->blanking = 1;
+               } else {
+                       this->blanking = mlt_properties_get_int(MLT_CONSUMER_PROPERTIES( consumer ), "blanking");
+               }
+       } else if (strstr(this->device_file_video, "sdivideotx")) {
+               this->blanking = 0;
+       } else {
+               // set default value without HD board, also with blanking
+               this->blanking = 1;
+       }
+
        // Define a frame pointer
        mlt_frame frame;