The Media Kit Table of Contents | The Media Kit Index |
Derived from: none
Declared in: be/media/MediaFormats.h
Library: libmedia.so
Allocation: Constructor only
The BMediaFormat class provides a means for translating between BeOS media format identifiers and those used by the codecs themselves. This is primarily useful if you're writing a codec add-on or a file format parser.
The BMediaFormats class currently knows how to translate among the following formats' codec identification methods:
|
Constructor. Call InitCheck() to ensure that the object was initialized properly after you instantiate it.
|
Destructor.
|
Given the specified media format, returns in outDescription the media format description for the specified format family.
RETURN CODES
B_OK. No error.
B_MEDIA_BAD_FORMAT. The specified format isn't recognized.
Other errors. The code couldn't be determined.
|
Returns in outFormat a media_format structure that describes the media format specified by description. This lets you easily obtain a media_format structure from file-native description information.
RETURN CODES
B_OK. No error.
B_MEDIA_BAD_FORMAT. The specified description isn't recognized.
Other errors. The format couldn't be determined.
|
Fills outFormat and outDescription with the media_format and media_format_description of the next supported media format.
RETURN CODES
B_OK. No error.
B_BAD_INDEX. No more formats to return.
Other errors. The format couldn't be determined.
|
Returns the status code from the constructor; you should call this to be sure the object was properly initialized before issuing any other calls.
RETURN CODES
B_OK. The object is ready to use.
B_BAD_HANDLER. The object isn't ready.
Other errors. The Media Server couldn't be contacted.
|
Lock() locks the BMediaFormats object so you can use it with the assurance that it won't change while you're working. You should call this before using any of the other BMediaFormats functions. Returns true if it's safe to use the BMediaFormats object; otherwise returns false.
Unlock() releases the BMediaFormats object when you're done with it; be sure to call it when you've finished your work.
|
Given the media format description description and the media_format inFormat, registers your format description and supported media_format with the Media Kit, and returns a media_format you can use from then on.
This function is called to let the Media Server assign you an encoding value for your media_format_description. If you're implementing a codec add-on or a file parser, you should call this function to let the Media Kit know what you handle.
RETURN CODES
B_OK. No error.
Other errors. The format couldn't be registered.
|
Resets format scanning to the first supported format; this causes GetNextFormat() to start at the beginning of the list.
RETURN CODES
B_OK. The object is ready to use.
Other errors. Unable to communicate with the Media Server.
Declared in: <be/media/MediaDefs.h>
These constants indicate the media format families the BMediaFormats class can map among.
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 codec; } media_aiff_description;
Describes the format of media data as an AIFF codec ID.
Declared in: <be/media/MediaFormats.h>
typedef struct { GUID guid; } media_asf_description;
Describes the format of media data as a 128-bit ASF GUID.
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 codec; } media_avi_description;
Describes the format of media data as an AVI codec ID.
Declared in: <be/media/MediaFormats.h>
typedef struct { int32 format; } media_beos_description;
Describes the format of media data in a way the BeOS Media Kit understands and appreciates. The format field has no predetermined meaning; it's a magic number that only the Media Kit understands.
Declared in: <be/media/MediaFormats.h>
struct encoder_info { char pretty_name[96]; char short_name[32]; int32 id; int32 pad[64]; };
Provides information about an encoder. The pretty_name is a complete human-readable name (such as "SuperSqueeze by Applied Interdynamic Systems, Inc."), and the short_name is a short-form version of the encoder's name (such as "SuperSqueeze").
The id is an opaque ID number that gets passed to BMediaFile::AddTrack() so the track can identify the encoder.
The padding is reserved space for future expansion of the structure.
Declared in: <be/media/MediaFormats.h>
struct media_file_format_info { char mimetype[64]; char pretty_name[64]; char short_name[32]; char file_extension[8]; media_format_family family; int64 capabilities; int32 id; int32 pad[64]; };
Describes a media file format. This is used when using BMediaFile objects to determine the type of media file being used.
Declared in: <be/media/MediaFormats.h>
typedef struct _media_format_description { #if defined(__cplusplus) _media_format_description(); ~_media_format_description(); _media_format_description(const _media_format_description &other); _media_format_description & operator=(const _media_format_description &other); #endif media_format_family family; uint32 _reserved_[3]; union { media_beos_description beos; media_quicktime_description quicktime; media_avi_description avi; media_asf_description asf; media_mpeg_description mpeg; media_wav_description wav; media_aiff_description aiff; media_misc_description misc; uint32 _reserved_[12]; } u; } media_format_description;
Describes a media format. The family indicates which media family in the union the description uses to identify the format.
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 file_format; uint32 codec; } media_misc_description;
Describes the format of a miscellaneous media file.
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 id; } media_mpeg_description;
Describes the format of media data as an MPEG format ID; this can be any of the following values:
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 file_format; uint32 codec; } media_misc_description;
Describes the format of media data as a file format/codec pair.
Declared in: <be/media/MediaFormats.h>
typedef struct { uint32 codec; } media_wav_description;
Describes the format of media data as a WAV codec ID.
|
Given a media_file_format, inputFormat, describing the format of a media file, and a media_format, outputFormat, describing the desired output format, returns in codecInfo information about the next encoder capable of handling the format.
You should set the int32 pointed to by cookie to 0 initially, and pass the same pointer each time you call get_next_encoder(), to scan through all possible encoders. When there are no more encoders left to check, B_BAD_INDEX is returned.
![]() |
get_next_encoder() doesn't support wildcards; you must explicitly state the format your data is in when calling it. |
RETURN CODES
B_OK. An encoder was found and returned.
B_BAD_INDEX. The cookie was invalid, or no more encoders found.
See also: get_next_file_format() in the global C functions section.
The Media Kit Table of Contents | The Media Kit Index |
Copyright © 1999 Be, Inc. All rights reserved.
Text last modified