static block_t *EncodeAudio( encoder_t *, aout_buffer_t * );
struct thread_context_t;
-static int FfmpegThread( struct thread_context_t *p_context );
+static void* FfmpegThread( vlc_object_t *p_this );
static int FfmpegExecute( AVCodecContext *s,
int (*pf_func)(AVCodecContext *c2, void *arg2),
void **arg, int *ret, int count );
if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
&psz_namecodec ) )
{
- if( GetFfmpegChroma( p_enc->fmt_out.i_codec ) < 0 )
+ if( TestFfmpegChroma( -1, p_enc->fmt_out.i_codec ) != VLC_SUCCESS )
{
/* handed chroma output */
return VLC_EGENERIC;
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
var_Get( p_enc, ENC_CFG_PREFIX "aac-profile", &val );
- p_sys->i_aac_profile = FF_PROFILE_UNKNOWN;
+ p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
if( val.psz_string && *val.psz_string )
{
if( !strncmp( val.psz_string, "main", 4 ) )
p_sys->i_aac_profile = FF_PROFILE_AAC_LTP;
else
{
- msg_Warn( p_enc, "unknown AAC profile requested" );
- p_sys->i_aac_profile = FF_PROFILE_UNKNOWN;
+ msg_Warn( p_enc, "unknown AAC profile requested, setting it to low" );
+ p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
}
}
free( val.psz_string );
p_sys->p_buffer_out = malloc( p_sys->i_buffer_out );
p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
- p_context->pix_fmt = GetFfmpegChroma( p_enc->fmt_in.i_codec );
+ p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec;
+ GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
+
if( p_codec->pix_fmts )
{
const enum PixelFormat *p = p_codec->pix_fmts;
if( *p == p_context->pix_fmt ) break;
}
if( *p == -1 ) p_context->pix_fmt = p_codec->pix_fmts[0];
- p_enc->fmt_in.i_codec = GetVlcChroma( p_context->pix_fmt );
+ GetVlcChroma( &p_enc->fmt_in.video, p_context->pix_fmt );
+ p_enc->fmt_in.i_codec = p_enc->fmt_in.video.i_chroma;
}
if( i_codec_id == CODEC_ID_RAWVIDEO )
{
/* XXX: hack: Force same codec (will be handled by transcode) */
- p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
- p_context->pix_fmt = GetFfmpegChroma( p_enc->fmt_in.i_codec );
+ 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 );
}
/* Make sure we get extradata filled by the encoder */
/****************************************************************************
* Ffmpeg threading system
****************************************************************************/
-static int FfmpegThread( struct thread_context_t *p_context )
+static void* FfmpegThread( vlc_object_t *p_this )
{
- while ( !p_context->b_die && !p_context->b_error )
+ struct thread_context_t *p_context = (struct thread_context_t *)p_this;
+ int canc = vlc_savecancel ();
+ while ( vlc_object_alive (p_context) && !p_context->b_error )
{
vlc_mutex_lock( &p_context->lock );
- while ( !p_context->b_work && !p_context->b_die && !p_context->b_error )
+ while ( !p_context->b_work && vlc_object_alive (p_context) && !p_context->b_error )
{
vlc_cond_wait( &p_context->cond, &p_context->lock );
}
p_context->b_work = 0;
vlc_mutex_unlock( &p_context->lock );
- if ( p_context->b_die || p_context->b_error )
+ if ( !vlc_object_alive (p_context) || p_context->b_error )
break;
if ( p_context->pf_func )
vlc_mutex_unlock( &p_context->lock );
}
- return 0;
+ vlc_restorecancel (canc);
+ return NULL;
}
static int FfmpegExecute( AVCodecContext *s,