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
736fd0e2
Commit
736fd0e2
authored
Jul 18, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: use avformat_open_input() if available
av_open_input_stream() has been deprecated.
parent
6592ca9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+35
-4
No files found.
src/decoder/ffmpeg_decoder_plugin.c
View file @
736fd0e2
...
...
@@ -89,7 +89,11 @@ struct mpd_ffmpeg_stream {
struct
decoder
*
decoder
;
struct
input_stream
*
input
;
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,101,0)
AVIOContext
*
io
;
#else
ByteIOContext
*
io
;
#endif
unsigned
char
buffer
[
8192
];
};
...
...
@@ -135,6 +139,33 @@ mpd_ffmpeg_stream_open(struct decoder *decoder, struct input_stream *input)
return
stream
;
}
/**
* API compatibility wrapper for av_open_input_stream() and
* avformat_open_input().
*/
static
int
mpd_ffmpeg_open_input
(
AVFormatContext
**
ic_ptr
,
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,101,0)
AVIOContext
*
pb
,
#else
ByteIOContext
*
pb
,
#endif
const
char
*
filename
,
AVInputFormat
*
fmt
)
{
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,1,3)
AVFormatContext
*
context
=
avformat_alloc_context
();
if
(
context
==
NULL
)
return
AVERROR
(
ENOMEM
);
context
->
pb
=
pb
;
*
ic_ptr
=
context
;
return
avformat_open_input
(
ic_ptr
,
filename
,
fmt
,
NULL
);
#else
return
av_open_input_stream
(
ic_ptr
,
pb
,
filename
,
fmt
,
NULL
);
#endif
}
static
void
mpd_ffmpeg_stream_close
(
struct
mpd_ffmpeg_stream
*
stream
)
{
...
...
@@ -322,8 +353,8 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
//ffmpeg works with ours "fileops" helper
AVFormatContext
*
format_context
=
NULL
;
if
(
av_open_input_stream
(
&
format_context
,
stream
->
io
,
input
->
uri
,
input_format
,
NULL
)
!=
0
)
{
if
(
mpd_ffmpeg_open_input
(
&
format_context
,
stream
->
io
,
input
->
uri
,
input_format
)
!=
0
)
{
g_warning
(
"Open failed
\n
"
);
mpd_ffmpeg_stream_close
(
stream
);
return
;
...
...
@@ -484,8 +515,8 @@ ffmpeg_stream_tag(struct input_stream *is)
return
NULL
;
AVFormatContext
*
f
=
NULL
;
if
(
av_open_input_stream
(
&
f
,
stream
->
io
,
is
->
uri
,
input_format
,
NULL
)
!=
0
)
{
if
(
mpd_ffmpeg_open_input
(
&
f
,
stream
->
io
,
is
->
uri
,
input_format
)
!=
0
)
{
mpd_ffmpeg_stream_close
(
stream
);
return
NULL
;
}
...
...
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