2 // Tizen Web Device API
3 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include "PlaylistUtils.h"
19 #include "ContentUtility.h"
27 int destroyMediaPlaylistHandle(media_playlist_h& playlist_handle)
29 if(!playlist_handle) {
30 return MEDIA_CONTENT_ERROR_NONE;
33 int ret_code = media_playlist_destroy(playlist_handle);
34 playlist_handle = NULL;
36 if(MEDIA_CONTENT_ERROR_NONE != ret_code) {
37 LOGE("%s", ContentUtility::getMediaContentLogMessage(
38 ret_code, "media_playlist_destroy()").c_str());
44 int destroyMediaFilterHandle(filter_h& filter_handle)
46 int ret_code = media_filter_destroy(filter_handle);
49 if(MEDIA_CONTENT_ERROR_NONE != ret_code) {
50 LOGE("%s", ContentUtility::getMediaContentLogMessage(
51 ret_code, "media_filter_destroy()").c_str());
57 PlaylistItemPtr getPlaylistItemFromJSObjectRef(JSContextRef context,
61 if(JSPlaylistItem::isObjectOfClass(context, obj)) {
62 return JSPlaylistItem::getPrivateObject(context, obj);
64 LOGE("Wrong content type");
65 throw TypeMismatchException("Wrong content type");
69 AudioContentPtr getAudioContentPtrFromJSObjectRef(JSContextRef context,
73 if(JSAudioContent::isObjectOfClass(context, obj) ) {
74 return JSAudioContent::getPrivateObject(context, obj);
76 LOGE("Wrong content type");
77 throw TypeMismatchException("Wrong content type");
82 PlaylistUnknownException::PlaylistUnknownException(const char* message,
84 Common::UnknownException(message),
85 m_core_api_error(core_api_error)
89 PlaylistUnknownException::PlaylistUnknownException(JSContextRef ctx,
90 JSValueRef exception, int core_api_error) :
91 Common::UnknownException(ctx, exception),
92 m_core_api_error(core_api_error)
96 int PlaylistUnknownException::getCoreAPIError() const
98 return m_core_api_error;
102 } //namespace Content
103 } //namespace DeviceAPI