Changeset 5223:3326fb359ffe in roaraudio for libroar/file.c


Ignore:
Timestamp:
11/12/11 12:44:52 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Removed roar_file_send_raw() and roarcatsendfile.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/file.c

    r5222 r5223  
    3535 
    3636#include "libroar.h" 
    37  
    38 #define BUFFERSIZE  8192 
    39 #define BUFMAX     65536 
    40  
    41 #ifdef ROAR_HAVE_IO_POSIX 
    42 #define _CAN_OPERATE 
    43 #endif 
    4437 
    4538int roar_file_codecdetect(char * buf, int len) { 
     
    9083} 
    9184 
    92 ssize_t roar_file_send_raw (int out, int in) { 
    93 #ifdef _CAN_OPERATE 
    94  ssize_t r = 0; 
    95 #ifdef ROAR_HAVE_LINUX_SENDFILE 
    96  ssize_t ret; 
    97 #endif 
    98  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 #endif 
    110  
    111  roar_debug_warn_obsolete("roar_file_send_raw", "roar_vio_copy_data", NULL); 
    112  
    113 #ifdef ROAR_HAVE_LINUX_SENDFILE 
    114  while ((ret = sendfile(out, in, NULL, BUFMAX)) > 0) 
    115   r += ret; 
    116 #endif 
    117  
    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 #endif 
    127  return r; 
    128 #else 
    129  return -1; 
    130 #endif 
    131 } 
    132  
    13385char  * roar_cdromdevice     (void) { 
    13486 char * k; 
Note: See TracChangeset for help on using the changeset viewer.