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
e6e9c212
Commit
e6e9c212
authored
Aug 18, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/ffmpeg: use av_strerror()
Generate more detailed error messages.
parent
636f5d4a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
4 deletions
+80
-4
Makefile.am
Makefile.am
+1
-0
NEWS
NEWS
+1
-0
FfmpegInputPlugin.cxx
src/input/plugins/FfmpegInputPlugin.cxx
+4
-4
Error.cxx
src/lib/ffmpeg/Error.cxx
+43
-0
Error.hxx
src/lib/ffmpeg/Error.hxx
+31
-0
No files found.
Makefile.am
View file @
e6e9c212
...
...
@@ -781,6 +781,7 @@ endif
if
HAVE_FFMPEG
noinst_LIBRARIES
+=
libffmpeg.a
libffmpeg_a_SOURCES
=
\
src/lib/ffmpeg/Error.cxx src/lib/ffmpeg/Error.hxx
\
src/lib/ffmpeg/Domain.cxx src/lib/ffmpeg/Domain.hxx
FFMPEG_LIBS2
=
libffmpeg.a
$(FFMPEG_LIBS)
endif
...
...
NEWS
View file @
e6e9c212
...
...
@@ -31,6 +31,7 @@ ver 0.19 (not yet released)
- alsa: new input plugin
- curl: options "verify_peer" and "verify_host"
- ffmpeg: update offset after seeking
- ffmpeg: improved error messages
- mms: non-blocking I/O
- nfs: new input plugin
- smbclient: new input plugin
...
...
src/input/plugins/FfmpegInputPlugin.cxx
View file @
e6e9c212
...
...
@@ -23,6 +23,7 @@
#include "config.h"
#include "FfmpegInputPlugin.hxx"
#include "lib/ffmpeg/Domain.hxx"
#include "lib/ffmpeg/Error.hxx"
#include "../InputStream.hxx"
#include "../InputPlugin.hxx"
#include "util/StringUtil.hxx"
...
...
@@ -101,8 +102,7 @@ input_ffmpeg_open(const char *uri,
AVIOContext
*
h
;
auto
result
=
avio_open
(
&
h
,
uri
,
AVIO_FLAG_READ
);
if
(
result
!=
0
)
{
error
.
Set
(
ffmpeg_domain
,
result
,
"libavformat failed to open the URI"
);
SetFfmpegError
(
error
,
result
);
return
nullptr
;
}
...
...
@@ -115,7 +115,7 @@ FfmpegInputStream::Read(void *ptr, size_t read_size, Error &error)
auto
result
=
avio_read
(
h
,
(
unsigned
char
*
)
ptr
,
read_size
);
if
(
result
<=
0
)
{
if
(
result
<
0
)
error
.
Set
(
ffmpeg_domain
,
"avio_read() failed"
);
SetFfmpegError
(
error
,
result
,
"avio_read() failed"
);
eof
=
true
;
return
false
;
...
...
@@ -137,7 +137,7 @@ FfmpegInputStream::Seek(offset_type new_offset, Error &error)
auto
result
=
avio_seek
(
h
,
new_offset
,
SEEK_SET
);
if
(
result
<
0
)
{
error
.
Set
(
ffmpeg_domain
,
"avio_seek() failed"
);
SetFfmpegError
(
error
,
result
,
"avio_seek() failed"
);
return
false
;
}
...
...
src/lib/ffmpeg/Error.cxx
0 → 100644
View file @
e6e9c212
/*
* Copyright (C) 2003-2014 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.
*/
#include "config.h"
#include "Error.hxx"
#include "Domain.hxx"
#include "util/Error.hxx"
extern
"C"
{
#include <libavutil/error.h>
}
void
SetFfmpegError
(
Error
&
error
,
int
errnum
)
{
char
msg
[
256
];
av_strerror
(
errnum
,
msg
,
sizeof
(
msg
));
error
.
Set
(
ffmpeg_domain
,
errnum
,
msg
);
}
void
SetFfmpegError
(
Error
&
error
,
int
errnum
,
const
char
*
prefix
)
{
char
msg
[
256
];
av_strerror
(
errnum
,
msg
,
sizeof
(
msg
));
error
.
Format
(
ffmpeg_domain
,
errnum
,
"%s: %s"
,
prefix
,
msg
);
}
src/lib/ffmpeg/Error.hxx
0 → 100644
View file @
e6e9c212
/*
* Copyright (C) 2003-2014 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_FFMPEG_ERROR_HXX
#define MPD_FFMPEG_ERROR_HXX
class
Error
;
void
SetFfmpegError
(
Error
&
error
,
int
errnum
);
void
SetFfmpegError
(
Error
&
error
,
int
errnum
,
const
char
*
prefix
);
#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