digitalwerk community: hiddenhttps://support.digitalwerk.net/https://support.digitalwerk.net/themes/digitalwerk_theme/favicon/dw.ico?16823609612019-08-12T16:50:53Zdigitalwerk community
Redmine Public Support - Support Request #7981: How to get SampleTypeNamehttps://support.digitalwerk.net/issues/7981#change-340302019-08-12T16:50:53Zhidden
<p>Thanks it is OK, you could close this ticket.</p>
<p>Please update your comment in ADTF headers to make clear that "_MediaSampleName_" equals "_SampleTypeName_".</p> Public Support - Support Request #7981: How to get SampleTypeNamehttps://support.digitalwerk.net/issues/7981#change-339952019-08-12T11:06:47Zhidden
<p>Unfortunatelly <em>const tChar* GetMediaSampleDescription();</em> cannot read <strong>SampleTypeName</strong>. So this function is useless. I need to get <strong>SampleTypeName</strong> from another filter, when IMediaTypeDescription can be obtained.</p>
<p>Please note that <strong>SampleTypeName</strong> is NOT <strong>MediaSampleDescription</strong>. Sample type name is a structure inside Media sample description.</p>
<pre>/** protect the @ref IMediaTypeDescription to sets the media sample description.
*
* If the strSampleTypeName is set to "tMySampleTypeName" and the description of this type is within
* strSampleTypeDescription the description will look like:
*
* \code
* <stream name="generated_name" type="tMyMediaTypeName">
* <struct type="tMySampleTypeName" bytepos="0"/>
* </stream>
* \endcode
*
* @copydoc IMediaTypeDescription::SetMediaSampleDescription
* @attention This implementation can only handle descriptions with one struct (complex type) within stream.
* To use more than one complex type you need to define a complex type with you complex types as elements.
*/
tResult SetMediaSampleDescription(const tChar* strSampleTypeName,
const tChar* strSampleTypeDescription,
ucom::IException** __exception_ptr=NULL);</pre> Public Support - Support Request #7981 (Closed): How to get SampleTypeNamehttps://support.digitalwerk.net/issues/79812019-07-30T16:19:44Zhidden
<p><strong>Supportanfrage</strong></p>
<p>Sorry, I did not find any function that can readback "strSampleTypeName". Please help how to get this value.</p>
<p>The only workaround seems to me to have same pin name and sample type name and it is not good.</p>
<pre>
// Set typing for output pin
ucom::cObjectPtr<adtf::IMediaType> pType = NULL;
RETURN_IF_FAILED(m_oOutputEnvironment.GetMediaType(&pType));
ucom::cObjectPtr<adtf::IMediaTypeDescription> pTypeDescription = NULL;
if(IS_OK(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&pTypeDescription)))
{
//if you are not sure your description works!
//react on this return value!
RETURN_IF_FAILED(pTypeDescription->SetMediaSampleDescription("tVehicleModelEnvironment", //strTypeName,
strMyDescription.GetPtr(),
IMediaDescription::MDF_DDL020000));
}
</pre>
<p><em>(I will be on vacation till 11.8. so no response needed sooner)</em></p>
<p><strong>Lösung</strong></p>
<p>Just hit <code>pTypeDescription->GetMediaSampleName</code> to retreive <code>SampleTypeName</code></p>
<p>For an example please have a look at <a href="https://support.digitalwerk.net/adtf/v2/adtf_sdk_html_docs/page_demo_qtmedia_desc_display.html" class="external">Demo Qt Media Description Display Filter</a> to adapt for your use case.</p>