Remove links in document
[platform/core/api/media-content.git] / src / media_video.c
1 /*
2 * Copyright (c) 2011 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 #include <media_info_private.h>
19
20 int video_meta_destroy(video_meta_h video)
21 {
22         video_meta_s *_video = (video_meta_s*)video;
23
24         content_retip_if_fail(video);
25
26         g_free(_video->media_id);
27         g_free(_video->album);
28         g_free(_video->artist);
29         g_free(_video->album_artist);
30         g_free(_video->genre);
31         g_free(_video->composer);
32         g_free(_video->year);
33         g_free(_video->recorded_date);
34         g_free(_video->copyright);
35         g_free(_video->track_num);
36         g_free(_video);
37
38         return MEDIA_CONTENT_ERROR_NONE;
39 }
40
41 int video_meta_clone(video_meta_h *dst, video_meta_h src)
42 {
43         video_meta_s *_src = (video_meta_s*)src;
44
45         content_retip_if_fail(dst);
46         content_retip_if_fail(src);
47
48         video_meta_s *_dst = g_new(video_meta_s, 1);
49
50         _dst->media_id = g_strdup(_src->media_id);
51         _dst->album = g_strdup(_src->album);
52         _dst->artist = g_strdup(_src->artist);
53         _dst->album_artist = g_strdup(_src->album_artist);
54         _dst->genre = g_strdup(_src->genre);
55         _dst->composer = g_strdup(_src->composer);
56         _dst->year = g_strdup(_src->year);
57         _dst->recorded_date = g_strdup(_src->recorded_date);
58         _dst->copyright = g_strdup(_src->copyright);
59         _dst->track_num = g_strdup(_src->track_num);
60         _dst->bitrate = _src->bitrate;
61         _dst->duration = _src->duration;
62         _dst->width = _src->width;
63         _dst->height = _src->height;
64         _dst->rotation = _src->rotation;
65
66         *dst = (video_meta_h)_dst;
67
68         return MEDIA_CONTENT_ERROR_NONE;
69 }
70
71 int video_meta_get_media_id(video_meta_h video, char **media_id)
72 {
73         video_meta_s *_video = (video_meta_s*)video;
74
75         content_retip_if_fail(video);
76         content_retip_if_fail(media_id);
77
78         *media_id = g_strdup(_video->media_id);
79
80         return MEDIA_CONTENT_ERROR_NONE;
81 }
82
83 int video_meta_get_album(video_meta_h video, char **album)
84 {
85         video_meta_s *_video = (video_meta_s*)video;
86
87         content_retip_if_fail(video);
88         content_retip_if_fail(album);
89
90         *album = g_strdup(_video->album);
91
92         return MEDIA_CONTENT_ERROR_NONE;
93 }
94
95 int video_meta_get_artist(video_meta_h video, char **artist)
96 {
97         video_meta_s *_video = (video_meta_s*)video;
98
99         content_retip_if_fail(video);
100         content_retip_if_fail(artist);
101
102         *artist = g_strdup(_video->artist);
103
104         return MEDIA_CONTENT_ERROR_NONE;
105 }
106
107 int video_meta_get_album_artist(video_meta_h video, char **album_artist)
108 {
109         video_meta_s *_video = (video_meta_s*)video;
110
111         content_retip_if_fail(video);
112         content_retip_if_fail(album_artist);
113
114         *album_artist = g_strdup(_video->album_artist);
115
116         return MEDIA_CONTENT_ERROR_NONE;
117 }
118
119 int video_meta_get_genre(video_meta_h video, char **genre)
120 {
121         video_meta_s *_video = (video_meta_s*)video;
122
123         content_retip_if_fail(video);
124         content_retip_if_fail(genre);
125
126         *genre = g_strdup(_video->genre);
127
128         return MEDIA_CONTENT_ERROR_NONE;
129 }
130
131 int video_meta_get_composer(video_meta_h video, char **composer)
132 {
133         video_meta_s *_video = (video_meta_s*)video;
134
135         content_retip_if_fail(video);
136         content_retip_if_fail(composer);
137
138         *composer = g_strdup(_video->composer);
139
140         return MEDIA_CONTENT_ERROR_NONE;
141 }
142
143 int video_meta_get_year(video_meta_h video, char **year)
144 {
145         video_meta_s *_video = (video_meta_s*)video;
146
147         content_retip_if_fail(video);
148         content_retip_if_fail(year);
149
150         *year = g_strdup(_video->year);
151
152         return MEDIA_CONTENT_ERROR_NONE;
153 }
154
155 int video_meta_get_recorded_date(video_meta_h video, char **recorded_date)
156 {
157         video_meta_s *_video = (video_meta_s*)video;
158
159         content_retip_if_fail(video);
160         content_retip_if_fail(recorded_date);
161
162         *recorded_date = g_strdup(_video->recorded_date);
163
164         return MEDIA_CONTENT_ERROR_NONE;
165 }
166
167 int video_meta_get_copyright(video_meta_h video, char **copyright)
168 {
169         video_meta_s *_video = (video_meta_s*)video;
170
171         content_retip_if_fail(video);
172         content_retip_if_fail(copyright);
173
174         *copyright = g_strdup(_video->copyright);
175
176         return MEDIA_CONTENT_ERROR_NONE;
177 }
178
179 int video_meta_get_track_num(video_meta_h video, char **track_num)
180 {
181         video_meta_s *_video = (video_meta_s*)video;
182
183         content_retip_if_fail(video);
184         content_retip_if_fail(track_num);
185
186         *track_num = g_strdup(_video->track_num);
187
188         return MEDIA_CONTENT_ERROR_NONE;
189 }
190
191 int video_meta_get_bit_rate(video_meta_h video, int *bit_rate)
192 {
193         video_meta_s *_video = (video_meta_s*)video;
194
195         content_retip_if_fail(video);
196         content_retip_if_fail(bit_rate);
197
198         *bit_rate = _video->bitrate;
199
200         return MEDIA_CONTENT_ERROR_NONE;
201 }
202
203 int video_meta_get_duration(video_meta_h video, int *duration)
204 {
205         video_meta_s *_video = (video_meta_s*)video;
206
207         content_retip_if_fail(video);
208         content_retip_if_fail(duration);
209
210         *duration = _video->duration;
211
212         return MEDIA_CONTENT_ERROR_NONE;
213 }
214
215 int video_meta_get_width(video_meta_h video, int *width)
216 {
217         video_meta_s *_video = (video_meta_s*)video;
218
219         content_retip_if_fail(video);
220         content_retip_if_fail(width);
221
222         *width = _video->width;
223
224         return MEDIA_CONTENT_ERROR_NONE;
225 }
226
227 int video_meta_get_height(video_meta_h video, int *height)
228 {
229         video_meta_s *_video = (video_meta_s*)video;
230
231         content_retip_if_fail(video);
232         content_retip_if_fail(height);
233
234         *height = _video->height;
235
236         return MEDIA_CONTENT_ERROR_NONE;
237 }
238
239 int video_meta_get_rotation(video_meta_h video, int *rotation)
240 {
241         video_meta_s *_video = (video_meta_s*)video;
242
243         content_retip_if_fail(video);
244         content_retip_if_fail(rotation);
245
246         *rotation = _video->rotation;
247
248         return MEDIA_CONTENT_ERROR_NONE;
249 }