[vlc-devel] [PATCH] codec: dummy: log the amount of frames and duration to do the dummy encoding
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 8 16:40:47 CET 2018
---
modules/codec/edummy.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/modules/codec/edummy.c b/modules/codec/edummy.c
index 46b280d809..5749ec8950 100644
--- a/modules/codec/edummy.c
+++ b/modules/codec/edummy.c
@@ -50,12 +50,20 @@ vlc_module_end ()
static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf );
+typedef struct
+{
+ size_t pic_count;
+ vlc_tick_t start;
+} encoder_sys_t;
+
+
/*****************************************************************************
* OpenDecoder: open the dummy encoder.
*****************************************************************************/
static int OpenEncoder( vlc_object_t *p_this )
{
encoder_t *p_enc = (encoder_t *)p_this;
+ p_enc->p_sys = vlc_obj_calloc(p_this,1,sizeof(encoder_sys_t));
p_enc->pf_encode_video = EncodeVideo;
p_enc->pf_encode_audio = EncodeAudio;
@@ -68,7 +76,13 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************/
static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
{
- VLC_UNUSED(p_enc); VLC_UNUSED(p_pict);
+ encoder_sys_t *p_sys = p_enc->p_sys;
+ if (p_pict)
+ {
+ if (p_sys->start == 0)
+ p_sys->start = vlc_tick_now();
+ p_sys->pic_count++;
+ }
return NULL;
}
@@ -86,5 +100,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf )
*****************************************************************************/
static void CloseEncoder( vlc_object_t *p_this )
{
- VLC_UNUSED(p_this);
+ encoder_t *p_enc = (encoder_t *)p_this;
+ encoder_sys_t *p_sys = p_enc->p_sys;
+ if (p_sys->pic_count)
+ msg_Info(p_this, "Encoded %d pictures in %lld ms", p_sys->pic_count,
+ MS_FROM_VLC_TICK(vlc_tick_now() - p_sys->start));
}
--
2.17.1
More information about the vlc-devel
mailing list