]> git.sesse.net Git - vlc/blobdiff - modules/misc/stats/decoder.c
Cosmetic fix
[vlc] / modules / misc / stats / decoder.c
index be39deb531e65ce29471170a92282407298c5b72..9039371107b11040845baf3d4acc484f92d9e808 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * decoder.c: stats decoder plugin for vlc.
  *****************************************************************************
- * Copyright (C) 2002 the VideoLAN team
- * $Id$
+ * Copyright (C) 2002-2008 the VideoLAN team
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
+ *          Pierre d'Herbemont <pdherbemont@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 #include "stats.h"
 
@@ -53,6 +52,13 @@ int OpenDecoder ( vlc_object_t *p_this )
     p_dec->pf_decode_audio = NULL;
     p_dec->pf_decode_sub = NULL;
 
+    /* */
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_I420 );
+    p_dec->fmt_out.video.i_width = 100;
+    p_dec->fmt_out.video.i_height = 100;
+    p_dec->fmt_out.video.i_sar_num = 1;
+    p_dec->fmt_out.video.i_sar_den = 1;
+
     return VLC_SUCCESS;
 }
 
@@ -67,17 +73,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     if( !pp_block || !*pp_block ) return NULL;
     p_block = *pp_block;
 
-    p_dec->fmt_out.video.i_width = 100;
-    p_dec->fmt_out.video.i_height = 100;
-    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
-
-    p_pic = p_dec->pf_vout_buffer_new( p_dec );
+    p_pic = decoder_NewPicture( p_dec );
 
     if( p_block->i_buffer == kBufferSize )
     {
-        msg_Dbg( p_dec, "got %d ms", *(mtime_t *)p_block->p_buffer  / 1000 );
-        msg_Dbg( p_dec, "got %d ms offset", (mdate() - *(mtime_t *)p_block->p_buffer) / 1000 );
+        msg_Dbg( p_dec, "got %"PRIu64" ms",
+                 *(mtime_t *)p_block->p_buffer  / 1000 );
+        msg_Dbg( p_dec, "got %"PRIu64" ms offset",
+                 (mdate() - *(mtime_t *)p_block->p_buffer) / 1000 );
         *(mtime_t *)(p_pic->p->p_pixels) = *(mtime_t *)p_block->p_buffer;
     }
     else
@@ -86,7 +89,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         *(mtime_t *)(p_pic->p->p_pixels) = mdate();
     }
 
-    p_pic->date = p_block->i_pts ? p_block->i_pts : p_block->i_dts;
+    p_pic->date = p_block->i_pts > VLC_TS_INVALID ?
+            p_block->i_pts : p_block->i_dts;
     p_pic->b_force = true;
 
     block_Release( p_block );