]> git.sesse.net Git - vlc/commitdiff
* modules/stream_out/transcode.c: if aenc/venc is specified, force the encoder.
authorGildas Bazin <gbazin@videolan.org>
Sun, 25 Apr 2004 17:02:49 +0000 (17:02 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 25 Apr 2004 17:02:49 +0000 (17:02 +0000)
* modules/codec/vorbis.c,flac.c,theora.c,speex.c: use encoder if forced.

include/vlc_codec.h
modules/codec/flac.c
modules/codec/speex.c
modules/codec/theora.c
modules/codec/vorbis.c
modules/stream_out/transcode.c

index 5224a1bdd8ebae3ab2779efea5f38f2adf1c0389..7302ce2f1cb1d61c2bd9cab406f66a8d8cb5c95c 100644 (file)
@@ -100,6 +100,7 @@ struct encoder_t
     /* Module properties */
     module_t *          p_module;
     encoder_sys_t *     p_sys;
+    vlc_bool_t          b_force;
 
     block_t *           ( * pf_header )( encoder_t * );
     block_t *           ( * pf_encode_video )( encoder_t *, picture_t * );
@@ -111,8 +112,11 @@ struct encoder_t
     /* Properties of the output of the encoder */
     es_format_t         fmt_out;
 
-    /* Number of threads to use during encoding */
-    int                 i_threads;
+    /* Common encoder options */
+    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 */
     sout_cfg_t *p_cfg;
index 1b31aabb7daf30a00fe86a60090d4e865a87c4b6..3e5b940596f85a57553868cd625f9e6910ee0d8a 100644 (file)
@@ -2,9 +2,9 @@
  * flac.c: flac decoder/packetizer/encoder module making use of libflac
  *****************************************************************************
  * 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>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -1060,7 +1060,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     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;
     }
@@ -1073,6 +1074,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     }
     p_enc->p_sys = p_sys;
     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->p_buffer = 0;
     p_sys->i_buffer = 0;
index f201863c456a0b57d34fe0b58d1fd92e6cfbf3c7..4161dced1fb3ff3eaae0c94b3b2f4d78ba00ede6 100755 (executable)
@@ -552,7 +552,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     SpeexMode *p_speex_mode = &speex_nb_mode;
     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;
     }
@@ -567,6 +568,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->pf_header = Headers;
     p_enc->pf_encode_audio = Encode;
     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,
                        1, p_speex_mode );
index 2e578cb7a6fb799c03fbb0aa8970fe35761e9109..eaceea47b1ca757c61b3d4aa5dd1821719a5b89c 100644 (file)
@@ -441,7 +441,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     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;
     }
@@ -466,6 +467,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->pf_header = Headers;
     p_enc->pf_encode_video = Encode;
     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_y_offset 0
index 976ac38c49364e494fc9c8efeff4e9e75a3bf878..3633d08cf9cfb3ed18b50f1987cf2efc5c9c8640 100644 (file)
@@ -26,6 +26,7 @@
  *****************************************************************************/
 #include <vlc/vlc.h>
 #include <vlc/decoder.h>
+#include <vlc/sout.h>
 
 #include <ogg/ogg.h>
 
@@ -558,7 +559,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     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;
     }
@@ -574,6 +576,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->pf_header = Headers;
     p_enc->pf_encode_audio = Encode;
     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 */
     vorbis_info_init( &p_sys->vi );
index 63f80967c066af2bfd69e947270902605ecb1a1f..a718f9006a94f67579ac1fef9d5ee6c0f1a04aac 100644 (file)
@@ -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->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 */
     vlc_object_attach( id->p_encoder, p_stream );
@@ -1308,6 +1310,8 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
     id->p_vresample      = NULL;
 
     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 */
     vlc_object_attach( id->p_encoder, p_stream );