2 * media-thumbnail-server
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #include "media-thumbnail.h"
23 #include "media-thumb-debug.h"
24 #include "media-thumb-ipc.h"
25 #include "media-thumb-util.h"
26 #include "thumb-server-internal.h"
33 #define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
35 static GMainLoop *g_thumb_server_mainloop;
40 GIOChannel *channel = NULL;
42 if (ms_cynara_initialize() != MS_MEDIA_ERR_NONE) {
43 thumb_err("Cynara initialization failed");
47 /* Create and bind new tcp socket */
48 if (!_thumb_server_prepare_socket(&sockfd)) {
49 thumb_err("Failed to create socket");
53 g_thumb_server_mainloop = g_main_loop_new(NULL, FALSE);
55 /* Create new channel to watch tcp socket */
56 channel = g_io_channel_unix_new(sockfd);
57 g_io_add_watch(channel, G_IO_IN, _thumb_server_read_socket, g_thumb_server_mainloop);
58 g_io_channel_unref(channel);
60 g_idle_add(_thumb_daemon_start_jobs, NULL);
62 thumb_info("Thumbnail server is running");
63 g_main_loop_run(g_thumb_server_mainloop);
65 thumb_info("Thumbnail server is shutting down");
67 g_main_loop_unref(g_thumb_server_mainloop);