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
9cc90b1f
Commit
9cc90b1f
authored
Jan 21, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/cdio_paranoia: convert to C++
parent
0c9f2250
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
55 deletions
+67
-55
Makefile.am
Makefile.am
+3
-2
InputRegistry.cxx
src/InputRegistry.cxx
+1
-1
CdioParanoiaInputPlugin.cxx
src/input/CdioParanoiaInputPlugin.cxx
+60
-49
CdioParanoiaInputPlugin.hxx
src/input/CdioParanoiaInputPlugin.hxx
+3
-3
No files found.
Makefile.am
View file @
9cc90b1f
...
...
@@ -80,7 +80,6 @@ mpd_headers = \
src/input_plugin.h
\
src/input_stream.h
\
src/input/despotify_input_plugin.h
\
src/input/cdio_paranoia_input_plugin.h
\
src/despotify_utils.h
\
src/text_input_stream.h
\
src/icy_server.h
\
...
...
@@ -741,7 +740,9 @@ libinput_a_SOURCES += \
endif
if
ENABLE_CDIO_PARANOIA
libinput_a_SOURCES
+=
src/input/cdio_paranoia_input_plugin.c
libinput_a_SOURCES
+=
\
src/input/CdioParanoiaInputPlugin.cxx
\
src/input/CdioParanoiaInputPlugin.hxx
endif
if
HAVE_FFMPEG
...
...
src/InputRegistry.cxx
View file @
9cc90b1f
...
...
@@ -42,7 +42,7 @@
#endif
#ifdef ENABLE_CDIO_PARANOIA
#include "input/
cdio_paranoia_input_plugin.h
"
#include "input/
CdioParanoiaInputPlugin.hxx
"
#endif
#ifdef ENABLE_DESPOTIFY
...
...
src/input/
cdio_paranoia_input_plugin.c
→
src/input/
CdioParanoiaInputPlugin.cxx
View file @
9cc90b1f
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,7 +22,7 @@
*/
#include "config.h"
#include "
input/cdio_paranoia_input_plugin.h
"
#include "
CdioParanoiaInputPlugin.hxx
"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"
...
...
@@ -38,7 +38,7 @@
#include <cdio/paranoia.h>
#include <cdio/cd_types.h>
struct
input_cdio_paranoia
{
struct
CdioParanoiaInputStream
{
struct
input_stream
base
;
cdrom_drive_t
*
drv
;
...
...
@@ -52,6 +52,26 @@ struct input_cdio_paranoia {
char
buffer
[
CDIO_CD_FRAMESIZE_RAW
];
int
buffer_lsn
;
CdioParanoiaInputStream
(
const
char
*
uri
,
GMutex
*
mutex
,
GCond
*
cond
,
int
_trackno
)
:
drv
(
nullptr
),
cdio
(
nullptr
),
para
(
nullptr
),
trackno
(
_trackno
)
{
input_stream_init
(
&
base
,
&
input_plugin_cdio_paranoia
,
uri
,
mutex
,
cond
);
}
~
CdioParanoiaInputStream
()
{
if
(
para
!=
nullptr
)
cdio_paranoia_free
(
para
);
if
(
drv
!=
nullptr
)
cdio_cddap_close_no_free_cdio
(
drv
);
if
(
cdio
!=
nullptr
)
cdio_destroy
(
cdio
);
input_stream_deinit
(
&
base
);
}
};
static
inline
GQuark
...
...
@@ -63,17 +83,9 @@ cdio_quark(void)
static
void
input_cdio_close
(
struct
input_stream
*
is
)
{
struct
input_cdio_paranoia
*
i
=
(
struct
input_cdio_paranoia
*
)
is
;
if
(
i
->
para
)
cdio_paranoia_free
(
i
->
para
);
if
(
i
->
drv
)
cdio_cddap_close_no_free_cdio
(
i
->
drv
);
if
(
i
->
cdio
)
cdio_destroy
(
i
->
cdio
);
CdioParanoiaInputStream
*
i
=
(
CdioParanoiaInputStream
*
)
is
;
input_stream_deinit
(
&
i
->
base
);
g_free
(
i
);
delete
i
;
}
struct
cdio_uri
{
...
...
@@ -97,7 +109,7 @@ parse_cdio_uri(struct cdio_uri *dest, const char *src, GError **error_r)
}
const
char
*
slash
=
strrchr
(
src
,
'/'
);
if
(
slash
==
NULL
)
{
if
(
slash
==
nullptr
)
{
/* play the whole CD in the specified drive */
g_strlcpy
(
dest
->
device
,
src
,
sizeof
(
dest
->
device
));
dest
->
track
=
-
1
;
...
...
@@ -131,9 +143,10 @@ parse_cdio_uri(struct cdio_uri *dest, const char *src, GError **error_r)
static
char
*
cdio_detect_device
(
void
)
{
char
**
devices
=
cdio_get_devices_with_cap
(
NULL
,
CDIO_FS_AUDIO
,
false
);
if
(
devices
==
NULL
)
return
NULL
;
char
**
devices
=
cdio_get_devices_with_cap
(
nullptr
,
CDIO_FS_AUDIO
,
false
);
if
(
devices
==
nullptr
)
return
nullptr
;
char
*
device
=
g_strdup
(
devices
[
0
]);
cdio_free_device_list
(
devices
);
...
...
@@ -146,52 +159,44 @@ input_cdio_open(const char *uri,
GMutex
*
mutex
,
GCond
*
cond
,
GError
**
error_r
)
{
struct
input_cdio_paranoia
*
i
;
struct
cdio_uri
parsed_uri
;
if
(
!
parse_cdio_uri
(
&
parsed_uri
,
uri
,
error_r
))
return
NULL
;
i
=
g_new
(
struct
input_cdio_paranoia
,
1
);
input_stream_init
(
&
i
->
base
,
&
input_plugin_cdio_paranoia
,
uri
,
mutex
,
cond
);
return
nullptr
;
/* initialize everything (should be already) */
i
->
drv
=
NULL
;
i
->
cdio
=
NULL
;
i
->
para
=
NULL
;
i
->
trackno
=
parsed_uri
.
track
;
CdioParanoiaInputStream
*
i
=
new
CdioParanoiaInputStream
(
uri
,
mutex
,
cond
,
parsed_uri
.
track
);
/* get list of CD's supporting CD-DA */
char
*
device
=
parsed_uri
.
device
[
0
]
!=
0
?
g_strdup
(
parsed_uri
.
device
)
:
cdio_detect_device
();
if
(
device
==
NULL
)
{
if
(
device
==
nullptr
)
{
g_set_error
(
error_r
,
cdio_quark
(),
0
,
"Unable find or access a CD-ROM drive with an audio CD in it."
);
input_cdio_close
(
&
i
->
base
)
;
return
NULL
;
delete
i
;
return
nullptr
;
}
/* Found such a CD-ROM with a CD-DA loaded. Use the first drive in the list. */
i
->
cdio
=
cdio_open
(
device
,
DRIVER_UNKNOWN
);
g_free
(
device
);
i
->
drv
=
cdio_cddap_identify_cdio
(
i
->
cdio
,
1
,
NULL
);
i
->
drv
=
cdio_cddap_identify_cdio
(
i
->
cdio
,
1
,
nullptr
);
if
(
!
i
->
drv
)
{
g_set_error
(
error_r
,
cdio_quark
(),
0
,
"Unable to identify audio CD disc."
);
input_cdio_close
(
&
i
->
base
)
;
return
NULL
;
delete
i
;
return
nullptr
;
}
cdda_verbose_set
(
i
->
drv
,
CDDA_MESSAGE_FORGETIT
,
CDDA_MESSAGE_FORGETIT
);
if
(
0
!=
cdio_cddap_open
(
i
->
drv
)
)
{
g_set_error
(
error_r
,
cdio_quark
(),
0
,
"Unable to open disc."
);
input_cdio_close
(
&
i
->
base
)
;
return
NULL
;
delete
i
;
return
nullptr
;
}
bool
reverse_endian
;
...
...
@@ -212,8 +217,8 @@ input_cdio_open(const char *uri,
g_set_error
(
error_r
,
cdio_quark
(),
0
,
"Drive returns unknown data type %d"
,
data_bigendianp
(
i
->
drv
));
input_cdio_close
(
&
i
->
base
)
;
return
NULL
;
delete
i
;
return
nullptr
;
}
i
->
lsn_relofs
=
0
;
...
...
@@ -250,7 +255,7 @@ static bool
input_cdio_seek
(
struct
input_stream
*
is
,
goffset
offset
,
int
whence
,
GError
**
error_r
)
{
struct
input_cdio_paranoia
*
cis
=
(
struct
input_cdio_paranoia
*
)
is
;
CdioParanoiaInputStream
*
cis
=
(
CdioParanoiaInputStream
*
)
is
;
/* calculate absolute offset */
switch
(
whence
)
{
...
...
@@ -288,7 +293,7 @@ static size_t
input_cdio_read
(
struct
input_stream
*
is
,
void
*
ptr
,
size_t
length
,
GError
**
error_r
)
{
struct
input_cdio_paranoia
*
cis
=
(
struct
input_cdio_paranoia
*
)
is
;
CdioParanoiaInputStream
*
cis
=
(
CdioParanoiaInputStream
*
)
is
;
size_t
nbytes
=
0
;
int
diff
;
size_t
len
,
maxwrite
;
...
...
@@ -305,7 +310,7 @@ input_cdio_read(struct input_stream *is, void *ptr, size_t length,
//current sector was changed ?
if
(
cis
->
lsn_relofs
!=
cis
->
buffer_lsn
)
{
rbuf
=
cdio_paranoia_read
(
cis
->
para
,
NULL
);
rbuf
=
cdio_paranoia_read
(
cis
->
para
,
nullptr
);
s_err
=
cdda_errors
(
cis
->
drv
);
if
(
s_err
)
{
...
...
@@ -356,16 +361,22 @@ input_cdio_read(struct input_stream *is, void *ptr, size_t length,
static
bool
input_cdio_eof
(
struct
input_stream
*
is
)
{
struct
input_cdio_paranoia
*
cis
=
(
struct
input_cdio_paranoia
*
)
is
;
CdioParanoiaInputStream
*
cis
=
(
CdioParanoiaInputStream
*
)
is
;
return
(
cis
->
lsn_from
+
cis
->
lsn_relofs
>
cis
->
lsn_to
);
}
const
struct
input_plugin
input_plugin_cdio_paranoia
=
{
.
name
=
"cdio_paranoia"
,
.
open
=
input_cdio_open
,
.
close
=
input_cdio_close
,
.
seek
=
input_cdio_seek
,
.
read
=
input_cdio_read
,
.
eof
=
input_cdio_eof
"cdio_paranoia"
,
nullptr
,
nullptr
,
input_cdio_open
,
input_cdio_close
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
input_cdio_read
,
input_cdio_eof
,
input_cdio_seek
,
};
src/input/
cdio_paranoia_input_plugin.h
→
src/input/
CdioParanoiaInputPlugin.hxx
View file @
9cc90b1f
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_CDIO_PARANOIA_INPUT_PLUGIN_H
#define MPD_CDIO_PARANOIA_INPUT_PLUGIN_H
#ifndef MPD_CDIO_PARANOIA_INPUT_PLUGIN_H
XX
#define MPD_CDIO_PARANOIA_INPUT_PLUGIN_H
XX
/**
* An input plugin based on libcdio_paranoia library.
...
...
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