2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <Elementary.h>
21 #include "videodata.h"
30 void videodata_destroy(struct videodata *video_info)
36 struct videodata *videodata_create(media_info_h media_h)
39 struct videodata *video_info;
45 r = media_info_get_video(media_h, &video_h);
46 if (r != MEDIA_CONTENT_ERROR_NONE || !video_h) {
47 _ERR("Media video handle fetch error");
51 video_info = (videodata *)calloc(1, sizeof(*video_info));
55 r = video_meta_get_duration(video_h, &video_info->duration);
56 if (r != MEDIA_CONTENT_ERROR_NONE) {
57 _ERR("video meta get duration error");
61 r = video_meta_get_width(video_h, &video_info->width);
62 if (r != MEDIA_CONTENT_ERROR_NONE) {
63 _ERR("video meta get width error");
67 r = video_meta_get_height(video_h, &video_info->height);
68 if (r != MEDIA_CONTENT_ERROR_NONE) {
69 _ERR("video meta get width error");
73 r = video_meta_get_played_position(video_h, &video_info->position);
74 if (r != MEDIA_CONTENT_ERROR_NONE) {
75 _ERR("video meta get played position error");
79 video_meta_destroy(video_h);
84 video_meta_destroy(video_h);
85 videodata_destroy(video_info);
90 int videodata_get_duration(const struct videodata *video_info)
95 return video_info->duration;
98 int videodata_get_played_position(const struct videodata *video_info)
103 return video_info->position;
106 int videodata_get_width(const struct videodata *video_info)
111 return video_info->width;
114 int videodata_get_height(const struct videodata *video_info)
119 return video_info->height;