コード例 #1
0
  void testIsFilterPresent ()
  {
    size_t nbw;
    Filter* filter = Gzip::factory ("GzipFilter");
    MemBuf mb;
    MemoryStream ms (&mb);

    fc->setStream (&ms);

    CPPUNIT_ASSERT_EQUAL (fc->isFilterPresent (filter), 0);
    CPPUNIT_ASSERT_EQUAL (fc->isFilterPresent (filter->getName ()), 0);

    fc->addFilter (filter, &nbw);

    CPPUNIT_ASSERT (fc->isFilterPresent (filter) != 0);
    CPPUNIT_ASSERT (fc->isFilterPresent (filter->getName ()) != 0);
  }
コード例 #2
0
ファイル: buffersrc.cpp プロジェクト: Adenilson/avcpp
int BufferSrcFilterContext::reinit(const Filter &filter, const string &name)
{
    if (isFilterValid(filter))
    {
        return reinitInt(filter, name);
    }

    clog << "You pass invalid filter for context: " << (filter.isValid() ? filter.getName() : "(null)") << endl;

    return -1;
}
コード例 #3
0
ファイル: buffersrc.cpp プロジェクト: Adenilson/avcpp
bool BufferSrcFilterContext::isFilterValid(const Filter &filter)
{
    if (filter.isValid())
    {
        if (filter.getName() == "buffer" ||
            filter.getName() == "abuffer")
        {
            return true;
        }
    }
    return false;
}
コード例 #4
0
void FilterGraph::pushFilter(Filter& filter)
{
    AVFilterContext* context = NULL;
    const int err = avfilter_graph_create_filter(&context, &filter.getAVFilter(), filter.getInstanceName().c_str(),
                                                 filter.getOptions().c_str(), NULL, _graph);
    filter.setAVFilterContext(context);
    if(err < 0)
    {
        std::string msg("Cannot add filter ");
        msg += filter.getName();
        msg += " (instance=";
        msg += filter.getInstanceName();
        msg += ") to the graph: ";
        msg += getDescriptionFromErrorCode(err);
        throw std::runtime_error(msg);
    }
}
コード例 #5
0
// FilterGroup
	FilterElement::FilterElement(Filter& filter, const std::vector<std::string>& _path, QTreeWidget* tree)
	 : name(filter.getName()), path(_path), item(NULL)
	{
		//std::cout << "FilterElement::FilterElement : " << this << std::endl;

		item = new QTreeWidgetItem(NodeFilter);
		item->setData(0, Qt::UserRole, QVariant::fromValue<UniformObject*>( reinterpret_cast<UniformObject*>(NULL) ));

		item->setText(0, tr("%1 [%2]").arg(name.c_str()).arg(filter.getTypeName().c_str()) );

		// List the variables : 
		for(int k=0; k<filter.program().getUniformVarsNames().size(); k++)
		{
			bool processNewItem = true;

			// Omit the variables : 
			/*if(filter.prgm().getUniformVarsNames()[k]=="gl_ModelViewMatrix" || filter.prgm().getUniformVarsNames()[k]=="gl_TextureMatrix[0]")
				objects.push_back( reinterpret_cast<UniformObject*>(new UniformUnknown(filter.prgm().getUniformVarsNames()[k], "(Forbidden)")) );
			else*/

			if( filter.program().isValid( filter.program().getUniformVarsNames()[k] ) )
			{
				switch(filter.program().getUniformVarsTypes()[k])
				{
					case GL_INT : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_INT, 1, 1, false)) );				
						break;
					case GL_INT_VEC2 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_INT_VEC2, 1, 2, false)) );				
						break;
					case GL_INT_VEC3 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_INT_VEC3, 1, 3, false)) );				
						break;
					case GL_INT_VEC4 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_INT_VEC4, 1, 4, false)) );				
						break;
					case GL_UNSIGNED_INT : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_UNSIGNED_INT, 1, 1, true)) );				
						break;
					case GL_UNSIGNED_INT_VEC2 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_UNSIGNED_INT_VEC2, 1, 2, true)) );				
						break;
					case GL_UNSIGNED_INT_VEC3 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_UNSIGNED_INT_VEC3, 1, 3, true)) );				
						break;
					case GL_UNSIGNED_INT_VEC4 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformInteger(filter.program().getUniformVarsNames()[k], GL_UNSIGNED_INT_VEC4, 1, 4, true)) );				
						break;
					case GL_FLOAT : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT, 1, 1)) );				
						break;
					case GL_FLOAT_VEC2 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_VEC2, 1, 2)) );				
						break;
					case GL_FLOAT_VEC3 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_VEC3, 1, 3)) );				
						break;
					case GL_FLOAT_VEC4 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_VEC4, 1, 4)) );				
						break;
					case GL_FLOAT_MAT2 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_MAT2, 2, 2)) );				
						break;
					case GL_FLOAT_MAT3 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_MAT3, 3, 3)) );				
						break;
					case GL_FLOAT_MAT4 : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformFloat(filter.program().getUniformVarsNames()[k], GL_FLOAT_MAT4, 4, 4)) );	
						break;
					default : 
						objects.push_back( reinterpret_cast<UniformObject*>(new UniformUnknown(filter.program().getUniformVarsNames()[k], tr("Unable to generate interface for type %1").arg(glParamName(filter.program().getUniformVarsTypes()[k]).c_str()))) );
				}

				objects.back()->read(filter.program());

				item->addChild( objects.back()->treeItem() );
				
				tree->setItemWidget( objects.back()->treeItem(), 1, objects.back() );

				QObject::connect( objects.back(), SIGNAL(updated(void)), this, SIGNAL(updated(void)) );
				QObject::connect( this, SIGNAL(propagateSettings(BoxesSettings&)), objects.back(), SLOT(applySettings(BoxesSettings&)));
			}
		}
	}