コード例 #1
0
static int processBegin(oggz_packet *packet, long serialno)
{
	int bos = (packet->op.b_o_s != 0);
    //int bos = oggz_get_bos(oggz, serialno);
    //int bos = (packet->op.packetno == 0);
    if (!bos) {
        // Not a bitstream start -- move on to header decoding...
		if (skeletonStream) {
	        appState = STATE_SKELETON;
	        return processSkeleton(packet, serialno);
	    } else {
			appState = STATE_DECODING;
			ogvjs_callback_loaded_metadata(videoCodecName, audioCodecName);
	        return processDecoding(packet, serialno);
		}
    }

    OggzStreamContent content = oggz_stream_get_content(oggz, serialno);

    if (!videoStream && content == OGGZ_CONTENT_THEORA) {
        videoCodec = content;
        videoCodecName = "theora";
        videoStream = serialno;
        ogvjs_callback_video_packet((const char *)packet->op.packet, packet->op.bytes, -1, -1);
        return OGGZ_CONTINUE;
    }

    if (!audioStream && content == OGGZ_CONTENT_VORBIS) {
        audioCodec = content;
        audioCodecName = "vorbis";
        audioStream = serialno;
        ogvjs_callback_audio_packet((const char *)packet->op.packet, packet->op.bytes, -1);
        return OGGZ_CONTINUE;
    }

    if (!audioStream && content == OGGZ_CONTENT_OPUS) {
        audioCodec = content;
        audioCodecName = "opus";
        audioStream = serialno;
        ogvjs_callback_audio_packet((const char *)packet->op.packet, packet->op.bytes, -1);
        return OGGZ_CONTINUE;
    }

    if (!skeletonStream && content == OGGZ_CONTENT_SKELETON) {
        skeletonStream = serialno;

        int ret = oggskel_decode_header(skeleton, &packet->op);
        if (ret == 0) {
            skeletonHeadersComplete = 1;
        } else if (ret > 0) {
            // Just keep going
        } else {
            printf("Invalid ogg skeleton track data? %d\n", ret);
            return OGGZ_STOP_ERR;
        }
    }
    return OGGZ_CONTINUE;
}
コード例 #2
0
void ScaenaAnimationWriter::skeletonToXmlTree(XmlTreeNode* parentNode, SkeletonDataTransfer* skeletonDataTransfer){
	// Consigo el nodo root del esqueleto
	SkeletonDataTransfer* rootSkeletonNode = skeletonDataTransfer;

	if(rootSkeletonNode != NULL){
		// Recorro todos los hijos y proceso cada uno
		list<SkeletonDataTransfer*>::iterator it = rootSkeletonNode->getChilds()->begin();
		while(it != rootSkeletonNode->getChilds()->end()){
			processSkeleton(parentNode, *it);
			++it;
		}
	}
}
コード例 #3
0
static int readPacketCallback(OGGZ *oggz, oggz_packet *packet, long serialno, void *user_data)
{
    switch (appState) {
        case STATE_BEGIN:
            return processBegin(packet, serialno);
        case STATE_SKELETON:
            return processSkeleton(packet, serialno);
        case STATE_DECODING:
            return processDecoding(packet, serialno);
        default:
            printf("Invalid state in Ogg readPacketCallback");
            return OGGZ_STOP_ERR;
    }
}
コード例 #4
0
ファイル: MmOptimiseTool.cpp プロジェクト: xubingyue/Ogitor
	//---------------------------------------------------------------------
	void OptimiseTool::processSkeletonFile(Ogre::String file, Ogre::String outFile)
	{
		StatefulSkeletonSerializer* skeletonSerializer =
			OgreEnvironment::getSingleton().getSkeletonSerializer();

		print("Loading skeleton " + file + "...");
		SkeletonPtr skeleton;
		try
		{
			skeleton = skeletonSerializer->loadSkeleton(file);
		}
		catch(std::exception& e)
		{
			warn(e.what());
			warn("Unable to open skeleton file " + file);
			warn("file skipped.");
			return;
		}
		print("Optimising skeleton...");
		processSkeleton(skeleton);
		skeletonSerializer->saveSkeleton(outFile, true);
		print("Skeleton saved as " + outFile + ".");

	}