#endif
#include <vlc_common.h>
-#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
#include <vlc_dialog.h>
#include <vlc_avcodec.h>
+#include <vlc_cpu.h>
/* ffmpeg header */
#define HAVE_MMX 1
int i_quality; /* for VBR */
float f_lumi_masking, f_dark_masking, f_p_masking, f_border_masking;
int i_luma_elim, i_chroma_elim;
-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
int i_aac_profile; /* AAC profile to use.*/
-#endif
/* Used to work around stupid timestamping behaviour in libavcodec */
uint64_t i_framenum;
mtime_t pi_delay_pts[MAX_FRAME_DELAY];
"trellis", "qscale", "strict", "lumi-masking", "dark-masking",
"p-masking", "border-masking", "luma-elim-threshold",
"chroma-elim-threshold",
-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
"aac-profile",
-#endif
NULL
};
int OpenEncoder( vlc_object_t *p_this )
{
encoder_t *p_enc = (encoder_t *)p_this;
- encoder_sys_t *p_sys = p_enc->p_sys;
+ encoder_sys_t *p_sys;
AVCodecContext *p_context;
AVCodec *p_codec;
int i_codec_id, i_cat;
return VLC_EGENERIC;
}
+ if( p_enc->fmt_out.i_cat == SPU_ES )
+ {
+ /* We don't support subtitle encoding */
+ return VLC_EGENERIC;
+ }
+
/* Initialization must be done before avcodec_find_encoder() */
InitLibavcodec( p_this );
var_Get( p_enc, ENC_CFG_PREFIX "chroma-elim-threshold", &val );
p_sys->i_chroma_elim = val.i_int;
-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
var_Get( p_enc, ENC_CFG_PREFIX "aac-profile", &val );
/* ffmpeg uses faac encoder atm, and it has issues with
* other than low-complexity profile, so default to that */
}
}
free( val.psz_string );
-#endif
if( p_enc->fmt_in.i_cat == VIDEO_ES )
{
__MAX( __MIN( p_sys->i_b_frames, FF_MAX_B_FRAMES ), 0 );
p_context->b_frame_strategy = 0;
if( !p_context->max_b_frames &&
- ( p_enc->fmt_out.i_codec == VLC_CODEC_MP2V ||
+ ( p_enc->fmt_out.i_codec == VLC_CODEC_MPGV ||
+ p_enc->fmt_out.i_codec == VLC_CODEC_MP2V ||
p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
p_context->flags |= CODEC_FLAG_LOW_DELAY;
}
}
-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
if ( p_sys->b_trellis )
p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#else
if( i_codec_id == CODEC_ID_MP3 && p_enc->fmt_in.audio.i_channels > 2 )
p_enc->fmt_in.audio.i_channels = 2;
- p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+ p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
p_context->channels = p_enc->fmt_out.audio.i_channels;
/* XXX: FAAC does resample only when setting the INPUT samplerate
* to the desired value (-R option of the faac frontend)
p_enc->fmt_in.audio.i_rate = p_context->sample_rate;*/
-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
/* vlc should default to low-complexity profile, faac encoder
* has bug and aac audio has issues otherwise atm */
p_context->profile = p_sys->i_aac_profile;
-#endif
}
}
msg_Err( p_enc, "cannot open encoder" );
dialog_Fatal( p_enc,
_("Streaming / Transcoding failed"),
- _("VLC could not open the encoder.") );
+ "%s", _("VLC could not open the encoder.") );
free( p_sys );
return VLC_EGENERIC;
}
{
msg_Err( p_enc, "cannot open encoder" );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"),
- _("VLC could not open the encoder.") );
+ "%s", _("VLC could not open the encoder.") );
free( p_sys );
return VLC_EGENERIC;
}
if ( current_date + HURRY_UP_GUARD3 > frame.pts )
{
p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE;
-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0;
if ( current_date + HURRY_UP_GUARD2 > frame.pts )
{
-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0;
}
else
{
-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
if ( p_sys->b_trellis )
p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#else
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
- p_sys->i_pts = p_aout_buf->start_date -
+ p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;