]> 4ch.mooo.com Git - 16.git/blob - src/lib/dl/ext/speex/skeleton.h
meh did some cleanings and i will work on mapread to mm thingy sometime soon! oops...
[16.git] / src / lib / dl / ext / speex / skeleton.h
1 /*
2  * skeleton.h
3  * author: Tahseen Mohammad
4  */
5
6 #ifndef _SKELETON_H
7 #define _SKELETON_H
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 #ifdef WIN32
14 #define snprintf _snprintf
15 #endif
16
17 #include <ext/libogg/ogg.h>
18
19 #define SKELETON_VERSION_MAJOR 3
20 #define SKELETON_VERSION_MINOR 0
21 #define FISHEAD_IDENTIFIER "fishead\0"
22 #define FISBONE_IDENTIFIER "fisbone\0"
23 #define FISHEAD_SIZE 64
24 #define FISBONE_SIZE 52
25 #define FISBONE_MESSAGE_HEADER_OFFSET 44
26
27 /* fishead_packet holds a fishead header packet. */
28 typedef struct {
29     ogg_uint16_t version_major;                             /* skeleton version major */
30     ogg_uint16_t version_minor;                             /* skeleton version minor */
31     /* Start time of the presentation
32      * For a new stream presentationtime & basetime is same. */
33     ogg_int64_t ptime_n;                                    /* presentation time numerator */
34     ogg_int64_t ptime_d;                                    /* presentation time denominator */
35     ogg_int64_t btime_n;                                    /* basetime numerator */
36     ogg_int64_t btime_d;                                    /* basetime denominator */
37     /* will holds the time of origin of the stream, a 20 bit field. */
38     unsigned char UTC[20];
39 } fishead_packet;
40
41 /* fisbone_packet holds a fisbone header packet. */
42 typedef struct {
43     ogg_uint32_t serial_no;                                 /* serial no of the corresponding stream */
44     ogg_uint32_t nr_header_packet;                      /* number of header packets */
45     /* granule rate is the temporal resolution of the logical bitstream */
46     ogg_int64_t granule_rate_n;                            /* granule rate numerator */
47     ogg_int64_t granule_rate_d;                            /* granule rate denominator */
48     ogg_int64_t start_granule;                             /* start granule value */
49     ogg_uint32_t preroll;                                   /* preroll */
50     unsigned char granule_shift;                            /* 1 byte value holding the granule shift */
51     char *message_header_fields;                            /* holds all the message header fields */
52     /* current total size of the message header fields, for realloc purpose, initially zero */
53     ogg_uint32_t current_header_size;
54 } fisbone_packet;
55
56 extern int write_ogg_page_to_file(ogg_page *og, FILE *out);
57 extern int add_message_header_field(fisbone_packet *fp, char *header_key, char *header_value);
58 /* remember to deallocate the returned ogg_packet properly */
59 extern ogg_packet ogg_from_fishead(fishead_packet *fp);
60 extern ogg_packet ogg_from_fisbone(fisbone_packet *fp);
61 extern fishead_packet fishead_from_ogg(ogg_packet *op);
62 extern fisbone_packet fisbone_from_ogg(ogg_packet *op);
63 extern int add_fishead_to_stream(ogg_stream_state *os, fishead_packet *fp);
64 extern int add_fisbone_to_stream(ogg_stream_state *os, fisbone_packet *fp);
65 extern int add_eos_packet_to_stream(ogg_stream_state *os);
66 extern int flush_ogg_stream_to_file(ogg_stream_state *os, FILE *out);
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif  /* _SKELETON_H */
73
74
75
76
77
78