Commit 9aee7d49 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

avcodec: cleanup chroma helper prototypes

Avoid passing a structure on the stack.
parent e313dedf
......@@ -122,7 +122,7 @@ static const struct
{ 0, 0, 0, 0, 0 }
};
int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
int TestFfmpegChroma( int i_ffmpeg_id, vlc_fourcc_t i_vlc_fourcc )
{
for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
{
......@@ -133,18 +133,18 @@ int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
}
/* FIXME special case the RGB formats */
int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
int GetFfmpegChroma( int *restrict i_ffmpeg_chroma, const video_format_t *fmt )
{
for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
{
if( chroma_table[i].i_chroma == fmt.i_chroma )
if( chroma_table[i].i_chroma == fmt->i_chroma )
{
if( ( chroma_table[i].i_rmask == 0 &&
chroma_table[i].i_gmask == 0 &&
chroma_table[i].i_bmask == 0 ) ||
( chroma_table[i].i_rmask == fmt.i_rmask &&
chroma_table[i].i_gmask == fmt.i_gmask &&
chroma_table[i].i_bmask == fmt.i_bmask ) )
( chroma_table[i].i_rmask == fmt->i_rmask &&
chroma_table[i].i_gmask == fmt->i_gmask &&
chroma_table[i].i_bmask == fmt->i_bmask ) )
{
*i_ffmpeg_chroma = chroma_table[i].i_chroma_id;
return VLC_SUCCESS;
......@@ -154,7 +154,7 @@ int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
return VLC_EGENERIC;
}
int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma )
int GetVlcChroma( video_format_t *fmt, int i_ffmpeg_chroma )
{
/* TODO FIXME for rgb format we HAVE to set rgb mask/shift */
for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
......
......@@ -26,8 +26,8 @@
#ifndef _VLC_AVUTIL_CHROMA_H
#define _VLC_AVUTIL_CHROMA_H 1
int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
int TestFfmpegChroma( int i_ffmpeg_id, vlc_fourcc_t i_vlc_fourcc );
int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t *fmt );
int GetVlcChroma( video_format_t *fmt, int i_ffmpeg_chroma );
#endif
......@@ -85,7 +85,7 @@ int OpenDeinterlace( vlc_object_t *p_this )
/* Misc init */
p_filter->fmt_in.video.i_chroma = p_filter->fmt_in.i_codec;
if( GetFfmpegChroma( &p_sys->i_src_ffmpeg_chroma, p_filter->fmt_in.video ) != VLC_SUCCESS )
if( GetFfmpegChroma( &p_sys->i_src_ffmpeg_chroma, &p_filter->fmt_in.video ) != VLC_SUCCESS )
{
msg_Err( p_filter, "Failed to match chroma type" );
return VLC_EGENERIC;
......
......@@ -464,7 +464,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_in.i_codec = VLC_CODEC_I420;
p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec;
GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
GetFfmpegChroma( &p_context->pix_fmt, &p_enc->fmt_in.video );
if( p_codec->pix_fmts )
{
......@@ -682,7 +682,7 @@ int OpenEncoder( vlc_object_t *p_this )
{
/* XXX: hack: Force same codec (will be handled by transcode) */
p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
GetFfmpegChroma( &p_context->pix_fmt, &p_enc->fmt_in.video );
}
/* Make sure we get extradata filled by the encoder */
......
......@@ -293,8 +293,8 @@ static int GetParameters( ScalerConfiguration *p_cfg,
bool b_swap_uvi = false;
bool b_swap_uvo = false;
GetFfmpegChroma( &i_fmti, *p_fmti );
GetFfmpegChroma( &i_fmto, *p_fmto );
GetFfmpegChroma( &i_fmti, p_fmti );
GetFfmpegChroma( &i_fmto, p_fmto );
if( p_fmti->i_chroma == p_fmto->i_chroma )
{
......
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