]> git.zerfleddert.de Git - record-dvb/blobdiff - dump-stream.c
better url detection
[record-dvb] / dump-stream.c
index 1cbaad260854656b6aedc32699b8d476e28e411a..a6039e0d2a12572b1a067c3d89548308cfd0e6bd 100644 (file)
@@ -9,8 +9,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <strings.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <strings.h>
+#include <netdb.h>
 
 #include "mcast.h"
 
 #include "mcast.h"
+#include "http.h"
+#include "sap.h"
+#include "common.h"
 
 #define CHUNKSIZE 1500
 
 
 #define CHUNKSIZE 1500
 
@@ -28,8 +32,26 @@ int main(int argc, char **argv)
                exit(EXIT_FAILURE);
        }
 
                exit(EXIT_FAILURE);
        }
 
-       if ((in = open_mcast(url)) < 0) {
-               fprintf(stderr,"Can't open url %s!\n",url);
+       if (!is_url(url)) {
+               char *service_url;
+               if ((service_url = get_url_from_sap(url))) {
+                       printf("SAP says: '%s' -> %s\n", url, service_url);
+                       url = service_url;
+               }
+       }
+
+       if (is_http(url)) {
+               if ((in = open_http(url)) < 0) {
+                       fprintf(stderr,"Can't open url %s!\n",url);
+                       exit(EXIT_FAILURE);
+               }
+       } else if (is_mcast(url)) {
+               if ((in = open_mcast(url)) < 0) {
+                       fprintf(stderr,"Can't open url %s!\n",url);
+                       exit(EXIT_FAILURE);
+               }
+       } else {
+               printf("URL '%s' not supported!\n", url);
                exit(EXIT_FAILURE);
        }
 
                exit(EXIT_FAILURE);
        }
 
Impressum, Datenschutz