]> git.sesse.net Git - vlc/blobdiff - modules/codec/theora.c
Fix a bug introduced by 920692ff5d2d6b001e0f6ac7bda1978c9f7abd1f
[vlc] / modules / codec / theora.c
index 5ded10482549a13b954b5bf6d6c5ea87727e4c12..225a395d06cc613f273b2c73efe58de0b10a33d6 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <vlc/vlc.h>
-#include <vlc/decoder.h>
-#include <vlc/input.h>
-#include <vlc/sout.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
+#include <vlc/vlc.h>
+#include <vlc_codec.h>
+#include <vlc_vout.h>
+#include <vlc_sout.h>
+#include <vlc_input.h>
 #include <ogg/ogg.h>
 
 #include <theora/theora.h>
@@ -39,7 +43,7 @@
 struct decoder_sys_t
 {
     /* Module mode */
-    vlc_bool_t b_packetizer;
+    bool b_packetizer;
 
     /*
      * Input properties
@@ -56,7 +60,7 @@ struct decoder_sys_t
     /*
      * Decoding properties
      */
-    vlc_bool_t b_decoded_first_keyframe;
+    bool b_decoded_first_keyframe;
 
     /*
      * Common properties
@@ -105,17 +109,15 @@ vlc_module_begin();
     set_description( _("Theora video packetizer") );
     set_capability( "packetizer", 100 );
     set_callbacks( OpenPacketizer, CloseDecoder );
-    add_shortcut( "theora" );
 
     add_submodule();
     set_description( _("Theora video encoder") );
     set_capability( "encoder", 150 );
     set_callbacks( OpenEncoder, CloseEncoder );
-    add_shortcut( "theora" );
 
 #   define ENC_CFG_PREFIX "sout-theora-"
     add_integer( ENC_CFG_PREFIX "quality", 2, NULL, ENC_QUALITY_TEXT,
-                 ENC_QUALITY_LONGTEXT, VLC_FALSE );
+                 ENC_QUALITY_LONGTEXT, false );
 vlc_module_end();
 
 static const char *ppsz_enc_options[] = {
@@ -142,10 +144,10 @@ static int OpenDecoder( vlc_object_t *p_this )
         msg_Err( p_dec, "out of memory" );
         return VLC_EGENERIC;
     }
-    p_dec->p_sys->b_packetizer = VLC_FALSE;
+    p_dec->p_sys->b_packetizer = false;
 
     p_sys->i_pts = 0;
-    p_sys->b_decoded_first_keyframe = VLC_FALSE;
+    p_sys->b_decoded_first_keyframe = false;
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
@@ -174,7 +176,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
 
     if( i_ret == VLC_SUCCESS )
     {
-        p_dec->p_sys->b_packetizer = VLC_TRUE;
+        p_dec->p_sys->b_packetizer = true;
         p_dec->fmt_out.i_codec = VLC_FOURCC( 't', 'h', 'e', 'o' );
     }
 
@@ -218,7 +220,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         p_dec->fmt_in.p_extra =
             realloc( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra +
                      oggpacket.bytes + 2 );
-        p_extra = p_dec->fmt_in.p_extra + p_dec->fmt_in.i_extra;
+        p_extra = ((uint8_t *)p_dec->fmt_in.p_extra) + p_dec->fmt_in.i_extra;
         *(p_extra++) = oggpacket.bytes >> 8;
         *(p_extra++) = oggpacket.bytes & 0xFF;
 
@@ -461,7 +463,7 @@ static picture_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
     /* Check for keyframe */
     if( !(p_oggpacket->packet[0] & 0x80) /* data packet */ &&
         !(p_oggpacket->packet[0] & 0x40) /* intra frame */ )
-        p_sys->b_decoded_first_keyframe = VLC_TRUE;
+        p_sys->b_decoded_first_keyframe = true;
 
     /* If we haven't seen a single keyframe yet, don't let Theora decode
      * anything, otherwise we'll get display artifacts.  (This is impossible
@@ -510,7 +512,7 @@ static void ParseTheoraComments( decoder_t *p_dec )
             *psz_value = '\0';
             psz_value++;
             input_Control( p_input, INPUT_ADD_INFO, _("Theora comment"),
-                           psz_name, psz_value );
+                           psz_name, "%s", psz_value );
         }
         free( psz_comment );
         i++;
@@ -577,7 +579,7 @@ struct encoder_sys_t
     /*
      * Input properties
      */
-    vlc_bool_t b_headers;
+    bool b_headers;
 
     /*
      * Theora properties
@@ -619,7 +621,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
     p_enc->fmt_out.i_codec = VLC_FOURCC('t','h','e','o');
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     var_Get( p_enc, ENC_CFG_PREFIX "quality", &val );
     i_quality = val.i_int;