Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Updating an ASF header via IMFASFContentInfo::SetProfile only works with one stream ?

$
0
0

Hello,

i am altering the ASF Header on a Media Sink before it gets written to the file.

This works very well as long as i only have one stream on the IMFASFProfile, with multiple streams it shows some odd behavior. When i have more than one stream on the profile and i change the stream config from one of the streams, then in the final file the first stream is deleted.

I went exactly after the documentation and payed very close attention to the clones of objects like the IMFASFStreamConfig or IMFASFProfile. The Problem lays in IMFASFContentInfo::SetProfile i guess, because when i do not set the updated profile the streams and its headers appear normal in file, but of course with no changes. The MSDN documentary states that on SetProfile it replaces the old one, but from my experience it only does when you have one stream in the profile.

After thousands of tests over the past 3 days i still cant figure out what SetProfile is doing internaly but i must be very close to it. I know my updated profile is correct, because i printed the media type attributes of every stream after i made some changes.

One thing that realy confuses me is that if you dont clone the profile or the stream config and directly use the pointer to the object inside of the content info and you call IMFASFProfile::RemoveStream on all streams, then in the final file the streams and its headers are still present. Like the documentary says on IMFASFProfile::CreateStream :

-

The ASF stream configuration object created by this method is not included in the profile. To include the stream, you must first configure the stream configuration and then call IMFASFProfile::SetStream.

-

That means even if you remove a stream the ContentInfo still has its stream config objects set. Well...theres no function exposed to delete/remove a stream config on a profile, you only have IMFASFProfile::SetStream. To quote the documentary on this function :

-

If the stream number in the ASF stream configuration object is already included in the profile, the information in the new object replaces the old one. If the profile does not contain a stream for the stream number, the ASF stream configuration object is added as a new stream.

-

Well this works normal as expected, i know that because i printed the whole profile after i set an updated config with this function. As i stated the problem is IMFASFContentInfo::SetProfile. Somehow Stream andStream Config is not the same inside the content info, and there must be some backup pointers of the stream configs.

Current behavior of IMFASFContentInfo::SetProfile :

With only one stream in a profile the function replaces the existent profile with the updated. With multiple streams on a profile the function not only deletes the first stream, it also uses internal backup pointers so that no changes are made even if you alter the second stream and let the first untouched ( second stream still has the old values in the header then ).

I would realy like hear from the MS team what SetProfile is doing and how to fix this.

regards

co0Kie







Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>