]> git.sesse.net Git - vlc/blobdiff - modules/codec/libmpeg2.c
macosx: Fix controller playlist toggling to use the contentRect and not the window...
[vlc] / modules / codec / libmpeg2.c
index f6e20d4d269670e625be8555608e9643d470459e..13ec4c512a79b7a56c3e5c6e9c826636b7f715bd 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
 
-#include <mpeg2dec/mpeg2.h>
+#include <mpeg2.h>
 
 #include <vlc_codec_synchro.h>
 
@@ -53,7 +54,7 @@ struct decoder_sys_t
      */
     mpeg2dec_t          *p_mpeg2dec;
     const mpeg2_info_t  *p_info;
-    vlc_bool_t          b_skip;
+    bool                b_skip;
 
     /*
      * Input properties
@@ -64,13 +65,13 @@ struct decoder_sys_t
     mtime_t          i_current_dts;
     int              i_current_rate;
     picture_t *      p_picture_to_destroy;
-    vlc_bool_t       b_garbage_pic;
-    vlc_bool_t       b_after_sequence_header; /* is it the next frame after
+    bool             b_garbage_pic;
+    bool             b_after_sequence_header; /* is it the next frame after
                                                * the sequence header ?    */
-    vlc_bool_t       b_slice_i;             /* intra-slice refresh stream */
-    vlc_bool_t       b_second_field;
+    bool             b_slice_i;             /* intra-slice refresh stream */
+    bool             b_second_field;
 
-    vlc_bool_t       b_preroll;
+    bool             b_preroll;
 
     /*
      * Output properties
@@ -98,7 +99,7 @@ static void GetAR( decoder_t *p_dec );
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    set_description( _("MPEG I/II video decoder (using libmpeg2)") );
+    set_description( N_("MPEG I/II video decoder (using libmpeg2)") );
     set_capability( "decoder", 150 );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_VCODEC );
@@ -129,10 +130,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Initialize the thread properties */
     memset( p_sys, 0, sizeof(decoder_sys_t) );
@@ -148,7 +146,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->b_slice_i  = 0;
     p_sys->b_second_field = 0;
     p_sys->b_skip     = 0;
-    p_sys->b_preroll = VLC_FALSE;
+    p_sys->b_preroll = false;
 
 #if defined( __i386__ ) || defined( __x86_64__ )
     if( vlc_CPU() & CPU_CAPABILITY_MMX )
@@ -261,11 +259,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
             if( p_block->i_flags & BLOCK_FLAG_PREROLL )
             {
-                p_sys->b_preroll = VLC_TRUE;
+                p_sys->b_preroll = true;
             }
             else if( p_sys->b_preroll )
             {
-                p_sys->b_preroll = VLC_FALSE;
+                p_sys->b_preroll = false;
                 /* Reset synchro */
                 decoder_SynchroReset( p_sys->p_synchro );
             }
@@ -296,9 +294,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             p_block->i_buffer = 0;
             break;
 
-#ifdef STATE_SEQUENCE_MODIFIED
-/* FIXME - the above ifdef is always FALSE, even with libmpeg2-0.5.0
- * Need to improve the implementation to avoid invalid/unref pictures */
+#if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
 
         case STATE_SEQUENCE_MODIFIED:
             GetAR( p_dec );
@@ -325,7 +321,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             }
 
             mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
-        mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
+            mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
 
             /* This picture will never go through display_picture. */
             p_pic->date = 0;
@@ -481,7 +477,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             }
 
             /* For still frames */
-            if( state == STATE_END && p_pic ) p_pic->b_force = VLC_TRUE;
+            if( state == STATE_END && p_pic ) p_pic->b_force = true;
 
             if( p_pic )
             {
@@ -525,7 +521,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
                     break;
                 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
-        mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
+                mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
             }
             p_sys->p_picture_to_destroy = p_pic;