]> git.sesse.net Git - vlc/blobdiff - modules/codec/schroedinger.c
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / codec / schroedinger.c
index d854f573170eff9187bdc1093eb8972580bd1dc3..fceae03c05831d93d3468b1ca42fab86d7e08a88 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include <schroedinger/schro.h>
 
@@ -88,7 +87,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     SchroDecoder *p_schro;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','r','a','c') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_DIRAC )
     {
         return VLC_EGENERIC;
     }
@@ -112,15 +111,12 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_dec->p_sys = p_sys;
     p_sys->p_schro = p_schro;
     p_sys->p_format = NULL;
-    p_sys->i_lastpts = -1;
+    p_sys->i_lastpts = VLC_TS_INVALID;
     p_sys->i_frame_pts_delta = 0;
 
-    /* request packetizer */
-    p_dec->b_need_packetized = true;
-
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+    p_dec->fmt_out.i_codec = VLC_CODEC_I420;
 
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
@@ -134,7 +130,6 @@ static int OpenDecoder( vlc_object_t *p_this )
 static void SetVideoFormat( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    double f_aspect;
 
     p_sys->p_format = schro_decoder_get_video_format(p_sys->p_schro);
     if( p_sys->p_format == NULL ) return;
@@ -145,9 +140,9 @@ static void SetVideoFormat( decoder_t *p_dec )
 
     switch( p_sys->p_format->chroma_format )
     {
-    case SCHRO_CHROMA_420: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0'); break;
-    case SCHRO_CHROMA_422: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','2'); break;
-    case SCHRO_CHROMA_444: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','4','4'); break;
+    case SCHRO_CHROMA_420: p_dec->fmt_out.i_codec = VLC_CODEC_I420; break;
+    case SCHRO_CHROMA_422: p_dec->fmt_out.i_codec = VLC_CODEC_I422; break;
+    case SCHRO_CHROMA_444: p_dec->fmt_out.i_codec = VLC_CODEC_I444; break;
     default:
         p_dec->fmt_out.i_codec = 0;
         break;
@@ -162,11 +157,8 @@ static void SetVideoFormat( decoder_t *p_dec )
     p_dec->fmt_out.video.i_height = p_sys->p_format->height;
 
     /* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio */
-    f_aspect = (double)
-        ( p_sys->p_format->aspect_ratio_numerator * p_sys->p_format->width ) /
-        ( p_sys->p_format->aspect_ratio_denominator * p_sys->p_format->height);
-
-    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * f_aspect;
+    p_dec->fmt_out.video.i_sar_num = p_sys->p_format->aspect_ratio_numerator;
+    p_dec->fmt_out.video.i_sar_den = p_sys->p_format->aspect_ratio_denominator;
 
     p_dec->fmt_out.video.i_frame_rate =
         p_sys->p_format->frame_rate_numerator;
@@ -300,11 +292,10 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
         /* reset the decoder when seeking as the decode in progress is invalid */
         /* discard the block as it is just a null magic block */
-        if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) {
+        if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY ) {
             schro_decoder_reset( p_sys->p_schro );
 
-            p_sys->i_lastpts = -1;
-
+            p_sys->i_lastpts = VLC_TS_INVALID;
             block_Release( p_block );
             *pp_block = NULL;
             return NULL;
@@ -314,7 +305,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         p_schrobuffer = schro_buffer_new_with_data( p_block->p_buffer, p_block->i_buffer );
         p_schrobuffer->free = SchroBufferFree;
         p_schrobuffer->priv = p_block;
-        if( p_block->i_pts != VLC_TS_INVALID ) {
+        if( p_block->i_pts > VLC_TS_INVALID ) {
             mtime_t *p_pts = malloc( sizeof(*p_pts) );
             if( p_pts ) {
                 *p_pts = p_block->i_pts;
@@ -377,7 +368,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 p_pic->date = *(mtime_t*) p_tag->value;
                 schro_tag_free( p_tag );
             }
-            else if( p_sys->i_lastpts >= 0 )
+            else if( p_sys->i_lastpts > VLC_TS_INVALID )
             {
                 /* NB, this shouldn't happen since the packetizer does a
                  * very thorough job of inventing timestamps.  The