Commit 75013fc5 authored by Gildas Bazin's avatar Gildas Bazin

* modules/stream_out/transcode.c: if aenc/venc is specified, force the encoder.

* modules/codec/vorbis.c,flac.c,theora.c,speex.c: use encoder if forced.
parent e3c68867
...@@ -100,6 +100,7 @@ struct encoder_t ...@@ -100,6 +100,7 @@ struct encoder_t
/* Module properties */ /* Module properties */
module_t * p_module; module_t * p_module;
encoder_sys_t * p_sys; encoder_sys_t * p_sys;
vlc_bool_t b_force;
block_t * ( * pf_header )( encoder_t * ); block_t * ( * pf_header )( encoder_t * );
block_t * ( * pf_encode_video )( encoder_t *, picture_t * ); block_t * ( * pf_encode_video )( encoder_t *, picture_t * );
...@@ -111,8 +112,11 @@ struct encoder_t ...@@ -111,8 +112,11 @@ struct encoder_t
/* Properties of the output of the encoder */ /* Properties of the output of the encoder */
es_format_t fmt_out; es_format_t fmt_out;
/* Number of threads to use during encoding */ /* Common encoder options */
int i_threads; int i_threads; /* Number of threads to use during encoding */
int i_iframes; /* One I frame per i_iframes */
int i_bframes; /* One B frame per i_bframes */
int i_tolerance; /* Bitrate tolerance */
/* Encoder config */ /* Encoder config */
sout_cfg_t *p_cfg; sout_cfg_t *p_cfg;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* flac.c: flac decoder/packetizer/encoder module making use of libflac * flac.c: flac decoder/packetizer/encoder module making use of libflac
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: flac.c,v 1.9 2004/02/25 17:48:52 fenrir Exp $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@videolan.org>
* Sigmund Augdal <sigmunau@idi.ntnu.no> * Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -1060,7 +1060,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -1060,7 +1060,8 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
if( p_enc->fmt_out.i_codec != VLC_FOURCC('f','l','a','c') ) if( p_enc->fmt_out.i_codec != VLC_FOURCC('f','l','a','c') &&
!p_enc->b_force )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -1073,6 +1074,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -1073,6 +1074,8 @@ static int OpenEncoder( vlc_object_t *p_this )
} }
p_enc->p_sys = p_sys; p_enc->p_sys = p_sys;
p_enc->pf_encode_audio = Encode; p_enc->pf_encode_audio = Encode;
p_enc->fmt_out.i_codec = VLC_FOURCC('f','l','a','c');
p_sys->i_headers = 0; p_sys->i_headers = 0;
p_sys->p_buffer = 0; p_sys->p_buffer = 0;
p_sys->i_buffer = 0; p_sys->i_buffer = 0;
......
...@@ -552,7 +552,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -552,7 +552,8 @@ static int OpenEncoder( vlc_object_t *p_this )
SpeexMode *p_speex_mode = &speex_nb_mode; SpeexMode *p_speex_mode = &speex_nb_mode;
int i_quality; int i_quality;
if( p_enc->fmt_out.i_codec != VLC_FOURCC('s','p','x',' ') ) if( p_enc->fmt_out.i_codec != VLC_FOURCC('s','p','x',' ') &&
!p_enc->b_force )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -567,6 +568,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -567,6 +568,7 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->pf_header = Headers; p_enc->pf_header = Headers;
p_enc->pf_encode_audio = Encode; p_enc->pf_encode_audio = Encode;
p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE; p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
p_enc->fmt_out.i_codec = VLC_FOURCC('s','p','x',' ');
speex_init_header( &p_sys->header, p_enc->fmt_in.audio.i_rate, speex_init_header( &p_sys->header, p_enc->fmt_in.audio.i_rate,
1, p_speex_mode ); 1, p_speex_mode );
......
...@@ -441,7 +441,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -441,7 +441,8 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_t *p_enc = (encoder_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 = p_enc->p_sys;
if( p_enc->fmt_out.i_codec != VLC_FOURCC('t','h','e','o') ) if( p_enc->fmt_out.i_codec != VLC_FOURCC('t','h','e','o') &&
!p_enc->b_force )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -466,6 +467,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -466,6 +467,7 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->pf_header = Headers; p_enc->pf_header = Headers;
p_enc->pf_encode_video = Encode; p_enc->pf_encode_video = Encode;
p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0'); p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
p_enc->fmt_out.i_codec = VLC_FOURCC('t','h','e','o');
#define frame_x_offset 0 #define frame_x_offset 0
#define frame_y_offset 0 #define frame_y_offset 0
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/decoder.h> #include <vlc/decoder.h>
#include <vlc/sout.h>
#include <ogg/ogg.h> #include <ogg/ogg.h>
...@@ -558,7 +559,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -558,7 +559,8 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') ) if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') &&
!p_enc->b_force )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -574,6 +576,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -574,6 +576,7 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->pf_header = Headers; p_enc->pf_header = Headers;
p_enc->pf_encode_audio = Encode; p_enc->pf_encode_audio = Encode;
p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2'); p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2');
p_enc->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
/* Initialize vorbis encoder */ /* Initialize vorbis encoder */
vorbis_info_init( &p_sys->vi ); vorbis_info_init( &p_sys->vi );
......
...@@ -837,6 +837,8 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, ...@@ -837,6 +837,8 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream,
id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate; id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate;
id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg; id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg;
if( p_stream->p_sys->psz_aenc &&
*p_stream->p_sys->psz_aenc ) id->p_encoder->b_force = VLC_TRUE;
/* Attach object to parent so object variables inheritance works */ /* Attach object to parent so object variables inheritance works */
vlc_object_attach( id->p_encoder, p_stream ); vlc_object_attach( id->p_encoder, p_stream );
...@@ -1308,6 +1310,8 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, ...@@ -1308,6 +1310,8 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
id->p_vresample = NULL; id->p_vresample = NULL;
id->p_encoder->p_cfg = p_sys->p_video_cfg; id->p_encoder->p_cfg = p_sys->p_video_cfg;
if( p_stream->p_sys->psz_venc &&
*p_stream->p_sys->psz_venc ) id->p_encoder->b_force = VLC_TRUE;
/* Attach object to parent so object variables inheritance works */ /* Attach object to parent so object variables inheritance works */
vlc_object_attach( id->p_encoder, p_stream ); vlc_object_attach( id->p_encoder, p_stream );
......
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