mplib.c File Reference
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include "xmalloc.h"
#include "mplib.h"
#include "mplib_s.h"
#include "mplib_s.c"
Go to the source code of this file.
Defines | |
#define | FLD(str1, str2, str3, str4) |
Functions | |
mpeg_header * | mp_get_mpeg_header_from_file (const char *filename) |
Allocates a MPEG header structure from a file. | |
mpeg_header * | mp_get_mpeg_header_from_fd (int fd) |
Gets the header structure from a file descriptor. | |
char * | mp_get_str_version (const mpeg_header *h) |
Allocates a label with the appropriate header field value as a string. | |
char * | mp_get_str_layer (const mpeg_header *h) |
Allocates a label with the appropriate header field value as a string. | |
char * | mp_get_str_bitrate (const mpeg_header *h) |
Allocates a label with the appropriate header field value as a string. | |
char * | mp_get_str_samplingfreq (const mpeg_header *h) |
Allocates a label with the appropriate header field value as a string. | |
char * | mp_get_str_mode (const mpeg_header *h) |
Allocates a label with the appropriate header field value as a string. | |
id3_tag_list * | mp_get_tag_list_from_mem (void *buf, size_t size) |
Allocates and fills a list of tags found in the given memory buffer. | |
id3_tag_list * | mp_get_tag_list_from_file (const char *filename) |
Allocates and fills a list of tags found in the given file. | |
id3_tag_list * | mp_get_tag_list_from_fd (int fd) |
Allocates and fills a list of tags found in the given file. | |
id3_tag_list * | mp_get_tag_list (size_t(*read_func)(void *, size_t, void *), off_t(*lseek_func)(off_t, int, void *), void *arg) |
Allocates and fills a list of tags using read and seek wrapper functions. | |
id3_content * | mp_get_content (const id3_tag *tag, int field) |
Gets the first content found of a specified field in the given tag and allocates a struct. | |
id3_content * | mp_get_content_at_pos (const id3_tag *tag, int field, int pos) |
It's posible that a tag has multiple ocurances of a field, use this function to get a specified field by position. | |
id3_content * | mp_get_content_custom (const id3_tag *tag, const char *field) |
Gets a custom fields content and allocates a struct. | |
id3_content * | mp_get_content_custom_at_pos (const id3_tag *tag, const char *field, int pos) |
See mp_get_content_at_pos() and mp_get_content_custom(). | |
int | mp_set_content (id3_tag *tag, const int field, id3_content *new_content) |
Copys the value of a specified field into the given tag. | |
int | mp_set_content_at_pos (id3_tag *tag, const int field, id3_content *new_content, int pos) |
Copys the value of a specified field into the given tag. | |
int | mp_set_custom_content (id3_tag *tag, char *field, id3_content *new_content) |
Sets up a new custom field with the given value. | |
int | mp_set_custom_content_at_pos (id3_tag *tag, char *field, id3_content *new_content, int pos) |
Sets up a new custom field with the given value on a certain frame position. | |
int | mp_write_to_file (const id3_tag_list *tag_list, const char *filename) |
Writes the tag to the specified file. | |
int | mp_write_to_fd (const id3_tag_list *tag_list, const int fd) |
Writes the tag to the specified file. | |
int | mp_del_tags_from_file (const char *filename) |
Deletes all tags in file. | |
int | mp_del_tags_from_fd (const int fd) |
Deletes all tags in file. | |
int | mp_del_tags_by_ver_from_file (const char *filename, const int version) |
Deletes all tags in file with the specified version. | |
int | mp_del_tags_by_ver_from_fd (const int fd, const int version) |
Deletes all tags in file with the specified version. | |
int | mp_convert_to_v2 (id3_tag *tag) |
Converts a tag to id3v2 tag format. | |
int | mp_convert_to_v1 (id3_tag *tag) |
Converts a tag to id3v1 tag format. | |
int | mp_is_valid_v1_value (int field, char *value) |
Checks wether the given value would be a valid v1 field. | |
void | mp_free_list (id3_tag_list *list) |
Frees a tag list beginning with the given element XXX. | |
id3_tag * | mp_alloc_tag (void) |
Gets a new allocated tag. | |
id3_tag * | mp_alloc_tag_with_version (int v) |
Gets a new allocated tag with the specified version. | |
void | mp_free_tag (id3_tag *tag) |
Frees tag struct. | |
void | mp_free_content (id3_content *content) |
Frees a content struct. | |
void | mp_free_text_content (id3_text_content *content) |
Frees a text struct. | |
void | mp_free_comment_content (id3_comment_content *content) |
Frees a comment struct. |
Define Documentation
|
Value: case str1:\ if(!new_content) v1->str2 = NULL;\ else\ {\ id3_text_content *tc = str4(new_content);\ if(strlen(tc->text) > str3 || tc->encoding != ISO_8859_1)\ {\ mp_convert_to_v2(tag);\ mp_free_text_content(tc);\ return mp_set_content(tag, field, new_content);\ }\ \ v1->str2 = tc->text;\ xfree(tc);\ }\ break; |
Function Documentation
|
Gets a new allocated tag.
|
|
Gets a new allocated tag with the specified version.
|
|
Converts a tag to id3v1 tag format.
|
|
Converts a tag to id3v2 tag format.
|
|
Deletes all tags in file with the specified version.
|
|
Deletes all tags in file with the specified version.
|
|
Deletes all tags in file.
|
|
Deletes all tags in file.
|
|
Frees a comment struct.
|
|
Frees a content struct.
|
|
Frees a tag list beginning with the given element XXX.
|
|
Frees tag struct.
|
|
Frees a text struct.
|
|
Gets the first content found of a specified field in the given tag and allocates a struct.
|
|
It's posible that a tag has multiple ocurances of a field, use this function to get a specified field by position. The first ocurance of the field in the tag is 0. e.g.: To get the third comment in an id3v2 tag use mp_get_content_at_pos(tag, MP_COMMENT, 2);
|
|
Gets a custom fields content and allocates a struct. This function can only be applied to ID3v2 tags. It will lookup a by the given identifier and return its content.
|
|
See mp_get_content_at_pos() and mp_get_content_custom().
|
|
Gets the header structure from a file descriptor.
|
|
Allocates a MPEG header structure from a file.
|
|
Allocates a label with the appropriate header field value as a string.
|
|
Allocates a label with the appropriate header field value as a string.
|
|
Allocates a label with the appropriate header field value as a string.
|
|
Allocates a label with the appropriate header field value as a string.
|
|
Allocates a label with the appropriate header field value as a string.
|
|
Allocates and fills a list of tags using read and seek wrapper functions.
|
|
Allocates and fills a list of tags found in the given file. This list will contain at least one and at most two tags or is NULL if no tags have been found. This function prepares argument and calls mp_get_tag_list() function.
|
|
Allocates and fills a list of tags found in the given file. This list will contain at least one and at most two tags or is NULL if no tags have been found. This function prepares argument and calls mp_get_tag_list() function.
|
|
Allocates and fills a list of tags found in the given memory buffer. This list will contain at least one and at most two tags or is NULL if no tags have been found. This function prepares argument and calls mp_get_tag_list() function.
|
|
Checks wether the given value would be a valid v1 field.
|
|
Copys the value of a specified field into the given tag. The content argument may be freed after using this function. The way a content is represented in a tag depends from the tags version and kind of field. I.e. it may be nessecary to represent a track number as a binary value in a v1 tag or to embeded it into a frame for a v2 tag. The caller just needs to give the correct identifier with the value as a id3_content and to take care of freeing the id3_content value afterwards.
|
|
Copys the value of a specified field into the given tag. This function allows to specify a certain frame position.
|
|
Sets up a new custom field with the given value.
|
|
Sets up a new custom field with the given value on a certain frame position.
|
|
Writes the tag to the specified file.
|
|
Writes the tag to the specified file.
|