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
2a2ac35b
Commit
2a2ac35b
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: FfmpegOpenInput() throws exception on error
parent
8c744efd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+15
-17
No files found.
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
2a2ac35b
...
...
@@ -60,22 +60,18 @@ extern "C" {
static
AVFormatContext
*
FfmpegOpenInput
(
AVIOContext
*
pb
,
const
char
*
filename
,
AVInputFormat
*
fmt
,
Error
&
error
)
AVInputFormat
*
fmt
)
{
AVFormatContext
*
context
=
avformat_alloc_context
();
if
(
context
==
nullptr
)
{
error
.
Set
(
ffmpeg_domain
,
"Out of memory"
);
return
nullptr
;
}
if
(
context
==
nullptr
)
throw
std
::
runtime_error
(
"avformat_alloc_context() failed"
);
context
->
pb
=
pb
;
int
err
=
avformat_open_input
(
&
context
,
filename
,
fmt
,
nullptr
);
if
(
err
<
0
)
{
avformat_free_context
(
context
);
SetFfmpegError
(
error
,
err
,
"avformat_open_input() failed"
);
return
nullptr
;
throw
MakeFfmpegError
(
err
,
"avformat_open_input() failed"
);
}
return
context
;
...
...
@@ -797,11 +793,12 @@ ffmpeg_decode(Decoder &decoder, InputStream &input)
return
;
}
Error
error
;
AVFormatContext
*
format_context
=
FfmpegOpenInput
(
stream
.
io
,
input
.
GetURI
(),
input_format
,
error
);
if
(
format_context
==
nullptr
)
{
LogError
(
error
);
AVFormatContext
*
format_context
;
try
{
format_context
=
FfmpegOpenInput
(
stream
.
io
,
input
.
GetURI
(),
input_format
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LogError
(
e
);
return
;
}
...
...
@@ -848,11 +845,12 @@ ffmpeg_scan_stream(InputStream &is,
if
(
!
stream
.
Open
())
return
false
;
AVFormatContext
*
f
=
FfmpegOpenInput
(
stream
.
io
,
is
.
GetURI
(),
input_format
,
IgnoreError
()
);
if
(
f
==
nullptr
)
AVFormatContext
*
f
;
try
{
f
=
FfmpegOpenInput
(
stream
.
io
,
is
.
GetURI
(),
input_format
);
}
catch
(
const
std
::
runtime_error
&
)
{
return
false
;
}
AtScopeExit
(
&
f
)
{
avformat_close_input
(
&
f
);
...
...
This diff is collapsed.
Click to expand it.
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