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
a2c6d5e1
Commit
a2c6d5e1
authored
Dec 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: move functions into the AvioStream struct
parent
373706c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
20 deletions
+37
-20
FfmpegIo.cxx
src/decoder/plugins/FfmpegIo.cxx
+30
-20
FfmpegIo.hxx
src/decoder/plugins/FfmpegIo.hxx
+7
-0
No files found.
src/decoder/plugins/FfmpegIo.cxx
View file @
a2c6d5e1
...
...
@@ -31,49 +31,60 @@ AvioStream::~AvioStream()
av_free
(
io
);
}
static
int
mpd_ffmpeg_stream_read
(
void
*
opaque
,
uint8_t
*
buf
,
int
size
)
inline
int
AvioStream
::
Read
(
void
*
dest
,
int
size
)
{
AvioStream
*
stream
=
(
AvioStream
*
)
opaque
;
return
decoder_read
(
stream
->
decoder
,
stream
->
input
,
(
void
*
)
buf
,
size
);
return
decoder_read
(
decoder
,
input
,
dest
,
size
);
}
static
int64_t
mpd_ffmpeg_stream_seek
(
void
*
opaque
,
int64_t
pos
,
int
whence
)
inline
int64_t
AvioStream
::
Seek
(
int64_t
pos
,
int
whence
)
{
AvioStream
*
stream
=
(
AvioStream
*
)
opaque
;
switch
(
whence
)
{
case
SEEK_SET
:
break
;
case
SEEK_CUR
:
pos
+=
stream
->
input
.
GetOffset
();
pos
+=
input
.
GetOffset
();
break
;
case
SEEK_END
:
if
(
!
stream
->
input
.
KnownSize
())
if
(
!
input
.
KnownSize
())
return
-
1
;
pos
+=
stream
->
input
.
GetSize
();
pos
+=
input
.
GetSize
();
break
;
case
AVSEEK_SIZE
:
if
(
!
stream
->
input
.
KnownSize
())
if
(
!
input
.
KnownSize
())
return
-
1
;
return
stream
->
input
.
GetSize
();
return
input
.
GetSize
();
default
:
return
-
1
;
}
if
(
!
stream
->
input
.
LockSeek
(
pos
,
IgnoreError
()))
if
(
!
input
.
LockSeek
(
pos
,
IgnoreError
()))
return
-
1
;
return
stream
->
input
.
GetOffset
();
return
input
.
GetOffset
();
}
int
AvioStream
::
_Read
(
void
*
opaque
,
uint8_t
*
buf
,
int
size
)
{
AvioStream
&
stream
=
*
(
AvioStream
*
)
opaque
;
return
stream
.
Read
(
buf
,
size
);
}
int64_t
AvioStream
::
_Seek
(
void
*
opaque
,
int64_t
pos
,
int
whence
)
{
AvioStream
&
stream
=
*
(
AvioStream
*
)
opaque
;
return
stream
.
Seek
(
pos
,
whence
);
}
bool
...
...
@@ -81,8 +92,7 @@ AvioStream::Open()
{
io
=
avio_alloc_context
(
buffer
,
sizeof
(
buffer
),
false
,
this
,
mpd_ffmpeg_stream_read
,
nullptr
,
input
.
IsSeekable
()
?
mpd_ffmpeg_stream_seek
:
nullptr
);
_Read
,
nullptr
,
input
.
IsSeekable
()
?
_Seek
:
nullptr
);
return
io
!=
nullptr
;
}
src/decoder/plugins/FfmpegIo.hxx
View file @
a2c6d5e1
...
...
@@ -45,6 +45,13 @@ struct AvioStream {
~
AvioStream
();
bool
Open
();
private
:
int
Read
(
void
*
buffer
,
int
size
);
int64_t
Seek
(
int64_t
pos
,
int
whence
);
static
int
_Read
(
void
*
opaque
,
uint8_t
*
buf
,
int
size
);
static
int64_t
_Seek
(
void
*
opaque
,
int64_t
pos
,
int
whence
);
};
#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