JSStaticValue JSVideo::m_property[] =
{
-// { TIZEN_CONTENT_VIDEO_GEOLOCATION, getPropertyGeoLocation, setPropertyGeoLocation, kJSPropertyAttributeNone},
{ TIZEN_CONTENT_VIDEO_ALBUM, getPropertyAlbum, NULL, kJSPropertyAttributeReadOnly},
{ TIZEN_CONTENT_VIDEO_ARTIST, getPropertyArtist, NULL, kJSPropertyAttributeReadOnly},
{ TIZEN_CONTENT_VIDEO_DURATION, getPropertyDuration, NULL, kJSPropertyAttributeReadOnly},
void JSVideo::initialize(JSContextRef context, JSObjectRef object)
{
- LoggerD( "entered" );
VideoPrivObject *priv = static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) );
if (!priv)
{
void JSVideo::finalize(JSObjectRef object)
{
- LoggerD( "entered" );
- VideoPrivObject *priv = static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) ) ;
- if (priv != NULL)
- {
- delete (priv);
- priv = NULL;
- JSObjectSetPrivate(object, NULL);
- }
-
- priv = NULL;
-
+ VideoPrivObject *priv = static_cast<VideoPrivObject*>( JSObjectGetPrivate( object ) ) ;
+ if (priv != NULL)
+ {
+ delete (priv);
+ priv = NULL;
+ JSObjectSetPrivate(object, NULL);
+ }
+ priv = NULL;
}
const JSClassRef JSVideo::getClassRef()
{
- LoggerD("JSVideo::getClassRef()");
-
if (!m_jsClassRef)
{
- m_jsClassRef = JSClassCreate(&m_classInfo);
+ m_jsClassRef = JSClassCreate(&m_classInfo);
}
return m_jsClassRef;
}
MediacontentVideoPtr JSVideo::getVideoObject(JSObjectRef object)
{
- LoggerD("entered");
VideoPrivObject *priv = static_cast<VideoPrivObject*>(JSObjectGetPrivate(object));
if(!priv)
{
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
JSValueRef value,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation =
- DeviceAPI::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
+ DeviceAPI::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
if(geoLocation){
video->setVideoLatitude(geoLocation->getLatitude());
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
- Converter converter(context);
- MediacontentVideoPtr video = getVideoObject(object);
- JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
- if (NULL == jsResult) {
- ThrowMsg(NullPointerException, "Could not create js array object");
- }
-
- for( unsigned int i=0; i < video->getVideoArtist().size(); i++) {
- string artist = video->getVideoArtist().at(i);
- LoggerD("artist : " << artist);
- JSValueRef val = converter.toJSValueRef(artist);
-
- if(!JSSetArrayElement(context, jsResult, i, val)){
- ThrowMsg(NullPointerException, "Could not insert value into js array");
- }
- }
- return jsResult;
+ Converter converter(context);
+ MediacontentVideoPtr video = getVideoObject(object);
+ JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
+ if (NULL == jsResult) {
+ ThrowMsg(NullPointerException, "Could not create js array object");
+ }
+
+ for( unsigned int i=0; i < video->getVideoArtist().size(); i++) {
+ string artist = video->getVideoArtist().at(i);
+ JSValueRef val = converter.toJSValueRef(artist);
+
+ if(!JSSetArrayElement(context, jsResult, i, val)){
+ ThrowMsg(NullPointerException, "Could not insert value into js array");
+ }
+ }
+ return jsResult;
}
- Catch(Exception){
+ Catch(Exception){
LoggerW("trying to get incorrect value");
}
return JSValueMakeNull(context);
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- if(video){
- return converter.toJSValueRef(video->getVideoDuration());
- }
+ if(video){
+ return converter.toJSValueRef(video->getVideoDuration());
+ }
}
Catch(Exception)
{
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
+
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- if(video){
- return converter.toJSValueRef(video->getVideoWidth());
- }
+ if(video){
+ return converter.toJSValueRef(video->getVideoWidth());
+ }
}
Catch(Exception)
{
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- if(video){
- return converter.toJSValueRef(video->getVideoHeight());
- }
+ if(video){
+ return converter.toJSValueRef(video->getVideoHeight());
+ }
}
Catch(Exception)
{
JSValueRef value,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- vector<std::string> artists;
- if (!JSValueIsNull(context, value)) {
-
- if (JSIsArrayValue(context, value)){
- JSObjectRef jsObject = converter.toJSObjectRef(value);
- for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
- JSValueRef element = JSGetArrayElement(context, jsObject, i);
- artists.push_back(converter.toString(element));
- }
- }
- else{
- DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
- }
- video->setVideoArtist(artists, true);
- return true;
- }
+ vector<std::string> artists;
+ if (!JSValueIsNull(context, value)) {
+
+ if (JSIsArrayValue(context, value)){
+ JSObjectRef jsObject = converter.toJSObjectRef(value);
+ for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
+ JSValueRef element = JSGetArrayElement(context, jsObject, i);
+ artists.push_back(converter.toString(element));
+ }
+ }
+ else{
+ DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
+ }
+ video->setVideoArtist(artists, true);
+ return true;
+ }
+ }
+ Catch(Exception)
+ {
+ LoggerW("trying to set incorrect value");
+ DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
}
- Catch(Exception)
- {
- LoggerW("trying to set incorrect value");
- DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
- }
return false;
}
JSValueRef value,
JSValueRef* exception)
{
- LoggerD("entered");
Try
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
string album = converter.toString(value);
- if(video){
- video->setVideoAlbum(album, true);
- return true;
- }
- }
+ if(video){
+ video->setVideoAlbum(album, true);
+ return true;
+ }
+ }
Catch(Exception)
{
LoggerW("trying to set incorrect value");