kwave  18.07.70
Kwave::FlacEncoder::VorbisCommentContainer Class Reference

#include <FlacEncoder.h>

Collaboration diagram for Kwave::FlacEncoder::VorbisCommentContainer:
Collaboration graph

Public Member Functions

 VorbisCommentContainer ()
 
virtual ~VorbisCommentContainer ()
 
void add (const QString &tag, const QString &value)
 
FLAC__StreamMetadata * data ()
 

Private Attributes

FLAC__StreamMetadata * m_vc
 

Detailed Description

Definition at line 109 of file FlacEncoder.h.

Constructor & Destructor Documentation

◆ VorbisCommentContainer()

Kwave::FlacEncoder::VorbisCommentContainer::VorbisCommentContainer ( )

Constructor

Definition at line 96 of file FlacEncoder.cpp.

References m_vc.

97  :m_vc(Q_NULLPTR)
98 {
99  m_vc = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
100  Q_ASSERT(m_vc);
101 }

◆ ~VorbisCommentContainer()

Kwave::FlacEncoder::VorbisCommentContainer::~VorbisCommentContainer ( )
virtual

Destructor

Definition at line 104 of file FlacEncoder.cpp.

References m_vc.

105 {
106  if (m_vc) {
107  // clean up all vorbis comments
108  }
109 }

Member Function Documentation

◆ add()

void Kwave::FlacEncoder::VorbisCommentContainer::add ( const QString &  tag,
const QString &  value 
)

add a new comment

Parameters
tagname of the vorbis tag, as string
valuethe value of the tag, as string

Definition at line 112 of file FlacEncoder.cpp.

References _, and m_vc.

Referenced by Kwave::FlacEncoder::encodeMetaData().

114 {
115  Q_ASSERT(m_vc);
116  if (!m_vc) return;
117 
118  QString s;
119  s = tag + _("=") + value;
120 
121  // make a plain C string out of it, containing UTF-8
122  QByteArray val = s.toUtf8();
123 
124  // put it into a vorbis_comment_entry structure
125  FLAC__StreamMetadata_VorbisComment_Entry entry;
126  entry.length = val.length(); // in bytes, not characters !
127  entry.entry = reinterpret_cast<FLAC__byte *>(val.data());
128 
129  // insert the comment into the list
130  unsigned int count = m_vc->data.vorbis_comment.num_comments;
131  bool ok = FLAC__metadata_object_vorbiscomment_insert_comment(
132  m_vc, count, entry, true);
133 
134  Q_ASSERT(ok);
135  Q_UNUSED(ok);
136 }
#define _(m)
Definition: memcpy.c:66
Here is the caller graph for this function:

◆ data()

FLAC__StreamMetadata * Kwave::FlacEncoder::VorbisCommentContainer::data ( )

Returns a pointer to the FLAC metadata

Definition at line 139 of file FlacEncoder.cpp.

References m_vc.

Referenced by Kwave::FlacEncoder::encodeMetaData().

140 {
141  return m_vc;
142 }
Here is the caller graph for this function:

Member Data Documentation

◆ m_vc

FLAC__StreamMetadata* Kwave::FlacEncoder::VorbisCommentContainer::m_vc
private

list of metadata objects

Definition at line 131 of file FlacEncoder.h.

Referenced by add(), data(), VorbisCommentContainer(), and ~VorbisCommentContainer().


The documentation for this class was generated from the following files: