1 /** 2 * Copyright (C) 2011-2012 Juho Vähä-Herttua 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 */ 14 15 #ifndef RAOP_BUFFER_H 16 #define RAOP_BUFFER_H 17 18 typedef struct raop_buffer_s raop_buffer_t; 19 20 /* From ALACMagicCookieDescription.txt at http://http://alac.macosforge.org/ */ 21 typedef struct { 22 unsigned int frameLength; 23 unsigned char compatibleVersion; 24 unsigned char bitDepth; 25 unsigned char pb; 26 unsigned char mb; 27 unsigned char kb; 28 unsigned char numChannels; 29 unsigned short maxRun; 30 unsigned int maxFrameBytes; 31 unsigned int avgBitRate; 32 unsigned int sampleRate; 33 } ALACSpecificConfig; 34 35 typedef int (*raop_resend_cb_t)(void *opaque, unsigned short seqno, unsigned short count); 36 37 raop_buffer_t *raop_buffer_init(const char *rtpmap, 38 const char *fmtp, 39 const unsigned char *aeskey, 40 const unsigned char *aesiv); 41 42 const ALACSpecificConfig *raop_buffer_get_config(raop_buffer_t *raop_buffer); 43 int raop_buffer_queue(raop_buffer_t *raop_buffer, unsigned char *data, unsigned short datalen, int use_seqnum); 44 const void *raop_buffer_dequeue(raop_buffer_t *raop_buffer, int *length, int no_resend); 45 void raop_buffer_handle_resends(raop_buffer_t *raop_buffer, raop_resend_cb_t resend_cb, void *opaque); 46 void raop_buffer_flush(raop_buffer_t *raop_buffer, int next_seq); 47 48 void raop_buffer_destroy(raop_buffer_t *raop_buffer); 49 50 #endif 51