Method Init

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
 
(5 intermediate revisions by one user not shown)
Line 2: Line 2:
 
<!--SORT=1-->
 
<!--SORT=1-->
  
Производит инициализацию данных объекта, для объектов - сплитеров или ридеров производит открытие файлов и начальный парсинг.
+
Initializes the object's data, for objects - splitter or reader makes opening files and the initial parsing.
 
=== ===
 
=== ===
 
<source lang=idl>HRESULT Init()</source>
 
<source lang=idl>HRESULT Init()</source>
Line 17: Line 17:
 
   //---------------------------------
 
   //---------------------------------
 
   // Create MXF Reader object
 
   // Create MXF Reader object
   CComPtr<IAVObject> spReader;
+
   CComPtr&lt;IAVObject&gt; spReader;
  
 
   HRESULT hr = Create_MXFReader(&spReader);  
 
   HRESULT hr = Create_MXFReader(&spReader);  
Line 24: Line 24:
  
 
   //---------------------------------
 
   //---------------------------------
   // Set filename
+
   // Query IAVProperties interface
 
   CComQIPtr<IAVProperties> spProps(spReader);
 
   CComQIPtr<IAVProperties> spProps(spReader);
 
   ATLASSERT(spProps != NULL);
 
   ATLASSERT(spProps != NULL);
  
 +
  //---------------------------------
 +
  // Set filename
 
   hr = spProps->PropsSet(L"source", L"file.mxf");
 
   hr = spProps->PropsSet(L"source", L"file.mxf");
 
   if(hr != S_OK)
 
   if(hr != S_OK)

Latest revision as of 13:43, 8 July 2014

This page is a copy of the original page on the AVObjects' web site and can also be viewed here.

Initializes the object's data, for objects - splitter or reader makes opening files and the initial parsing.

HRESULT Init()

Returns:

S_OK     AVObject successfully initialized
E_FAIL   Source file not found or other failure.

Sample

  //---------------------------------
  // Create MXF Reader object
  CComPtr&lt;IAVObject&gt;	spReader;
 
  HRESULT hr = Create_MXFReader(&spReader); 
  if (hr != S_OK)
     return hr;
 
  //---------------------------------
  // Query IAVProperties interface
  CComQIPtr<IAVProperties> spProps(spReader);
  ATLASSERT(spProps != NULL);
 
  //---------------------------------
  // Set filename
  hr = spProps->PropsSet(L"source", L"file.mxf");
  if(hr != S_OK)
    return hr;
 
  //---------------------------------
  // Init Object
  hr = spReader->Init();
  if(hr != S_OK)
    return hr;
Personal tools