Fix memory leak
[platform/core/api/mediademuxer.git] / src / port_ffmpeg / mediademuxer_port_ffmpeg.c
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file mediademuxer_port_ffmpeg.c
19  * @brief Handling for FFMPEG Port, defined function and there implementation
20  */
21
22 #include <mm_debug.h>
23 #include <mediademuxer_error.h>
24 #include <mediademuxer_private.h>
25 #include <mediademuxer_port.h>
26 #include <mediademuxer_port_ffmpeg.h>
27
28 static int ffmpeg_demuxer_init(MMHandleType *pHandle);
29 static int ffmpeg_demuxer_prepare(MMHandleType pHandle, char *uri);
30 static int ffmpeg_demuxer_get_data_count(MMHandleType pHandle, int *count);
31 static int ffmpeg_demuxer_get_track_info(MMHandleType pHandle, media_format_h *format, int track);
32 static int ffmpeg_demuxer_set_track(MMHandleType pHandle, int track);
33 static int ffmpeg_demuxer_get_data(MMHandleType pHandle, char *buffer);
34
35 /* Media Demuxer API common */
36 static media_port_demuxer_ops def_demux_ops = {
37         .n_size = 0,
38         .init = ffmpeg_demuxer_init,
39         .prepare = ffmpeg_demuxer_prepare,
40         .get_track_count = ffmpeg_demuxer_get_data_count,
41         .get_track_info = ffmpeg_demuxer_get_track_info,
42         .set_track = ffmpeg_demuxer_set_track,
43         .get_data = ffmpeg_demuxer_get_data,
44 };
45
46 int ffmpeg_port_register(media_port_demuxer_ops *pOps)
47 {
48         int ret = MD_ERROR_NONE;
49         MEDIADEMUXER_FENTER();
50         MEDIADEMUXER_CHECK_NULL(pOps);
51
52         def_demux_ops.n_size = sizeof(def_demux_ops);
53
54         memcpy((char *)pOps + sizeof(pOps->n_size), (char *)&def_demux_ops + sizeof(def_demux_ops.n_size), pOps->n_size - sizeof(pOps->n_size));
55
56         MEDIADEMUXER_FLEAVE();
57         return ret;
58 }
59
60 static int ffmpeg_demuxer_init(MMHandleType *pHandle)
61 {
62         int ret = MD_ERROR_NONE;
63         MEDIADEMUXER_FENTER();
64         MD_E("%s:exit: Not implemented\n", __func__);
65         MEDIADEMUXER_FLEAVE();
66         return ret;
67 }
68
69 static int ffmpeg_demuxer_prepare(MMHandleType pHandle, char *uri)
70 {
71         int ret = MD_ERROR_NONE;
72         MEDIADEMUXER_FENTER();
73         MD_E("%s:exit: Not implemented\n", __func__);
74         MEDIADEMUXER_FLEAVE();
75         return ret;
76 }
77
78 static int ffmpeg_demuxer_get_data_count(MMHandleType pHandle, int *count)
79 {
80         int ret = MD_ERROR_NONE;
81         MEDIADEMUXER_FENTER();
82         MD_E("%s:exit: Not implemented\n", __func__);
83         MEDIADEMUXER_FLEAVE();
84         return ret;
85 }
86
87 static int ffmpeg_demuxer_get_track_info(MMHandleType pHandle, media_format_h *format, int track)
88 {
89         int ret = MD_ERROR_NONE;
90         MEDIADEMUXER_FENTER();
91         MD_E("%s:exit: Not implemented\n", __func__);
92         MEDIADEMUXER_FLEAVE();
93         return ret;
94 }
95
96 static int ffmpeg_demuxer_set_track(MMHandleType pHandle, int track)
97 {
98         int ret = MD_ERROR_NONE;
99         MEDIADEMUXER_FENTER();
100         MD_E("%s:exit: Not implemented\n", __func__);
101         MEDIADEMUXER_FLEAVE();
102         return ret;
103 }
104
105 static int ffmpeg_demuxer_get_data(MMHandleType pHandle, char *buffer)
106 {
107         int ret = MD_ERROR_NONE;
108         MEDIADEMUXER_FENTER();
109         MD_E("%s:exit: Not implemented\n", __func__);
110         MEDIADEMUXER_FLEAVE();
111         return ret;
112 }