Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
14cdda33
Commit
14cdda33
authored
Aug 26, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mediacodec: add pf_on_flush for Video/Audio
parent
60e59d2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
+31
-11
modules/codec/omxil/mediacodec.c
modules/codec/omxil/mediacodec.c
+31
-11
No files found.
modules/codec/omxil/mediacodec.c
View file @
14cdda33
...
...
@@ -67,6 +67,11 @@ struct csd
*/
typedef
int
(
*
dec_on_new_block_cb
)(
decoder_t
*
,
block_t
*
);
/**
* Callback called when decoder is flushing.
*/
typedef
void
(
*
dec_on_flush_cb
)(
decoder_t
*
);
/**
* Callback called when DecodeCommon try to get an output buffer (pic or block).
* It returns -1 in case of error, or the number of output buffer returned.
...
...
@@ -97,6 +102,7 @@ struct decoder_sys_t
/* Specific Audio/Video callbacks */
dec_on_new_block_cb
pf_on_new_block
;
dec_get_output_cb
pf_get_output
;
dec_on_flush_cb
pf_on_flush
;
union
{
...
...
@@ -132,10 +138,12 @@ static void CloseDecoder(vlc_object_t *);
static
int
Video_OnNewBlock
(
decoder_t
*
,
block_t
*
);
static
int
Video_GetOutput
(
decoder_t
*
,
picture_t
**
,
block_t
**
,
bool
*
,
mtime_t
);
static
void
Video_OnFlush
(
decoder_t
*
);
static
picture_t
*
DecodeVideo
(
decoder_t
*
,
block_t
**
);
static
int
Audio_OnNewBlock
(
decoder_t
*
,
block_t
*
);
static
int
Audio_GetOutput
(
decoder_t
*
,
picture_t
**
,
block_t
**
,
bool
*
,
mtime_t
);
static
void
Audio_OnFlush
(
decoder_t
*
);
static
block_t
*
DecodeAudio
(
decoder_t
*
,
block_t
**
);
static
void
InvalidateAllPictures
(
decoder_t
*
);
...
...
@@ -557,6 +565,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
if
(
p_dec
->
fmt_in
.
i_cat
==
VIDEO_ES
)
{
p_sys
->
pf_on_new_block
=
Video_OnNewBlock
;
p_sys
->
pf_on_flush
=
Video_OnFlush
;
p_sys
->
pf_get_output
=
Video_GetOutput
;
p_sys
->
u
.
video
.
i_width
=
p_dec
->
fmt_in
.
video
.
i_width
;
p_sys
->
u
.
video
.
i_height
=
p_dec
->
fmt_in
.
video
.
i_height
;
...
...
@@ -598,6 +607,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
{
p_sys
->
pf_on_new_block
=
Audio_OnNewBlock
;
p_sys
->
pf_get_output
=
Audio_GetOutput
;
p_sys
->
pf_on_flush
=
Audio_OnFlush
;
p_sys
->
u
.
audio
.
i_channels
=
p_dec
->
fmt_in
.
audio
.
i_channels
;
p_sys
->
psz_name
=
MediaCodec_GetName
(
VLC_OBJECT
(
p_dec
),
p_sys
->
mime
,
0
);
...
...
@@ -1078,6 +1088,8 @@ static int DecodeFlush(decoder_t *p_dec)
if
(
p_sys
->
decoded
||
p_sys
->
i_csd_send
>
0
)
{
p_sys
->
pf_on_flush
(
p_dec
);
p_sys
->
i_preroll_end
=
0
;
if
(
p_sys
->
api
->
flush
(
p_sys
->
api
)
!=
VLC_SUCCESS
)
return
VLC_EGENERIC
;
...
...
@@ -1242,16 +1254,6 @@ static int Video_OnNewBlock(decoder_t *p_dec, block_t *p_block)
if
(
p_block
->
i_flags
&
(
BLOCK_FLAG_DISCONTINUITY
|
BLOCK_FLAG_CORRUPTED
))
{
if
(
p_sys
->
decoded
)
{
timestamp_FifoEmpty
(
p_sys
->
u
.
video
.
timestamp_fifo
);
/* Invalidate all pictures that are currently in flight
* since flushing make all previous indices returned by
* MediaCodec invalid. */
if
(
p_sys
->
api
->
b_direct_rendering
)
InvalidateAllPictures
(
p_dec
);
}
if
(
DecodeFlush
(
p_dec
)
!=
VLC_SUCCESS
)
return
-
1
;
return
0
;
...
...
@@ -1302,6 +1304,18 @@ static int Video_OnNewBlock(decoder_t *p_dec, block_t *p_block)
return
1
;
}
static
void
Video_OnFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
timestamp_FifoEmpty
(
p_sys
->
u
.
video
.
timestamp_fifo
);
/* Invalidate all pictures that are currently in flight
* since flushing make all previous indices returned by
* MediaCodec invalid. */
if
(
p_sys
->
api
->
b_direct_rendering
)
InvalidateAllPictures
(
p_dec
);
}
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
...
...
@@ -1332,7 +1346,6 @@ static int Audio_OnNewBlock(decoder_t *p_dec, block_t *p_block)
{
if
(
DecodeFlush
(
p_dec
)
!=
VLC_SUCCESS
)
return
-
1
;
date_Set
(
&
p_sys
->
u
.
audio
.
i_end_date
,
VLC_TS_INVALID
);
return
0
;
}
...
...
@@ -1376,6 +1389,13 @@ static int Audio_OnNewBlock(decoder_t *p_dec, block_t *p_block)
return
1
;
}
static
void
Audio_OnFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
date_Set
(
&
p_sys
->
u
.
audio
.
i_end_date
,
VLC_TS_INVALID
);
}
static
block_t
*
DecodeAudio
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
block_t
*
p_out
=
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