The UMSMPEG1MovieFileReader object provides the ability to read MPEG1 movie files. This object inherits or overrides all methods from the UMSMovieFileReader base class and adds one new method. The reader only supports access to one video stream and one audio stream at a time. The audio stream can be stereo. The video stream is decompressed to YUV420Plane images. There are no provisions for skipping frames or selecting reduced quality decompression. It is possible to seek to a frame number, but it is implemented by decompressing frames until the desired frame is reached. Because of these limitations the object has not been added to the UMS_config file.
The files can contain video and audio, video only, or audio only. If the file contains both video and audio then the audio is split into frames to match the video frame rate. If the file contains only audio then it is split into ten frames per second. This object does not support selecting audio tracks if the file has more than one track. This object does not support selecting video tracks if the file has more than one track. The most recent audio and video tracks encountered when the file is opened are used. This object does not support switching tracks in the middle of the file.
A YUV420Plane image is composed of three planes in memory. The pixels are in order from left to right, top to bottom. The first plane is the Y component, 8 bits per pixel. The second is the U component, 8 bits each. Each U corresponds to a 2x2 block of Y pixels. The third is the V component, 8 bits each. Each V corresponds to a 2x2 block of Y pixels.
For introductory information, see Formatted File Access Objects.
in string file_name | The name of the file to open. |
Success Failure OutOfMemory UnsupportedFormat
Success
Returns the current bits-per-sample value for the selected audio track.
inout long bits_per_sample | The current bits-per-sample value for the selected audio track. |
Success Failure Uninitialized NoAudio
Returns the current audio format for the selected track. Storage for the string is allocated in the method. The caller must free the storage when the string is no longer needed.
out string audio_format_string | The returned audio format. |
Success Failure Uninitialized NoAudio OutOfMemory
Returns the audio data for a specified frame and track.
Note: This object returns PCM audio data, not compressed audio data in the audio_buffer argument.
Success Failure Uninitialized NoAudio OutOfRange InsufficientBufferLength OutOfMemory EndOfFile
Gives the current number of channels for the selected audio track.
inout long audio_number_of_channels | The number of channels. For example this value will be one for mono and two for stereo. |
Success Failure NoAudio Uninitialized
Returns the current samples per second for the selected audio track.
inout long samples_per_second | The audio sampling rate in units of samples per second. |
Success Failure NoAudio Uninitialized
Returns the track number of the currently selected audio track.
inout long audio_track_id | The track id. This object always returns zero for this value. |
Success Failure NoAudio Uninitialized
Returns the current frame position in the file.
inout long presentation_frame_number | The frame number of the data to be returned by the next call to the get_next_movie_frame method. |
Success Failure Uninitialized
Returns the video frame rate for the currently selected video track. If the file is audio only then it returns ten frames per second.
inout float frame_rate | The frame rate for the data in the file. |
Success Failure Uninitialized
Returns the frame positions of previous and next I-frames relative to a given video frame in the selected video track. This method is not implemented for this object.
Failure Uninitialized
Returns the video frame dimensions for the currently selected video track.
inout long width | The width in pixels. |
inout long height | The height in pixels. |
Success Failure NoVideo Uninitialized
Returns the maximum buffer size required to hold any audio frame data for the currently selected audio track.
inout long buffer_size | The size in bytes needed to hold any audio frame. |
Success Failure NoAudio Uninitialized
Returns the maximum buffer size required to hold any video frame data for the currently selected video track.
inout long buffer_size | The size in bytes needed to hold any video frame. |
Success Failure NoVideo Uninitialized
Returns the number of frames in the currently selected video track. This method will usually return -1 indicating that the object is not able to determine how many video frames are in the file. This method will return zero if the file is audio-only.
inout long number_of_frames | Either contains the number of video frames in the file or -1. |
Success Failure Uninitialized
Returns the audio and video data for the next frame.
Note: This object returns PCM audio data, not compressed audio data in the audio_buffer argument. This object returns YUV420Plane data, not compressed video data in the video_buffer argument.
Success Failure Uninitialized InsufficientBufferLength OutOfMemory EndOfFile
Returns the number of audio tracks contained in the file. This object does not support selecting audio tracks if the file has more than one track. The most recent track encountered when the file is opened is used.
inout long number_of_audio_tracks | The number of audio tracks. This object returns either one or zero. |
Success Failure Uninitialized
Returns the number of video tracks contained in the file. This object does not support selecting video tracks if the file has more than one track. The most recent track encountered when the file is opened is used.
inout long number_of_video_tracks | The number of video tracks. This object returns either one or zero. |
Success Failure Uninitialized
Returns the video aspect ratio for the currently selected video track.
inout float video_aspect_ratio | The video aspect ratio. This object always returns 1.0. |
Success Failure Uninitialized
Returns the format of the selected video track. Storage for the string is allocated in the method. The caller must free the storage when the string is no longer needed.
out string video_format_string | The returned format string. This object always returns "YUV420Plane". |
Success Failure NoVideo Uninitialized OutOfMemory
Returns the video data for a specified frame and track.
Note: This object returns YUV420Plane data, not compressed video data in the video_buffer argument.
Success Failure Uninitialized NoVideo OutOfRange InsufficientBufferLength OutOfMemory EndOfFile
Indicates the type of video frames in the file. The types can be I-frames, delta frames, and bidirectional delta frames.
inout VideoFrameType video_frame_type | This object always returns UMSMovieFileReader_IFrame. |
Success Failure NoVideo Uninitialized
Returns the track number of the currently selected video track.
inout long video_track_id | The track id. This object always returns zero for this value. |
Success Failure NoVideo Uninitialized
Seeks to a given frame location within the selected tracks. This method is implemented by decompressing frames until the desired frame is reached.
in long frame_number | The desired presentation frame number. The first frame in the file is presentation frame number zero. |
Success Failure Uninitialized OutOfMemory EndOfFile
Selects an audio track number.
in long audio_track_id | The desired audio track. This object accepts only zero. |
Success Failure NoAudio Uninitialized
Specifies a playback speed factor.
in unsigned long percent | The desired speed factor. This object accepts only 100. |
Success Failure Uninitialized
in long video_track_id | The desired video track. This object accepts only zero. |
Success Failure NoVideo Uninitialized
Returns the number format of the selected audio track. Storage for the string is allocated in the method. The caller must free the storage when the string is no longer needed.
out string number_format | The returned number format string. This object always returns "TWOS_COMPLEMENT". |
Success Failure NoAudio Uninitialized OutOfMemory
Returns the byte order of the selected audio track. Storage for the string is allocated in the method. The caller must free the storage when the string is no longer needed.
out string byte_order | The returned byte order string. |
Success Failure NoAudio Uninitialized OutOfMemory
This method is new with this object and is not inherited or overridden from the UMSMovieFileReader base class. This method is an alternative to the open method. The open_with_frw and open methods should not be used at the same time. It accepts an object of class UMSFileReadWrite and uses it for all file operations. The UMSFileReadWrite object should be in the open state at the time of this method call. The passed-in object is not freed when the UMSMPEG1MovieFileReader object is closed. The UMSFileReadWrite object need not have the lseek method implemented. If it returns an error the UMSMPEG1MovieFileReader object will assume that the input data is a non-seekable stream of data.
in UMSFileReadWrite frw | An object to be used for all file operations. It should be in the open state at the time of the method call. |
Failure OutOfMemory UnsupportedFormat Success
For introductory information, see Formatted File Access Objects.