]> git.sesse.net Git - vlc/blobdiff - modules/codec/invmem.c
Add a predefined string list for --decklink-video-connection.
[vlc] / modules / codec / invmem.c
index d18513c1b5dbc1edc3997df944ee108ac7946747..7e96d27b00aaf967d5ed64991a24a09a6c304cc0 100644 (file)
@@ -71,19 +71,11 @@ static picture_t *DecodeBlock  ( decoder_t *, block_t ** );
 #define LT_CHROMA N_("Output chroma for the memory image as a 4-character " \
                       "string, eg. \"RV32\".")
 
-#define INVMEM_HELP N_( "This module make possible making video stream from raw-image " \
-                        "generating (to memory) from rendering program uses libvlc. " \
-                        "To use this module from libvlc set --codec to invmem, "\
-                        "set all --invmem-* options in vlc_argv an use " \
-                        "libvlc_media_new(libvlc, \"fake://\", &ex);. " \
-                        "Besides is simillar to vmem video output module." )
-
 vlc_module_begin()
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_VCODEC )
     set_shortname( N_("Memory video decoder") )
     set_description( N_("Memory video decoder") )
-    set_help( INVMEM_HELP )
     set_capability( "decoder", 50 )
     set_callbacks( OpenDecoder, CloseDecoder )
     add_shortcut( "invmem" )
@@ -108,8 +100,6 @@ struct decoder_sys_t
     int i_pitch;
 
     vlc_fourcc_t i_chroma;
-
-    picture_t *p_pic;
 };
 
 
@@ -214,13 +204,12 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_dec->fmt_out.i_codec = chroma;
     p_dec->fmt_out.video.i_width = p_dec->p_sys->i_width;
     p_dec->fmt_out.video.i_height = p_dec->p_sys->i_height;
-    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->p_sys->i_width / p_dec->p_sys->i_height;
+    p_dec->fmt_out.video.i_sar_num = 1;
+    p_dec->fmt_out.video.i_sar_den = 1;
     p_dec->fmt_out.i_cat = VIDEO_ES;
 
     p_sys->i_pitch = pitch;
 
-    p_sys->p_pic = NULL;
-
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
 
@@ -240,28 +229,27 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_block;
+    picture_t*  p_pic;
 
     if( !pp_block || !*pp_block ) return NULL;
 
     p_block = *pp_block;
 
     // create new picture
-    if( p_sys->p_pic != NULL )
-        picture_Release( p_sys->p_pic );
-    p_sys->p_pic = decoder_NewPicture( p_dec );
-    if ( !p_sys->p_pic ) return NULL;
-    p_sys->p_pic->b_force = true;
-    p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
-    p_sys->p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
+    p_pic = decoder_NewPicture( p_dec );
+    if ( !p_pic ) return NULL;
+    p_pic->b_force = true;
+    p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
+    p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
 
     // lock input and copy to picture
-    p_sys->p_pic->p->p_pixels = p_sys->pf_lock( p_dec->p_sys->p_data );
+    p_pic->p->p_pixels = p_sys->pf_lock( p_dec->p_sys->p_data );
 
     // unlock input
     p_sys->pf_unlock( p_dec->p_sys->p_data );
 
     block_Release( *pp_block ); *pp_block = NULL;
-    return p_sys->p_pic;
+    return p_pic;
 }
 
 /*****************************************************************************
@@ -272,8 +260,5 @@ static void CloseDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( p_sys->p_pic != NULL )
-        picture_Release( p_sys->p_pic );
-
     free( p_sys );
 }