8000 Add taglib_default_file_extensions() to C bindings by redrabbit · Pull Request #815 · taglib/taglib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add taglib_default_file_extensions() to C bindings #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bindings/c/tag_c.cpp
8000
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ namespace
bool unicodeStrings = true;
bool stringManagementEnabled = true;

const StringList defaultFileExtensions = FileRef::defaultFileExtensions();

char *stringToCharArray(const String &s)
{
const std::string str = s.to8Bit(unicodeStrings);
Expand Down Expand Up @@ -291,6 +293,16 @@ int taglib_audioproperties_channels(const TagLib_AudioProperties *audioPropertie
return p->channels();
}

const char **taglib_default_file_extensions(unsigned int *size)
{
*size = defaultFileExtensions.size();
const char** dest = (const char**)malloc(*size * sizeof(char*));
for(unsigned int i = 0; i < *size; ++i) {
dest[i] = defaultFileExtensions[i].toCString();
}
return dest;
}

void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding)
{
String::Type type = String::Latin1;
Expand Down
7 changes: 7 additions & 0 deletions bindings/c/tag_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ TAGLIB_C_EXPORT int taglib_audioproperties_samplerate(const TagLib_AudioProperti
*/
TAGLIB_C_EXPORT int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties);

/*!
* Returns the list of file extensions that are used by default.
*
* \note This array of strings should be freed using taglib_free().
*/
TAGLIB_C_EXPORT const char **taglib_default_file_extensions(unsigned int *size);

/*******************************************************************************
* Special convenience ID3v2 functions
*******************************************************************************/
Expand Down
0