|
Paraslash Audio Streaming |
About News Download Documentation Development |
Macros | |
#define | GET_NUM_DIGITS(x, num) |
Functions | |
int | aft_get_row_of_path (const char *path, struct osl_row **row) |
int | get_afsi_of_row (const struct osl_row *row, struct afs_info *afsi) |
int | get_audio_file_path_of_row (const struct osl_row *row, char **path) |
int | get_afhi_of_row (const struct osl_row *row, struct afh_info *afhi) |
int | load_afd (int shmid, struct audio_file_data *afd) |
void | free_status_items (void) |
int | open_and_update_audio_file (int *fd) |
int | audio_file_loop (void *private_data, osl_rbtree_loop_func *func) |
int | send_afs_status (struct command_context *cc, int parser_friendly) |
int | aft_check_callback (struct afs_callback_arg *aca) |
int | aft_check_attributes (uint64_t att_mask, struct para_buffer *pb) |
Variables | |
const struct server_cmd_user_data | lsg_server_cmd_com_ls_user_data = { .handler = com_ls } |
const struct server_cmd_user_data | lsg_server_cmd_com_add_user_data = { .handler = com_add } |
const struct server_cmd_user_data | lsg_server_cmd_com_touch_user_data = { .handler = com_touch } |
const struct server_cmd_user_data | lsg_server_cmd_com_rm_user_data = { .handler = com_rm } |
const struct server_cmd_user_data | lsg_server_cmd_com_cpsi_user_data = { .handler = com_cpsi } |
const struct server_cmd_user_data | lsg_server_cmd_com_setatt_user_data = { .handler = com_setatt } |
const struct afs_table_operations | aft_ops |
#define GET_NUM_DIGITS | ( | x, | |
num | |||
) |
Compute the number of (decimal) digits of a number.
enum ls_sorting_method |
The different sorting methods of the ls command.
enum ls_listing_mode |
enum afsi_offsets |
Describes the layout of the mmapped-afs info struct.
The columns of the audio file table.
enum afhi_offsets |
The on-disk layout of a afhi struct.
The format of the data stored by save_audio_file_data().
int aft_get_row_of_path | ( | const char * | path, |
struct osl_row ** | row | ||
) |
Get the row of the audio file table corresponding to the given path.
path | The full path of the audio file. |
row | Result pointer. |
References osl().
int get_afsi_of_row | ( | const struct osl_row * | row, |
struct afs_info * | afsi | ||
) |
Get the audio file selector info, given a row of the audio file table.
row | Pointer to a row in the audio file table. |
afsi | Result pointer. |
int get_audio_file_path_of_row | ( | const struct osl_row * | row, |
char ** | path | ||
) |
int get_afhi_of_row | ( | const struct osl_row * | row, |
struct afh_info * | afhi | ||
) |
Get the audio format handler info, given a row of the audio file table.
row | Pointer to a row of the audio file table. |
afhi | Result pointer. |
After the call the members of the afhi structure point to mapped memory which is owned by the osl table, Hence the caller must not attempt to free this memory by calling clear_afhi().
References osl().
int load_afd | ( | int | shmid, |
struct audio_file_data * | afd | ||
) |
Extract an audio file data structure from a shared memory area.
This is called by the virtual streaming system each time a new audio file is about to be streamed.
shmid | Identifies a serialized version of the audio file data. |
afd | Result pointer. |
Attach the shared memory area and populate the fields of the audio file data structure from the contents of the area, allocating the necessary memory on the heap. Then detach the area.
References ATTACH_RO, shm_attach(), and shm_size().
void free_status_items | ( | void | ) |
int open_and_update_audio_file | ( | int * | fd | ) |
Open the audio file with highest score and set up an afd structure.
This determines and opens the next audio file, verifies that it did not change by comparing the recomputed the hash value of the file contents against the value stored in the audio file table. If all goes well, it creates a shared memory area containing the serialized version of the afd structure, including the chunk table, if any. The caller can then send the ID of this area and the open fd to the server process.
fd | Result pointer for the file descriptor of the audio file. |
On success, the numplayed field of the audio file selector info is increased and the lastplayed time is set to the current time. Finally, the score of the audio file is updated.
References HASH2_SIZE.
int audio_file_loop | ( | void * | private_data, |
osl_rbtree_loop_func * | func | ||
) |
Call the given function for each file in the audio file table.
private_data | An arbitrary data pointer, passed to func. |
func | The custom function to be called. |
References osl().
Referenced by aft_check_attributes(), and aft_check_callback().
int send_afs_status | ( | struct command_context * | cc, |
int | parser_friendly | ||
) |
Get the current afs status items from the afs process and send it.
cc | The command context, used e.g. for data encryption. |
parser_friendly | Whether parser-friendly output format should be used. |
As the contents of the afs status items change in time and the command handler only has a COW version created at fork time, it can not send up-to-date afs status items directly. Therefore the usual callback mechanism is used to pass the status items from the afs process to the command handler via a shared memory area and a pipe.
References send_callback_request().
int aft_check_callback | ( | struct afs_callback_arg * | aca | ) |
Check the audio file table for inconsistencies.
aca | Only ->pbout is used for diagnostics. |
References audio_file_loop(), para_printf(), and afs_callback_arg::pbout.
int aft_check_attributes | ( | uint64_t | att_mask, |
struct para_buffer * | pb | ||
) |
Iterate over all audio files and check the attribute bit mask.
att_mask | The mask of all valid attributes. |
pb | Used for reporting inconsistencies. |
This reads the attribute bit mask of each audio file from the afs info structure stored in the audio file table and verifies that all set bits are also turned on in att_mask, i.e., correspond to an attribute of the attribute table. Audio files for which this is not the case are reported via pb.
References audio_file_loop(), and para_printf().
const struct server_cmd_user_data lsg_server_cmd_com_ls_user_data = { .handler = com_ls } |
const struct server_cmd_user_data lsg_server_cmd_com_add_user_data = { .handler = com_add } |
const struct server_cmd_user_data lsg_server_cmd_com_touch_user_data = { .handler = com_touch } |
const struct server_cmd_user_data lsg_server_cmd_com_rm_user_data = { .handler = com_rm } |
const struct server_cmd_user_data lsg_server_cmd_com_cpsi_user_data = { .handler = com_cpsi } |
const struct server_cmd_user_data lsg_server_cmd_com_setatt_user_data = { .handler = com_setatt } |
const struct afs_table_operations aft_ops |
The audio file table contains information about known audio files.