From 8b7f0766f138ce28359fb399f5c91c5e5b53671d Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 17 Feb 2016 23:40:10 +0800 Subject: [PATCH] FS-8748 track pdf total pages and current page --- src/include/switch_module_interfaces.h | 4 ++++ src/mod/formats/mod_imagick/mod_imagick.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 04054f6cd4..16c71dc0e6 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -393,6 +393,10 @@ struct switch_file_handle { char *modname; switch_mm_t mm; switch_mutex_t *flag_mutex; + /*! total video duration, or total page in pdf*/ + int64_t duration; + /*! current video position, or current page in pdf */ + int64_t vpos; }; /*! \brief Abstract interface to an asr module */ diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index ec74f49f0b..2ded733f3e 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -161,6 +161,7 @@ static switch_status_t imagick_file_open(switch_file_handle_t *handle, const cha } context->pagecount = GetImageListLength(context->images); + handle->duration = context->pagecount; if (context->max) { context->samples = (handle->samplerate / 1000) * context->max; @@ -359,6 +360,7 @@ static switch_status_t imagick_file_seek(switch_file_handle_t *handle, unsigned context->pagenumber = page; context->same_page = 0; *cur_sample = page; + handle->vpos = page; } return status;