2 * GStreamer codec plugin for Tizen Emulator.
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
7 * KiTae Kim <kt920.kim@samsung.com>
8 * SeokYeon Hwang <syeon.hwang@samsung.com>
9 * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
37 #include <sys/ioctl.h>
41 #include "gstemulcommon.h"
42 #include "gstemuldev.h"
46 gst_emul_codec_device_open (CodecDevice *dev)
51 printf("enter: %s\n", __func__);
53 if ((fd = open(CODEC_DEV, O_RDWR)) < 0) {
54 perror("Failed to open codec device.");
57 GST_DEBUG("succeeded to open %s.\n", CODEC_DEV);
59 mmapbuf = mmap (NULL, dev->buf_size, PROT_READ | PROT_WRITE,
62 perror("Failed to map device memory of codec.");
66 GST_DEBUG("succeeded to map device memory.\n");
75 gst_emul_codec_device_close (CodecDevice *dev)
80 printf("enter: %s\n", __func__);
84 GST_ERROR("Failed to get %s fd.\n", CODEC_DEV);
90 GST_ERROR("Failed to get mmaped memory address.\n");
94 GST_DEBUG("Release memory region of %s.\n", CODEC_DEV);
95 if (munmap(mmapbuf, dev->buf_size) != 0) {
96 GST_ERROR("Failed to release memory region of %s.\n", CODEC_DEV);
99 GST_DEBUG("close %s.\n", CODEC_DEV);
100 if (close(fd) != 0) {
101 GST_ERROR("Failed to close %s. fd: %d\n", CODEC_DEV, fd);
104 printf("leave: %s\n", __func__);