blob: 750f7825e8955181253236cab057f4dc08058608 (
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
|
/*
* media-thumbnail-server
*
* 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 "media-thumbnail.h"
#include "media-thumb-debug.h"
#include "media-thumb-ipc.h"
#include "media-thumb-util.h"
#include "thumb-server-internal.h"
#include <pthread.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
static GMainLoop *g_thumb_server_mainloop;
int main(void)
{
int sockfd = -1;
GIOChannel *channel = NULL;
if (ms_cynara_initialize() != MS_MEDIA_ERR_NONE) {
thumb_err("Cynara initialization failed");
return -1;
}
/* Create and bind new tcp socket */
if (!_thumb_server_prepare_socket(&sockfd)) {
thumb_err("Failed to create socket");
return -1;
}
g_thumb_server_mainloop = g_main_loop_new(NULL, FALSE);
/* Create new channel to watch tcp socket */
channel = g_io_channel_unix_new(sockfd);
g_io_add_watch(channel, G_IO_IN, _thumb_server_read_socket, g_thumb_server_mainloop);
g_io_channel_unref(channel);
g_idle_add(_thumb_daemon_start_jobs, NULL);
thumb_info("Thumbnail server is running");
g_main_loop_run(g_thumb_server_mainloop);
thumb_info("Thumbnail server is shutting down");
close(sockfd);
g_main_loop_unref(g_thumb_server_mainloop);
ms_cynara_finish();
return 0;
}
|