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
0c9f2250
Commit
0c9f2250
authored
Jan 21, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/ffmpeg: convert to C++
parent
9c870e42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
22 deletions
+32
-22
Makefile.am
Makefile.am
+2
-2
InputRegistry.cxx
src/InputRegistry.cxx
+1
-1
FfmpegInputPlugin.cxx
src/input/FfmpegInputPlugin.cxx
+26
-16
FfmpegInputPlugin.hxx
src/input/FfmpegInputPlugin.hxx
+3
-3
No files found.
Makefile.am
View file @
0c9f2250
...
...
@@ -79,7 +79,6 @@ mpd_headers = \
src/decoder/pcm_decoder_plugin.h
\
src/input_plugin.h
\
src/input_stream.h
\
src/input/ffmpeg_input_plugin.h
\
src/input/despotify_input_plugin.h
\
src/input/cdio_paranoia_input_plugin.h
\
src/despotify_utils.h
\
...
...
@@ -746,7 +745,8 @@ libinput_a_SOURCES += src/input/cdio_paranoia_input_plugin.c
endif
if
HAVE_FFMPEG
libinput_a_SOURCES
+=
src/input/ffmpeg_input_plugin.c
libinput_a_SOURCES
+=
\
src/input/FfmpegInputPlugin.cxx src/input/FfmpegInputPlugin.hxx
endif
if
ENABLE_MMS
...
...
src/InputRegistry.cxx
View file @
0c9f2250
...
...
@@ -34,7 +34,7 @@
#endif
#ifdef HAVE_FFMPEG
#include "input/
ffmpeg_input_plugin.h
"
#include "input/
FfmpegInputPlugin.hxx
"
#endif
#ifdef ENABLE_MMS
...
...
src/input/
ffmpeg_input_plugin.c
→
src/input/
FfmpegInputPlugin.cxx
View file @
0c9f2250
/*
* 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,14 +17,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* necessary because libavutil/common.h uses UINT64_C */
#define __STDC_CONSTANT_MACROS
#include "config.h"
#include "
input/ffmpeg_input_plugin.h
"
#include "
FfmpegInputPlugin.hxx
"
#include "input_internal.h"
#include "input_plugin.h"
extern
"C"
{
#include <libavutil/avutil.h>
#include <libavformat/avio.h>
#include <libavformat/avformat.h>
}
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "input_ffmpeg"
...
...
@@ -51,10 +56,10 @@ static inline bool
input_ffmpeg_supported
(
void
)
{
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,0,0)
void
*
opaque
=
NULL
;
return
avio_enum_protocols
(
&
opaque
,
0
)
!=
NULL
;
void
*
opaque
=
nullptr
;
return
avio_enum_protocols
(
&
opaque
,
0
)
!=
nullptr
;
#else
return
av_protocol_next
(
NULL
)
!=
NULL
;
return
av_protocol_next
(
nullptr
)
!=
nullptr
;
#endif
}
...
...
@@ -87,7 +92,7 @@ input_ffmpeg_open(const char *uri,
!
g_str_has_prefix
(
uri
,
"rtmp://"
)
&&
!
g_str_has_prefix
(
uri
,
"rtmpt://"
)
&&
!
g_str_has_prefix
(
uri
,
"rtmps://"
))
return
NULL
;
return
nullptr
;
i
=
g_new
(
struct
input_ffmpeg
,
1
);
input_stream_init
(
&
i
->
base
,
&
input_plugin_ffmpeg
,
uri
,
...
...
@@ -104,7 +109,7 @@ input_ffmpeg_open(const char *uri,
g_free
(
i
);
g_set_error
(
error_r
,
ffmpeg_quark
(),
ret
,
"libavformat failed to open the URI"
);
return
NULL
;
return
nullptr
;
}
i
->
eof
=
false
;
...
...
@@ -134,9 +139,9 @@ input_ffmpeg_read(struct input_stream *is, void *ptr, size_t size,
struct
input_ffmpeg
*
i
=
(
struct
input_ffmpeg
*
)
is
;
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,0,0)
int
ret
=
avio_read
(
i
->
h
,
ptr
,
size
);
int
ret
=
avio_read
(
i
->
h
,
(
unsigned
char
*
)
ptr
,
size
);
#else
int
ret
=
url_read
(
i
->
h
,
ptr
,
size
);
int
ret
=
url_read
(
i
->
h
,
(
unsigned
char
*
)
ptr
,
size
);
#endif
if
(
ret
<=
0
)
{
if
(
ret
<
0
)
...
...
@@ -194,11 +199,16 @@ input_ffmpeg_seek(struct input_stream *is, goffset offset, int whence,
}
const
struct
input_plugin
input_plugin_ffmpeg
=
{
.
name
=
"ffmpeg"
,
.
init
=
input_ffmpeg_init
,
.
open
=
input_ffmpeg_open
,
.
close
=
input_ffmpeg_close
,
.
read
=
input_ffmpeg_read
,
.
eof
=
input_ffmpeg_eof
,
.
seek
=
input_ffmpeg_seek
,
"ffmpeg"
,
input_ffmpeg_init
,
nullptr
,
input_ffmpeg_open
,
input_ffmpeg_close
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
input_ffmpeg_read
,
input_ffmpeg_eof
,
input_ffmpeg_seek
,
};
src/input/
ffmpeg_input_plugin.h
→
src/input/
FfmpegInputPlugin.hxx
View file @
0c9f2250
/*
* 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_FFMPEG_INPUT_PLUGIN_H
#define MPD_FFMPEG_INPUT_PLUGIN_H
#ifndef MPD_FFMPEG_INPUT_PLUGIN_H
XX
#define MPD_FFMPEG_INPUT_PLUGIN_H
XX
/**
* An input plugin based on libavformat's "avio" 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