FS-8748 track pdf total pages and current page

This commit is contained in:
Seven Du 2016-02-17 23:40:10 +08:00
parent 1204abf87a
commit 8b7f0766f1
2 changed files with 6 additions and 0 deletions

View File

@ -393,6 +393,10 @@ struct switch_file_handle {
char *modname; char *modname;
switch_mm_t mm; switch_mm_t mm;
switch_mutex_t *flag_mutex; 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 */ /*! \brief Abstract interface to an asr module */

View File

@ -161,6 +161,7 @@ static switch_status_t imagick_file_open(switch_file_handle_t *handle, const cha
} }
context->pagecount = GetImageListLength(context->images); context->pagecount = GetImageListLength(context->images);
handle->duration = context->pagecount;
if (context->max) { if (context->max) {
context->samples = (handle->samplerate / 1000) * 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->pagenumber = page;
context->same_page = 0; context->same_page = 0;
*cur_sample = page; *cur_sample = page;
handle->vpos = page;
} }
return status; return status;