]> git.sesse.net Git - vlc/blobdiff - modules/access/dshow/dshow.cpp
Do not leak psz_demux
[vlc] / modules / access / dshow / dshow.cpp
index 40458eb5a7ed7e718c0584449f32b9bf44b3ad3f..ee28b8612158d782c3eeb0ad6296bdf9c8673c08 100644 (file)
 # include "config.h"
 #endif
 
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_access.h>
 #include <vlc_demux.h>
@@ -415,7 +419,7 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
     p_sys->p_capture_graph_builder2 = NULL;
     p_sys->p_control = NULL;
 
-    vlc_mutex_init( p_this, &p_sys->lock );
+    vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( p_this, &p_sys->wait );
 
     /* Build directshow graph */
@@ -653,11 +657,13 @@ static int AccessOpen( vlc_object_t *p_this )
             p_stream->i_fourcc == VLC_FOURCC('d','v','s','d') ||
             p_stream->i_fourcc == VLC_FOURCC('d','v','h','d') )
         {
+            free( p_access->psz_demux );
             p_access->psz_demux = strdup( "rawdv" );
         }
         else if( p_stream->i_fourcc == VLC_FOURCC('m','p','2','v') )
         {
-            p_access->psz_demux = "mpgv";
+            free( p_access->psz_demux );
+            p_access->psz_demux = strdup( "mpgv" );
         }
     }
 
@@ -1641,7 +1647,7 @@ static block_t *ReadCompressed( access_t *p_access )
         }
 
         sample.p_sample->GetPointer( &p_data );
-        p_access->p_libvlc->pf_memcpy( p_block->p_buffer, p_data, i_data_size );
+        vlc_memcpy( p_block->p_buffer, p_data, i_data_size );
         sample.p_sample->Release();
 
         /* The caller got what he wanted */
@@ -1725,12 +1731,12 @@ static int Demux( demux_t *p_demux )
     i_pts /= 10; /* Dshow works with 100 nano-seconds resolution */
 
 #if 0
-    msg_Dbg( p_demux, "Read() stream: %i, size: %i, PTS: "I64Fd,
+    msg_Dbg( p_demux, "Read() stream: %i, size: %i, PTS: %"PRId64,
              i_stream, i_data_size, i_pts );
 #endif
 
     p_block = block_New( p_demux, i_data_size );
-    p_demux->p_libvlc->pf_memcpy( p_block->p_buffer, p_data, i_data_size );
+    vlc_memcpy( p_block->p_buffer, p_data, i_data_size );
     p_block->i_pts = p_block->i_dts = i_pts;
     sample.p_sample->Release();