Setting Properties on Sources
When you create a new source object, there are a few properties you are required to set and others you can optionally set. You must set the following properties.
A source object inherits its media type from the parent group, so it is not necessary to specify a media type.
Optional properties include the following:
- The stretch mode. The stretch mode specifies how Microsoft® DirectShow® Editing Services (DES) renders a source whose size does not match the output dimensions. By default, DES stretches an image without preserving the aspect ratio. Alternatively, DES can crop an image or create a letterbox. Call the IAMTimelineSrc::SetStretchMode method to specify the stretch mode.
- The duration of the source file. If you set this property before setting the media times, DES validates the media stop time and truncates the stop time if it exceeds the file duration. This can help avoid rendering errors later. You can obtain the duration of the file using the media detector, as described in Using the Media Detector. Call the IAMTimelineSrc::SetMediaLength method to specify the file duration.
- The stream number. By default, a source object uses the first stream in the file that matches the media type of the parent group. If a file contains two or more streams of the same media type, select which stream to use by calling IAMTimelineSrc::SetStreamNumber. You can use the media detector to find the number of streams.