paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Fields
audio_format_handler Struct Reference

Structure for audio format handling. More...

#include <afh.h>

Data Fields

const char *const * suffixes
 Typical file endings for files that can be handled by this afh. More...
 
int(* get_file_info )(char *map, size_t numbytes, int fd, struct afh_info *afhi)
 Check if this audio format handler can handle the file. More...
 
void(* get_header )(void *map, size_t mapsize, char **buf, size_t *len)
 Optional, used for header-rewriting. More...
 
int(* open )(const void *map, size_t mapsize, void **afh_context)
 An audio format handler may signify support for dynamic chunks by defining ->get_chunk below. More...
 
int(* get_chunk )(uint32_t chunk_num, void *afh_context, const char **buf, uint32_t *len)
 Return a reference to one chunk. More...
 
void(* close )(void *afh_context)
 Deallocate the resources occupied by ->open(). More...
 
int(* rewrite_tags )(const char *map, size_t mapsize, struct taginfo *tags, int output_fd, const char *filename)
 Write audio file with altered tags, optional. More...
 

Detailed Description

Structure for audio format handling.

There's one such struct for each supported audio format. Initially, only name and init are defined. During the startup process, para_server calls the init function of each audio format handler which is expected to fill in the other part of this struct.

Field Documentation

◆ suffixes

const char* const* suffixes

Typical file endings for files that can be handled by this afh.

Referenced by guess_audio_format().

◆ get_file_info

int(* get_file_info) (char *map, size_t numbytes, int fd, struct afh_info *afhi)

Check if this audio format handler can handle the file.

This is a pointer to a function returning whether a given file is valid for this audio format. A negative return value indicates that this audio format handler is unable to decode the given file. On success, the function must return a positive value and fill in the given struct afh_info.

See also
struct afh_info.

◆ get_header

void(* get_header) (void *map, size_t mapsize, char **buf, size_t *len)

Optional, used for header-rewriting.

See afh_get_header().

Referenced by afh_free_header(), and afh_get_header().

◆ open

int(* open) (const void *map, size_t mapsize, void **afh_context)

An audio format handler may signify support for dynamic chunks by defining ->get_chunk below.

In this case the vss calls ->open() at BOS, ->get_chunk() for each chunk while streaming, and ->close() at EOS. The chunk table is not accessed at all.

The function may return its (opaque) context through the last argument. The returned pointer is passed to subsequent calls to ->get_chunk() and ->close().

Referenced by afh_get_chunk().

◆ get_chunk

int(* get_chunk) (uint32_t chunk_num, void *afh_context, const char **buf, uint32_t *len)

Return a reference to one chunk.

The returned pointer points to a portion of the memory mapped audio file. The caller must not call free() on it.

Referenced by afh_get_chunk(), and afh_supports_dynamic_chunks().

◆ close

void(* close) (void *afh_context)

Deallocate the resources occupied by ->open().

Referenced by afh_close(), and afh_get_chunk().

◆ rewrite_tags

int(* rewrite_tags) (const char *map, size_t mapsize, struct taginfo *tags, int output_fd, const char *filename)

Write audio file with altered tags, optional.

The output file descriptor has been opened by the caller and must not be closed in this function.

Referenced by afh_rewrite_tags().


The documentation for this struct was generated from the following file: