1 #ifndef _ASF_H 2 #define _ASF_H 3 4 #include <inttypes.h> 5 #include "../../deadbeef.h" 6 7 /* ASF codec IDs */ 8 #define ASF_CODEC_ID_WMAV1 0x160 9 #define ASF_CODEC_ID_WMAV2 0x161 10 #define ASF_CODEC_ID_WMAPRO 0x162 11 #define ASF_CODEC_ID_WMAVOICE 0x00A 12 13 enum asf_error_e { 14 ASF_ERROR_INTERNAL = -1, /* incorrect input to API calls */ 15 ASF_ERROR_OUTOFMEM = -2, /* some malloc inside program failed */ 16 ASF_ERROR_EOF = -3, /* unexpected end of file */ 17 ASF_ERROR_IO = -4, /* error reading or writing to file */ 18 ASF_ERROR_INVALID_LENGTH = -5, /* length value conflict in input data */ 19 ASF_ERROR_INVALID_VALUE = -6, /* other value conflict in input data */ 20 ASF_ERROR_INVALID_OBJECT = -7, /* ASF object missing or in wrong place */ 21 ASF_ERROR_OBJECT_SIZE = -8, /* invalid ASF object size (too small) */ 22 ASF_ERROR_SEEKABLE = -9, /* file not seekable */ 23 ASF_ERROR_SEEK = -10, /* file is seekable but seeking failed */ 24 ASF_ERROR_ENCRYPTED = -11 /* file is encrypted */ 25 }; 26 27 struct asf_waveformatex_s { 28 uint32_t packet_size; 29 uint32_t max_packet_size; 30 int audiostream; 31 uint16_t codec_id; 32 uint16_t channels; 33 uint32_t rate; 34 uint32_t bitrate; 35 uint16_t blockalign; 36 uint16_t bitspersample; 37 uint16_t datalen; 38 uint64_t numpackets; 39 uint8_t data[46]; 40 uint64_t play_duration; 41 uint64_t send_duration; 42 uint64_t preroll; 43 uint32_t flags; 44 int32_t first_frame_timestamp; 45 }; 46 typedef struct asf_waveformatex_s asf_waveformatex_t; 47 48 int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlength, 49 asf_waveformatex_t* wfx, DB_FILE *fp); 50 51 int asf_get_timestamp(int *duration, DB_FILE *fp); 52 53 int asf_seek(int ms, asf_waveformatex_t* wfx, DB_FILE *fp, int64_t first_frame_offset, int *skip_ms); 54 55 #endif /* _ASF_H */ 56