Exemplo n.º 1
0
    bool MotionSpecialTest()
    {
        Video video;

        if (SOURCE.length() == 0)
        {
            TEST_LOG_SS(Error, "Video source is undefined (-s parameter)!");
            return false;
        }
        if(!video.SetSource(SOURCE))
        {
            TEST_LOG_SS(Error, "Can't open video file '" << SOURCE << "'!");
            return false;
        }

        Filter filter;

        video.SetFilter(&filter);

        video.Start();

#ifdef TEST_PERFORMANCE_TEST_ENABLE
        TEST_LOG_SS(Info, PerformanceMeasurerStorage::s_storage.Report(false, true));
        PerformanceMeasurerStorage::s_storage.Clear();
#endif

        return true;
    }
Exemplo n.º 2
0
/*	FUNCTION:		ViewObject :: DragDrop
	ARGUMENTS:		none
	RETURN:			n/a
	DESCRIPTION:	Hook function called when user drops files in application window.
					Essentially, determine if file is image or video.	
*/
void ViewObject :: DragDrop(entry_ref *ref, float mouse_x, float mouse_y)
{
	//	Image file?
	BPath path(ref);
	BBitmap *bitmap = BTranslationUtils::GetBitmap(path.Path(), NULL);
	if (bitmap)
	{
		MediaSource *media = new MediaSource(this);
		GLCreateTexture(media, bitmap);
		if (!SurfaceUpdate(media, mouse_x, mouse_y))
			delete media;
		delete bitmap;
		return;
	}
	
	//	Video file
	Video *video = new Video(ref);
	if (video->GetStatus() == B_OK)
	{
		MediaSource *media = new MediaSource(this);
		GLCreateTexture(media, video->GetBitmap());
		media->SetVideo(video);
		if (SurfaceUpdate(media, mouse_x, mouse_y))
			video->Start();
		else
			delete media;
		return;
	}
	else
		delete video;
	
	printf("Unsupported file\n");
}