]> git.sesse.net Git - vlc/blobdiff - modules/codec/dmo/dmo.c
vlc_thread_ready: remove
[vlc] / modules / codec / dmo / dmo.c
index 2586e56db5e6df61ac7daf8750d296482a6a4f5f..55fe6e279f5009a06b1c6b6d807030cdb47c5047 100644 (file)
  * Preamble
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_vout.h>
 #include <vlc_aout.h>
@@ -50,7 +55,7 @@
 
 #ifdef LOADER
 /* Not Needed */
-long CoInitialize( void *pvReserved ) { return -1; }
+long CoInitialize( void *pvReserved ) { VLC_UNUSED(pvReserved); return -1; }
 void CoUninitialize( void ) { }
 
 /* A few prototypes */
@@ -90,11 +95,11 @@ static void EncoderClose ( vlc_object_t * );
 static block_t *EncodeBlock( encoder_t *, void * );
 
 static int LoadDMO( vlc_object_t *, HINSTANCE *, IMediaObject **,
-                    es_format_t *, vlc_bool_t );
+                    es_format_t *, bool );
 static void CopyPicture( decoder_t *, picture_t *, uint8_t * );
 
 vlc_module_begin();
-    set_description( _("DirectMedia Object decoder") );
+    set_description( N_("DirectMedia Object decoder") );
     add_shortcut( "dmo" );
     set_capability( "decoder", 1 );
     set_callbacks( DecoderOpen, DecoderClose );
@@ -103,7 +108,7 @@ vlc_module_begin();
 
 #   define ENC_CFG_PREFIX "sout-dmo-"
     add_submodule();
-    set_description( _("DirectMedia Object encoder") );
+    set_description( N_("DirectMedia Object encoder") );
     set_capability( "encoder", 10 );
     set_callbacks( EncoderOpen, EncoderClose );
 
@@ -175,8 +180,9 @@ static const codec_dll decoders_table[] =
     { VLC_FOURCC('w','v','c','1'), "wvc1dmod.dll", &guid_wvc1 },
     /* WMV3 */
     { VLC_FOURCC('W','M','V','3'), "wmv9dmod.dll", &guid_wmv9 },
-    { VLC_FOURCC('W','M','V','P'), "wmv9dmod.dll", &guid_wmv9 },
     { VLC_FOURCC('w','m','v','3'), "wmv9dmod.dll", &guid_wmv9 },
+    { VLC_FOURCC('W','M','V','P'), "wmv9dmod.dll", &guid_wmv9 },
+    { VLC_FOURCC('w','m','v','p'), "wmv9dmod.dll", &guid_wmv9 },
     /* WMV2 */
     { VLC_FOURCC('W','M','V','2'), "wmvdmod.dll", &guid_wmv },
     { VLC_FOURCC('w','m','v','2'), "wmvdmod.dll", &guid_wmv },
@@ -184,21 +190,27 @@ static const codec_dll decoders_table[] =
     { VLC_FOURCC('W','M','V','1'), "wmvdmod.dll", &guid_wmv },
     { VLC_FOURCC('w','m','v','1'), "wmvdmod.dll", &guid_wmv },
     /* Screen codecs */
-    { VLC_FOURCC('M','S','S','1'), "wmsdmod.dll", &guid_wms },
     { VLC_FOURCC('M','S','S','2'), "wmsdmod.dll", &guid_wms },
+    { VLC_FOURCC('m','s','s','2'), "wmsdmod.dll", &guid_wms },
+    { VLC_FOURCC('M','S','S','1'), "wmsdmod.dll", &guid_wms },
+    { VLC_FOURCC('m','s','s','1'), "wmsdmod.dll", &guid_wms },
     /* Windows Media Video Adv */
     { VLC_FOURCC('W','M','V','A'), "wmvadvd.dll", &guid_wmva },
+    { VLC_FOURCC('w','m','v','a'), "wmvadvd.dll", &guid_wmva },
     { VLC_FOURCC('W','V','P','2'), "wmvadvd.dll", &guid_wmva },
+    { VLC_FOURCC('w','v','p','2'), "wmvadvd.dll", &guid_wmva },
 
     /* WMA 3 */
     { VLC_FOURCC('W','M','A','3'), "wma9dmod.dll", &guid_wma9 },
     { VLC_FOURCC('w','m','a','3'), "wma9dmod.dll", &guid_wma9 },
+    { VLC_FOURCC('W','M','A','P'), "wma9dmod.dll", &guid_wma9 },
     { VLC_FOURCC('w','m','a','p'), "wma9dmod.dll", &guid_wma9 },
     /* WMA 2 */
     { VLC_FOURCC('W','M','A','2'), "wma9dmod.dll", &guid_wma9 },
     { VLC_FOURCC('w','m','a','2'), "wma9dmod.dll", &guid_wma9 },
 
     /* WMA Speech */
+    { VLC_FOURCC('W','M','A','S'), "wmspdmod.dll", &guid_wma },
     { VLC_FOURCC('w','m','a','s'), "wmspdmod.dll", &guid_wma },
 
     /* */
@@ -303,7 +315,7 @@ static int DecOpen( vlc_object_t *p_this )
     CoInitialize( 0 );
 #endif /* LOADER */
 
-    if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, VLC_FALSE )
+    if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, false )
         != VLC_SUCCESS )
     {
         hmsdmo_dll = 0;
@@ -474,7 +486,7 @@ static int DecOpen( vlc_object_t *p_this )
         dmo_output_type.formattype = FORMAT_VideoInfo;
         dmo_output_type.subtype = dmo_output_type.majortype;
         dmo_output_type.subtype.Data1 = p_bih->biCompression;
-        dmo_output_type.bFixedSizeSamples = VLC_TRUE;
+        dmo_output_type.bFixedSizeSamples = true;
         dmo_output_type.bTemporalCompression = 0;
         dmo_output_type.lSampleSize = p_bih->biSizeImage;
         dmo_output_type.cbFormat = sizeof(VIDEOINFOHEADER);
@@ -508,7 +520,6 @@ static int DecOpen( vlc_object_t *p_this )
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
     {
-        msg_Err( p_dec, "out of memory" );
         goto error;
     }
 
@@ -545,8 +556,8 @@ static int DecOpen( vlc_object_t *p_this )
     else
         date_Init( &p_sys->end_date, 25 /* FIXME */, 1 );
 
-    if( p_vih ) free( p_vih );
-    if( p_wf ) free( p_wf );
+    free( p_vih );
+    free( p_wf );
 
     return VLC_SUCCESS;
 
@@ -562,9 +573,9 @@ static int DecOpen( vlc_object_t *p_this )
     CoUninitialize();
 #endif /* LOADER */
 
-    if( p_vih ) free( p_vih );
-    if( p_wf )  free( p_wf );
-    if( p_sys ) free( p_sys );
+    free( p_vih );
+    free( p_wf );
+    free( p_sys );
 
     return VLC_EGENERIC;
 }
@@ -574,7 +585,7 @@ static int DecOpen( vlc_object_t *p_this )
  *****************************************************************************/
 static int LoadDMO( vlc_object_t *p_this, HINSTANCE *p_hmsdmo_dll,
                     IMediaObject **pp_dmo, es_format_t *p_fmt,
-                    vlc_bool_t b_out )
+                    bool b_out )
 {
     DMO_PARTIAL_MEDIATYPE dmo_partial_type;
     int i_err;
@@ -760,7 +771,7 @@ void DecoderClose( vlc_object_t *p_this )
     CoUninitialize();
 #endif
 
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
+    free( p_sys->p_buffer );
     free( p_sys );
 }
 
@@ -818,7 +829,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     {
         CMediaBuffer *p_in;
 
-        p_in = CMediaBufferCreate( p_block, p_block->i_buffer, VLC_TRUE );
+        p_in = CMediaBufferCreate( p_block, p_block->i_buffer, true );
 
         i_result = p_sys->p_dmo->vt->ProcessInput( p_sys->p_dmo, 0,
                        (IMediaBuffer *)p_in, DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
@@ -860,7 +871,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     block_out.p_buffer = p_sys->p_buffer;
     block_out.i_buffer = 0;
 
-    p_out = CMediaBufferCreate( &block_out, p_sys->i_min_output, VLC_FALSE );
+    p_out = CMediaBufferCreate( &block_out, p_sys->i_min_output, false );
     memset( &db, 0, sizeof(db) );
     db.pBuffer = (IMediaBuffer *)p_out;
 
@@ -951,7 +962,7 @@ static void CopyPicture( decoder_t *p_dec, picture_t *p_pic, uint8_t *p_in )
 
         for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
         {
-            p_dec->p_libvlc->pf_memcpy( p_dst, p_src, i_width );
+            vlc_memcpy( p_dst, p_src, i_width );
             p_src += i_width;
             p_dst += i_dst_stride;
         }
@@ -1047,7 +1058,7 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
     vih.rcSource.bottom = p_enc->fmt_in.video.i_height;
     vih.rcTarget = vih.rcSource;
 
-    vih.AvgTimePerFrame = I64C(10000000) / 25; //FIXME
+    vih.AvgTimePerFrame = INT64_C(10000000) / 25; //FIXME
 
     dmo_type.majortype = MEDIATYPE_Video;
     //dmo_type.subtype = MEDIASUBTYPE_RGB24;
@@ -1308,7 +1319,7 @@ static int EncOpen( vlc_object_t *p_this )
     CoInitialize( 0 );
 #endif /* LOADER */
 
-    if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, VLC_TRUE )
+    if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, true )
         != VLC_SUCCESS )
     {
         hmsdmo_dll = 0;
@@ -1329,7 +1340,6 @@ static int EncOpen( vlc_object_t *p_this )
     if( ( p_enc->p_sys = p_sys =
           (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
     {
-        msg_Err( p_enc, "out of memory" );
         goto error;
     }
 
@@ -1389,7 +1399,7 @@ static int EncOpen( vlc_object_t *p_this )
     CoUninitialize();
 #endif /* LOADER */
 
-    if( p_sys ) free( p_sys );
+    free( p_sys );
 
     return VLC_EGENERIC;
 }
@@ -1433,7 +1443,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
             for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines;
                  i_line++ )
             {
-                p_enc->p_libvlc->pf_memcpy( p_dst, p_src, i_width );
+                vlc_memcpy( p_dst, p_src, i_width );
                 p_dst += i_width;
                 p_src += i_src_stride;
             }
@@ -1452,7 +1462,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
     }
 
     /* Feed input to the DMO */
-    p_in = CMediaBufferCreate( p_block_in, p_block_in->i_buffer, VLC_TRUE );
+    p_in = CMediaBufferCreate( p_block_in, p_block_in->i_buffer, true );
     i_result = p_sys->p_dmo->vt->ProcessInput( p_sys->p_dmo, 0,
        (IMediaBuffer *)p_in, DMO_INPUT_DATA_BUFFERF_TIME, i_pts * 10, 0 );
 
@@ -1461,7 +1471,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
     {
         /* No output generated */
 #ifdef DMO_DEBUG
-        msg_Dbg( p_enc, "ProcessInput(): no output generated "I64Fd, i_pts );
+        msg_Dbg( p_enc, "ProcessInput(): no output generated %"PRId64, i_pts );
 #endif
         return NULL;
     }
@@ -1489,7 +1499,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
 
         p_block_out = block_New( p_enc, p_sys->i_min_output );
         p_block_out->i_buffer = 0;
-        p_out = CMediaBufferCreate(p_block_out, p_sys->i_min_output, VLC_FALSE);
+        p_out = CMediaBufferCreate(p_block_out, p_sys->i_min_output, false);
         memset( &db, 0, sizeof(db) );
         db.pBuffer = (IMediaBuffer *)p_out;
 
@@ -1523,7 +1533,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
         if( db.dwStatus & DMO_OUTPUT_DATA_BUFFERF_TIME )
         {
 #ifdef DMO_DEBUG
-            msg_Dbg( p_enc, "ProcessOutput(): pts: "I64Fd", "I64Fd,
+            msg_Dbg( p_enc, "ProcessOutput(): pts: %"PRId64", %"PRId64,
                      i_pts, db.rtTimestamp / 10 );
 #endif
             i_pts = db.rtTimestamp / 10;
@@ -1533,7 +1543,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
         {
             p_block_out->i_length = db.rtTimelength / 10;
 #ifdef DMO_DEBUG
-            msg_Dbg( p_enc, "ProcessOutput(): length: "I64Fd,
+            msg_Dbg( p_enc, "ProcessOutput(): length: %"PRId64,
                      p_block_out->i_length );
 #endif
         }