* @remarks @a frame must be released with @c free() by you
*
* @param [in] path The file path
- * @param [in] timestamp The timestamp in milliseconds
+ * @param [in] timestamp The timestamp in microseconds
* @param [in] is_accurate @a true, user can get an accurated frame for given the timestamp.\n
* @a false, user can only get the nearest i-frame of video rapidly.
* @param [out] frame raw frame data in RGB888
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
+#include <inttypes.h>
#include <mm_file.h>
#include "mm_file_debug.h"
} while(0)
#define MM_TIME_CHECK_FINISH(title) do { \
gettimeofday(&finish, NULL); \
- double end_time = (finish.tv_sec + 1e-6*finish.tv_usec); \
- double start_time = (start.tv_sec + 1e-6*start.tv_usec); \
+ int64_t end_time = (finish.tv_sec * 1000 + finish.tv_usec / 1000); \
+ int64_t start_time = (start.tv_sec * 1000 + start.tv_usec / 1000); \
if (msg_tmp_fp != NULL) { \
fprintf(msg_tmp_fp, "%s\n", title); \
- fprintf(msg_tmp_fp, " - start_time: %3.5lf sec\n", start_time); \
- fprintf(msg_tmp_fp, " - finish_time: %3.5lf sec\n", end_time); \
- fprintf(msg_tmp_fp, " - elapsed time: %3.5lf sec\n", end_time - start_time); \
+ fprintf(msg_tmp_fp, " - start_time: %"PRId64" msec\n", start_time); \
+ fprintf(msg_tmp_fp, " - finish_time: %"PRId64" msec\n", end_time); \
+ fprintf(msg_tmp_fp, " - elapsed time: %"PRId64" msec\n", end_time - start_time); \
fflush(msg_tmp_fp); fclose(msg_tmp_fp); \
} \
} while(0)
int width = 0;
int height = 0;
bool is_accurate = false;
- unsigned long long time_stamp = 5 * 1000 * 1000; //5sec
+ double time_stamp = 5. * 1000 * 1000; //5sec
if (accurate && accurate[0] == '1')
is_accurate = true;
- printf("Extracting video frame for [%s] [%llu] accurate [%d]\n", path, time_stamp, is_accurate);
+ printf("Extracting video frame for [%s] [%f] accurate [%d]\n", path, time_stamp, is_accurate);
if (file_test)
ret = mm_file_get_video_frame(path, time_stamp, is_accurate, &_frame, &_frame_size, &width, &height);