[vlc-commits] transcode: refactor video encoder and filters config
Francois Cartegnie
git at videolan.org
Mon Jul 9 16:15:28 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jun 25 17:20:37 2018 +0200| [efcb93645d3a16a42f4dea69d505c62a46c70201] | committer: Francois Cartegnie
transcode: refactor video encoder and filters config
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=efcb93645d3a16a42f4dea69d505c62a46c70201
---
modules/stream_out/transcode/transcode.c | 140 ++++++++++++++++---------------
modules/stream_out/transcode/transcode.h | 86 +++++++++++++++----
modules/stream_out/transcode/video.c | 99 +++++++++++-----------
3 files changed, 191 insertions(+), 134 deletions(-)
diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index 7c7563c32a..4cb2931e24 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -235,6 +235,54 @@ static void *Add( sout_stream_t *, const es_format_t * );
static void Del( sout_stream_t *, void * );
static int Send( sout_stream_t *, void *, block_t * );
+static void SetVideoEncoderConfig( sout_stream_t *p_stream, sout_encoder_config_t *p_cfg )
+{
+ char *psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "venc" );
+ if( psz_string && *psz_string )
+ {
+ char *psz_next;
+ psz_next = config_ChainCreate( &p_cfg->psz_name,
+ &p_cfg->p_config_chain,
+ psz_string );
+ free( psz_next );
+ }
+ free( psz_string );
+
+ psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vcodec" );
+ if( psz_string && *psz_string )
+ {
+ char fcc[5] = " \0";
+ memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) );
+ p_cfg->i_codec = vlc_fourcc_GetCodecFromString( VIDEO_ES, fcc );
+ msg_Dbg( p_stream, "Checking video codec mapping for %s got %4.4s ",
+ fcc, (char*)&p_cfg->i_codec);
+ }
+ free( psz_string );
+
+ p_cfg->video.i_bitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "vb" );
+ if( p_cfg->video.i_bitrate < 16000 )
+ p_cfg->video.i_bitrate *= 1000;
+
+ p_cfg->video.f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" );
+
+ var_InheritURational( p_stream, &p_cfg->video.fps.num,
+ &p_cfg->video.fps.den,
+ SOUT_CFG_PREFIX "fps" );
+
+ p_cfg->video.i_width = var_GetInteger( p_stream, SOUT_CFG_PREFIX "width" );
+ p_cfg->video.i_height = var_GetInteger( p_stream, SOUT_CFG_PREFIX "height" );
+ p_cfg->video.i_maxwidth = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxwidth" );
+ p_cfg->video.i_maxheight = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxheight" );
+
+ p_cfg->video.threads.i_count = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" );
+ p_cfg->video.threads.pool_size = var_GetInteger( p_stream, SOUT_CFG_PREFIX "pool-size" );
+
+ if( var_GetBool( p_stream, SOUT_CFG_PREFIX "high-priority" ) )
+ p_cfg->video.threads.i_priority = VLC_THREAD_PRIORITY_OUTPUT;
+ else
+ p_cfg->video.threads.i_priority = VLC_THREAD_PRIORITY_VIDEO;
+}
+
/*****************************************************************************
* Open:
*****************************************************************************/
@@ -311,74 +359,37 @@ static int Open( vlc_object_t *p_this )
free( psz_string );
/* Video transcoding parameters */
- psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "venc" );
- p_sys->psz_venc = NULL;
- p_sys->p_video_cfg = NULL;
- if( psz_string && *psz_string )
- {
- char *psz_next;
- psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg,
- psz_string );
- free( psz_next );
- }
- free( psz_string );
+ sout_encoder_config_init( &p_sys->venc_cfg );
- psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vcodec" );
- p_sys->i_vcodec = 0;
- if( psz_string && *psz_string )
+ SetVideoEncoderConfig( p_stream, &p_sys->venc_cfg );
+ p_sys->b_master_sync = (p_sys->venc_cfg.video.fps.num > 0);
+ if( p_sys->venc_cfg.i_codec )
{
- char fcc[5] = " \0";
- memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) );
- p_sys->i_vcodec = vlc_fourcc_GetCodecFromString( VIDEO_ES, fcc );
- msg_Dbg( p_stream, "Checking video codec mapping for %s got %4.4s ", fcc, (char*)&p_sys->i_vcodec);
+ msg_Dbg( p_stream, "codec video=%4.4s %dx%d scaling: %f %dkb/s",
+ (char *)&p_sys->venc_cfg.i_codec,
+ p_sys->venc_cfg.video.i_width,
+ p_sys->venc_cfg.video.i_height,
+ p_sys->venc_cfg.video.f_scale,
+ p_sys->venc_cfg.video.i_bitrate / 1000 );
}
- free( psz_string );
- p_sys->i_vbitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "vb" );
- if( p_sys->i_vbitrate < 16000 ) p_sys->i_vbitrate *= 1000;
-
- p_sys->f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" );
-
- p_sys->b_master_sync = var_InheritURational( p_stream, &p_sys->fps_num, &p_sys->fps_den, SOUT_CFG_PREFIX "fps" ) == VLC_SUCCESS;
-
- p_sys->i_width = var_GetInteger( p_stream, SOUT_CFG_PREFIX "width" );
-
- p_sys->i_height = var_GetInteger( p_stream, SOUT_CFG_PREFIX "height" );
-
- p_sys->i_maxwidth = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxwidth" );
-
- p_sys->i_maxheight = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxheight" );
+ /* Video Filter Parameters */
+ sout_filters_config_init( &p_sys->vfilters_cfg );
psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vfilter" );
if( psz_string && *psz_string )
- p_sys->psz_vf2 = strdup(psz_string );
+ p_sys->vfilters_cfg.psz_filters = psz_string;
else
- p_sys->psz_vf2 = NULL;
- free( psz_string );
+ free( psz_string );
if( var_GetBool( p_stream, SOUT_CFG_PREFIX "deinterlace" ) )
+ {
psz_string = var_GetString( p_stream,
SOUT_CFG_PREFIX "deinterlace-module" );
- else
- psz_string = NULL;
-
- free( config_ChainCreate( &p_sys->psz_deinterlace,
- &p_sys->p_deinterlace_cfg, psz_string ) );
- free( psz_string );
-
- p_sys->i_threads = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" );
- p_sys->pool_size = var_GetInteger( p_stream, SOUT_CFG_PREFIX "pool-size" );
-
- if( var_GetBool( p_stream, SOUT_CFG_PREFIX "high-priority" ) )
- p_sys->i_thread_priority = VLC_THREAD_PRIORITY_OUTPUT;
- else
- p_sys->i_thread_priority = VLC_THREAD_PRIORITY_VIDEO;
-
- if( p_sys->i_vcodec )
- {
- msg_Dbg( p_stream, "codec video=%4.4s %dx%d scaling: %f %dkb/s",
- (char *)&p_sys->i_vcodec, p_sys->i_width, p_sys->i_height,
- p_sys->f_scale, p_sys->i_vbitrate / 1000 );
+ if( psz_string )
+ free( config_ChainCreate( &p_sys->vfilters_cfg.video.psz_deinterlace,
+ &p_sys->vfilters_cfg.video.p_deinterlace_cfg, psz_string ) );
+ free( psz_string );
}
/* Subpictures transcoding parameters */
@@ -415,8 +426,8 @@ static int Open( vlc_object_t *p_this )
p_sys->b_soverlay = var_GetBool( p_stream, SOUT_CFG_PREFIX "soverlay" );
/* Set default size for TEXT spu non overlay conversion / updater */
- p_sys->i_spu_width = (p_sys->i_width) ? p_sys->i_width : 1280;
- p_sys->i_spu_height = (p_sys->i_height) ? p_sys->i_height : 720;
+ p_sys->i_spu_width = (p_sys->venc_cfg.video.i_width) ? p_sys->venc_cfg.video.i_width : 1280;
+ p_sys->i_spu_height = (p_sys->venc_cfg.video.i_height) ? p_sys->venc_cfg.video.i_height : 720;
psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "sfilter" );
if( psz_string && *psz_string )
@@ -443,20 +454,15 @@ static void Close( vlc_object_t * p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_stream_sys_t *p_sys = p_stream->p_sys;
+ sout_encoder_config_clean( &p_sys->venc_cfg );
+ sout_filters_config_clean( &p_sys->vfilters_cfg );
+
free( p_sys->psz_af );
config_ChainDestroy( p_sys->p_audio_cfg );
free( p_sys->psz_aenc );
free( p_sys->psz_alang );
- free( p_sys->psz_vf2 );
-
- config_ChainDestroy( p_sys->p_video_cfg );
- free( p_sys->psz_venc );
-
- config_ChainDestroy( p_sys->p_deinterlace_cfg );
- free( p_sys->psz_deinterlace );
-
config_ChainDestroy( p_sys->p_spu_cfg );
free( p_sys->psz_senc );
@@ -536,7 +542,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
if( p_fmt->i_cat == AUDIO_ES && p_sys->i_acodec )
success = transcode_audio_add(p_stream, p_fmt, id);
- else if( p_fmt->i_cat == VIDEO_ES && p_sys->i_vcodec )
+ else if( p_fmt->i_cat == VIDEO_ES && p_sys->venc_cfg.i_codec )
success = transcode_video_add(p_stream, p_fmt, id);
else if( ( p_fmt->i_cat == SPU_ES ) &&
( p_sys->i_scodec || p_sys->b_soverlay ) )
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index f927c2a4a7..1053553468 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -10,8 +10,75 @@ typedef struct sout_stream_id_sys_t sout_stream_id_sys_t;
typedef struct
{
+ char *psz_filters;
+ union
+ {
+ struct
+ {
+ char *psz_deinterlace;
+ config_chain_t *p_deinterlace_cfg;
+ } video;
+ };
+} sout_filters_config_t;
+
+static inline
+void sout_filters_config_init( sout_filters_config_t *p_cfg )
+{
+ memset( p_cfg, 0, sizeof(*p_cfg) );
+}
+
+static inline
+void sout_filters_config_clean( sout_filters_config_t *p_cfg )
+{
+ free( p_cfg->psz_filters );
+ if( p_cfg->video.psz_deinterlace )
+ {
+ free( p_cfg->video.psz_deinterlace );
+ config_ChainDestroy( p_cfg->video.p_deinterlace_cfg );
+ }
+}
+
+typedef struct
+{
+ vlc_fourcc_t i_codec; /* (0 if not transcode) */
+ char *psz_name;
+ config_chain_t *p_config_chain;
+ union
+ {
+ struct
+ {
+ unsigned int i_bitrate;
+ float f_scale;
+ unsigned int i_width, i_maxwidth;
+ unsigned int i_height, i_maxheight;
+ bool b_hurry_up;
+ vlc_rational_t fps;
+ struct
+ {
+ unsigned int i_count;
+ int i_priority;
+ uint32_t pool_size;
+ } threads;
+ } video;
+ };
+} sout_encoder_config_t;
+
+static inline
+void sout_encoder_config_init( sout_encoder_config_t *p_cfg )
+{
+ memset( p_cfg, 0, sizeof(*p_cfg) );
+}
+
+static inline
+void sout_encoder_config_clean( sout_encoder_config_t *p_cfg )
+{
+ free( p_cfg->psz_name );
+ config_ChainDestroy( p_cfg->p_config_chain );
+}
+
+typedef struct
+{
sout_stream_id_sys_t *id_video;
- uint32_t pool_size;
/* Audio */
vlc_fourcc_t i_acodec; /* codec audio (0 if not transcode) */
@@ -25,21 +92,8 @@ typedef struct
char *psz_af;
/* Video */
- vlc_fourcc_t i_vcodec; /* codec video (0 if not transcode) */
- char *psz_venc;
- config_chain_t *p_video_cfg;
- int i_vbitrate;
- float f_scale;
- unsigned int i_width, i_maxwidth;
- unsigned int i_height, i_maxheight;
- char *psz_deinterlace;
- config_chain_t *p_deinterlace_cfg;
- int i_threads;
- int i_thread_priority;
- bool b_hurry_up;
- unsigned int fps_num,fps_den;
-
- char *psz_vf2;
+ sout_encoder_config_t venc_cfg;
+ sout_filters_config_t vfilters_cfg;
/* SPU */
vlc_fourcc_t i_scodec; /* codec spu (0 if not transcode) */
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index eb2e5ecb76..8a2cd535a1 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -181,21 +181,18 @@ static picture_t *transcode_dequeue_all_pics( sout_stream_id_sys_t *id )
}
static int transcode_video_encoder_test( sout_stream_t *p_stream,
+ const sout_encoder_config_t *p_cfg,
const es_format_t *p_dec_fmtin,
vlc_fourcc_t i_codec_in,
- int i_threads,
- const config_chain_t *p_cfg,
const es_format_t *p_enc_fmtout,
es_format_t *p_enc_wanted_in )
{
- sout_stream_sys_t *p_sys = p_stream->p_sys;
-
encoder_t *p_encoder = sout_EncoderCreate( p_stream );
if( !p_encoder )
return VLC_EGENERIC;
- p_encoder->i_threads = i_threads;
- p_encoder->p_cfg = p_cfg;
+ p_encoder->i_threads = p_cfg->video.threads.i_count;
+ p_encoder->p_cfg = p_cfg->p_config_chain;
es_format_Init( &p_encoder->fmt_in, VIDEO_ES, i_codec_in );
es_format_Copy( &p_encoder->fmt_out, p_enc_fmtout );
@@ -217,12 +214,13 @@ static int transcode_video_encoder_test( sout_stream_t *p_stream,
p_vfmt_in->i_frame_rate = ENC_FRAMERATE;
p_vfmt_in->i_frame_rate_base = ENC_FRAMERATE_BASE;
- module_t *p_module = module_need( p_encoder, "encoder", p_sys->psz_venc, true );
+ module_t *p_module = module_need( p_encoder, "encoder", p_cfg->psz_name, true );
if( !p_module )
{
msg_Err( p_stream, "cannot find video encoder (module:%s fourcc:%4.4s). "
"Take a look few lines earlier to see possible reason.",
- p_sys->psz_venc ? p_sys->psz_venc : "any", (char *)&p_sys->i_vcodec );
+ p_cfg->psz_name ? p_cfg->psz_name : "any",
+ (char *)&p_cfg->i_codec );
}
else
{
@@ -300,13 +298,12 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *i
es_format_Init( &id->encoder_tested_fmt_in, id->p_decoder->fmt_in.i_cat,
id->p_decoder->fmt_out.i_codec );
- id->p_encoder->i_threads = p_sys->i_threads;
- id->p_encoder->p_cfg = p_sys->p_video_cfg;
+ id->p_encoder->i_threads = p_sys->venc_cfg.video.threads.i_count;
+ id->p_encoder->p_cfg = p_sys->venc_cfg.p_config_chain;
- if( transcode_video_encoder_test( p_stream, &id->p_decoder->fmt_in,
+ if( transcode_video_encoder_test( p_stream, &p_sys->venc_cfg,
+ &id->p_decoder->fmt_in,
id->p_decoder->fmt_out.i_codec,
- p_sys->i_threads,
- p_sys->p_video_cfg,
&id->p_encoder->fmt_out,
&id->encoder_tested_fmt_in ) )
{
@@ -331,37 +328,38 @@ static const struct filter_video_callbacks transcode_filter_video_cbs =
};
static void transcode_video_filter_init( sout_stream_t *p_stream,
+ const sout_filters_config_t *p_cfg,
+ bool b_master_sync,
sout_stream_id_sys_t *id )
{
- sout_stream_sys_t *p_sys = p_stream->p_sys;
const es_format_t *p_src = &id->p_decoder->fmt_out;
es_format_t *p_dst = &id->p_encoder->fmt_in;
/* Build chain */
filter_owner_t owner = {
.video = &transcode_filter_video_cbs,
- .sys = p_sys,
+ .sys = id,
};
id->p_f_chain = filter_chain_NewVideo( p_stream, false, &owner );
filter_chain_Reset( id->p_f_chain, p_src, p_src );
/* Deinterlace */
- if( p_sys->psz_deinterlace != NULL )
+ if( p_cfg->video.psz_deinterlace != NULL )
{
filter_chain_AppendFilter( id->p_f_chain,
- p_sys->psz_deinterlace,
- p_sys->p_deinterlace_cfg,
+ p_cfg->video.psz_deinterlace,
+ p_cfg->video.p_deinterlace_cfg,
p_src, p_src );
p_src = filter_chain_GetFmtOut( id->p_f_chain );
}
- if( p_sys->b_master_sync )
+ if( b_master_sync )
{
filter_chain_AppendFilter( id->p_f_chain, "fps", NULL, p_src, p_dst );
p_src = filter_chain_GetFmtOut( id->p_f_chain );
}
- if( p_sys->psz_vf2 )
+ if( p_cfg->psz_filters )
{
id->p_uf_chain = filter_chain_NewVideo( p_stream, true, &owner );
filter_chain_Reset( id->p_uf_chain, p_src, p_dst );
@@ -369,7 +367,7 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
{
filter_chain_AppendConverter( id->p_uf_chain, p_src, p_dst );
}
- filter_chain_AppendFromString( id->p_uf_chain, p_sys->psz_vf2 );
+ filter_chain_AppendFromString( id->p_uf_chain, p_cfg->psz_filters );
p_src = filter_chain_GetFmtOut( id->p_uf_chain );
es_format_Clean( p_dst );
es_format_Copy( p_dst, p_src );
@@ -379,12 +377,6 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
id->p_encoder->fmt_out.video.i_sar_den = p_dst->video.i_sar_den;
}
- if( p_src )
- {
- p_sys->i_spu_width = p_src->video.i_visible_width;
- p_sys->i_spu_height = p_src->video.i_visible_height;
- }
-
/* Keep colorspace etc info along */
p_dst->video.space = p_src->video.space;
p_dst->video.transfer = p_src->video.transfer;
@@ -561,9 +553,9 @@ static void transcode_video_sar_apply( const video_format_t *p_src,
static void transcode_video_encoder_configure( sout_stream_t *p_stream,
sout_stream_id_sys_t *id,
+ const sout_encoder_config_t *p_cfg,
picture_t *p_pic )
{
- sout_stream_sys_t *p_sys = p_stream->p_sys;
const video_format_t *p_src = filtered_video_format( id, p_pic );
const video_format_t *p_dec_in = &id->p_decoder->fmt_in.video;
const video_format_t *p_dec_out = &id->p_decoder->fmt_out.video;
@@ -571,15 +563,17 @@ static void transcode_video_encoder_configure( sout_stream_t *p_stream,
video_format_t *p_enc_out = &id->p_encoder->fmt_out.video;
/* Complete destination format */
- id->p_encoder->fmt_out.i_codec = p_enc_out->i_chroma = p_sys->i_vcodec;
- id->p_encoder->fmt_out.i_bitrate = p_sys->i_vbitrate;
- p_enc_out->i_width = p_enc_out->i_visible_width = p_sys->i_width & ~1;
- p_enc_out->i_height = p_enc_out->i_visible_height = p_sys->i_height & ~1;
+ id->p_encoder->fmt_out.i_codec = p_enc_out->i_chroma = p_cfg->i_codec;
+ id->p_encoder->fmt_out.i_bitrate = p_cfg->video.i_bitrate;
+ p_enc_out->i_width = p_enc_out->i_visible_width = p_cfg->video.i_width & ~1;
+ p_enc_out->i_height = p_enc_out->i_visible_height = p_cfg->video.i_height & ~1;
p_enc_out->i_sar_num = p_enc_out->i_sar_den = 0;
- if( p_sys->fps_num )
+ if( p_cfg->video.fps.num )
{
- p_enc_in->i_frame_rate = p_enc_out->i_frame_rate = p_sys->fps_num;
- p_enc_in->i_frame_rate_base = p_enc_out->i_frame_rate_base = __MAX(p_sys->fps_den, 1);
+ p_enc_in->i_frame_rate = p_enc_out->i_frame_rate =
+ p_cfg->video.fps.num;
+ p_enc_in->i_frame_rate_base = p_enc_out->i_frame_rate_base =
+ __MAX(p_cfg->video.fps.den, 1);
}
/* Complete source format */
@@ -594,9 +588,9 @@ static void transcode_video_encoder_configure( sout_stream_t *p_stream,
p_enc_in->i_frame_rate, p_enc_in->i_frame_rate_base );
transcode_video_size_apply( VLC_OBJECT(p_stream), p_src,
- p_sys->f_scale,
- p_sys->i_maxwidth,
- p_sys->i_maxheight,
+ p_cfg->video.f_scale,
+ p_cfg->video.i_maxwidth,
+ p_cfg->video.i_maxheight,
p_enc_out );
p_enc_in->i_width = p_enc_out->i_width;
p_enc_in->i_visible_width = p_enc_out->i_visible_width;
@@ -623,7 +617,7 @@ static void transcode_video_encoder_close( sout_stream_t *p_stream,
if( id->p_encoder->p_module == NULL )
return;
- if( p_sys->i_threads >= 1 && !id->b_abort )
+ if( p_sys->venc_cfg.video.threads.i_count >= 1 && !id->b_abort )
{
vlc_mutex_lock( &id->lock_out );
id->b_abort = true;
@@ -655,12 +649,12 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
id->p_encoder->fmt_in.video.i_height );
id->p_encoder->p_module =
- module_need( id->p_encoder, "encoder", p_sys->psz_venc, true );
+ module_need( id->p_encoder, "encoder", p_sys->venc_cfg.psz_name, true );
if( !id->p_encoder->p_module )
{
msg_Err( p_stream, "cannot find video encoder (module:%s fourcc:%4.4s)",
- p_sys->psz_venc ? p_sys->psz_venc : "any",
- (char *)&p_sys->i_vcodec );
+ p_sys->venc_cfg.psz_name ? p_sys->venc_cfg.psz_name : "any",
+ (char *)&p_sys->venc_cfg.i_codec );
return VLC_EGENERIC;
}
@@ -679,14 +673,14 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
return VLC_EGENERIC;
}
- vlc_sem_init( &id->picture_pool_has_room, p_sys->pool_size );
+ vlc_sem_init( &id->picture_pool_has_room, p_sys->venc_cfg.video.threads.pool_size );
vlc_mutex_init( &id->lock_out );
vlc_cond_init( &id->cond );
id->p_buffers = NULL;
id->b_abort = false;
- if( p_sys->i_threads > 0 &&
- vlc_clone( &id->thread, EncoderThread, id, p_sys->i_thread_priority ) )
+ if( p_sys->venc_cfg.video.threads.i_count > 0 &&
+ vlc_clone( &id->thread, EncoderThread, id, p_sys->venc_cfg.video.threads.i_priority ) )
{
msg_Err( p_stream, "cannot spawn encoder thread" );
vlc_cond_destroy( &id->cond );
@@ -769,7 +763,7 @@ static void OutputFrame( sout_stream_t *p_stream, picture_t *p_pic, sout_stream_
}
}
- if( p_sys->i_threads == 0 )
+ if( p_sys->venc_cfg.video.threads.i_count == 0 )
{
block_t *p_block;
@@ -822,7 +816,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
{
if( id->p_encoder->p_module == NULL ) /* Configure Encoder input/output */
{
- transcode_video_encoder_configure( p_stream, id, p_pic );
+ transcode_video_encoder_configure( p_stream, id, &p_sys->venc_cfg, p_pic );
/* will be opened below */
}
else /* picture format has changed */
@@ -844,10 +838,13 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
video_format_Copy( &id->fmt_input_video, &p_pic->format );
- transcode_video_filter_init( p_stream, id );
+ transcode_video_filter_init( p_stream, &p_sys->vfilters_cfg, p_sys->b_master_sync, id );
if( conversion_video_filter_append( id, p_pic ) != VLC_SUCCESS )
goto error;
+ p_sys->i_spu_width = p_pic->format.i_visible_width;
+ p_sys->i_spu_height = p_pic->format.i_visible_height;
+
/* Start missing encoder */
if( id->p_encoder->p_module == NULL &&
transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
@@ -890,7 +887,7 @@ error:
id->b_error = true;
} while( p_pics );
- if( p_sys->i_threads >= 1 )
+ if( p_sys->venc_cfg.video.threads.i_count >= 1 )
{
/* Pick up any return data the encoder thread wants to output. */
vlc_mutex_lock( &id->lock_out );
@@ -903,7 +900,7 @@ end:
/* Drain encoder */
if( unlikely( !id->b_error && in == NULL ) && id->p_encoder->p_module )
{
- if( p_sys->i_threads == 0 )
+ if( p_sys->venc_cfg.video.threads.i_count == 0 )
{
block_t *p_block;
do {
@@ -931,7 +928,7 @@ bool transcode_video_add( sout_stream_t *p_stream, const es_format_t *p_fmt,
msg_Dbg( p_stream,
"creating video transcoding from fcc=`%4.4s' to fcc=`%4.4s'",
- (char*)&p_fmt->i_codec, (char*)&p_sys->i_vcodec );
+ (char*)&p_fmt->i_codec, (char*)&p_sys->venc_cfg.i_codec );
id->fifo.pic.first = NULL;
id->fifo.pic.last = &id->fifo.pic.first;
More information about the vlc-commits
mailing list