]> git.sesse.net Git - vlc/blobdiff - modules/access/dc1394.c
Replaced vout_InitPicture/Format with their equivalent.
[vlc] / modules / access / dc1394.c
index 53f6c5a3447d9a357e3048c49a2eebf885523e7a..b79d38a50549071a892b11364812107e801a3c7b 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_input.h>
-#include <vlc_vout.h>
 #include <vlc_demux.h>
 
 
@@ -63,12 +62,12 @@ static void Close( vlc_object_t * );
 static void OpenAudioDev( demux_t *p_demux );
 static inline void CloseAudioDev( demux_t *p_demux );
 
-vlc_module_begin();
-    set_description( _("dc1394 input") );
-    set_capability( "access_demux", 10 );
-    add_shortcut( "dc1394" );
-    set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+    set_description( N_("dc1394 input") )
+    set_capability( "access_demux", 10 )
+    add_shortcut( "dc1394" )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 typedef struct __dc_camera
 {
@@ -215,9 +214,11 @@ static int Open( vlc_object_t *p_this )
     int i;
     int i_width;
     int i_height;
-    int i_aspect;
     int result = 0;
 
+    if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
+        return VLC_EGENERIC;
+
     /* Set up p_demux */
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
@@ -225,13 +226,9 @@ static int Open( vlc_object_t *p_this )
     p_demux->info.i_title = 0;
     p_demux->info.i_seekpoint = 0;
 
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+    p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
     if( !p_sys )
-    {
-        msg_Err( p_demux, "not enough memory available" );
         return VLC_ENOMEM;
-    }
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
     memset( &fmt, 0, sizeof( es_format_t ) );
 
     /* DEFAULTS */
@@ -478,12 +475,16 @@ static int Open( vlc_object_t *p_this )
     i_width = p_sys->camera.frame_width;
     i_height = p_sys->camera.frame_height;
 
-    i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic,
-                    VLC_FOURCC('U', 'Y', 'V', 'Y'),
-                    i_width, i_height,
-                    i_width * VOUT_ASPECT_FACTOR / i_height );
+    if( picture_Setup( &p_sys->pic, VLC_CODEC_UYVY,
+                       i_width, i_height,
+                       i_width * VOUT_ASPECT_FACTOR / i_height ) )
+    {
+        msg_Err( p_demux ,"unknown chroma" );
+        Close( p_this );
+        return VLC_EGENERIC;
+    }
 
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('U', 'Y', 'V', 'Y') );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_UYVY );
 
     fmt.video.i_width = i_width;
     fmt.video.i_height = i_height;
@@ -499,11 +500,11 @@ static int Open( vlc_object_t *p_this )
         if( p_sys->fd_audio >= 0 )
         {
             es_format_t fmt;
-            es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') );
+            es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L ); /* FIXME: hmm, ?? */
 
             fmt.audio.i_channels = p_sys->channels ? p_sys->channels : 1;
             fmt.audio.i_rate = p_sys->i_sample_rate;
-            fmt.audio.i_bitspersample = 16; /* FIXME: hmm, ?? */
+            fmt.audio.i_bitspersample = 16;
             fmt.audio.i_blockalign = fmt.audio.i_channels *
                                      fmt.audio.i_bitspersample / 8;
             fmt.i_bitrate = fmt.audio.i_channels * fmt.audio.i_rate *
@@ -838,9 +839,6 @@ static int process_options( demux_t *p_demux )
     char *state = NULL;
     float rate_f;
 
-    if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
-        return VLC_EGENERIC;
-
     psz_dup = strdup( p_demux->psz_path );
     psz_parser = psz_dup;
     for( token = strtok_r( psz_parser,":",&state); token;