gcrypt: Allocate a secmem pool at startup.
[paraslash.git] / ogg_afh_common.h
1 /* Copyright (C) 2010 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
2
3 /**
4  * \file ogg_afh_common.h Structures and prototypes common to audio format
5  * handlers that use the ogg container format.
6  */
7
8 struct oac_custom_header *oac_custom_header_new(void);
9 void oac_custom_header_init(int serial, struct oac_custom_header *h);
10 int oac_custom_header_append(ogg_packet *op, struct oac_custom_header *h);
11 void oac_custom_header_flush(struct oac_custom_header *h);
12 size_t oac_custom_header_get(char **buf, struct oac_custom_header *h);
13
14 /**
15  * Callback structure provided by audio format handlers.
16  *
17  * All audio formats which utilize the ogg container format define a callback
18  * function whose purpose is to extract the meta information about the audio
19  * file from the first few ogg packets of the bitstream.
20  */
21 struct oac_callback_info {
22         /**
23          * ogg_get_file_info() calls this function for the first three ogg
24          * packets, or until the callback returns a non-positive value. If it
25          * returns negative, the audio file was not recognized by the audio
26          * format handler. If it returns zero, the audio file is considered
27          * valid, and no further processing by the callback is needed. In this
28          * case the header chunk, i.e. chunk number zero, is defined as the
29          * concatenation of all packets that have been processed by the
30          * callback.
31          */
32         int (*packet_callback)(ogg_packet *packet, int packet_num,
33                 int serial, struct afh_info *afhi, void *private_data);
34         /** Data specific to the audio format handler. */
35         void *private_data;
36 };
37
38 int oac_get_file_info(char *map, size_t numbytes, struct afh_info *afhi,
39                 struct oac_callback_info *ci);
40 int oac_rewrite_tags(const char *map, size_t mapsize, int fd,
41                 char *meta_packet, size_t meta_sz);