Beispiel #1
0
BOOL SWrapObjectDlgProc::DlgProc(
		TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
	{int FToTick=(int)((float)TIME_TICKSPERSEC/(float)GetFrameRate());
	switch (msg) {
		case WM_INITDIALOG: {
			ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_AP_WRAPBUTTON));
			iBut->SetType(CBT_CHECK);
			iBut->SetHighlightColor(GREEN_WASH);
			ReleaseICustButton(iBut);
			po->hParams=hWnd;
			Update(t);
			return FALSE;	// stop default keyboard focus - DB 2/27  
			}
		case WM_COMMAND:
			switch (LOWORD(wParam)) 
			{    case IDC_AP_WRAPBUTTON:
				   { if (po->ip->GetCommandMode()->ID() == CID_STDPICK) 
					{ if (po->creating) 
						{  theCreateSWrapObjectMode.JumpStart(po->ip,po);
							po->ip->SetCommandMode(&theCreateSWrapObjectMode);
						} else {po->ip->SetStdCommandMode(CID_OBJMOVE);}
					} else 
						{ po->pickCB.po = po;						
						  po->ip->SetPickMode(&po->pickCB);
						}
					break;
				}

			}
			break;	
		}
	return TRUE;
	}
Beispiel #2
0
void VideoDecoder::ProcessVideoPacket(AVFormatContext *Context, AVStream *Stream, AVPacket *Packet)
{
    if (!Context || !Packet || !Stream || (Stream && !Stream->codec))
        return;

    // Add any preprocessing here

    // Decode a frame
    AVFrame avframe;
    memset(&avframe, 0, sizeof(AVFrame));
    avcodec_get_frame_defaults(&avframe);
    int gotframe = 0;

    int result = avcodec_decode_video2(Stream->codec, &avframe, &gotframe, Packet);

    if (result < 0)
    {
        LOG(VB_GENERAL, LOG_ERR, QString("Unknown video decoding error (%1)").arg(result));
        return;
    }

    if (!gotframe)
        return;

    // mark frames that may be corrupt
    if (!m_keyframeSeen && (avframe.key_frame || (Packet->flags & AV_PKT_FLAG_KEY)))
        m_keyframeSeen = true;

    VideoFrame *frame = avframe.opaque ? static_cast<VideoFrame*>(avframe.opaque) : m_videoParent->GetBuffers()->GetFrameForDecoding();

    if (!frame)
    {
        LOG(VB_GENERAL, LOG_ERR, "Failed to get video frame");
        return;
    }

    AccelerationFactory* factory = AccelerationFactory::GetAccelerationFactory();
    for ( ; factory; factory = factory->NextFactory())
        factory->ConvertBuffer(avframe, frame, m_conversionContext);

    frame->m_colourSpace      = Stream->codec->colorspace;
    frame->m_colourRange      = Stream->codec->color_range;
    frame->m_topFieldFirst    = avframe.top_field_first;
    frame->m_interlaced       = avframe.interlaced_frame;
    frame->m_frameAspectRatio = GetFrameAspectRatio(Stream, avframe);
    frame->m_pixelAspectRatio = GetPixelAspectRatio(Stream, avframe);
    frame->m_repeatPict       = avframe.repeat_pict;
    frame->m_frameNumber      = avframe.coded_picture_number;
    frame->m_pts              = av_q2d(Stream->time_base) * 1000 * GetValidTimestamp(avframe.pkt_pts, avframe.pkt_dts);
    frame->m_corrupt          = !m_keyframeSeen;
    frame->m_frameRate        = GetFrameRate(Context, Stream);
    frame->m_invertForSource  = 0;
    frame->m_invertForDisplay = 0;
    frame->m_field            = VideoFrame::Frame;

    m_videoParent->GetBuffers()->ReleaseFrameFromDecoding(frame);

    if (m_firstVideoTimecode == (qint64)AV_NOPTS_VALUE)
        m_firstVideoTimecode = frame->m_pts;
}
HRESULT GetEncodingBitrate(IMFMediaType *pMediaType, UINT32 *uiEncodingBitrate)
{
    UINT32 uiWidth;
    UINT32 uiHeight;
    float uiBitrate;
    UINT32 uiFrameRateNum;
    UINT32 uiFrameRateDenom;

    HRESULT hr = GetFrameSize(pMediaType, &uiWidth, &uiHeight);
    if (FAILED(hr))
    {
        goto done;
    }

    hr = GetFrameRate(pMediaType, &uiFrameRateNum, &uiFrameRateDenom);
    if (FAILED(hr))
    {
        goto done;
    }

    uiBitrate = uiWidth / 3.0f * uiHeight * uiFrameRateNum / uiFrameRateDenom;
    
    *uiEncodingBitrate = (UINT32) uiBitrate;

done:

    return hr;
}
Beispiel #4
0
bool SlideShow::CopyAnimationToClipboard()
{
  if (wxTheClipboard->Open())
  {
    // Show a busy cursor as long as we export a .gif file (which might be a lengthy
    // action).
    wxBusyCursor crs;
    
    wxImageArray gifFrames;
    
    for (int i = 0; i < m_size; i++)
    {
      wxImage frame;
      // Reduce the frame to at most 256 colors
      wxQuantize::Quantize(m_images[i]->GetUnscaledBitmap().ConvertToImage(),frame);
      // Gif supports only fully transparent or not transparent at all.
      frame.ConvertAlphaToMask();
      gifFrames.Add(frame);
    }

    wxMemoryOutputStream stream;
    wxGIFHandler gif;
    if(!gif.SaveAnimation(gifFrames, &stream, true, 1000 / GetFrameRate()))
      return false;

    GifDataObject *clpbrdObj = new GifDataObject(stream);
    bool res = wxTheClipboard->SetData(clpbrdObj);
    wxTheClipboard->Close();

    return res;
  }
  return false;
}
Beispiel #5
0
void MeshExporter::_dumpAnimation(IGameControl * pGameControl, int boneId)
{
	int start = ExportConfig::Instance()->GetFrameRange().x;
	int end = ExportConfig::Instance()->GetFrameRange().y;
	start *= GetTicksPerFrame();
	end *= GetTicksPerFrame();

	if ((pGameControl->IsAnimated(IGAME_POS)) || pGameControl->IsAnimated(IGAME_ROT) || pGameControl->IsAnimated(IGAME_SCALE))
	{
		IGameKeyTab Key;
		if(pGameControl->GetFullSampledKeys(Key, 1, IGAME_TM, true) )
		{
			SkeletonAnimation * skelAnim = new SkeletonAnimation(boneId);

			int count = Key.Count();
			for(int i=0;i<count;i++)
			{
				if (Key[i].t >= start && Key[i].t <= end)
				{
					float time = (float)Key[i].t / (float)GetTicksPerFrame() / (float)GetFrameRate();
					SkeletonAnimation::KeyFrame * kf = skelAnim->CreateKeyFrame(time);

					kf->position = Utility::ToFloat3(Key[i].sampleKey.gval.Translation());
					kf->rotation = Utility::ToQuat(Key[i].sampleKey.gval.Rotation());
					kf->scale = Utility::ToFloat3(Key[i].sampleKey.gval.Scaling());
				}
			}

			skelAnim->Optimize();
			_getAnimation()->AddSkeletonAnimation(skelAnim);
		}
	}
}
Beispiel #6
0
wxSize SlideShow::ToGif(wxString file)
{
  // Show a busy cursor as long as we export a .gif file (which might be a lengthy
  // action).
  wxBusyCursor crs;

  wxImageArray gifFrames;

  for (int i = 0; i < m_size; i++)
  {
    wxImage frame;
    // Reduce the frame to at most 256 colors
    wxQuantize::Quantize(m_images[i]->GetUnscaledBitmap().ConvertToImage(),frame);
    // Gif supports only fully transparent or not transparent at all.
    frame.ConvertAlphaToMask();
    gifFrames.Add(frame);
  }

  wxFile fl(file, wxFile::write);
  if(fl.IsOpened())
  {
    wxFileOutputStream outStream(fl);
    if(outStream.IsOk())
    {
      wxGIFHandler gif;
      
      if(gif.SaveAnimation(gifFrames, &outStream, true, 1000 / GetFrameRate()))
        return wxSize(m_images[1]->GetOriginalWidth(), m_images[1]->GetOriginalHeight());
    }
  }
  return wxSize(-1,-1);
}
Beispiel #7
0
bool bgGlobalMax::Initialize(Interface* p3DMax)
{
	m_p3DMax = p3DMax;
	m_pRootNode = p3DMax->GetRootNode();

	if (m_p3DMax == NULL && m_pRootNode == NULL)
		return false;
	if (CheckFile(m_p3DMax) == false)
		return true;

	m_Interval = m_p3DMax->GetAnimRange();

	memset(&m_Scene, 0, sizeof(m_Scene));
	m_Scene.iVersion = 100;
	m_Scene.iFirstFrame = m_Interval.Start() / GetTicksPerFrame();
	m_Scene.iLastFrame = m_Interval.End() / GetTicksPerFrame();
	m_Scene.iFrameSpeed = GetFrameRate();
	m_Scene.iTickPerFrame = GetTicksPerFrame();

	PreProcess(m_pRootNode);

	m_Scene.iNumMesh = m_MatrixMap.Count();
	m_Scene.iMaxWeight = 1;

	return true;
}
Beispiel #8
0
uint64_t BDRingBuffer::GetChapterStartFrame(uint32_t chapter)
{
    if (chapter < 0 || chapter >= GetNumChapters())
        return 0;
    return (uint64_t)((long double)(m_currentTitleInfo->chapters[chapter].start *
                                    GetFrameRate()) / 90000.0f);
}
Beispiel #9
0
void sseEngine::ManageSimulator()
{
	// not supported on windows 7
	//glutCreateMenu (menuSelect);
	//glutAddMenuEntry ("Pause", 0);
	//glutAddMenuEntry ("Toggle normalized speed vectors", 1);
	//glutAddMenuEntry ("Quit", 2);
	//glutAttachMenu (GLUT_RIGHT_BUTTON);

	m_pSceneLoader->Initialize();

	sseErrorHandler::_ThrowIfSDLTextureLoadError();

	m_pSceneLoader->Build();

	sseErrorHandler::_ThrowIfSDLTextureLoadError();

	m_pSceneLoader->Load();

    while(m_bSimulating)
    {
		m_pEventHandler->HandleEvents();
        m_pSceneLoader->Render();
		GetFrameRate();
    }
}
Beispiel #10
0
wxString SlideShow::ToXML()
{
  wxString images;

  for (int i = 0; i < m_size; i++)
  {
    wxString basename = m_cellPointers->WXMXGetNewFileName();
    // add the file to memory
    if (m_images[i])
    {
      if (m_images[i]->GetCompressedImage())
        wxMemoryFSHandler::AddFile(basename + m_images[i]->GetExtension(),
                                   m_images[i]->GetCompressedImage().GetData(),
                                   m_images[i]->GetCompressedImage().GetDataLen()
        );
    }

    images += basename + m_images[i]->GetExtension() + wxT(";");
  }

  wxString flags;
  if (m_forceBreakLine)
    flags += wxT(" breakline=\"true\"");
  if (m_animationRunning)
    flags += wxT(" running=\"true\"");
  else
    flags += wxT(" running=\"false\"");
  if (m_framerate > 0)
    flags +=  wxString::Format(wxT(" fr=\"%i\""), GetFrameRate());
  return wxT("\n<slide") + flags + wxT(">") + images + wxT("</slide>");
}
Beispiel #11
0
void CCyclerSprite::Think( void )
{
	if( ShouldAnimate() )
		Animate( GetFrameRate() * ( gpGlobals->time - m_lastTime ) );

	SetNextThink( gpGlobals->time + 0.1 );
	m_lastTime = gpGlobals->time;
}
Beispiel #12
0
PinObject::PinObject()
{	int FToTick=(int)((float)TIME_TICKSPERSEC/(float)GetFrameRate());
	ReplaceReference(0,CreateParameterBlock(descPinVer0, PBLOCK_LENGTH, CURRENT_VERSION));
	assert(pblock);	
	pblock->SetValue(PB_ONTIME,0,0);
	pblock->SetValue(PB_OFFTIME,0,FToTick*100);
	pblock->SetValue(PB_PINTYPE,0,0);
}
Beispiel #13
0
long CPgPubExtra::GetSlidePosition(long frames, long seconds)
{
	double fr = GetFrameRate( frames, seconds );

	// Convert to negative slide if less than one
	if ( fr < 1 ) fr = -( (double)1 / fr );

	return (long)fr;
}
Beispiel #14
0
wxSize SlideShow::ToGif(wxString file)
{
  wxArrayString which;
  bool success = true;

  wxString convert(wxT("convert -delay "+wxString::Format(wxT("%i"),100/GetFrameRate())));
  wxString convertArgs;

  wxString tmpdir = wxFileName::GetTempDir();

  for (int i=0; i<m_size; i++)
  {
    wxFileName imgname(tmpdir, wxString::Format(wxT("wxm_anim%d.png"), i));

    wxImage image = m_images[i]->ToImageFile(imgname.GetFullPath());

    convert << wxT(" \"") << imgname.GetFullPath() << wxT("\"");
  }

  convert << wxT(" \"") << file << wxT("\"");

#if defined __WXMSW__
  if (!wxShell(convert))
#else
  if (wxExecute(convert, wxEXEC_SYNC) != 0)
#endif
  {
    success = false;
    wxMessageBox(_("There was an error during GIF export!\n\nMake sure ImageMagick is installed and wxMaxima can find the convert program."),
        wxT("Error"), wxICON_ERROR);
  }

  for (int i=0; i<m_size; i++)
  {
    wxFileName imgname(tmpdir, wxString::Format(wxT("wxm_anim%d.png"), i));
    wxRemoveFile(imgname.GetFullPath());
  }

  if(success)
  {
    if(m_size>0)
      return wxSize(m_images[1]->GetOriginalWidth(),m_images[1]->GetOriginalHeight());
    else
    {
      wxSize retval;
      retval.x=retval.y=0;
      return retval;
    }
  }
  else
  {
    wxSize retval;
    retval.x=retval.y=-1;
    return retval;
  }
}
Beispiel #15
0
CCameraOpencv::CCameraOpencv(QObject *parent) :
    CCamera(parent)
{
    m_tmCapture = 1000 / GetFrameRate();
    bool check = connect(&m_Timer, SIGNAL(timeout()),
                         SLOT(slotTimeOut()));
    Q_ASSERT(check);
    check = connect(this, SIGNAL(sigCaptureRawFrame(QVideoFrame)), 
                    &m_CaptureFrameProcess, SLOT(slotCaptureFrame(QVideoFrame)));
    Q_ASSERT(check);
}
Beispiel #16
0
Animation * MeshExporter::_getAnimation()
{
	if (mMeshSource->GetAnimationCount() == 0)
	{
		Animation * anim = mMeshSource->NewAnimation("Default");

		float length = (float)ExportConfig::Instance()->GetFrames();
		length /= (float)GetFrameRate();

		anim->SetLength(length);
	}

	return mMeshSource->GetAnimation(0);
}
Beispiel #17
0
void SlideShow::ReloadTimer()
{
  if(!m_timer)
  {
    // Tell MathCtrl about our timer.
    m_timer = new wxTimer(m_cellPointers->GetMathCtrl(), wxNewId());
    m_cellPointers->m_slideShowTimers[this] = m_timer->GetId();
  }
  
  if(m_timer)
  {
    if(!m_timer->IsRunning())
      m_timer->StartOnce(1000 / GetFrameRate());
  }
}
INT WINAPI StartRecording(HIDS* m_hCam, const char* strFilePath, INT quality) {
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	INT result = IS_SUCCESS;
	if (!m_nAviID) {
		result = isavi_InitAVI(&m_nAviID, *m_hCam);
	}
	if (result == IS_AVI_NO_ERR) {
		// Query image buffer geometry
		int nWidth, nHeight, xPos, yPos;
		int pnX, pnY, pnBits, pnPitch;
		
		is_InquireImageMem (*m_hCam, m_pcImageMemory, m_lMemoryId, &pnX,&pnY, &pnBits, &pnPitch);
		GetImageSize( *m_hCam, nWidth, nHeight );
		// Derive pixel pitch from buffer byte pitch
		INT pPitchPx=0;
		pPitchPx = (pnPitch * 8 ) / pnBits;
		nWidth =  nWidth /8 * 8; // width has to be a multiple of 8
		INT LineOffsetPx = pPitchPx - nWidth ;

		// Get actual framerate
		double newFPS;
		GetFrameRate(*m_hCam, newFPS);
		// Get image position 
		GetImagePos(*m_hCam, xPos, yPos);
		pnX = pnX == nWidth ? 0 : xPos;
		pnY = pnY == nHeight ? 0 : yPos;
		// Get color mode
		INT cMode = GetColorMode(*m_hCam);

		result |= isavi_SetImageSize( m_nAviID, cMode,
			nWidth, nHeight,
			pnX, pnY,
			LineOffsetPx);

		result |= isavi_OpenAVI(m_nAviID, strFilePath);
		// TODO image quality is hard coded to 75 for now
		result |= isavi_SetImageQuality (m_nAviID, quality);
		result |= isavi_SetFrameRate(*m_hCam, newFPS);
		result |= isavi_StartAVI(m_nAviID);
		// Set recording to true
		m_bRecording = TRUE;
		PostThreadMessage(m_renderThread->m_nThreadID, IS_THREAD_MESSAGE, IS_RECORDING, (LPARAM) m_bRecording);
		// Send avi id to render thread
		PostThreadMessage(m_renderThread->m_nThreadID, IS_THREAD_MESSAGE, SET_AVI_ID, (LPARAM) m_nAviID);
		TRACE("Recording started\n");
	}	
	return result;
}
Beispiel #19
0
	void RenderInterface()
	{
		renderer_->DisableDepthTest();
		
		// Draw FPS
		text_shader_->Bind();
		text_shader_->Uniform1i("u_texture", 0);
		text_shader_->Uniform4f("u_color", 1.0f, 0.5f, 1.0f, 1.0f);
		fps_text_->SetText(font_, 0.0f, 0.8f, 0.05f, L"fps: %.2f", GetFrameRate());
		fps_text_->Render();
		text_shader_->Unbind();

		renderer_->ChangeTexture(nullptr);
		
		renderer_->EnableDepthTest();
	}
void UCodecMovieFallback::GetFrame( class FTextureMovieResource* InTextureMovieResource )
{
	CurrentTime += 1.f / GetFrameRate();
	if( CurrentTime > PlaybackDuration )
	{
		CurrentTime = 0.f;
	}	
	if( InTextureMovieResource &&
		InTextureMovieResource->IsInitialized() )
	{
		FLinearColor ClearColor(1.f,CurrentTime/PlaybackDuration,0.f,1.f);
		RHISetRenderTarget(InTextureMovieResource->GetRenderTargetTexture(),FTextureRHIRef());
		RHIClear(true,ClearColor,false,0.f,false,0, FIntRect());
		RHICopyToResolveTarget(InTextureMovieResource->GetRenderTargetTexture(),InTextureMovieResource->TextureRHI,false,FResolveParams());
	}
}
Beispiel #21
0
PBombObject::PBombObject()
{
	int FToTick=(int)((float)TIME_TICKSPERSEC/(float)GetFrameRate());
	MakeRefByID(FOREVER, 0, 
		CreateParameterBlock(descVer1, PBLOCK_LENGTH, CURRENT_VERSION));
	assert(pblock);	
	ff = NULL;
	mf = NULL;

	pblock->SetValue(PB_SYMMETRY,0,0);
	pblock->SetValue(PB_CHAOS,0,0.10f);
	pblock->SetValue(PB_STARTTIME,0,FToTick*30);
	pblock->SetValue(PB_LASTSFOR,0,FToTick);
	pblock->SetValue(PB_DELTA_V,0,1.0f);
	pblock->SetValue(PB_DECAY,0,1000.0f);
	pblock->SetValue(PB_DECAYTYPE,0,1);
	srand(12345);
}
HRESULT MFMovieSource::Open( const wchar_t* pszFilePath )
{
  HRESULT hr;
  hr=MFCreateSourceReaderFromURL( pszFilePath, CreateSourceReaderAttribute(), &_reader );
  PKY_IF_ERR_RETURN( hr, "Create SourceReader Failed" );

  hr=GetDuration( _reader, m_Duration );
  PKY_IF_ERR_RETURN( hr, "GetDuration Failed" );

  hr=GetSourceFlags( _reader, &m_SeekingFlag );

  hr=EnumerateTypsForStream( _reader,(DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, [this]( IMFMediaType*pType )->bool {
    UINT32 wd;
    UINT32 ht;
    if( SUCCEEDED( GetFrameSize( pType, &wd, &ht ) ) )
    {
      this->_wd=wd;
      this->_ht=ht;
    }
    if( SUCCEEDED( GetKeyFrameDelta( pType, &this->_keyFrameDelta ) ) )
    {

    }
    uint32_t numer, denum;
    if( SUCCEEDED(GetFrameRate(pType, numer, denum)) )
    {
      this->_numer = numer;
      this->_denum = denum;
    }
    return true;
  } );

  _frameCount = (UINT64)(m_Duration * _numer/_denum/10000000.0 + 0.001);

  hr=ConfigureDecoder( _reader, (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM );
  hr=ConfigureDecoder( _reader, (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM );

  //Jump(0);

  return E_NOTIMPL;
}
Beispiel #23
0
void Exporter::ExportCameraObject(INode* node, int indentLevel)
{
	RSCameraObject *pCO=new RSCameraObject;
	pCO->name=new char[strlen(node->GetName())+1];
	strcpy(pCO->name,node->GetName());

	INode* target = node->GetTarget();
	ExportNodeTM(node, indentLevel,&pCO->tm);

	CameraState cs;
	TimeValue t = GetStaticFrame();
	Interval valid = FOREVER;
	// Get animation range
	Interval animRange = ip->GetAnimRange();
	
	ObjectState os = node->EvalWorldState(t);
	CameraObject *cam = (CameraObject *)os.obj;
	
	cam->EvalCameraState(t,valid,&cs);
	pCO->fov=cs.fov;

#define TARGETFPS	60

	TimeValue start = ip->GetAnimRange().Start();
	TimeValue end = ip->GetAnimRange().End();
	int delta = GetTicksPerFrame() * GetFrameRate() / TARGETFPS;
	Matrix3 tm;

	rsm->m_nCameraFrame=(end-start)/delta+1;
	Matrix3 *m=pCO->am=new Matrix3[rsm->m_nCameraFrame];
	for (t=start; t<=end; t+=delta) {
		tm = node->GetNodeTM(t) * Inverse(node->GetParentTM(t));
		*m=tm;
		m++;
	}
	
	rsm->m_CameraList.Add(pCO);

}
Beispiel #24
0
// ###########################################################
// #######   EXPORTERs DI SINGOLE ENTITA' DELLA SCENA  #######
// ###########################################################
void SkeletonExporter::export_general_info(void)
{
	int ff, lf, fs;
	Interval range = ip->GetAnimRange();
	Box3 bbox;

	fprintf(fTXT, "[AD]Turbo ROX as usual !! \n\n");

	INode *root = ip->GetRootNode();
	bbox.pmin.x=bbox.pmin.y=bbox.pmin.z=(float)1E10;
	bbox.pmax.x=bbox.pmax.y=bbox.pmax.z=(float)-1E10;
    GetSceneBoundingBox(root, 0, &bbox);

	ff=range.Start() / GetTicksPerFrame();
	lf=range.End() / GetTicksPerFrame();
	fs=GetFrameRate();

	// Start with a file identifier and format version
	fprintf(fTXT, "First frame : %d\n", ff);
	fprintf(fTXT, "Last frame : %d\n", lf);
	fprintf(fTXT, "Frame speed : %d\n", fs);
	fprintf(fTXT, "Scene Bounding Box at time 0\n");
	fprintf(fTXT, "min : %f, %f, %f\n",
		    bbox.pmin.x, bbox.pmin.y, bbox.pmin.z);
	fprintf(fTXT, "max : %f, %f, %f\n",
		    bbox.pmax.x, bbox.pmax.y, bbox.pmax.z);

	write_chunk_header(fA3D, SCENE_GENERAL_INFO_ID, "Scene Root", 36);
	fwrite(&ff, sizeof(int), 1, fA3D);
	fwrite(&lf, sizeof(int), 1, fA3D);
	fwrite(&fs, sizeof(int), 1, fA3D);
	write_bbox(&bbox, fA3D);

	if (makeRAY) write_chunk_header(fRAY, SCENE_GENERAL_INFO_ID, "Scene Root", 36);
	if (makeRAY) fwrite(&ff, sizeof(int), 1, fRAY);
	if (makeRAY) fwrite(&lf, sizeof(int), 1, fRAY);
	if (makeRAY) fwrite(&fs, sizeof(int), 1, fRAY);
	if (makeRAY) write_bbox(&bbox, fRAY);
}
Beispiel #25
0
bool BDRingBuffer::UpdateTitleInfo(uint32_t index)
{
    m_titleChanged = true;
    m_currentTitleLength = m_currentTitleInfo->duration;
    m_currentTitleAngleCount = m_currentTitleInfo->angle_count;
    m_currentAngle = 0;
    m_titlesize = bd_get_title_size(bdnav);
    uint32_t chapter_count = m_currentTitleInfo->chapter_count;
    VERBOSE(VB_IMPORTANT, LOC + QString("Selected title/playlist: index %1. "
                                        "Duration: %2 (%3 mins) "
                                        "Number of Chapters: %4 Number of Angles: %5 "
                                        "Title Size: %6")
                                        .arg(index)
                                        .arg(m_currentTitleLength)
                                        .arg(m_currentTitleLength / (90000 * 60))
                                        .arg(chapter_count)
                                        .arg(m_currentTitleAngleCount)
                                        .arg(m_titlesize));
    VERBOSE(VB_PLAYBACK, LOC + QString("Frame Rate: %1").arg(GetFrameRate()));
    if (chapter_count)
    {
        for (uint i = 0; i < chapter_count; i++)
        {
            uint64_t total_secs = GetChapterStartTime(i);
            uint64_t framenum   = GetChapterStartFrame(i);
            int hours = (int)total_secs / 60 / 60;
            int minutes = ((int)total_secs / 60) - (hours * 60);
            double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60);
            VERBOSE(VB_PLAYBACK, LOC + QString("Chapter %1 found @ [%2:%3:%4]->%5")
                    .arg(QString().sprintf("%02d", i + 1))
                    .arg(QString().sprintf("%02d", hours))
                    .arg(QString().sprintf("%02d", minutes))
                    .arg(QString().sprintf("%06.3f", secs))
                    .arg(framenum));
        }
    }
    return true;
}
Beispiel #26
0
ForceObject::ForceObject()
{   int FToTick=(int)((float)TIME_TICKSPERSEC/(float)GetFrameRate());
    ReplaceReference(0,CreateParameterBlock(descForceVer0, PBLOCK_LENGTH, CURRENT_VERSION));
    assert(pblock);
    ff = NULL;
    mf = NULL;
    pblock->SetValue(PB_ONTIME,0,0);
    pblock->SetValue(PB_OFFTIME,0,FToTick*30);
    pblock->SetValue(PB_STRENGTH,0,1.0f);
    pblock->SetValue(PB_UNITS,0,0);
    pblock->SetValue(PB_FEEDBACKON,0,0);
    pblock->SetValue(PB_REVERSIBLE,0,0);
    pblock->SetValue(PB_CONTROLGAIN,0,50.0f);
    pblock->SetValue(PB_TARGETVEL,0,100.0f);
    pblock->SetValue(PB_ENABLESINES,0,0);
    pblock->SetValue(PB_TIMEPER1,0,100);
    pblock->SetValue(PB_AMP1,0,100.0f);
    pblock->SetValue(PB_PHASPER1,0,0.0f);
    pblock->SetValue(PB_TIMEPER2,0,100);
    pblock->SetValue(PB_AMP2,0,100.0f);
    pblock->SetValue(PB_RANGEON,0,0);
    pblock->SetValue(PB_RANGEVAL,0,1000.0f);
    pblock->SetValue(PB_PHASPER2,0,0.0f);
}
Beispiel #27
0
wxString SlideShow::ToXML()
{
  wxString images;

  for (int i=0; i<m_size; i++) {
    wxString basename = ImgCell::WXMXGetNewFileName();
    // add the file to memory
    if(m_images[i])
    {
      if(m_images[i]->GetCompressedImage())
        wxMemoryFSHandler::AddFile(basename+m_images[i] -> GetExtension(),
                                   m_images[i]->GetCompressedImage().GetData(),
                                   m_images[i]->GetCompressedImage().GetDataLen()
          );
    }

    images += basename + m_images[i] -> GetExtension()+wxT(";");
  }

  if(m_framerate<0)
    return wxT("\n<slide>") + images + wxT("</slide>");
  else
    return wxT("\n<slide fr=\"")+ wxString::Format(wxT("%i\">"),GetFrameRate()) + images + wxT("</slide>");
}
Beispiel #28
0
bool BDRingBuffer::UpdateTitleInfo(void)
{
    QMutexLocker locker(&m_infoLock);
    if (!m_currentTitleInfo)
        return false;

    m_titleChanged = true;
    m_currentTitleLength = m_currentTitleInfo->duration;
    m_currentTitleAngleCount = m_currentTitleInfo->angle_count;
    m_currentAngle = 0;
    m_titlesize = bd_get_title_size(bdnav);
    uint32_t chapter_count = GetNumChapters();
    uint64_t total_secs = m_currentTitleLength / 90000;
    int hours = (int)total_secs / 60 / 60;
    int minutes = ((int)total_secs / 60) - (hours * 60);
    double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60);
    QString duration = QString("%1:%2:%3")
                        .arg(QString().sprintf("%02d", hours))
                        .arg(QString().sprintf("%02d", minutes))
                        .arg(QString().sprintf("%02.1f", secs));
    VERBOSE(VB_IMPORTANT, LOC +
        QString("New title info: Index %1 Playlist: %2 Duration: %3 Chapters: %5")
                .arg(m_currentTitleInfo->idx).arg(m_currentTitleInfo->playlist)
                .arg(duration).arg(chapter_count));
    VERBOSE(VB_IMPORTANT, LOC +
        QString("New title info: Clips: %6 Angles: %7 Title Size: %8 Frame Rate %9")
                .arg(m_currentTitleInfo->clip_count)
                .arg(m_currentTitleAngleCount).arg(m_titlesize)
                .arg(GetFrameRate()));

    if (chapter_count)
    {
        for (uint i = 0; i < chapter_count; i++)
        {
            uint64_t total_secs = GetChapterStartTime(i);
            uint64_t framenum   = GetChapterStartFrame(i);
            int hours = (int)total_secs / 60 / 60;
            int minutes = ((int)total_secs / 60) - (hours * 60);
            double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60);
            VERBOSE(VB_PLAYBACK, LOC + QString("Chapter %1 found @ [%2:%3:%4]->%5")
                    .arg(QString().sprintf("%02d", i + 1))
                    .arg(QString().sprintf("%02d", hours))
                    .arg(QString().sprintf("%02d", minutes))
                    .arg(QString().sprintf("%06.3f", secs))
                    .arg(framenum));
        }
    }

    int still = BLURAY_STILL_NONE;
    int time  = 0;
    if (m_currentTitleInfo->clip_count)
    {
        for (uint i = 0; i < m_currentTitleInfo->clip_count; i++)
        {
            VERBOSE(VB_PLAYBACK, LOC + QString("Clip %1 stillmode %2 "
                                               "stilltime %3 videostreams %4 "
                                               "audiostreams %5 igstreams %6")
                    .arg(i).arg(m_currentTitleInfo->clips[i].still_mode)
                    .arg(m_currentTitleInfo->clips[i].still_time)
                    .arg(m_currentTitleInfo->clips[i].video_stream_count)
                    .arg(m_currentTitleInfo->clips[i].audio_stream_count)
                    .arg(m_currentTitleInfo->clips[i].ig_stream_count));
            still |= m_currentTitleInfo->clips[i].still_mode;
            time = m_currentTitleInfo->clips[i].still_time;
        }
    }

    if (m_currentTitleInfo->clip_count > 1 && still != BLURAY_STILL_NONE)
        VERBOSE(VB_IMPORTANT, LOC + "Warning: more than 1 clip, following still"
                                    " frame analysis may be wrong");
    if (still == BLURAY_STILL_TIME)
    {
        VERBOSE(VB_PLAYBACK, LOC +
            QString("Entering still frame (%1 seconds) UNSUPPORTED").arg(time));
    }
    else if (still == BLURAY_STILL_INFINITE)
    {
        VERBOSE(VB_PLAYBACK, LOC + "Entering infinite still frame.");
    }

    m_stillMode = still;
    m_stillTime = time;

    return true;
}
Beispiel #29
0
bool MeshExpUtility::SaveSkinKeys(const char* n){
	CFS_Memory F;

	int FramesPerSecond = GetFrameRate();
	int TicksPerFrame	= GetTicksPerFrame();
	int FirstTick		= ip->GetAnimRange().Start();
	int LastTick		= ip->GetAnimRange().End();

	Point3 v;
	Matrix3 tm;

	// Write signature and version
	char S[MAX_PATH];
	sprintf(S, "KEYEXP 3.0");
	F.Wstring(S);

	INode *node;
	ObjectEntry *Current;

	//-----------------------------------------------------------------------
	// Count bones and report

	int NumBones = 0;
	Current = theObjects->head;
	while(Current)
	{
		/*
		if(Current->entry->type != OBTYPE_BONE)
		{
			Current = Current->next;
			continue;
		}
		*/

		NumBones++;

		Current = Current->next;
	}

	sprintf(S, "Number of Bones = %d", NumBones);
	F.Wstring(S);
	ELog.Msg(mtInformation,S);

	//-----------------------------------------------------------------------
	// Write out necessary data for motion keys

	sprintf(S, "Key Data");
	F.Wstring(S);

	TimeValue t;
	Quat qq;
	Point3 tp, sp;
	INode* parent;
	Matrix3 tmp;

	sprintf(S, "%d %d %d", FirstTick / TicksPerFrame, LastTick / TicksPerFrame, FramesPerSecond);
	F.Wstring(S);

	Current = theObjects->head;
	while(Current){
		/*
		if(Current->entry->type != OBTYPE_BONE)
		{
			Current = Current->next;
			continue;
		}
		*/

		Matrix3 tm;

		node = Current->entry->node;

		sprintf(S, "Node: %s", node->GetName());
		F.Wstring(S);
		ELog.Msg(mtInformation,S);

		// Print notetrack info
		{
			int NumNT, n, i, j, NumNotes;
			NoteTrack* pNT;
			DefNoteTrack* pDNT;
			NoteKey* pNK;

			NumNT = node->NumNoteTracks();

			// count all of the notes on all of the notetracks
			NumNotes = 0;
			for(n=0;n<NumNT;n++){
				pNT = node->GetNoteTrack(n);
				if(pNT->ClassID() == Class_ID(NOTETRACK_CLASS_ID, 0)){
					pDNT = (DefNoteTrack*)pNT;
					j = pDNT->NumKeys();
					for(i=0;i<j;i++){
						pNK = pDNT->keys[i];
						if( (pNK->time >= FirstTick) && (pNK->time <= LastTick) )
							NumNotes++;
					}
				}
			}

			sprintf(S, "Number of Notes = %d", NumNotes);
			F.Wstring(S);

			for(n=0;n<NumNT;n++){
				pNT = node->GetNoteTrack(n);
				if(pNT->ClassID() == Class_ID(NOTETRACK_CLASS_ID, 0)){
					pDNT = (DefNoteTrack*)pNT;
					j = pDNT->NumKeys();
					for(i=0;i<j;i++){
						pNK = pDNT->keys[i];
						if( (pNK->time >= FirstTick) && (pNK->time <= LastTick) ){
							sprintf(S, "%d: %s", (pNK->time - FirstTick) / TicksPerFrame, pNK->note);
							F.Wstring(S);
						}
					}
				}
			}
		}

		for(t=FirstTick;t<=LastTick;t+=TicksPerFrame){
			tm = node->GetNodeTM(t);
			DecomposeMatrix(tm, tp, qq, sp);
			qq.MakeMatrix	(tm);
			tm.SetTrans		(tp);

			parent = node->GetParentNode();
			if(parent){
				tmp = parent->GetNodeTM(t);
				DecomposeMatrix(tmp, tp, qq, sp);
				qq.MakeMatrix(tmp);
				tmp.SetTrans(tp);
				tmp = Inverse(tmp);
				tm *= tmp;
			}

			DecomposeMatrix(tm, tp, qq, sp);
			sprintf(S,"%f %f %f %f",qq.x, qq.y, qq.z, qq.w);
			F.Wstring(S);
			sprintf(S,"%f %f %f",tp.x,tp.y,tp.z);
			F.Wstring(S);

			/*
			// Euler angles
			Point3			E;
			QuatToEuler		(Quat(tm), E);
			fprintf			(f,"%f %f %f",E.x,E.y,E.z);

			// Translate
			DecomposeMatrix	(tm, tp, qq, sp);
			fprintf			(f,"%f %f %f",tp.x,tp.y,tp.z);
			*/

//			Matrix3fprint(f, tm);
		}
		Current = Current->next;
	}

	sprintf(S, "Key Data Complete");
	F.Wstring(S);
	ELog.Msg(mtInformation,S);

	F.SaveTo(n,0);

	return true;
}
// ============================================================================
int TicksToFPS(TimeValue t)
{
	return (TicksToSec(t) * GetFrameRate());
}