Audacity 3.2.0
Classes | Typedefs | Functions | Variables
anonymous_namespace{ImportMP3_MPG123.cpp} Namespace Reference

Classes

class  MP3ImportFileHandle
 
class  MP3ImportPlugin
 

Typedefs

using NewChannelGroup = std::vector< std::shared_ptr< WaveTrack > >
 

Functions

wxString GetId3v2Genre (Tags &tags, const char *genre)
 
wxSeekMode GetWXSeekMode (int whence)
 

Variables

static const auto exts = { wxT("mp3"), wxT("mp2"), wxT("mpa") }
 
static Importer::RegisteredImportPlugin registered
 

Typedef Documentation

◆ NewChannelGroup

using anonymous_namespace{ImportMP3_MPG123.cpp}::NewChannelGroup = typedef std::vector< std::shared_ptr<WaveTrack> >

Definition at line 124 of file ImportMP3_MPG123.cpp.

Function Documentation

◆ GetId3v2Genre()

wxString anonymous_namespace{ImportMP3_MPG123.cpp}::GetId3v2Genre ( Tags tags,
const char *  genre 
)

Definition at line 51 of file ImportMP3_MPG123.cpp.

52{
53 if (genre == nullptr)
54 return {};
55
56 // It was observed, however, that Genre can use a different format
57 if (genre[0] != '(')
58 // We consider the string to be a genre name
59 return audacity::ToWXString(genre);
60
61 auto it = genre;
62 auto end = it + std::strlen(it);
63
64 while (*it == '(')
65 {
66 int tagValue;
67 auto result = FromChars(++it, end, tagValue);
68
69 // Parsing failed, consider it to be the genre
70 if (result.ec != std::errc {})
71 break;
72
73 const auto parsedGenre = tags.GetGenre(tagValue);
74
75 if (!parsedGenre.empty())
76 return parsedGenre;
77
78 it = result.ptr;
79
80 // Nothing left to parse
81 if (it == end)
82 break;
83
84 // Unexpected symbol in the tag
85 if (*it != ')')
86 break;
87
88 ++it;
89 }
90
91 if (it != end)
92 return audacity::ToWXString(it);
93
94 return audacity::ToWXString(genre);
95}
FromCharsResult FromChars(const char *buffer, const char *last, float &value) noexcept
Parse a string into a single precision floating point value, always uses the dot as decimal.
Definition: FromChars.cpp:153
wxString GetGenre(int value)
Definition: Tags.cpp:383
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
wxString ToWXString(const std::string &str)

References PackedArray::end(), FromChars(), Tags::GetGenre(), and audacity::ToWXString().

Referenced by anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::ReadTags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWXSeekMode()

wxSeekMode anonymous_namespace{ImportMP3_MPG123.cpp}::GetWXSeekMode ( int  whence)

Definition at line 505 of file ImportMP3_MPG123.cpp.

506{
507 switch (whence)
508 {
509 case SEEK_SET:
510 return wxFromStart;
511 case SEEK_CUR:
512 return wxFromCurrent;
513 case SEEK_END:
514 return wxFromEnd;
515 default:
516 // We have covered all the lseek whence modes defined by POSIX
517 // so this branch should not be reachable
518 assert(false);
519 return wxFromStart;
520 }
521}

Referenced by anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::SeekCallback().

Here is the caller graph for this function:

Variable Documentation

◆ exts

const auto anonymous_namespace{ImportMP3_MPG123.cpp}::exts = { wxT("mp3"), wxT("mp2"), wxT("mpa") }
static

Definition at line 41 of file ImportMP3_MPG123.cpp.

◆ registered

Importer::RegisteredImportPlugin anonymous_namespace{ImportMP3_MPG123.cpp}::registered
static
Initial value:
{
"MP3",
std::make_unique<MP3ImportPlugin>()
}

Definition at line 178 of file ImportMP3_MPG123.cpp.