MXF Reader Lib

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
 
(8 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{This|av_objects/splitters%26readers/MXFReaderLib.html}}
 
{{This|av_objects/splitters%26readers/MXFReaderLib.html}}
 
<!--SORT=1-->
 
<!--SORT=1-->
 
 
__NOTOC__
 
__NOTOC__
  
Line 10: Line 9:
  
 
==Interfaces&Methods==
 
==Interfaces&Methods==
 +
 
Object implements follows methods of [[:Category:IAVObject|IAVObject Interface]]
 
Object implements follows methods of [[:Category:IAVObject|IAVObject Interface]]
 
*[[Method Init|Init()]]
 
*[[Method Init|Init()]]
 +
 
*[[Method Close|Close()]]
 
*[[Method Close|Close()]]
 +
 
*[[Method CanGetFrame|CanGetFrame()]]
 
*[[Method CanGetFrame|CanGetFrame()]]
 +
 
*[[Method GetFrame|GetFrame()]]
 
*[[Method GetFrame|GetFrame()]]
  
 
[[:Category:IAVProperties|IAVProperties Interface]] used for sets ang gets values of MXF Reader Lib properties.
 
[[:Category:IAVProperties|IAVProperties Interface]] used for sets ang gets values of MXF Reader Lib properties.
 +
 
==Properties==
 
==Properties==
{|
+
 
|-
+
| '''format'''
+
| BSTR
+
| RO
+
| File format
+
|-
+
| '''format_name'''
+
| BSTR
+
| RO
+
| File format description
+
|-
+
| '''source'''
+
| BSTR
+
| RW
+
| Name of file
+
|-
+
| '''start_time'''
+
| double
+
| RO
+
| Start timecode
+
|-
+
| '''duration'''
+
| double
+
| RO
+
| File duration in second
+
|-
+
| '''ext_audio'''
+
| bool
+
| RW
+
| Enable external audio file, as example for Panasonic P2
+
|-
+
| '''fw_play'''
+
| bool
+
| RW
+
| Play direction, true for forward, false  fo backward
+
|-
+
| '''aes_key'''
+
| BSTR
+
| RW
+
| Encription key for DCI files in HEX format XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX, dots may be omnited or replaced to any delimiter
+
|-
+
| '''streams'''
+
| array of objects
+
| RW
+
| Array of media streams for file
+
|}
+
  
 
<table class=prop>
 
<table class=prop>
{{AVOProp|format|BSTR|ReadOnly|File format}}
+
{{AVOProp|format|BSTR|ReadOnly|File format - "MXF"}}
{{AVOProp|format_name|BSTR|ReadOnly|File format description}}
+
{{AVOProp|format_name|BSTR|ReadOnly|File format description - "MXF (Material eXchange Format)"}}
 
{{AVOProp|source|BSTR|ReadWrite|Name of file}}
 
{{AVOProp|source|BSTR|ReadWrite|Name of file}}
{{AVOProp|start_time|double|ReadOnly|Start timecode}}
+
{{AVOProp|streams|array of objects|ReadWrite|Array of media streams for file}}
 +
{{AVOProp|start_time|LONGLONG|ReadOnly|Start timecode in frames}}
 
{{AVOProp|duration|double|ReadOnly|File duration in second}}
 
{{AVOProp|duration|double|ReadOnly|File duration in second}}
{{AVOProp|ext_audio|bool|ReadWrite|
+
{{AVOProp|ext_audio|bool|ReadWrite|Enable external audio file,as example for Panasonic P2 }}
Enable external audio file,as example for Panasonic P2 }}
+
{{AVOProp|fw_play|bool|ReadWrite|Play direction, ''true'' for forward, ''false'' for backward}}
{{AVOProp|fw_play|bool|ReadWrite|Play direction, true for forward, false  fo backward}}
+
 
{{AVOProp|aes_key|BSTR|ReadWrite|Encription key for DCI files in HEX format XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX, dots may be omnited or replaced to any delimiter}}
 
{{AVOProp|aes_key|BSTR|ReadWrite|Encription key for DCI files in HEX format XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX, dots may be omnited or replaced to any delimiter}}
{{AVOProp|streams|array of objects|ReadWrite|Array of media streams for file}}
+
{{AVOProp|metadata_xml|BSTR|ReadOnly|String with XML metadata according SMPTE 434-2006}}
 
</table>
 
</table>
  
  
 
==Samples==
 
==Samples==
 +
{{AVO Sample of create and Initialize|MXFReader}}
 
{{AVO Sample of trace properties}}
 
{{AVO Sample of trace properties}}
 
+
{{AVO Sample of copy stream}}
  
 
[[Category:Splitters&Readers]]
 
[[Category:Splitters&Readers]]

Latest revision as of 15:23, 11 July 2014

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


TODO: Description

Overview

TODO: Overview

Interfaces&Methods

Object implements follows methods of IAVObject Interface

IAVProperties Interface used for sets ang gets values of MXF Reader Lib properties.

Properties

formatBSTRReadOnly
File format - "MXF"
format_nameBSTRReadOnly
File format description - "MXF (Material eXchange Format)"
sourceBSTRReadWrite
Name of file
streamsarray of objectsReadWrite
Array of media streams for file
start_timeLONGLONGReadOnly
Start timecode in frames
durationdoubleReadOnly
File duration in second
ext_audioboolReadWrite
Enable external audio file,as example for Panasonic P2
fw_playboolReadWrite
Play direction, true for forward, false for backward
aes_keyBSTRReadWrite
Encription key for DCI files in HEX format XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX, dots may be omnited or replaced to any delimiter
metadata_xmlBSTRReadOnly
String with XML metadata according SMPTE 434-2006


Samples

Create and Initialize

//---------------------------------
// Create {{{1}}} object
CComPtr<IAVObject>;	spReader;
 
HRESULT hr = Create_{{{1}}}(&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"filename.ext");
if(hr != S_OK)
  return hr;
 
//---------------------------------
// Init Object
hr = spReader->Init();
if(hr != S_OK)
  return hr;

Trace all object's properties

//Query IAVProperties interface
CComQIPtr<IAVProperties> spProps(spObject);
 
//Get list name=value pairs separated CR
//for all properties of object
CComBSTR cbsPropsList;
HRESULT hr = spProps->PropsGet(L"\n", cbsPropsList);
ATLASSERT(hr == S_OK);
 
//Trace properties	
ATLTRACE2(atlTraceGeneral, 2, L"Qbject's properties:\n%s\n", 
  spPropsList);

Copy stream

//BYTE* pbBuffer - pointer to frame buffer
//DWORD cbBuffer - size of frane buffer in bytes
//int nStream - index of stream
 
HRESULT hr = S_OK;
while(1)
{
  hr = spDest->CanPutFrame(nStream, INFINITE);
  if ( hr != S_OK )
     return hr;
 
  hr = spSource->CanGetFrame(nStream, INFINITE);
  if (hr != S_OK)
    return hr;
 
  DWORD cbActual = 0;
  REFERENCE_TIME tS = 0, tE = 0;
  DWORD dwFlags = 0;
 
  hr = spSource->GetFrame(nStream, pbBuffer, cbBuffer,
    &cbActual, &dwFlags, &tS, &tE, NULL);
  if (hr == S_OK)
  {
     hr = spDest->PutFrame(nStream, m_pbBuffer, cbActual, 
        dwFlags, tS, tE, NULL);
  }
  else if (hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF))
  {
     // EOS, put empty frame to dest
     hr = spDest->PutFrame(nStream, NULL, 0, 0, 0, 0, NULL);
     if (hr == S_OK)
        return hr;
  }  
  if (FAILED(hr))
    return hr;
}
Personal tools