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
eafa432c
Commit
eafa432c
authored
Oct 01, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoder/vorbis: use C++ compiler
parent
d95e5380
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
26 deletions
+56
-26
Makefile.am
Makefile.am
+3
-1
VorbisEncoderPlugin.cxx
src/encoder/VorbisEncoderPlugin.cxx
+26
-23
VorbisEncoderPlugin.hxx
src/encoder/VorbisEncoderPlugin.hxx
+25
-0
encoder_list.c
src/encoder_list.c
+2
-2
No files found.
Makefile.am
View file @
eafa432c
...
...
@@ -703,7 +703,9 @@ libencoder_plugins_a_SOURCES += src/encoder/wave_encoder.c
endif
if
ENABLE_VORBIS_ENCODER
libencoder_plugins_a_SOURCES
+=
src/encoder/vorbis_encoder.c
libencoder_plugins_a_SOURCES
+=
\
src/encoder/VorbisEncoderPlugin.cxx
\
src/encoder/VorbisEncoderPlugin.hxx
endif
if
ENABLE_LAME_ENCODER
...
...
src/encoder/
vorbis_encoder.c
→
src/encoder/
VorbisEncoderPlugin.cxx
View file @
eafa432c
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
2
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,7 +18,12 @@
*/
#include "config.h"
#include "VorbisEncoderPlugin.hxx"
extern
"C"
{
#include "encoder_api.h"
}
#include "encoder_plugin.h"
#include "tag.h"
#include "audio_format.h"
...
...
@@ -53,8 +58,6 @@ struct vorbis_encoder {
bool
flush
;
};
extern
const
struct
encoder_plugin
vorbis_encoder_plugin
;
static
inline
GQuark
vorbis_encoder_quark
(
void
)
{
...
...
@@ -65,8 +68,8 @@ static bool
vorbis_encoder_configure
(
struct
vorbis_encoder
*
encoder
,
const
struct
config_param
*
param
,
GError
**
error
)
{
const
char
*
value
=
config_get_block_string
(
param
,
"quality"
,
NULL
);
if
(
value
!=
NULL
)
{
const
char
*
value
=
config_get_block_string
(
param
,
"quality"
,
nullptr
);
if
(
value
!=
nullptr
)
{
/* a quality was configured (VBR) */
char
*
endptr
;
...
...
@@ -81,7 +84,7 @@ vorbis_encoder_configure(struct vorbis_encoder *encoder,
return
false
;
}
if
(
config_get_block_string
(
param
,
"bitrate"
,
NULL
)
!=
NULL
)
{
if
(
config_get_block_string
(
param
,
"bitrate"
,
nullptr
)
!=
nullptr
)
{
g_set_error
(
error
,
vorbis_encoder_quark
(),
0
,
"quality and bitrate are "
"both defined (line %i)"
,
...
...
@@ -91,8 +94,8 @@ vorbis_encoder_configure(struct vorbis_encoder *encoder,
}
else
{
/* a bit rate was configured */
value
=
config_get_block_string
(
param
,
"bitrate"
,
NULL
);
if
(
value
==
NULL
)
{
value
=
config_get_block_string
(
param
,
"bitrate"
,
nullptr
);
if
(
value
==
nullptr
)
{
g_set_error
(
error
,
vorbis_encoder_quark
(),
0
,
"neither bitrate nor quality defined "
"at line %i"
,
...
...
@@ -125,7 +128,7 @@ vorbis_encoder_init(const struct config_param *param, GError **error)
if
(
!
vorbis_encoder_configure
(
encoder
,
param
,
error
))
{
/* configuration has failed, roll back and return error */
g_free
(
encoder
);
return
NULL
;
return
nullptr
;
}
return
&
encoder
->
encoder
;
...
...
@@ -246,7 +249,7 @@ static void
vorbis_encoder_blockout
(
struct
vorbis_encoder
*
encoder
)
{
while
(
vorbis_analysis_blockout
(
&
encoder
->
vd
,
&
encoder
->
vb
)
==
1
)
{
vorbis_analysis
(
&
encoder
->
vb
,
NULL
);
vorbis_analysis
(
&
encoder
->
vb
,
nullptr
);
vorbis_bitrate_addblock
(
&
encoder
->
vb
);
ogg_packet
packet
;
...
...
@@ -358,7 +361,7 @@ static size_t
vorbis_encoder_read
(
struct
encoder
*
_encoder
,
void
*
_dest
,
size_t
length
)
{
struct
vorbis_encoder
*
encoder
=
(
struct
vorbis_encoder
*
)
_encoder
;
unsigned
char
*
dest
=
_dest
;
unsigned
char
*
dest
=
(
unsigned
char
*
)
_dest
;
ogg_page
page
;
int
ret
=
ogg_stream_pageout
(
&
encoder
->
os
,
&
page
);
...
...
@@ -392,16 +395,16 @@ vorbis_encoder_get_mime_type(G_GNUC_UNUSED struct encoder *_encoder)
}
const
struct
encoder_plugin
vorbis_encoder_plugin
=
{
.
name
=
"vorbis"
,
.
init
=
vorbis_encoder_init
,
.
finish
=
vorbis_encoder_finish
,
.
open
=
vorbis_encoder_open
,
.
close
=
vorbis_encoder_close
,
.
end
=
vorbis_encoder_pre_tag
,
.
flush
=
vorbis_encoder_flush
,
.
pre_tag
=
vorbis_encoder_pre_tag
,
.
tag
=
vorbis_encoder_tag
,
.
write
=
vorbis_encoder_write
,
.
read
=
vorbis_encoder_read
,
.
get_mime_type
=
vorbis_encoder_get_mime_type
,
"vorbis"
,
vorbis_encoder_init
,
vorbis_encoder_finish
,
vorbis_encoder_open
,
vorbis_encoder_close
,
vorbis_encoder_pre_tag
,
vorbis_encoder_flush
,
vorbis_encoder_pre_tag
,
vorbis_encoder_tag
,
vorbis_encoder_write
,
vorbis_encoder_read
,
vorbis_encoder_get_mime_type
,
};
src/encoder/VorbisEncoderPlugin.hxx
0 → 100644
View file @
eafa432c
/*
* Copyright (C) 2003-2012 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_ENCODER_VORBIS_H
#define MPD_ENCODER_VORBIS_H
extern
const
struct
encoder_plugin
vorbis_encoder_plugin
;
#endif
src/encoder_list.c
View file @
eafa432c
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
2
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -20,11 +20,11 @@
#include "config.h"
#include "encoder_list.h"
#include "encoder_plugin.h"
#include "encoder/VorbisEncoderPlugin.hxx"
#include <string.h>
extern
const
struct
encoder_plugin
null_encoder_plugin
;
extern
const
struct
encoder_plugin
vorbis_encoder_plugin
;
extern
const
struct
encoder_plugin
lame_encoder_plugin
;
extern
const
struct
encoder_plugin
twolame_encoder_plugin
;
extern
const
struct
encoder_plugin
wave_encoder_plugin
;
...
...
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