summaryrefslogtreecommitdiff
path: root/test/test-thumb.c
blob: ac9e638c3d2fb51a5acd0d67c6faa000eb26c382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * libmedia-thumbnail
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

#include "media-thumbnail.h"
#include "thumb-server-internal.h"
#include "media-thumb-debug.h"
#include "media-thumb-ipc.h"
#include "media-thumb-util.h"

int main(int argc, char *argv[])
{
	int mode;
	int err = -1;
	unsigned int req_id = 0;
	const char *origin_path = NULL;

	if ((argc != 3) && (argc != 4)) {
		printf("Usage: %s [test mode number] [path]\n", argv[0]);
		return -1;
	}

	mode = atoi(argv[1]);
	origin_path = argv[2];

	if (origin_path && (mode == 1)) {
		printf("Test _thumbnail_get_data\n");
#if 0
		char *thumb_path = "thumbnail_path.jpg";

		//long start = thumb_get_debug_time();

		err = _thumbnail_get_data(origin_path, thumb_path);
		if (err < 0) {
			printf("_thumbnail_get_data failed - %d\n", err);
			return -1;
		}

		//long end = thumb_get_debug_time();
		//printf("Time : %f\n", ((double)(end - start) / (double)CLOCKS_PER_SEC));
#endif
	} else if (mode == 2) {
		printf("Test thumbnail_request_cancel_media\n");

		err = thumbnail_request_cancel_media(req_id);
		if (err < 0) {
			printf("thumbnail_request_cancel_media failed : %d\n", err);
			return -1;
		} else {
			printf("thumbnail_request_cancel_media success!\n");
		}
	}

	thumb_dbg("Test is Completed");

	return 0;
}