This section describes the defined types that make the Media Kit tick.
Declared in: media/MediaDefs.h
struct encode_parameters { floatquality
; int32avg_field_size
; int32max_field_size
; int32_pad
[27]; void*user_data
; size_tuser_data_size
; };
Parameters for encoding a buffer.
Field | Description |
---|---|
| Indicates the compression quality to use. 0.0 is lowest
quality, 1.0 is high quality. You can use the
|
| Indicates the average size of a field that should be allowed, in bytes. The encoder will try to maintain this average as it compresses. |
| Indicates the maximum field size that should be allowed, in bytes. The encoder will try to encode each field to be smaller than this size. |
| Indicate user-defined data. |
Declared in: media/MediaDefs.h
struct live_node_info {live_node_info
();~live_node_info
(); media_nodenode
;BPoint
hint_point
; charname
[B_MEDIA_NAME_LENGTH
]; private:reserved
[160]; };
The live_node_info structure describes
an active node, and is returned by
BMediaRoster::GetLiveNodes()
.
Field | Description |
---|---|
| Specifies which node the live_node_info structure describes. |
| Is reserved for future use. Pass a
|
Declared in: media/MediaDefs.h
struct media_audio_header {
int32 _reserved_
[16];
};
Defines the header of an audio buffer. There are no Be-defined fields in this structure as of the release of BeOS R4; however, you may append fields to the end of this structure if you wish.
Declared in: media/MediaDefs.h
struct media_decode_info { bigtime_ttime_to_decode
; int32_pad
[26]; void*file_format_data
; size_tfile_format_data_size
; void*codec_data
; size_tcodec_data_size
;media_decode_info
(); };
Provides options to decoders.
Field | Description |
---|---|
| Indicates how long, in microseconds, the decoder is
allowed to take to decode the buffer. Specify 0 to do it as fast as
possible, or |
| These are a pointer to file-format specific data, and the size of the buffer respectively. |
| These are a pointer to a codec-specific data buffer, and the size of the buffer respectively. |
Declared in: media/MediaDefs.h
struct media_destination {media_destination
(port_id, int32);media_destination
(const media_destination&clone
); media_destination&operator=
(const media_destination&clone
);media_destination
();~media_destination
(); port_idport
; int32id
; static media_destinationnull
; private: uint32_reserved_media_destination_
[2]; };
Describes the destination end of a media connection between two nodes.
The port
indicates the port ID on which the destination communicates.
This can be different from the media_node
.port
value.
Declared in: media/MediaDefs.h
struct media_encode_info { uint32flags
; int32used_data_size
; bigtime_tstart_time
; bigtime_ttime_to_encode
; int32_pad
[22]; void*file_format_data
; size_tfile_format_data_size
; void*codec_data
; size_tcodec_data_size
;media_encode_info
(); };
Provides options to encoders and file writers about.
Field | Description |
---|---|
| Contains flags that alter the behavior of the encoder or
writer. The only defined value right now is |
| Is currently reserved for use by Be. |
| Indicates the time at which the buffer being written is located, in microseconds, from the start of the file. |
| Indicates how long, in microseconds, the encoder is
allowed to take to encode the buffer. Specify 0 to do it as fast as
possible, or |
| These are a pointer to file-format specific data, and the size of the buffer respectively. |
| These are a pointer to a codec-specific data buffer, and the size of the buffer respectively. |
Declared in: media/MediaDefs.h
struct media_encoded_audio_format { enum audio_encoding {B_ANY
}; media_raw_audio_formatoutput
; audio_encodingencoding
; floatbit_rate
; size_tframe_size
; media_multi_audio_infomulti_info
; uint32_reserved_
[3]; static media_encoded_audio_formatwildcard
; };
Describes the format of encoded audio data.
Field | Description |
---|---|
| Indicates the raw audio format that results from decoding the encoded audio. |
| Specifies the encoding format. This should just be |
| Specifies the bit rate (not byte rate) of the data stream. |
| Indicates the size of each frame of audio, in bytes. |
| Provides multi-channel information. |
Declared in: media/MediaDefs.h
struct media_encoded_audio_header { int32_reserved_0
[14]; uint32buffer_flags
; ucharunused_mask
; uchar_reserved_2
[3]; };
Defines the header of a an encoded audio buffer.
Field | Description |
---|---|
| Contains flags that provide additional information about
the buffer. The only value currently defined (other than 0) is
|
| Indicates which bits of the last byte in the buffer are unused (since encoded audio may result in a number of bits that doesn't fill up the last byte in the buffer). |
If you wish, you can add more fields to the end of the header.
Declared in: media/MediaDefs.h
struct media_encoded_video_format { enum video_encoding {B_ANY
}; media_raw_video_formatoutput
; floatavg_bit_rate
; floatmax_bit_rate
; video_encodingencoding
; size_tframe_size
; int16forward_history
; int16backward_history
; uint32_reserved_
[3]; static media_encoded_video_formatwildcard
; };
Describes the format of encoded video data.
Field | Description |
---|---|
| Specifies the raw video format that results from decoding the
video. Set this to
media_raw_video_format:: |
| Indicates the average bit rate of the video. |
| Specifies the maximum bit rate that occurs at any point in the video. |
| Has been depreciated, and should always be B_ANY; use the
|
| Indicates the size in bytes of a frame of data. |
| Indicates the maximum number of future frames the encoding algorithm requires in order to decode the current frame. |
| Indicates the maximum number of past frames the encoding algorithm requires in order to decode the current frame. |
Declared in: media/MediaDefs.h
struct media_encoded_video_header { int32_reserved_1
[9]; uint32field_flags
; int16forward_history
; int16backward_history
; ucharunsued_mask
; uchar_rserved_2
[3]; floatfield_gamma
; uint32field_sequence
; uint16field_number
; uint16pulldown_number
; uint16first_active_line
; uint16line_count
; };
Defines the header of a video buffer. The fields in this buffer are the
same as those in the
media_video_header
structure, except for the reserved fields, the
forward_history
and backward_history
fields, the
unused_mask
, which indicates which bits are unused in the last byte of
the video buffer, and field_flags
, which can be either 0 or
B_MEDIA_KEY_FRAME
(which indicates that the field is a key frame).
The forward_history
field indicates how many buffers ahead of the current
one are required in order to decode the current buffer. The
backward_history
field indicates the number of previous buffers are
required to decode the current buffer.
Field | Description |
---|---|
| Specifies the gamma at which the video was captured. |
| Is an identifying number assigned to the field when it was captured. They progress in sequence; you can tell if a field was dropped by looking for skips in the sequence. Note that this value doesn't necessarily start at 0, and it can wrap back around to 0. |
| Indicates which field of a video frame the buffer represents. It's 0 for field 1, 1 for field 2, and so forth. |
| Indicates that the field represented by the buffer is
a duplicate of a field |
| Indicates the topmost line that actually contains video data (instead of VBL data); this is an NTSC or PAL line number, which is 1-based. |
| Indicates the number of active video lines in the field. |
You may add fields to the end of this buffer if your video format requires them.
Declared in: media/MediaDefs.h
struct media_file_format { enum {B_READABLE
= 0x1,B_WRITABLE
= 0x2,B_PERFECTLY_SEEKABLE
= 0x4,B_IMPERFECTLY_SEEKABLE
= 0x8,B_KNOWS_RAW_VIDEO
= 0x10,B_KNOWS_RAW_AUDIO
= 0x20,B_KNOWS_MIDI
= 0x40,B_KNOWS_ENCODED_VIDEO
= 0x80,B_KNOWS_ENCODED_AUDIO
= 0x100,B_KNOWS_OTHER
= 0x1000000,B_KNOWS_ANYTHING
= 0x2000000 }; uint32 capabilities; media_file_format_id id; media_format_family family; int32 version; uint32 _reserved_[25]; char mime_type[64]; char pretty_name[64]; char short_name[32]; char file_extension[8]; char reserved[88]; };
Describes a media file format.
Field | Description |
---|---|
| Is a bitfield providing informational flags describing the file format's capabilities.
|
| Is an opaque ID used by the Media Kit to construct a
|
| Is one of the media_format_family constants. |
| Should be 100. |
| Specifies the MIME type string that identifies the file format. |
| Is a nice user-viewable name, such as "QuickTime File Format". |
| Is a short-form name, like "QuickTime". |
| Specifies the file extension used on files containing this format, such as ".mov". |
Declared in: media/MediaDefs.h
struct media_file_format_id { ino_tnode
; dev_tdevice
; uint32internal_id
; };
A simple means for identifying file formats; used by the media_file_format structure.
Declared in: media/MediaDefs.h
struct media_format { media_typetype
; type_codeuser_data_type
; ucharuser_data
[48]; uint32_reserved_
[3]; uint16require_flags
; uint16deny_flags
; private: void*meta_data
; int32meta_data_size
; area_idmeta_data_area
; area_iduse_area
; team_idteam
; void*thisPtr
; public: union { media_multi_audio_formatraw_audio
; media_raw_video_formatraw_video
; media_multistream_formatmultistream
; media_encoded_audio_formatencoded_audio
; media_encoded_video_formatencoded_video
; char_reserved_
[96]; } u; boolIsVideo
() const ; uint32Width
() const; uint32Height
() const; color_spaceColorSpace
() const; uint32&Width
(); uint32&Height
(); color_space&ColorSpace
(); boolIsAudio
() const; uint32&AudioFormat
(); uint32AudioFormat
() const; uint32Encoding
() const; boolMatches
(const media_format*otherFormat
) const; voidSpecializeTo
(const media_format*otherFormat
); voidSetMetaData
(const void*data
, int32size
); const void*MetaData
() const; int32MetaDataSize
() const;media_format
();media_format
(const media_format&other
);~media_format
(); media_format&operator=
(const media_format&clone
); };
The media_format structure can describe any media data format the BeOS can support.
Field | Description |
---|---|
| Indicates the type of media the format describes. |
| Allows the application to store custom data in the media_format structure |
| specifies the type of data stored in |
| Are media_format_flags indicating what options are required, and what options are rejected. |
| Are currently only used by decoders when communicating with the file reader; they're not currently for public use. |
The union, u
, permits the selection of a specific media format, such
as raw audio or multistream data, and contains the descriptive
information specific to that media format.
If any field is 0, it's treated as a wildcard.
There are several convenience functions for fetching information from the format that take care of dealing with different types automatically:
Function | Description |
---|---|
| Returns |
| Returns the width of the video data; its value is undetermined if the format doesn't represent video. |
| Returns the height of the video data; its value is undetermined if the format doesn't represent video. |
| Returns the video's color space. Its value is undetermined if the format doesn't represent video. |
| Returns |
| Returns the audio's sample format. |
| Returns |
| Adjusts the specified otherFormat as needed to match the format. |
Declared in: media/MediaDefs.h
struct media_header { media_typetype
; media_buffer_idbuffer
; int32destination
; media_node_idtime_source
; uint32_depreciated_
; uint32size_used
; bigtime_tstart_time
; area_idowner
; enum {B_SEEK_TAG
= 'TRST' }; type_codeuser_data_type
; ucharuser_data
[64]; uint32_reserved_
[2]; off_tfile_pos
; size_torig_size
; uint32data_offset
; union { media_audio_headerraw_audio
; media_video_headerraw_video
; media_multistream_headermultistream
; media_encoded_audio_headerencoded_audio
; media_encoded_video_headerencoded_video
; char_reserved_
[64]; }u
; };
Defines the header of a media data buffer.
Field | Description |
---|---|
| Indicates the type of media the format describes. |
| Indicates what buffer the header goes with. This field is
filled out by the
|
| Specifies the ID number of the
media_destination
to which the buffer is being sent. This field is filled out by the
|
| Indicates the ID number of the node that encoded the
|
| Specifies how many bytes of the buffer actually contain data. |
| Indicates the performance time at which the buffer should be performed. |
| Specifies the area ID of the buffer's owner. |
| Allow the application to store custom data in the
media_format structure;
|
|
|
| Indicates the offset within the buffer to the data. This
is reflected by the
|
The union, u
, permits the selection of a specific media format, such
as raw audio or multistream data, and contains the descriptive
information specific to that media format.
Declared in: media/MediaDefs.h
struct media_input {media_input
();~media_input
(); media_nodenode
; media_sourcesource
; media_destinationdestination
; media_formatformat
; charname
[B_MEDIA_NAME_LENGTH
]; private: char_reserved_media_input_
[4]; };
The media_input structure describes a complete connection between a media_source and media_destination, from the point-of-view of the consumer (the destination).
Field | Description |
---|---|
| Is the media_node that owns the input. |
| Is the source socket from which the data is being sent. |
| Is the destination socket at which the data is arriving. |
| Is the format of the data. |
| Is the input's name. |
Declared in: media/MediaDefs.h
struct media_multistream_format { enum {B_ANY
= 0,B_VID
= 1,B_AVI
,B_MPEG1
,B_MPEG2
,B_QUICKTIME
,B_PRIVATE
= 90000,B_FIRST_USER_TYPE
= 100000 }; floatavg_bit_rate
; floatmax_bit_rate
; uint32avg_chunk_size
; uint32max_chunk_size
; enum {B_HEADER_HAS_FLAGS
= 0x1,B_CLEAN_BUFFERS
= 0x2,B_HOMOGENOUS_BUFFERS
= 0x4 }; uint32flags
; int32format
; uint32_reserved_
[2]; struct vid_info { floatframe_rate
; uint16width
; uint16height
; color_spacespace
; floatsampling_rate
; uint32sample_format
; uint16byte_order
; uint16channel_count
; }; struct avi_info { uint32us_per_frame
; uint16width
; uint16height
; uint16_reserved_
; uint16type_count
; media_typetypes
[5]; }; union { vid_infovid
; avi_infoavi
; }u
; static media_multistream_formatwildcard
; };
Describes the format of multistream media data, such as a QuickTime, AVI, or MPEG movie.
Field | Description |
---|---|
| Indicate the average and maximum bit rates of the media data. |
| Indicate the average and maximum buffer sizes; if all buffers are the same size, these two values should be equal. |
| Provides informational flags for the buffers.
|
| Indicates the multistream data format
|
The union | contains either a vid_info or an avi_info structure that describes the video stream: |
vid_info
Field | Description |
---|---|
| Specifies the video frame rate (in frames per second). |
| Indicate the width and height of the video, in pixels. |
| Indicates the video's color space. |
| Specify the sampling rate, sample format, byte order, and number of channels (stereo or mono) of the media's audio. |
avi_info
Field | Description |
---|---|
| Specifies the number of microseconds each frame should be displayed. |
| Indicate the width and height of the video in pixels. |
| Indicates the number of media_types used in the AVI movie. |
| Is a list of the media_types used. |
Declared in: media/MediaDefs.h
struct media_multi_audio_format { media_raw_audio_formatraw
; media_multi_audio_infomulti
; };
Describes a multi-channel audio format. This is constructed by using a media_raw_audio_format to describe the physical format of the sound, followed by a media_multi_audio_info structure that adds the multi-channel information. This allows compatibility with existing BeOS software while adding support for multi-channel audio in new software.
Declared in: media/MediaDefs.h
struct media_multi_audio_info { uint32channel_mask
; int16valid_bits
; uint16matrix_mask
; uint32_reserved_b
[3]; };
Provides information about multi-channel audio support.
Field | Description |
---|---|
| Indicates which channels are supported; for each channel
( |
| Indicates how many bits in a 32-bit integer sample actually contain sample data. |
| Indicates which multi-channel audio matrices are used. |
Declared in: media/MediaDefs.h
struct media_multistream_header { uint32_reserved_
[14]; ucharunused_mask
; uchar_reserved_2
[3]; enum {B_MASTER_HEADER
= 0x1,B_SUBSTREAM_HEADER
= 0x2,B_COMPLETE_BUFFER
= 0x4 }; uint32flags
; };
Defines the header of a multistream media buffer.
Field | Description |
---|---|
| Indicates which bits of the last byte in the buffer are unused. |
| Provides informational flags about the buffer. If
|
You may add fields to the end of this structure if your multistream media format requires them.
Declared in: media/MediaDefs.h
classmedia_node
{ public:media_node
();~media_node
(); media_node_idnode
; port_idport
; uint32kind
; static media_nodenull
; private: uint32_reserved_
[3]; };
The media_node
structure is the class that defines a node to client
applications; interactions with the
BMediaRoster
regarding nodes is done using media_node
objects.
Field | Description |
---|---|
| Indicates the node's ID number. |
| Specifies the port ID number of the node's control port. |
| Specifies the node's media kind. See node_kind for a list of node kinds. |
| Represents a null node |
Applications will usually treat this as a black box.
Declared in: media/MediaDefs.h
struct media_node_attribute { enum {B_R40_COMPILED
= 1,B_USER_ATTRIBUTE_NAME
= 0x1000000,B_FIRST_USER_ATTRIBUTE
}; uint32what
; uint32flags
; uint64data
; };
The media_node_attribute structure provides additional information about
nodes. Nodes can have as many of these as they want, and will return them
from their
BMediaNode::GetNodeAttributes()
function. Applications query the node using the
BMediaRoster::GetNodeAttributesFor()
function.
The what
field indicates the attribute type.
B_R40_COMPILED
indicates
that the node was compiled using BeOS Release 4.0;
BMediaNode
returns
this attribute automatically for nodes that were compiled using the
Release 4.0 headers. Nodes may create their own attribute types,
beginning at B_FIRST_USER_ATTRIBUTE
.
The B_USER_ATTRIBUTE_NAME
attribute
specifies the name of a protocol for the user attributes implemented by the
node. For example, if you devise a third-party standard for attribute
values whose attribute IDs are greater than
B_FIRST_USER_ATTRIBUTE
, the value of
B_USER_ATTRIBUTE_NAME
would be the name of the
standard.
The flags
and data
fields are used for different things depending on the
what
value; the B_R40_COMPILED
attribute doesn't use them.
Declared in: media/MediaDefs.h
struct media_output {media_output
();~media_output
(); media_nodenode
; media_sourcesource
; media_destinationdestination
; media_formatformat
; charname
[B_MEDIA_NAME_LENGTH
]; private: char_reserved_media_output_
[4]; };
The media_output structure describes a complete connection between a media_source and media_destination, from the point-of-view of the consumer (the destination).
Field | Description |
---|---|
| Is the media_node that owns the output. |
| Is the source socket from which the data is being sent. |
| Is the destination socket to which the data is being sent. |
| Is the format of the data. |
| Is the output's name. |
Declared in: media/MediaDefs.h
struct media_raw_audio_format { enum {B_AUDIO_FLOAT
= 0x24,B_AUDIO_INT
= 0x4B_AUDIO_SHORT
= 0x2,B_AUDIO_UCHAR
= 0x11,B_AUDIO_CHAR
= 0x1,B_AUDIO_SIZE_MASK
= 0xf } floatframe_rate
; uint32channel_count
; uint32format
; uint32byte_order
; size_tbuffer_size
; static media_multi_audio_formatwildcard
; };
Describes the format of raw audio data.
Field | Description |
---|---|
| Indicates the frame rate, in Hertz. One frame is one sample per channel (stereo buffers contain two samples per channel). For audio, each buffer contains multiple audio samples, whereas video contains one frame, or one field (half-frame) per buffer. |
| Indicates the number of channels of audio (typically this is either 1 for mono or 2 for stereo). |
| Specifies the sample format (for compressed formats, see media_encoded_audio_format):
It's guaranteed that
( |
| Indicates the endianness of the data (either
|
| Indicates the size of each buffer, in bytes. |
Declared in: media/MediaDefs.h
struct media_raw_video_format { floatfield_rate
; uint32interlace
; uint32first_active
; uint32last_active
; uint32orientation
; uint16pixel_width_aspect
; uint16pixel_height_aspect
; media_video_display_infodisplay
; static media_raw_video_formatwildcard
; };
Describes the format of raw video data.
Field | Description |
---|---|
| Indicates the field rate. This is 59.94 for NTSC and 50.0 for PAL. If you use BT848 in non-interlaced mode (thereby picking out only every other field), you'd specify 29.97. |
| Specifies how many fields there are per frame. A value of 1 indicates that the video is progressive (non-interlaced). NTSC video is interlaced such that there are two fields per frame, so for standard NTSC video, this value is 2. |
| Indicate where the VBL lines at the top
of the frame end, and where they resume at the bottom of the frame;
video data is confined between these two scan lines. Usually you'll use
0 for |
| Indicates the orientation of the video; this is typically
|
| Specify the numerator and denominator of the video's aspect ratio. If the aspect ratio is 4:3, these values will be 4 and 3, respectively. |
Declared in: media/MediaDefs.h
struct media_request_info { enum what_code {B_SET_VIDEO_CLIPPING_FOR
= 1,B_REQUEST_FORMAT_CHANGE
,B_SET_OUTPUT_ENABLED
,B_SET_OUTPUT_BUFFERS_FOR
,B_FORMAT_CHANGED
= 4097 }; what_code what; int32 change_tag; status_t status; int32 cookie; void* user_data; media_source source; media_destination destination; media_format format; uint32 _reserved_[32]; };
This structure contains information that describes a request that has
been completed (or has failed). It gets passed into the
BMediaNode::RequestCompleted()
function.
Field | Description |
---|---|
| Describes what type of request has been completed:
|
| Contains the |
| Indicates the status of the function called, and is |
Declared in: media/MediaDefs.h
struct media_seek_tag {
char data
[16];
};
The media_seek_tag type is used to contain the seek tag data placed in buffer headers by producers. This can contain whatever information the producer deems necessary.
Declared in: media/MediaDefs.h
struct media_source {media_source
(port_id, int32);media_source
(const media_source&clone
); media_source&operator=
(const media_source&clone
);media_source
();~media_source
(); port_idport
; int32id
; static media_sourcenull
; private: uint32_reserved_media_source_
[2]; };
Describes the source end of a media connection between two nodes. The
port
field indicates the port ID on which the source communicates. This
must be the same as the media_node
.port
value.
Declared in: media/MediaDefs.h
struct media_video_display_info { color_spaceformat
; uint32line_width
; uint32line_count
; uint32bytes_per_row
; uint32pixel_offset
; uint32line_offset
; uint32flags
; uint32_reserved_
[3]; static media_video_display_infowildcard
; };
Describes a video buffer in terms of how its contents should be interpreted in order to display it on the screen.
Field | Description |
---|---|
| Specifies the buffer's color space. |
| Indicate the total width of the buffer in pixels, and the total height of the buffer in lines. |
| Specifies the number of bytes wide the buffer's image is, including any slop space. |
| Indicates the number of pixels between the start of the buffer and the start of the video field. The buffer is the framebuffer. |
| Specifies the offset between the start of the buffer and the start of the field, in lines. The buffer is the framebuffer. |
| Are media_display_flags, indicating the dominance and order of the video fields. |
Declared in: media/MediaDefs.h
struct media_video_header { uint32_reserved_
[12]; floatfield_gamma
; uint32field_sequence
; uint16field_number
; uint16pulldown_number
; uint16first_active_line
; uint16line_count
; };
Defines the header of a video buffer.
Field | Description |
---|---|
| Specifies the gamma at which the video was captured. |
| Is an identifying number assigned to the field when it was captured. They progress in sequence; you can tell if a field was dropped by looking for skips in the sequence. Note that this value doesn't necessarily start at 0, and it can wrap back around to 0. |
| Indicates which field of a video frame the buffer represents. It's 0 for field 1, 1 for field 2, and so forth. |
| Indicates that the field represented by the buffer is
a duplicate of a field |
| Indicates the topmost line that actually contains video data (instead of VBL data); this is an NTSC or PAL line number, which is 1-based. |
| Indicates the number of active video lines in the field. |
You may add fields to the end of this buffer if your video format requires them.