Commit 41067d21 authored by Julian Scheel's avatar Julian Scheel Committed by Martin Storsjö

omxil: Passthrough aspect ratio from input format.

If the input format has a valid pixel aspect ratio set (ie from the
packetizer) pass this into the output format. This helps for omx
implementations which do not report the aspect ratio.
For omx implementations which provide aspect ratio information give these
precedence over the incoming values.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 5f77310f
...@@ -732,9 +732,10 @@ static OMX_ERRORTYPE InitialiseComponent(decoder_t *p_dec, ...@@ -732,9 +732,10 @@ static OMX_ERRORTYPE InitialiseComponent(decoder_t *p_dec,
omx_error = OMX_SetParameter(omx_handle, omx_error = OMX_SetParameter(omx_handle,
OMX_IndexConfigRequestCallback, &notifications); OMX_IndexConfigRequestCallback, &notifications);
if (omx_error == OMX_ErrorNone) if (omx_error == OMX_ErrorNone) {
msg_Dbg(p_dec, "Enabled aspect ratio notifications"); msg_Dbg(p_dec, "Enabled aspect ratio notifications");
else p_sys->b_aspect_ratio_handled = true;
} else
msg_Dbg(p_dec, "Could not enable aspect ratio notifications"); msg_Dbg(p_dec, "Could not enable aspect ratio notifications");
} }
...@@ -1245,6 +1246,19 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -1245,6 +1246,19 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
return NULL; 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 */ /* Take care of decoded frames first */
while(!p_pic) while(!p_pic)
{ {
......
...@@ -94,6 +94,8 @@ struct decoder_sys_t ...@@ -94,6 +94,8 @@ struct decoder_sys_t
bool b_error; bool b_error;
bool b_aspect_ratio_handled;
date_t end_date; date_t end_date;
size_t i_nal_size_length; /* Length of the NAL size field for H264 */ size_t i_nal_size_length; /* Length of the NAL size field for H264 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment