Peter Krenesky
Saving, Loading, and interacting with Helix Producer Jobs
The encoding job is the object that the producer SDK revolves around. It contains configuration for what, when and how something is encoded. It is defined by IHTXEncodingJob and implemented by CHXTEncodingJob. Most of the producer client logic will deal with creating and manipulating this object and its children
This example shows an input being created and added to the job.
// Create the inputIHXTInput* pInput = NULL;
if (SUCCEEDED(res))
res = m_pFactory->BuildInstance(IID_IHXTInput, pInitParams, (IUnknown**)&pInput);// Set the input on the encoding job
if (SUCCEEDED(res))
res = m_pJob->SetInput(pInput);
Encoding jobs can also be stored or read from xml files. CHXTEncodingJob implements IHXTUserConfigFile which contains the methods WriteToFile(…) and ReadFromFile(…). This feature won’t be needed by all clients but its easy and unobtrusive to add.
// Get the serialization interfaceIHXTUserConfigFile* pSerializer = NULL;
res = m_pJob->QueryInterface(IID_IHXTUserConfigFile, (void**)&pSerializer);// Save the job to a file
if (SUCCEEDED(res))
res = pSerializer->WriteToFile(szInput);
IHXTEncodingJob isn’t the only interface that can be serialized. Audiences can be stored separately so they may be reused in different jobs.
This code snippet taken from the command line producer app shows an audience being read from a file
IHXTAudiencePtr spAudDef;res = m_spFactory->CreateInstance(IID_IHXTAudience, (IUnknown**)spAudDef.Adopt());
IHXTUserConfigFilePtr spSerial;// retrieve serialization interface
if ( SUCCEEDED(res) )
res=spAudDef0->QueryInterface(IID_IHXTUserConfigFile, (void**)spSerial.Adopt());
//deserialize audience
if ( SUCCEEDED(res) )
res = spSerial->ReadFromFile( audpath.c_str(), !m_Params.bDisableUpdateCodecs);