Changeset 5223:3326fb359ffe in roaraudio for libroar/file.c
- Timestamp:
- 11/12/11 12:44:52 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/file.c
r5222 r5223 35 35 36 36 #include "libroar.h" 37 38 #define BUFFERSIZE 819239 #define BUFMAX 6553640 41 #ifdef ROAR_HAVE_IO_POSIX42 #define _CAN_OPERATE43 #endif44 37 45 38 int roar_file_codecdetect(char * buf, int len) { … … 90 83 } 91 84 92 ssize_t roar_file_send_raw (int out, int in) {93 #ifdef _CAN_OPERATE94 ssize_t r = 0;95 #ifdef ROAR_HAVE_LINUX_SENDFILE96 ssize_t ret;97 #endif98 int len;99 char buf[BUFFERSIZE];100 #if defined(__linux__) && defined(ROAR_HAVE_IPV4)101 int cork_new = 1, cork_old;102 socklen_t cork_len = sizeof(int);103 104 if ( getsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, &cork_len) == -1 ) {105 cork_old = -1;106 } else {107 setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_new, sizeof(int));108 }109 #endif110 111 roar_debug_warn_obsolete("roar_file_send_raw", "roar_vio_copy_data", NULL);112 113 #ifdef ROAR_HAVE_LINUX_SENDFILE114 while ((ret = sendfile(out, in, NULL, BUFMAX)) > 0)115 r += ret;116 #endif117 118 // TODO: try mmap here!119 120 while ((len = read(in, buf, BUFFERSIZE)) > 0)121 r += write(out, buf, len);122 123 #if defined(__linux__) && defined(ROAR_HAVE_IPV4)124 if ( cork_old != -1 )125 setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, cork_len);126 #endif127 return r;128 #else129 return -1;130 #endif131 }132 133 85 char * roar_cdromdevice (void) { 134 86 char * k;
Note: See TracChangeset
for help on using the changeset viewer.