Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
215213fc
Commit
215213fc
authored
May 09, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoder/vorbis: add wrapper class for vorbis_comment
parent
99d32dc0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
11 deletions
+65
-11
Makefile.am
Makefile.am
+1
-0
VorbisEncoderPlugin.cxx
src/encoder/plugins/VorbisEncoderPlugin.cxx
+6
-11
VorbisComment.hxx
src/lib/xiph/VorbisComment.hxx
+58
-0
No files found.
Makefile.am
View file @
215213fc
...
...
@@ -585,6 +585,7 @@ if HAVE_XIPH
noinst_LIBRARIES
+=
libxiph.a
libxiph_a_SOURCES
=
\
src/lib/xiph/VorbisComment.hxx
\
src/lib/xiph/VorbisComments.cxx src/lib/xiph/VorbisComments.hxx
\
src/lib/xiph/XiphTags.cxx src/lib/xiph/XiphTags.hxx
libxiph_a_CPPFLAGS
=
$(AM_CPPFLAGS)
\
...
...
src/encoder/plugins/VorbisEncoderPlugin.cxx
View file @
215213fc
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "VorbisEncoderPlugin.hxx"
#include "OggEncoder.hxx"
#include "lib/xiph/VorbisComment.hxx"
#include "AudioFormat.hxx"
#include "config/ConfigError.hxx"
#include "util/StringUtil.hxx"
...
...
@@ -202,11 +203,8 @@ VorbisEncoder::HeaderOut(vorbis_comment &vc)
void
VorbisEncoder
::
SendHeader
()
{
vorbis_comment
vc
;
vorbis_comment_init
(
&
vc
);
VorbisComment
vc
;
HeaderOut
(
vc
);
vorbis_comment_clear
(
&
vc
);
}
Encoder
*
...
...
@@ -260,24 +258,22 @@ VorbisEncoder::PreTag(gcc_unused Error &error)
}
static
void
copy_tag_to_vorbis_comment
(
vorbis_comment
*
vc
,
const
Tag
&
tag
)
copy_tag_to_vorbis_comment
(
VorbisComment
&
vc
,
const
Tag
&
tag
)
{
for
(
const
auto
&
item
:
tag
)
{
char
name
[
64
];
ToUpperASCII
(
name
,
tag_item_names
[
item
.
type
],
sizeof
(
name
));
v
orbis_comment_add_tag
(
vc
,
name
,
item
.
value
);
v
c
.
AddTag
(
name
,
item
.
value
);
}
}
bool
VorbisEncoder
::
SendTag
(
const
Tag
&
tag
,
gcc_unused
Error
&
error
)
{
vorbis_comment
comment
;
/* write the vorbis_comment object */
vorbis_comment_init
(
&
comment
)
;
copy_tag_to_vorbis_comment
(
&
comment
,
tag
);
VorbisComment
comment
;
copy_tag_to_vorbis_comment
(
comment
,
tag
);
/* reset ogg_stream_state and begin a new stream */
...
...
@@ -286,7 +282,6 @@ VorbisEncoder::SendTag(const Tag &tag, gcc_unused Error &error)
/* send that vorbis_comment to the ogg_stream_state */
HeaderOut
(
comment
);
vorbis_comment_clear
(
&
comment
);
return
true
;
}
...
...
src/lib/xiph/VorbisComment.hxx
0 → 100644
View file @
215213fc
/*
* Copyright 2003-2016 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_VORBIS_COMMENT_HXX
#define MPD_VORBIS_COMMENT_HXX
#include "check.h"
#include <vorbis/codec.h>
/**
* OO wrapper for a #vorbis_comment instance.
*/
class
VorbisComment
{
vorbis_comment
vc
;
public
:
VorbisComment
()
{
vorbis_comment_init
(
&
vc
);
}
~
VorbisComment
()
{
vorbis_comment_clear
(
&
vc
);
}
VorbisComment
(
const
VorbisComment
&
)
=
delete
;
VorbisComment
&
operator
=
(
const
VorbisComment
&
)
=
delete
;
operator
vorbis_comment
&
()
{
return
vc
;
}
operator
vorbis_comment
*
()
{
return
&
vc
;
}
void
AddTag
(
const
char
*
tag
,
const
char
*
contents
)
{
vorbis_comment_add_tag
(
&
vc
,
tag
,
contents
);
}
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment