Example #1
0
void DLNADelegation::openMediaObj(const deejay::DLNAItem* mediaItem)
{
	DeviceDescList devlist = m_core->snapshotMediaServerList();
	UUID renderUuid = devlist.itemAt(0)->uuid();

	DLNAObjectList objList;
	DLNAObject * obj = objList.itemAt(0);
	DLNAItem * item = obj->asItem();

   // deejay::UUID renderUuid = getCurrentRenderUUID();
	if (!renderUuid.isNull()) 
    {
        DLNAMediaObjType type;
		getMediaObjType(mediaItem, type);
		
        NPT_String iconUrl;
        if (((deejay::DLNAObject*)mediaItem)->findThumbnailURL(200, 200, NULL, iconUrl))
        {
            //setThumbImg(iconUrl, type);
        }
        
		deejay::DLNACoreOp *op;
		if (NPT_SUCCEEDED(m_core->playMedia(renderUuid, mediaItem, &op))) 
        {
            if (wait(op))
            {
                if (op->succeeded()) 
                {
                    //[m_delegate showControlPointPageWithMediaType:type];
                }
                else
                {
                    printf("play op un successed");
                    printf("\n");
                }
            }
			else
            {
                printf("wait wrong-->click cancle btn");
                printf("\n");
            }
			op->release();
		}
        else
        {
            //NSLog(@"create Op error");
        }
	}
    else
    {
        //[m_delegate shouldSelectRenderForMedia:mediaItem];
    }
}
Example #2
0
void DLNAProxy::openMediaObj(const SiteView::DLNAItem* mediaItem)
{
	DeviceDescList devlist = m_core->snapshotMediaServerList();
	UUID renderUuid = devlist.itemAt(0)->uuid();

	DLNAObjectList objList;
	DLNAObject * obj = objList.itemAt(0);
	DLNAItem * item = obj->asItem();

   // SiteView::UUID renderUuid = getCurrentRenderUUID();
	if (!renderUuid.isNull()) 
    {
        DLNAMediaObjType type;
		getMediaObjType(mediaItem, type);
		
        NPT_String iconUrl;
        if (((SiteView::DLNAObject*)mediaItem)->findThumbnailURL(200, 200, NULL, iconUrl))
        {
            //setThumbImg(iconUrl, type);
        }
        
		SiteView::DLNACoreOp *op;
		if (NPT_SUCCEEDED(m_core->playMedia(renderUuid, mediaItem, &op))) 
        {
			op->release();
		}
        else
        {
            //NSLog(@"create Op error");
        }
	}
    else
    {
        //[m_delegate shouldSelectRenderForMedia:mediaItem];
    }
}
Example #3
0
static jobjectArray buildArrayFromDLNAObjectList(JNIEnv *env, const DLNAObjectList& ls)
{
	jobjectArray arr = env->NewObjectArray(ls.count(), CG::c_DLNAObject, NULL);
	
	for (int i = 0; i < ls.count(); i++) {
		DLNAObject *mediaObj = ls.itemAt(i);
		if (DLNAContainer *mediaContainer = mediaObj->asContainer()) {
			mediaContainer->addRef();
			jobject containerObj = env->NewObject(CG::c_DLNAContainer, CG::m_DLNAContainer_Init);
			env->SetLongField(containerObj, CG::f_DLNAContainer_obj, reinterpret_cast<jlong>(mediaContainer));
			env->SetObjectArrayElement(arr, i, containerObj);
			env->DeleteLocalRef(containerObj);
		} else {
			DLNAItem *mediaItem = mediaObj->asItem();
			mediaItem->addRef();
			jobject itemObj = env->NewObject(CG::c_DLNAItem, CG::m_DLNAItem_Init);
			env->SetLongField(itemObj, CG::f_DLNAItem_obj, reinterpret_cast<jlong>(mediaItem));
			env->SetObjectArrayElement(arr, i, itemObj);
			env->DeleteLocalRef(itemObj);
		}
	}
	
	return arr;
}