return 0;
}
+int is_url(char *string)
+{
+ char *pos;
+
+ if (!(strlen(string)))
+ return 0;
+
+ pos = string;
+
+ while(*pos != ':' && *pos != 0)
+ pos++;
+
+ if (!strncmp("://", pos, 3))
+ return 1;
+
+ return 0;
+}
struct dvb_host *parse(char *urlpart, char *defport);
int resolve(struct dvb_host *dvbhost, struct sockaddr_in *server);
+int is_url(char *string);
#include <fcntl.h>
#include <unistd.h>
#include <strings.h>
+#include <netdb.h>
#include "mcast.h"
+#include "http.h"
+#include "sap.h"
+#include "common.h"
#define CHUNKSIZE 1500
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);
}
#include <fcntl.h>
#include <unistd.h>
#include <strings.h>
+#include <netdb.h>
#include "http.h"
#include "mcast.h"
#include "sap.h"
+#include "common.h"
#define CHUNKSIZE 3000
#define GTOD_INTERVAL 100
exit(EXIT_FAILURE);
}
- if (!is_http(url) && !is_mcast(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);