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
8fd992dd
Commit
8fd992dd
authored
Jul 10, 2014
by
Thomas Guillem
Committed by
Martin Storsjö
Jul 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omxil: move input handling into DecodeVideoInput
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
a73fd7be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
62 deletions
+75
-62
modules/codec/omxil/omxil.c
modules/codec/omxil/omxil.c
+75
-62
No files found.
modules/codec/omxil/omxil.c
View file @
8fd992dd
...
...
@@ -1268,72 +1268,23 @@ error:
return
-
1
;
}
/*****************************************************************************
* DecodeVideo: Called to decode one frame
*****************************************************************************/
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
static
int
DecodeVideoInput
(
decoder_t
*
p_dec
,
OmxPort
*
p_port
,
block_t
**
pp_block
,
unsigned
int
i_input_used
,
bool
*
p_reconfig
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
picture_t
*
p_pic
=
NULL
;
OMX_ERRORTYPE
omx_error
;
unsigned
int
i
;
OMX_BUFFERHEADERTYPE
*
p_header
;
block_t
*
p_block
;
unsigned
int
i_input_used
=
0
;
struct
H264ConvertState
convert_state
=
{
0
,
0
};
block_t
*
p_block
=
*
pp_block
;
if
(
!
pp_block
||
!*
pp_block
)
return
NULL
;
p_block
=
*
pp_block
;
/* Check for errors from codec */
if
(
p_sys
->
b_error
)
{
msg_Dbg
(
p_dec
,
"error during decoding"
);
block_Release
(
p_block
);
return
0
;
}
if
(
p_block
->
i_flags
&
(
BLOCK_FLAG_DISCONTINUITY
|
BLOCK_FLAG_CORRUPTED
)
)
{
block_Release
(
p_block
);
if
(
!
p_sys
->
in
.
b_flushed
)
{
msg_Dbg
(
p_dec
,
"flushing"
);
OMX_SendCommand
(
p_sys
->
omx_handle
,
OMX_CommandFlush
,
p_sys
->
in
.
definition
.
nPortIndex
,
0
);
}
p_sys
->
in
.
b_flushed
=
true
;
return
NULL
;
}
/* Use the aspect ratio provided by the input (ie read from packetizer).
* In case the we get aspect ratio info from the decoder (as in the
* broadcom OMX implementation on RPi), don't let the packetizer values
* override what the decoder says, if anything - otherwise always update
* even if it already is set (since it can change within a stream). */
if
((
p_dec
->
fmt_in
.
video
.
i_sar_num
!=
0
&&
p_dec
->
fmt_in
.
video
.
i_sar_den
!=
0
)
&&
(
p_dec
->
fmt_out
.
video
.
i_sar_num
==
0
||
p_dec
->
fmt_out
.
video
.
i_sar_den
==
0
||
!
p_sys
->
b_aspect_ratio_handled
))
{
p_dec
->
fmt_out
.
video
.
i_sar_num
=
p_dec
->
fmt_in
.
video
.
i_sar_num
;
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_dec
->
fmt_in
.
video
.
i_sar_den
;
}
/* Take care of decoded frames first */
if
(
DecodeVideoOutput
(
p_dec
,
&
p_sys
->
out
,
&
p_pic
)
!=
0
)
goto
error
;
more_input:
/* Send the input buffer to the component */
OMX_FIFO_GET_TIMEOUT
(
&
p_
sys
->
in
.
fifo
,
p_header
,
200000
);
OMX_FIFO_GET_TIMEOUT
(
&
p_
port
->
fifo
,
p_header
,
200000
);
if
(
p_header
&&
p_header
->
nFlags
&
SENTINEL_FLAG
)
{
free
(
p_header
);
goto
reconfig
;
*
p_reconfig
=
true
;
return
0
;
}
*
p_reconfig
=
false
;
if
(
p_header
)
{
...
...
@@ -1348,7 +1299,7 @@ more_input:
/* In direct mode we pass the input pointer as is.
* Otherwise we memcopy the data */
if
(
p_
sys
->
in
.
b_direct
)
if
(
p_
port
->
b_direct
)
{
p_header
->
pOutputPortPrivate
=
p_header
->
pBuffer
;
p_header
->
pBuffer
=
p_block
->
p_buffer
;
...
...
@@ -1383,19 +1334,81 @@ more_input:
msg_Dbg
(
p_dec
,
"EmptyThisBuffer %p, %p, %i, %"
PRId64
,
p_header
,
p_header
->
pBuffer
,
(
int
)
p_header
->
nFilledLen
,
FromOmxTicks
(
p_header
->
nTimeStamp
)
);
#endif
OMX_EmptyThisBuffer
(
p_
sys
->
omx_handle
,
p_header
);
p_
sys
->
in
.
b_flushed
=
false
;
OMX_EmptyThisBuffer
(
p_
port
->
omx_handle
,
p_header
);
p_
port
->
b_flushed
=
false
;
if
(
decode_more
)
goto
more_input
;
return
DecodeVideoInput
(
p_dec
,
p_port
,
pp_block
,
i_input_used
,
p_reconfig
);
else
*
pp_block
=
NULL
;
/* Avoid being fed the same packet again */
}
return
0
;
}
/*****************************************************************************
* DecodeVideo: Called to decode one frame
*****************************************************************************/
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
picture_t
*
p_pic
=
NULL
;
OMX_ERRORTYPE
omx_error
;
unsigned
int
i
;
bool
b_reconfig
;
block_t
*
p_block
;
if
(
!
pp_block
||
!*
pp_block
)
return
NULL
;
p_block
=
*
pp_block
;
/* Check for errors from codec */
if
(
p_sys
->
b_error
)
{
msg_Dbg
(
p_dec
,
"error during decoding"
);
block_Release
(
p_block
);
return
0
;
}
if
(
p_block
->
i_flags
&
(
BLOCK_FLAG_DISCONTINUITY
|
BLOCK_FLAG_CORRUPTED
)
)
{
block_Release
(
p_block
);
if
(
!
p_sys
->
in
.
b_flushed
)
{
msg_Dbg
(
p_dec
,
"flushing"
);
OMX_SendCommand
(
p_sys
->
omx_handle
,
OMX_CommandFlush
,
p_sys
->
in
.
definition
.
nPortIndex
,
0
);
}
p_sys
->
in
.
b_flushed
=
true
;
return
NULL
;
}
/* Use the aspect ratio provided by the input (ie read from packetizer).
* In case the we get aspect ratio info from the decoder (as in the
* broadcom OMX implementation on RPi), don't let the packetizer values
* override what the decoder says, if anything - otherwise always update
* even if it already is set (since it can change within a stream). */
if
((
p_dec
->
fmt_in
.
video
.
i_sar_num
!=
0
&&
p_dec
->
fmt_in
.
video
.
i_sar_den
!=
0
)
&&
(
p_dec
->
fmt_out
.
video
.
i_sar_num
==
0
||
p_dec
->
fmt_out
.
video
.
i_sar_den
==
0
||
!
p_sys
->
b_aspect_ratio_handled
))
{
p_dec
->
fmt_out
.
video
.
i_sar_num
=
p_dec
->
fmt_in
.
video
.
i_sar_num
;
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_dec
->
fmt_in
.
video
.
i_sar_den
;
}
/* Take care of decoded frames first */
if
(
DecodeVideoOutput
(
p_dec
,
&
p_sys
->
out
,
&
p_pic
)
!=
0
)
goto
error
;
if
(
DecodeVideoInput
(
p_dec
,
&
p_sys
->
in
,
pp_block
,
0
,
&
b_reconfig
)
!=
0
)
goto
error
;
/* If we don't have a p_pic from the first try. Try again */
if
(
!
p_pic
&&
DecodeVideoOutput
(
p_dec
,
&
p_sys
->
out
,
&
p_pic
)
!=
0
)
if
(
!
b_reconfig
&&
!
p_pic
&&
DecodeVideoOutput
(
p_dec
,
&
p_sys
->
out
,
&
p_pic
)
!=
0
)
goto
error
;
reconfig:
/* Handle the PortSettingsChanged events */
for
(
i
=
0
;
i
<
p_sys
->
ports
;
i
++
)
{
...
...
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