Example #1
0
void MP4SoundAtom::Read()
{
  MP4Atom *parent = GetParentAtom();
  if (ATOMID(parent->GetType()) != ATOMID("stsd")) {
    // Quicktime has an interesting thing - they'll put an mp4a atom
    // which is blank inside a wave atom, which is inside an mp4a atom
    // we have a mp4a inside an wave inside an mp4a - delete all properties
    m_pProperties.Delete(8);
    m_pProperties.Delete(7);
    m_pProperties.Delete(6);
    m_pProperties.Delete(5);
    m_pProperties.Delete(4);
    m_pProperties.Delete(3);
    m_pProperties.Delete(2);
    m_pProperties.Delete(1);
    m_pProperties.Delete(0);
    if (ATOMID(GetType()) == ATOMID("alac")) {
      AddProperty(new MP4BytesProperty("decoderConfig", m_size));
      ReadProperties();
    }
    if (m_pChildAtomInfos.Size() > 0) {
      ReadChildAtoms();
    }
  } else {
    ReadProperties(0, 3); // read first 3 properties
    AddProperties(((MP4IntegerProperty *)m_pProperties[2])->GetValue());
    ReadProperties(3); // continue
    if (m_pChildAtomInfos.Size() > 0) {
      ReadChildAtoms();
    }
  }
  Skip();
}
Example #2
0
void MP4Stz2Atom::Read() 
{
	ReadProperties(0, 4);

	uint8_t fieldSize = 
	  ((MP4Integer8Property *)m_pProperties[3])->GetValue();
	//	uint32_t sampleCount = 0;

	MP4Integer32Property* pCount = 
	  (MP4Integer32Property *)m_pProperties[4]; 

	MP4TableProperty *pTable;
	if (fieldSize != 4) {
	  pTable = new MP4TableProperty("entries", pCount);
	} else {
	  // 4 bit field size uses a special table.
	  pTable = new MP4HalfSizeTableProperty("entries", pCount);
	}

	AddProperty(pTable);

	if (fieldSize == 16) {
	  pTable->AddProperty( /* 5/0 */
			      new MP4Integer16Property("entrySize"));
	} else {
	  pTable->AddProperty( /* 5/0 */
			      new MP4Integer8Property("entrySize"));
	}
	  
	ReadProperties(4);

	Skip();	// to end of atom
}
Example #3
0
void MP4ElstAtom::Read() 
{
    /* read atom version */
    ReadProperties(0, 1);

    /* need to create the properties based on the atom version */
    AddProperties(GetVersion());

    /* now we can read the remaining properties */
    ReadProperties(1);

    Skip();    // to end of atom
}
Example #4
0
void MP4UrnAtom::Read()
{
    // read the version, flags, and name properties
    ReadProperties(0, 3);

    // check if location is present
    if (m_File.GetPosition() < GetEnd()) {
        // read it
        ReadProperties(3);
    }

    Skip(); // to end of atom
}
Example #5
0
void MP4TrunAtom::Read()
{
	/* read atom version, flags, and sampleCount */
	ReadProperties(0, 3);

	/* need to create the properties based on the atom flags */
	AddProperties(GetFlags());

	/* now we can read the remaining properties */
	ReadProperties(3);

	Skip();	// to end of atom
}
Example #6
0
void MP4StszAtom::Read() 
{
	ReadProperties(0, 4);

	u_int32_t sampleSize = 
		((MP4Integer32Property*)m_pProperties[2])->GetValue();

	// only attempt to read entries table if sampleSize is zero
	// i.e sample size is not constant
	m_pProperties[4]->SetImplicit(sampleSize != 0);

	ReadProperties(4);

	Skip();	// to end of atom
}
Example #7
0
int StyleSheetParser::Parse(StyleSheetNode* node, Stream* _stream)
{
	int rule_count = 0;
	line_number = 0;
	stream = _stream;
	stream_file_name = stream->GetSourceURL().GetURL().Replace("|", ":");

	// Look for more styles while data is available
	while (FillBuffer())
	{
		String style_names;
		
		while (FindToken(style_names, "{", true))
		{
			// Read the attributes
			PropertyDictionary properties;
			if (!ReadProperties(properties))
			{
				continue;
			}

			StringList style_name_list;
			StringUtilities::ExpandString(style_name_list, style_names);

			// Add style nodes to the root of the tree
			for (size_t i = 0; i < style_name_list.size(); i++)
				ImportProperties(node, style_name_list[i], properties, rule_count);

			rule_count++;
		}
	}	

	return rule_count;
}
void XmlMapHandler::Load(std::istream& file, Map& map)
{
    wxXmlDocument doc;
    wxFInputStream fis(file);
    if (!doc.Load(dynamic_cast<wxInputStream&>(fis)))
        throw "Could not open XML file";

    wxXmlNode* child = doc.GetRoot()->GetChildren();

    if (child != NULL && child->GetName() != "Properties")
        throw "Properties must be the first node in the XML file";

    ReadProperties(child, map);
    while ((child = child->GetNext()))
    {
        std::string name = child->GetName().ToStdString();
        VerboseLog("%s Got node %s", __func__, name.c_str());

        if (name == "Layer")
            ReadLayer(child, map);
        else if (name == "Background")
            ReadBackground(child, map);
        else if (name == "Collision")
            ReadCollision(child, map);
        else if (name == "Animation")
            ReadAnimation(child, map);
        else
            throw "Unknown element found in file " + name;
    }
}
Example #9
0
bool StyleSheetParser::ParseProperties(PropertyDictionary& parsed_properties, const String& properties)
{
	stream = new StreamMemory((const byte*)properties.CString(), properties.Length());
	bool success = ReadProperties(parsed_properties);
	stream->Close();
	return success;
}
Example #10
0
TextBox::TextBox(tinyxml2::XMLElement* element, Control* parent)
	: Button(element, parent), _caretPosition(0), _caretPositionX(0), _caretPositionY(0), _caretSrcX(0), 
	_caretSrcY(0), _caretSrcWidth(0), _caretSrcHeight(0)
{
	_label = new Label();
	ReadProperties(element);
}
//-----------------------------------------------------------------------------
CPUTResult CPUTRenderStateBlockDX11::LoadRenderStateBlock(const cString &fileName)
{
    // TODO: If already loaded, then Release() all the old members

    // use the fileName for now, maybe we'll add names later?
    mMaterialName = fileName;

    // Open/parse the file
    CPUTConfigFile file;
    CPUTResult result = file.LoadFile(fileName);
    ASSERT( !FAILED(result), _L("Failed loading file: '") + fileName + _L("'.") );

    // Note: We ignore "not found error" results for ReadProperties() calls.
    // These blocks are optional.
    UINT ii;
    for( ii=0; ii<8; ii++ )
    {
        wchar_t pBlockName[64];
        wsprintf( pBlockName, _L("RenderTargetBlendStateDX11_%d"), ii+1 );
        ReadProperties( file, cString(pBlockName), pRenderTargetBlendDescMap, &mStateDesc.BlendDesc.RenderTarget[ii] );
    }
    ReadProperties( file, _L("BlendStateDX11"),        pBlendDescMap,        &mStateDesc.BlendDesc );
    ReadProperties( file, _L("DepthStencilStateDX11"), pDepthStencilDescMap, &mStateDesc.DepthStencilDesc);
    ReadProperties( file, _L("rasterizerstateDX11"),   pRasterizerDescMap,   &mStateDesc.RasterizerDesc);

    mNumSamplers = 0;
    for( ii=0; ii<D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; ii++ )
    {
        // TODO: Use sampler names from .fx file.  Already did this for texture names.
        // The challenge is that the renderstate file is independent from the material (and the shaders).
        // Another feature is that the artists don't name the samplers (in the CPUTSL source).  Though, arbitrary .fx files can.
        // TODO: Add sampler-state properties to CPUTSL source (e.g., filter modes).  Then, have ShaderGenerator output a .rs file.
        wchar_t pBlockName[64];
        wsprintf( pBlockName, _L("SamplerDX11_%d"), ii+1 );
        CPUTResult result = ReadProperties( file, cString(pBlockName), pSamplerDescMap, &mStateDesc.SamplerDesc[ii] );
        if( CPUT_SUCCESS != result )
        {
            break; // Reached last sampler spec
        }
        ++mNumSamplers;
    }
    CreateNativeResources();

    return CPUT_SUCCESS;
} // CPUTRenderStateBlockDX11::LoadRenderStateBlock()
Example #12
0
void MP4UnknownQosQualifier::Read(MP4File* pFile)
{
    ReadHeader(pFile);

    /* byte properties need to know how long they are before reading */
    ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);

    ReadProperties(pFile);
}
Example #13
0
//------------------------------------------------------------------------
void CGunTurret::OnReset()
{
	if(IScriptTable *pScriptTable = GetEntity()->GetScriptTable())
	{
		SmartScriptTable props;

		if(pScriptTable->GetValue("Properties", props))
			ReadProperties(props);
	}

	CItem::OnReset();

	Matrix34 tm = GetEntity()->GetSlotLocalTM(eIGS_Aux0,false);

	tm.SetTranslation(GetSlotHelperPos(eIGS_Aux0,m_radarHelper.c_str(),false));
	GetEntity()->SetSlotLocalTM(eIGS_ThirdPerson,tm);

	if(GetEntity()->IsSlotValid(eIGS_Aux1))
	{
		tm.SetTranslation(GetSlotHelperPos(eIGS_ThirdPerson,m_barrelHelper.c_str(),false));
		GetEntity()->SetSlotLocalTM(eIGS_Aux1,tm);
	}

	m_targetId = 0;
	m_destinationId = 0;
	m_updateTargetTimer = 0.0f;
	m_abandonTargetTimer = 0.0f;
	m_goalYaw = 0.0f;
	m_goalPitch = 0.0f;
	m_burstTimer = 0.0f;
	m_pauseTimer = 0.0f;
	m_searchHint = 0;
	m_fireHint = 1;
	m_deviationPos.zero();

	m_randoms[eRV_UpdateTarget].Range(m_turretparams.update_target_time * m_fireparams.randomness);
	m_randoms[eRV_AbandonTarget].Range(m_turretparams.abandon_target_time * m_fireparams.randomness);
	m_randoms[eRV_BurstTime].Range(m_turretparams.burst_time * m_fireparams.randomness);
	m_randoms[eRV_BurstPause].Range(m_turretparams.burst_pause * m_fireparams.randomness);

	m_lightId = AttachLight(eIGS_ThirdPerson, m_lightId, false);
	StopSound(m_lightSound);
	m_lightSound = INVALID_SOUNDID;

	if(m_turretparams.light_fov > 0.f)
	{
		m_lightId = AttachLight(eIGS_ThirdPerson, 0, true, m_turretparams.mg_range, m_searchparams.light_color*m_searchparams.light_diffuse_mul, 1.f/m_searchparams.light_diffuse_mul, m_searchparams.light_texture, m_turretparams.light_fov, m_searchparams.light_helper, Vec3(0,0,0), Vec3(-1,0,0), m_searchparams.light_material, m_searchparams.light_hdr_dyn);
		m_lightSound = PlayAction(g_pItemStrings->use_light);
	}

	SetFiringLocator(this);

	if(m_fm2)
		m_fm2->Activate(true);

	EnableUpdate(true, eIUS_General);
}
Example #14
0
/*! \brief Read atom.
*/
void MP4OhdrAtom::Read() {
  ReadProperties(0, 8);
  MP4Property* lProperty;
  MP4Property* property;
  lProperty = GetProperty(5);
  property = GetProperty(8);
  ((OhdrMP4StringProperty*)property)->SetFixedLength(
    ((MP4Integer16Property*)lProperty)->GetValue());
  lProperty = GetProperty(6);
  property = GetProperty(9);
  ((OhdrMP4StringProperty*)property)->SetFixedLength(
    ((MP4Integer16Property*)lProperty)->GetValue());
  lProperty = GetProperty(7);
  property = GetProperty(10);
  ((MP4BytesProperty*)property)->SetFixedSize(
    ((MP4Integer16Property*)lProperty)->GetValue());
  ReadProperties(8, 3);
}
Example #15
0
void MP4ExtensionDescriptor::Read(MP4File* pFile)
{
	ReadHeader(pFile);

	/* byte properties need to know how long they are before reading */
	((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);

	ReadProperties(pFile);
}
Example #16
0
Slider::Slider(tinyxml2::XMLElement* element, Control* parent)
	: Button(element, parent), _orientation(ORIENTATION_HORIZONTAL), onValueChanged(0), 
	_markerOffsetX(0), _markerOffsetY(0), _value(0), _minValue(0), _maxValue(0)
{
	_marker = new Button();
	AddChild(GetMarker());
	GetMarker()->onMouseMove.bind(this, &Slider::MarkerOnMouseMove);
	GetMarker()->onMouseButtonDown.bind(this, &Slider::MarkerOnMouseButtonDown);
	ReadProperties(element);
}
Example #17
0
AnalogStick::AnalogStick(tinyxml2::XMLElement* element, Control* parent)
	: Button(element, parent), _stickX(0), _stickY(0), _valueX(0), _valueY(0), _pressed(false)
{
	for (uchar i = 0; i < CONTROL_STATE_COUNT; i++)
	{
		_stickSrcX[i] = 0;
		_stickSrcY[i] = 0;
	}

	ReadProperties(element);
}
Example #18
0
void MP4SLConfigDescriptor::Read(MP4File* pFile)
{
	ReadHeader(pFile);

	// read the first property, 'predefined'
	ReadProperties(pFile, 0, 1);

	// if predefined == 0
	if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) {

		/* read the next 18 properties */
		ReadProperties(pFile, 1, 18);
	}

	// now mutate 
	Mutate();

	// and read the remaining properties
	ReadProperties(pFile, 19);
}
Example #19
0
void MP4RtpAtom::ReadHntiType() 
{
	ReadProperties(0, 1);

	// read sdp string, length is implicit in size of atom
	u_int64_t size = GetEnd() - m_pFile->GetPosition();
	char* data = (char*)MP4Malloc(size + 1);
	m_pFile->ReadBytes((u_int8_t*)data, size);
	data[size] = '\0';
	((MP4StringProperty*)m_pProperties[1])->SetValue(data);
	MP4Free(data);
}
wxString SubversionLocalProperties::ReadProperty(const wxString& propName)
{
    ReadProperties();

    // find the relevant group
    GroupTable::const_iterator iter = m_values.find(m_url);
    if(iter == m_values.end()) return wxT("");

    SimpleTable::const_iterator it = iter->second.find(propName);
    if(it == iter->second.end()) return wxT("");

    return it->second;
}
Example #21
0
void MP4ContentIdDescriptor::Read(MP4File* pFile)
{
	ReadHeader(pFile);

	/* read the first property, 'compatiblity' */
	ReadProperties(pFile, 0, 1);

	/* if compatiblity != 0 */
	if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) {
		/* we don't understand it */
		VERBOSE_READ(pFile->GetVerbosity(),
			printf("incompatible content id descriptor\n"));
		return;
	}

	/* read the next four properties */
	ReadProperties(pFile, 1, 4);

	/* which allows us to reconfigure ourselves */
	Mutate();

	/* read the remaining properties */
	ReadProperties(pFile, 5);
}
Example #22
0
// There is a spec incompatiblity between QT and MP4
// QT says name field is a counted string
// MP4 says name field is a null terminated string
// Here we attempt to make all things work
void MP4HdlrAtom::Read() 
{
    // read all the properties but the "name" field
    ReadProperties(0, 5);

    // take a peek at the next byte
    u_int8_t strLength;
    m_pFile->PeekBytes(&strLength, 1);

    // if the value matches the remaining atom length
    if (m_pFile->GetPosition() + strLength + 1 == GetEnd()) {
        // read a counted string
        MP4StringProperty* pNameProp = 
            (MP4StringProperty*)m_pProperties[5];
        pNameProp->SetCountedFormat(true);
        ReadProperties(5);
        pNameProp->SetCountedFormat(false);
    } else {
        // read a null terminated string
        ReadProperties(5);
    }

    Skip();    // to end of atom
}
void SubversionLocalProperties::WriteProperty(const wxString& name, const wxString& val)
{
    ReadProperties();

    GroupTable::iterator iter = m_values.find(m_url);
    if(iter == m_values.end()) {
        SimpleTable tb;
        tb[name] = val;
        m_values[m_url] = tb;
    } else {
        m_values[m_url][name] = val;
    }

    // Update the properties
    WriteProperties();
}
Example #24
0
bool ScintillaEditor::OpenFile(const CString& fileName, const CString& forcedExt)
{
	ReadProperties(fileName, forcedExt);

	SendEditor(SCI_CLEARALL);

	CFile file;
	if (!file.Open(fileName, CFile::modeRead))
		return false;

	DWORD size = (DWORD)file.GetLength();
	char* buffer = new char[size];
	file.Read(buffer, size);
	file.Close();

	SendEditor(SCI_ADDTEXT, size, (LPARAM)buffer);

	delete [] buffer;

	return true;
}
Example #25
0
int main(int argc, char *argv[])
{
  int myproc, numprocs, j;
  MPI_Comm comm;
  gridT *grid;
  physT *phys;
  propT *prop;

  StartMpi(&argc,&argv,&comm,&myproc,&numprocs);

  ParseFlags(argc,argv,myproc);
  
  if(GRID)
    GetGrid(&grid,myproc,numprocs,comm);
  else
    ReadGrid(&grid,myproc,numprocs,comm);
  

  if(SOLVE) {
    //read parameters in suntans.dat into the solver
    ReadProperties(&prop,grid,myproc);
    // give space and initialize dzf(edge) dzz(center) dzzold(center)
    InitializeVerticalGrid(&grid,myproc);
    AllocatePhysicalVariables(grid,&phys,prop);
    AllocateTransferArrays(&grid,myproc,numprocs,comm);
    OpenFiles(prop,myproc);
    if(RESTART)
      ReadPhysicalVariables(grid,phys,prop,myproc,comm);
    else
      InitializePhysicalVariables(grid,phys,prop,myproc,comm);

    Solve(grid,phys,prop,myproc,numprocs,comm);
    //    FreePhysicalVariables(grid,phys,prop);
    //    FreeTransferArrays(grid,myproc,numprocs,comm);
  }

  EndMpi(&comm);
}
Example #26
0
main(int argc, char *argv[])
{
  int myproc, numprocs, j, i;
  MPI_Comm comm;
  gridT *grid;
  physT *phys;
  propT *prop;
  sediT *sedi;
  spropT *sprop;
  waveT *wave;
  wpropT *wprop;

  StartMpi(&argc,&argv,&comm,&myproc,&numprocs);

  ParseFlags(argc,argv,myproc);
  
  
  if(GRID)
    GetGrid(&grid,myproc,numprocs,comm);
  else
    ReadGrid(&grid,myproc,numprocs,comm);


  if(SOLVE) {
    ReadProperties(&prop,myproc);
    InitializeVerticalGrid(&grid);
    AllocatePhysicalVariables(grid,&phys,prop);

   // if(prop->wave){
      InitializeWaveProperties(&wprop, prop, myproc);
      AllocateWaveVariables(grid, &wave, prop, wprop);
      InitializeWaveVariables(grid, wave, prop, wprop, myproc, comm);
      
   // }
    
    if(prop->sedi){
      InitializeSediProperties(prop, &sprop, myproc);
      AllocateSediVariables(grid, &sedi, sprop, prop);
      InitializeSediVariables(grid, sedi, prop, sprop, myproc, comm);
    }
    
    AllocateTransferArrays(&grid,myproc,numprocs,comm);
    
    OpenFiles(prop,myproc);
    
    if(RESTART){
      ReadPhysicalVariables(grid,phys,prop,sedi,sprop,wave,wprop,myproc,comm);
     
    }
    else{
      InitializePhysicalVariables(grid,phys,sedi,prop,sprop);
      
    }

    InputTides(grid, phys, prop, myproc);
    
    SetDragCoefficients(grid,phys,prop);
    
    if (prop->wave)
      if (wprop->wind_forcing){
    	ObtainKrigingCoef(grid, wave, wprop, myproc, numprocs);    
    	for (i = 0; i< wprop->nstation; i++)      
    	  InputWind(i, prop, wave,wprop,myproc,numprocs);
      }

   
    Solve(grid,phys,prop,sprop,sedi,wave,wprop,myproc,numprocs,comm);
   
    //    FreePhysicalVariables(grid,phys,prop);
    //    FreeTransferArrays(grid,myproc,numprocs,comm);   
  }

  EndMpi(&comm);
}
Example #27
0
int main(int argc, char **argv)
{
    /*
     * Parse args.
     */
    if (argc <= 1)
    {
        printf("usage: %s [-C|--dir <UCD-dir>] [UnicodeData.txt [DerivedCoreProperties.txt [PropList.txt] [DerivedNormalizationProps.txt]]]\n",
                argv[0]);
        return 1;
    }

    const char *pszBaseDir                      = NULL;
    const char *pszUnicodeData                  = "UnicodeData.txt";
    const char *pszDerivedCoreProperties        = "DerivedCoreProperties.txt";
    const char *pszPropList                     = "PropList.txt";
    const char *pszDerivedNormalizationProps    = "DerivedNormalizationProps.txt";
    int iFile = 0;
    for (int argi = 1;  argi < argc; argi++)
    {
        if (argv[argi][0] != '-')
        {
            switch (iFile++)
            {
                case 0: pszUnicodeData                  = argv[argi]; break;
                case 1: pszDerivedCoreProperties        = argv[argi]; break;
                case 2: pszPropList                     = argv[argi]; break;
                case 3: pszDerivedNormalizationProps    = argv[argi]; break;
                default:
                    fprintf(stderr, "uniread: syntax error at '%s': too many filenames\n", argv[argi]);
                    return 1;
            }
        }
        else if (   !strcmp(argv[argi], "--dir")
                 || !strcmp(argv[argi], "-C"))
        {
            if (argi + 1 >= argc)
            {
                fprintf(stderr, "uniread: syntax error: '%s' is missing the directory name.\n", argv[argi]);
                return 1;
            }
            argi++;
            pszBaseDir = argv[argi];
        }
        else if (   !strcmp(argv[argi], "-q")
                 || !strcmp(argv[argi], "--quiet"))
            g_fQuiet = true;
        else
        {
            fprintf(stderr, "uniread: syntax error at '%s': Unknown argument\n", argv[argi]);
            return 1;
        }
    }

    /*
     * Read the data.
     */
    int rc = ReadUnicodeData(pszBaseDir, pszUnicodeData);
    if (rc)
        return rc;
    rc = GenerateExcludedData();
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszPropList);
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszDerivedCoreProperties);
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszDerivedNormalizationProps);
    if (rc)
        return rc;

    /*
     * Print stuff.
     */
    rc = PrintHeader(argv[0]);
    if (rc)
        return rc;
    rc = PrintFlags();
    if (rc)
        return rc;
    rc = PrintUpper();
    if (rc)
        return rc;
    rc = PrintLower();
    if (rc)
        return rc;

    /* done */
    fflush(stdout);

    return rc;
}
//-----------------------------------------------------------------------------
CPUTResult CPUTRenderStateBlockOGL::LoadRenderStateBlock(const cString &fileName)
{
    // TODO: If already loaded, then Release() all the old members

    // use the fileName for now, maybe we'll add names later?
    mMaterialName = fileName;

    // Open/parse the file
    CPUTConfigFile file;
    CPUTResult result = file.LoadFile(fileName);
    ASSERT( !FAILED(result), _L("Failed loading file: '") + fileName + _L("'.") );

    // Note: We ignore "not found error" results for ReadProperties() calls.
    // These blocks are optional.
//    for( UINT ii=0; ii<8; ii++ )
//    {
//        char pBlockName[64];
//#ifndef CPUT_OS_WINDOWS
//        sprintf( pBlockName, _L("RenderTargetBlendStateOGL_%d"), ii+1 );
//#else
//        sprintf( pBlockName, ("RenderTargetBlendStateOGL_%d"), ii+1 );
//#endif
//    }

//#ifndef CPUT_OS_WINDOWS
//    ReadProperties( file, "DepthStencilStateOGL", pDepthStencilDescMap, &mStateDesc.DepthStencilDesc);
//    ReadProperties( file, "RasterizerStateOGL",   pRasterizerDescMap,   &mStateDesc.RasterizerDesc);
//    ReadProperties( file, "RenderTargetBlendStateOGL",   pRenderTargetBlendDescMap,   &mStateDesc.RenderTargetBlendDesc);
//#else
    ReadProperties( file, _L("DepthStencilStateOGL"), pDepthStencilDescMap, &mStateDesc.DepthStencilDesc);
    ReadProperties( file, _L("RasterizerStateOGL"),   pRasterizerDescMap,   &mStateDesc.RasterizerDesc);
    ReadProperties( file, _L("RenderTargetBlendStateOGL"),   pRenderTargetBlendDescMap,   &mStateDesc.RenderTargetBlendDesc);
//#endif

    //
    // For each sampler we read, need to create an OGL sampler object
    //
#ifndef CPUT_FOR_OGLES2
    GL_CHECK(ES3_COMPAT(glGenSamplers(1, &mStateDesc.DefaultSamplerID)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_MIN_FILTER,   mStateDesc.DefaultSamplerDesc.MinFilter)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_MAG_FILTER,   mStateDesc.DefaultSamplerDesc.MagFilter)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_WRAP_S,       mStateDesc.DefaultSamplerDesc.AddressU)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_WRAP_T,       mStateDesc.DefaultSamplerDesc.AddressV)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_WRAP_R,       mStateDesc.DefaultSamplerDesc.AddressW)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_COMPARE_MODE, mStateDesc.DefaultSamplerDesc.ComparisonMode)));
    GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.DefaultSamplerID, GL_TEXTURE_COMPARE_FUNC, mStateDesc.DefaultSamplerDesc.ComparisonFunc)));
    GL_CHECK(ES3_COMPAT(glSamplerParameterf( mStateDesc.DefaultSamplerID, GL_TEXTURE_MIN_LOD,      mStateDesc.DefaultSamplerDesc.MinLOD)));
    GL_CHECK(ES3_COMPAT(glSamplerParameterf( mStateDesc.DefaultSamplerID, GL_TEXTURE_MAX_LOD,      mStateDesc.DefaultSamplerDesc.MaxLOD)));
#ifndef CPUT_FOR_OGLES
    GL_CHECK(glSamplerParameterf( mStateDesc.DefaultSamplerID, GL_TEXTURE_LOD_BIAS,     mStateDesc.DefaultSamplerDesc.MipLODBias));
    GL_CHECK(glSamplerParameterfv(mStateDesc.DefaultSamplerID, GL_TEXTURE_BORDER_COLOR, mStateDesc.DefaultSamplerDesc.BorderColor));
#endif
#else
#warning "Need to do something with samplers here"
#endif
        
    mNumSamplers = 0;
    for( UINT ii=0; ii<NUM_SAMPLERS_PER_RENDERSTATE; ii++ )
    {
        // TODO: Use sampler names from .fx file.  Already did this for texture names.
        // The challenge is that the renderstate file is independent from the material (and the shaders).
        // Another feature is that the artists don't name the samplers (in the CPUTSL source).  Though, arbitrary .fx files can.
        // TODO: Add sampler-state properties to CPUTSL source (e.g., filter modes).  Then, have ShaderGenerator output a .rs file.
        char pBlockName[64];
#ifndef CPUT_OS_WINDOWS
        sprintf( pBlockName, _L("SamplerOGL_%d"), ii+1 );
        CPUTResult result = ReadProperties( file, cString(pBlockName), pSamplerDescMap, &mStateDesc.SamplerDesc[ii] );
#else
        sprintf( pBlockName, ("SamplerOGL_%d"), ii+1 );
        CPUTResult result = ReadProperties( file, cString(s2ws(pBlockName)), pSamplerDescMap, &mStateDesc.SamplerDesc[ii] );
#endif

        if( CPUT_SUCCESS != result )
        {
            break; // Reached last sampler spec
        }

#ifndef CPUT_FOR_OGLES2
        //
        // For each sampler we read, need to create an OGL sampler object
        //
        GL_CHECK(ES3_COMPAT(glGenSamplers(1, &mStateDesc.SamplerIDs[ii])));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_MIN_FILTER,   mStateDesc.SamplerDesc[ii].MinFilter)));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_MAG_FILTER,   mStateDesc.SamplerDesc[ii].MagFilter)));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_WRAP_S,       mStateDesc.SamplerDesc[ii].AddressU)));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_WRAP_T,       mStateDesc.SamplerDesc[ii].AddressV)));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_WRAP_R,       mStateDesc.SamplerDesc[ii].AddressW)));
#ifndef CPUT_FOR_OGLES
        GL_CHECK(glSamplerParameterf( mStateDesc.SamplerIDs[ii], GL_TEXTURE_LOD_BIAS,     mStateDesc.SamplerDesc[ii].MipLODBias));
        GL_CHECK(glSamplerParameterfv(mStateDesc.SamplerIDs[ii], GL_TEXTURE_BORDER_COLOR, mStateDesc.SamplerDesc[ii].BorderColor));
#endif
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_COMPARE_MODE, mStateDesc.SamplerDesc[ii].ComparisonMode)));
        GL_CHECK(ES3_COMPAT(glSamplerParameteri( mStateDesc.SamplerIDs[ii], GL_TEXTURE_COMPARE_FUNC, mStateDesc.SamplerDesc[ii].ComparisonFunc)));
        GL_CHECK(ES3_COMPAT(glSamplerParameterf( mStateDesc.SamplerIDs[ii], GL_TEXTURE_MIN_LOD,      mStateDesc.SamplerDesc[ii].MinLOD)));
        GL_CHECK(ES3_COMPAT(glSamplerParameterf( mStateDesc.SamplerIDs[ii], GL_TEXTURE_MAX_LOD,      mStateDesc.SamplerDesc[ii].MaxLOD)));
#else
#warning "Need to do something with samplers here"
#endif

        ++mNumSamplers;
    }
 //   CreateNativeResources();

    return CPUT_SUCCESS;
} // CPUTRenderStateBlockOGL::LoadRenderStateBlock()
tResult cMarkerDetectFilter::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));
    if (eStage == StageFirst)
        {
        //create the video rgb input pin
        RETURN_IF_FAILED(m_oPinInputVideo.Create("Video_RGB_input",IPin::PD_Input, static_cast<IPinEventSink*>(this))); 
        RETURN_IF_FAILED(RegisterPin(&m_oPinInputVideo));

        //create the video rgb output pin
        RETURN_IF_FAILED(m_oPinOutputVideo.Create("Video_RGB_output", IPin::PD_Output, static_cast<IPinEventSink*>(this)));
        RETURN_IF_FAILED(RegisterPin(&m_oPinOutputVideo));

        // create the description manager
        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**)&pDescManager,__exception_ptr));

		tChar const * strDescSignalLanacc_man = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalLanacc_man);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_lanacc = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalLanacc_man, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_lanacc->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_Lan_Acc_Man));
		RETURN_IF_FAILED(Lan_Acc_Man.Create("Lan_Acc_Man", pTypeSignalmaneuver_lanacc, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&Lan_Acc_Man));

		tChar const * strDescSignalmaneuver_accspeed = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_accspeed);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_accspeed = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_accspeed, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_accspeed->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_Lan_Acc_Speed));
		RETURN_IF_FAILED(Lan_Acc_Speed.Create("Lane_Speed", pTypeSignalmaneuver_accspeed, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&Lan_Acc_Speed));

		tChar const * strDescSignalmaneuver_idJury = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_idJury);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_idjury = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_idJury, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_idjury->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuverid_Jury));
		RETURN_IF_FAILED(maneuverid_Jury.Create("maneuverid_Jury", pTypeSignalmaneuver_idjury, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuverid_Jury));

		tChar const * strDescSignalmaneuver_id = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_id);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_id = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalmaneuver_id, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_id->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuver_id));
		RETURN_IF_FAILED(maneuver_id.Create("Maneuver_ID", pTypeSignalmaneuver_id, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuver_id));

		tChar const * strDescSignalmaneuver_finish = pDescManager->GetMediaDescription("tBoolSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalmaneuver_finish);
		cObjectPtr<IMediaType> pTypeSignalmaneuver_finish = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescSignalmaneuver_finish, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalmaneuver_finish->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&mediatype_maneuver_finish));
		RETURN_IF_FAILED(maneuver_finish.Create("Maneuver_int_Finish", pTypeSignalmaneuver_finish, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&maneuver_finish));

        // create the description for the road sign pin
        tChar const * strDesc = pDescManager->GetMediaDescription("tRoadSign");   
        RETURN_IF_POINTER_NULL(strDesc);    
        cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tRoadSign", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        
        // create the road sign OutputPin
        RETURN_IF_FAILED(m_oPinRoadSign.Create("RoadSign", pType, this));
        RETURN_IF_FAILED(RegisterPin(&m_oPinRoadSign));
        // set the description for the road sign pin
        RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionRoadSign));
                
        // create the description for the road sign pin
        tChar const * strDescExt = pDescManager->GetMediaDescription("tRoadSignExt");   
        RETURN_IF_POINTER_NULL(strDescExt);    
        cObjectPtr<IMediaType> pTypeExt = new cMediaType(0, 0, 0, "tRoadSignExt", strDescExt, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        
        // create the extended road sign OutputPin
        RETURN_IF_FAILED(m_oPinRoadSignExt.Create("RoadSign_ext", pTypeExt, this));
        RETURN_IF_FAILED(RegisterPin(&m_oPinRoadSignExt));
        // set the description for the extended road sign pin
        RETURN_IF_FAILED(pTypeExt->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionRoadSignExt));
        }
    else if (eStage == StageNormal)
        {
            // get the propeerties
    		ReadProperties(NULL);
            m_iOutputMode = GetPropertyInt("Video Output Pin");
            m_f32MarkerSize = static_cast<tFloat32>(GetPropertyFloat("Size of Markers"));
            m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console");
            imshowflag = GetPropertyBool(MD_ENABLE_IMSHOW);
            imshowflag_ver = GetPropertyBool(MD_ENABLE_IMSHOW_VER);
            m_bCamaraParamsLoaded = tFalse;
            //Get path of marker configuration file
            cFilename fileConfig = GetPropertyStr("Dictionary File For Markers");
            //create absolute path for marker configuration file
            ADTF_GET_CONFIG_FILENAME(fileConfig);
            fileConfig = fileConfig.CreateAbsolutePath(".");
            
            //check if marker configuration file exits
            if (fileConfig.IsEmpty() || !(cFileSystem::Exists(fileConfig)))
                {
                LOG_ERROR("Dictionary File for Markers not found");
                RETURN_ERROR(ERR_INVALID_FILE);
                }   
            else
                {
                //try to read the marker configuration file
                if(m_Dictionary.fromFile(string(fileConfig))==false)
                    {
                    RETURN_ERROR(ERR_INVALID_FILE);
                    LOG_ERROR("Dictionary File for Markers could not be read");
                    }
                if(m_Dictionary.size()==0)
                    {
                    RETURN_ERROR(ERR_INVALID_FILE);
                    LOG_ERROR("Dictionary File does not contain valid markers or could not be read sucessfully");
                    }
                //set marker configuration file to highlyreliable markers class
                if (!(HighlyReliableMarkers::loadDictionary(m_Dictionary)==tTrue))
                    {
                    //LOG_ERROR("Dictionary File could not be read for highly reliable markers"); 
                    }
                } 
    
            //Get path of calibration file with camera paramters
            cFilename fileCalibration = GetPropertyStr("Calibration File for used Camera"); ;
        
            //Get path of calibration file with camera paramters
            ADTF_GET_CONFIG_FILENAME(fileCalibration);
            fileCalibration = fileCalibration.CreateAbsolutePath(".");
            //check if calibration file with camera paramters exits
            if (fileCalibration.IsEmpty() || !(cFileSystem::Exists(fileCalibration)))
                {
                LOG_ERROR("Calibration File for camera not found");
                }   
            else
                {
                // read the calibration file with camera paramters exits and save to member variable
                m_TheCameraParameters.readFromXMLFile(fileCalibration.GetPtr());
                cv::FileStorage camera_data (fileCalibration.GetPtr(),cv::FileStorage::READ);
                camera_data ["camera_matrix"] >> m_Intrinsics; 
                camera_data ["distortion_coefficients"] >> m_Distorsion;    
                m_bCamaraParamsLoaded = tTrue;
                }   
        }
tResult cMarkerDetectFilter::PropertyChanged(const char* strProperty)
{
    ReadProperties(strProperty);
    RETURN_NOERROR;
}