]>
git.zerfleddert.de Git - record-dvb/blob - dump-stream.c
a6039e0d2a12572b1a067c3d89548308cfd0e6bd
6 #include <sys/socket.h>
19 #define CHUNKSIZE 1500
21 int main(int argc
, char **argv
)
24 int bytes
, written
, i
;
26 char buffer
[CHUNKSIZE
];
31 fprintf(stderr
,"Syntax: %s URL\n", argv
[0]);
37 if ((service_url
= get_url_from_sap(url
))) {
38 printf("SAP says: '%s' -> %s\n", url
, service_url
);
44 if ((in
= open_http(url
)) < 0) {
45 fprintf(stderr
,"Can't open url %s!\n",url
);
48 } else if (is_mcast(url
)) {
49 if ((in
= open_mcast(url
)) < 0) {
50 fprintf(stderr
,"Can't open url %s!\n",url
);
54 printf("URL '%s' not supported!\n", url
);
59 if ((bytes
= recv(in
, buffer
, CHUNKSIZE
, 0)) < 1) {
66 if ((i
= write(STDOUT_FILENO
, buffer
, bytes
-written
)) < 0) {
71 } while(written
< bytes
);