summaryrefslogtreecommitdiff
path: root/src/advtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/advtime.c')
-rw-r--r--src/advtime.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/advtime.c b/src/advtime.c
index 89af714..93a4057 100644
--- a/src/advtime.c
+++ b/src/advtime.c
@@ -9,6 +9,16 @@
#include "video_decode.h"
#include "util.h"
+static inline void
+pswap(void **p1, void **p2)
+{
+ void *tmp;
+
+ tmp = *p1;
+ *p1 = *p2;
+ *p2 = tmp;
+}
+
/* print time in format: "hh:mm:ss.xxx" */
static void
print_time(int64_t msec) {
@@ -75,8 +85,7 @@ int
main(int argc, char **argv)
{
struct video_decode *vd;
- struct video_frame *frame_a;
- struct video_frame *frame_b;
+ struct video_frame *frame_a = NULL, *frame_b = NULL, *tmp;
int ret, ch;
int diff_flag = 0, average_flag = 0, frame_flag = 0, showcut_flag = 0;
int64_t timestamp = 0;
@@ -177,10 +186,10 @@ main(int argc, char **argv)
if (frame_flag || average_flag)
printf("\n");
- video_decode_free_frame(&frame_a);
- frame_a = frame_b;
+ pswap(&frame_a, &frame_b);
}
+ video_decode_free_frame(&frame_a);
video_decode_free_frame(&frame_b);
video_decode_uninit(&vd);
return EXIT_SUCCESS;