]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8748 track pdf total pages and current page
authorSeven Du <dujinfang@gmail.com>
Wed, 17 Feb 2016 15:40:10 +0000 (23:40 +0800)
committerSeven Du <dujinfang@gmail.com>
Thu, 17 Mar 2016 01:34:57 +0000 (09:34 +0800)
src/include/switch_module_interfaces.h
src/mod/formats/mod_imagick/mod_imagick.c

index 04054f6cd4b2f89e636f8055b195f5c335cebcf2..16c71dc0e6f67cae7a28a936e2e173a37f4ef39b 100644 (file)
@@ -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 */
index ec74f49f0b62c1e4a5397bdf46f69e7e5162d4f3..2ded733f3eb7566b841f7affe2f52a800cd71719 100644 (file)
@@ -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;