redribben

bytesRead

Jul 9th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void) readStreamClientCallBackWithData:(CFReadStreamRef) stream
  2.                                  withType:(CFStreamEventType) type {
  3.    
  4.     if(type == kCFStreamEventHasBytesAvailable) {
  5.         UInt8 buffer[2048];
  6.         CFIndex bytesRead = CFReadStreamRead(stream, buffer, sizeof(buffer));
  7.        
  8.         if (bytesRead < 0) {
  9.             //nothing
  10.         }
  11.         // If zero bytes were read, wait for the EOF to come.
  12.         else if (bytesRead) {
  13.             // parse the data. this will call MyPropertyListenerProc and MyPacketsProc
  14.             // AudioFileStreamParseBytes function called when you have data to pass to the parser.
  15.             // Send the data to the parser sequentially and, if possible, without gaps.
  16.             OSStatus err = AudioFileStreamParseBytes(_audioData->audioFileStream, bytesRead, buffer, 0);
  17.             if (err) PRINTERROR("AudioFileStreamParseBytes");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment