2010-05-02 17:19:42 +00:00
|
|
|
#ifndef _ASF_H
|
|
|
|
#define _ASF_H
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
/* ASF codec IDs */
|
2010-05-09 21:42:09 +00:00
|
|
|
#define ASF_CODEC_ID_WMAV1 0x160
|
|
|
|
#define ASF_CODEC_ID_WMAV2 0x161
|
|
|
|
#define ASF_CODEC_ID_WMAPRO 0x162
|
2010-08-07 17:55:02 +00:00
|
|
|
#define ASF_CODEC_ID_WMAVOICE 0x00A
|
2010-05-02 17:19:42 +00:00
|
|
|
|
|
|
|
enum asf_error_e {
|
|
|
|
ASF_ERROR_INTERNAL = -1, /* incorrect input to API calls */
|
|
|
|
ASF_ERROR_OUTOFMEM = -2, /* some malloc inside program failed */
|
|
|
|
ASF_ERROR_EOF = -3, /* unexpected end of file */
|
|
|
|
ASF_ERROR_IO = -4, /* error reading or writing to file */
|
|
|
|
ASF_ERROR_INVALID_LENGTH = -5, /* length value conflict in input data */
|
|
|
|
ASF_ERROR_INVALID_VALUE = -6, /* other value conflict in input data */
|
|
|
|
ASF_ERROR_INVALID_OBJECT = -7, /* ASF object missing or in wrong place */
|
|
|
|
ASF_ERROR_OBJECT_SIZE = -8, /* invalid ASF object size (too small) */
|
|
|
|
ASF_ERROR_SEEKABLE = -9, /* file not seekable */
|
2010-05-02 18:27:01 +00:00
|
|
|
ASF_ERROR_SEEK = -10, /* file is seekable but seeking failed */
|
|
|
|
ASF_ERROR_ENCRYPTED = -11 /* file is encrypted */
|
2010-05-02 17:19:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct asf_waveformatex_s {
|
|
|
|
uint32_t packet_size;
|
|
|
|
int audiostream;
|
|
|
|
uint16_t codec_id;
|
|
|
|
uint16_t channels;
|
|
|
|
uint32_t rate;
|
|
|
|
uint32_t bitrate;
|
|
|
|
uint16_t blockalign;
|
|
|
|
uint16_t bitspersample;
|
|
|
|
uint16_t datalen;
|
2010-05-21 15:51:22 +00:00
|
|
|
uint16_t numpackets;
|
2010-08-07 17:55:02 +00:00
|
|
|
uint8_t data[46];
|
2010-05-02 17:19:42 +00:00
|
|
|
};
|
|
|
|
typedef struct asf_waveformatex_s asf_waveformatex_t;
|
|
|
|
|
|
|
|
int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlength,
|
2010-05-02 20:07:11 +00:00
|
|
|
asf_waveformatex_t* wfx);
|
2010-05-02 17:19:42 +00:00
|
|
|
|
2010-05-02 20:07:11 +00:00
|
|
|
int asf_get_timestamp(int *duration);
|
|
|
|
|
2010-05-21 16:05:28 +00:00
|
|
|
int asf_seek(int ms, asf_waveformatex_t* wfx);
|
2010-05-21 15:51:22 +00:00
|
|
|
|
2010-05-02 18:27:01 +00:00
|
|
|
|
|
|
|
#endif /* _ASF_H */
|