![]() |
![]() |
![]() |
GStreamer Base Plugins 1.0 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <gst/pbutils/encoding-profile.h> GstEncodingProfile; #define gst_encoding_profile_unref (profile) #define gst_encoding_profile_ref (profile) GstEncodingProfile * gst_encoding_profile_find (const gchar *targetname
,const gchar *profilename
,const gchar *category
); GstEncodingProfile * gst_encoding_profile_from_discoverer (GstDiscovererInfo *info
); const gchar * gst_encoding_profile_get_name (GstEncodingProfile *profile
); const gchar * gst_encoding_profile_get_description (GstEncodingProfile *profile
); GstCaps * gst_encoding_profile_get_format (GstEncodingProfile *profile
); const gchar * gst_encoding_profile_get_preset (GstEncodingProfile *profile
); guint gst_encoding_profile_get_presence (GstEncodingProfile *profile
); GstCaps * gst_encoding_profile_get_restriction (GstEncodingProfile *profile
); void gst_encoding_profile_set_name (GstEncodingProfile *profile
,const gchar *name
); void gst_encoding_profile_set_description (GstEncodingProfile *profile
,const gchar *description
); void gst_encoding_profile_set_format (GstEncodingProfile *profile
,GstCaps *format
); void gst_encoding_profile_set_preset (GstEncodingProfile *profile
,const gchar *preset
); void gst_encoding_profile_set_restriction (GstEncodingProfile *profile
,GstCaps *restriction
); void gst_encoding_profile_set_presence (GstEncodingProfile *profile
,guint presence
); gboolean gst_encoding_profile_is_equal (GstEncodingProfile *a
,GstEncodingProfile *b
); GstCaps * gst_encoding_profile_get_input_caps (GstEncodingProfile *profile
); const gchar * gst_encoding_profile_get_type_nick (GstEncodingProfile *profile
); GstEncodingContainerProfile; GstEncodingContainerProfile * gst_encoding_container_profile_new (const gchar *name
,const gchar *description
,GstCaps *format
,const gchar *preset
); gboolean gst_encoding_container_profile_add_profile (GstEncodingContainerProfile *container
,GstEncodingProfile *profile
); gboolean gst_encoding_container_profile_contains_profile (GstEncodingContainerProfile *container
,GstEncodingProfile *profile
); const GList * gst_encoding_container_profile_get_profiles (GstEncodingContainerProfile *profile
); GstEncodingAudioProfile; GstEncodingAudioProfile * gst_encoding_audio_profile_new (GstCaps *format
,const gchar *preset
,GstCaps *restriction
,guint presence
); GstEncodingVideoProfile; GstEncodingVideoProfile * gst_encoding_video_profile_new (GstCaps *format
,const gchar *preset
,GstCaps *restriction
,guint presence
); guint gst_encoding_video_profile_get_pass (GstEncodingVideoProfile *prof
); gboolean gst_encoding_video_profile_get_variableframerate (GstEncodingVideoProfile *prof
); void gst_encoding_video_profile_set_pass (GstEncodingVideoProfile *prof
,guint pass
); void gst_encoding_video_profile_set_variableframerate (GstEncodingVideoProfile *prof
,gboolean variableframerate
); #define GST_ENCODING_CATEGORY_DEVICE #define GST_ENCODING_CATEGORY_ONLINE_SERVICE #define GST_ENCODING_CATEGORY_STORAGE_EDITING #define GST_ENCODING_CATEGORY_CAPTURE GstEncodingTarget; #define gst_encoding_target_unref (target) #define gst_encoding_target_ref (target) GstEncodingTarget * gst_encoding_target_new (const gchar *name
,const gchar *category
,const gchar *description
,const GList *profiles
); const gchar * gst_encoding_target_get_name (GstEncodingTarget *target
); const gchar * gst_encoding_target_get_category (GstEncodingTarget *target
); const gchar * gst_encoding_target_get_description (GstEncodingTarget *target
); const GList * gst_encoding_target_get_profiles (GstEncodingTarget *target
); GstEncodingProfile * gst_encoding_target_get_profile (GstEncodingTarget *target
,const gchar *name
); gboolean gst_encoding_target_add_profile (GstEncodingTarget *target
,GstEncodingProfile *profile
); gboolean gst_encoding_target_save (GstEncodingTarget *target
,GError **error
); gboolean gst_encoding_target_save_to_file (GstEncodingTarget *target
,const gchar *filepath
,GError **error
); GstEncodingTarget * gst_encoding_target_load (const gchar *name
,const gchar *category
,GError **error
); GstEncodingTarget * gst_encoding_target_load_from_file (const gchar *filepath
,GError **error
); GList * gst_encoding_list_all_targets (const gchar *categoryname
); GList * gst_encoding_list_available_categories (void
);
GObject +----GstEncodingProfile +----GstEncodingVideoProfile +----GstEncodingAudioProfile +----GstEncodingContainerProfile
GObject +----GstEncodingProfile +----GstEncodingContainerProfile
GObject +----GstEncodingProfile +----GstEncodingAudioProfile
GObject +----GstEncodingProfile +----GstEncodingVideoProfile
GObject +----GstEncodingTarget
Functions to create and handle encoding profiles.
Encoding profiles describe the media types and settings one wishes to use for an encoding process. The top-level profiles are commonly GstEncodingContainerProfile(s) (which contains a user-readable name and description along with which container format to use). These, in turn, reference one or more GstEncodingProfile(s) which indicate which encoding format should be used on each individual streams.
GstEncodingProfile(s) can be provided to the 'encodebin' element, which will take care of selecting and setting up the required elements to produce an output stream conforming to the specifications of the profile.
Unlike other systems, the encoding profiles do not specify which GstElement to use for the various encoding and muxing steps, but instead relies on specifying the format one wishes to use.
Encoding profiles can be created at runtime by the application or loaded from (and saved to) file using the GstEncodingTarget API.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include <gst/pbutils/encoding-profile.h> ... GstEncodingProfile * create_ogg_theora_profile(void) { GstEncodingContainerProfile *prof; GstCaps *caps; caps = gst_caps_from_string("application/ogg"); prof = gst_encoding_container_profile_new("Ogg audio/video", "Standard OGG/THEORA/VORBIS", caps, NULL); gst_caps_unref (caps); caps = gst_caps_from_string("video/x-theora"); gst_encoding_container_profile_add_profile(prof, (GstEncodingProfile*) gst_encoding_video_profile_new(caps, NULL, NULL, 0)); gst_caps_unref (caps); caps = gst_caps_from_string("audio/x-vorbis"); gst_encoding_container_profile_add_profile(prof, (GstEncodingProfile*) gst_encoding_audio_profile_new(caps, NULL, NULL, 0)); gst_caps_unref (caps); return (GstEncodingProfile*) prof; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include <gst/pbutils/encoding-profile.h> ... GstEncodingProfile *prof; GList *categories, *tmpc; GList *targets, *tmpt; ... categories = gst_encoding_target_list_available_categories(); ... Show available categories to user ... for (tmpc = categories; tmpc; tmpc = tmpc->next) { gchar *category = (gchar *) tmpc->data; ... and we can list all targets within that category ... targets = gst_encoding_target_list_all (category); ... and show a list to our users ... g_list_foreach (targets, (GFunc) gst_encoding_target_unref, NULL); g_list_free (targets); } g_list_foreach (categories, (GFunc) g_free, NULL); g_list_free (categories); ... |
typedef struct _GstEncodingProfile GstEncodingProfile;
The opaque base class object for all encoding profiles. This contains generic information like name, description, format and preset.
#define gst_encoding_profile_unref(profile) (g_object_unref ((GObject*) profile))
Decreases the reference count of the profile
, possibly freeing the profile
.
|
a GstEncodingProfile |
#define gst_encoding_profile_ref(profile) (g_object_ref ((GObject*) profile))
Increases the reference count of the profile
.
|
a GstEncodingProfile |
GstEncodingProfile * gst_encoding_profile_find (const gchar *targetname
,const gchar *profilename
,const gchar *category
);
Find the GstEncodingProfile with the specified name and category.
|
The name of the target. [transfer none] |
|
The name of the profile. [transfer none] |
|
The target category. Can be NULL . [transfer none][allow-none]
|
Returns : |
The matching GstEncodingProfile or NULL . [transfer full]
|
GstEncodingProfile * gst_encoding_profile_from_discoverer
(GstDiscovererInfo *info
);
Creates a GstEncodingProfile matching the formats from the given GstEncodingProfile. Streams other than audio or video (eg, subtitles), are currently ignored.
|
The GstDiscovererInfo to read from. [transfer none] |
Returns : |
The new GstEncodingProfile or NULL . [transfer full]
|
const gchar * gst_encoding_profile_get_name (GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
the name of the profile, can be NULL . |
const gchar * gst_encoding_profile_get_description
(GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
the description of the profile, can be NULL . |
GstCaps * gst_encoding_profile_get_format (GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
the GstCaps corresponding to the media format used in the profile. Unref after usage. [transfer full] |
const gchar * gst_encoding_profile_get_preset (GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
the name of the GstPreset to be used in the profile. |
guint gst_encoding_profile_get_presence (GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
The number of times the profile is used in its parent container profile. If 0, it is not a mandatory stream. |
GstCaps * gst_encoding_profile_get_restriction
(GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
The restriction GstCaps to apply before the encoder
that will be used in the profile. The fields present in restriction caps are
properties of the raw stream (that is before encoding), such as height and
width for video and depth and sampling rate for audio. Does not apply to
GstEncodingContainerProfile (since there is no corresponding raw stream).
Can be NULL . Unref after usage. [transfer full]
|
void gst_encoding_profile_set_name (GstEncodingProfile *profile
,const gchar *name
);
Set name
as the given name for the profile
. A copy of name
will be made
internally.
|
a GstEncodingProfile |
|
the name to set on the profile |
void gst_encoding_profile_set_description (GstEncodingProfile *profile
,const gchar *description
);
Set description
as the given description for the profile
. A copy of
description
will be made internally.
|
a GstEncodingProfile |
|
the description to set on the profile |
void gst_encoding_profile_set_format (GstEncodingProfile *profile
,GstCaps *format
);
Sets the media format used in the profile.
|
a GstEncodingProfile |
|
the media format to use in the profile. |
void gst_encoding_profile_set_preset (GstEncodingProfile *profile
,const gchar *preset
);
Sets the preset to use for the profile.
|
a GstEncodingProfile |
|
the element preset to use |
void gst_encoding_profile_set_restriction (GstEncodingProfile *profile
,GstCaps *restriction
);
Set the restriction GstCaps to apply before the encoder
that will be used in the profile. See gst_encoding_profile_set_restriction()
for more about restrictions. Does not apply to GstEncodingContainerProfile.
|
a GstEncodingProfile |
|
the restriction to apply. [transfer full] |
void gst_encoding_profile_set_presence (GstEncodingProfile *profile
,guint presence
);
Set the number of time the profile is used in its parent container profile. If 0, it is not a mandatory stream
|
a GstEncodingProfile |
|
the number of time the profile can be used |
gboolean gst_encoding_profile_is_equal (GstEncodingProfile *a
,GstEncodingProfile *b
);
Checks whether the two GstEncodingProfile are equal
|
a GstEncodingProfile |
|
a GstEncodingProfile |
Returns : |
TRUE if a and b are equal, else FALSE . |
GstCaps * gst_encoding_profile_get_input_caps (GstEncodingProfile *profile
);
Computes the full output caps that this profile
will be able to consume.
|
a GstEncodingProfile |
Returns : |
The full caps the given profile can consume. Call
gst_caps_unref() when you are done with the caps. [transfer full]
|
const gchar * gst_encoding_profile_get_type_nick (GstEncodingProfile *profile
);
|
a GstEncodingProfile |
Returns : |
the human-readable name of the type of profile . |
typedef struct _GstEncodingContainerProfile GstEncodingContainerProfile;
Encoding profiles for containers. Keeps track of a list of GstEncodingProfile
GstEncodingContainerProfile * gst_encoding_container_profile_new (const gchar *name
,const gchar *description
,GstCaps *format
,const gchar *preset
);
Creates a new GstEncodingContainerProfile.
|
The name of the container profile, can be NULL . [allow-none]
|
|
The description of the container profile,
can be NULL . [allow-none]
|
|
The format to use for this profile |
|
The preset to use for this profile. [allow-none] |
Returns : |
The newly created GstEncodingContainerProfile. |
gboolean gst_encoding_container_profile_add_profile (GstEncodingContainerProfile *container
,GstEncodingProfile *profile
);
Add a GstEncodingProfile to the list of profiles handled by container
.
No copy of profile
will be made, if you wish to use it elsewhere after this
method you should increment its reference count.
|
the GstEncodingContainerProfile to use |
|
the GstEncodingProfile to add. [transfer full] |
Returns : |
TRUE if the stream was properly added, else FALSE . |
gboolean gst_encoding_container_profile_contains_profile (GstEncodingContainerProfile *container
,GstEncodingProfile *profile
);
Checks if container
contains a GstEncodingProfile identical to
profile
.
|
a GstEncodingContainerProfile |
|
a GstEncodingProfile |
Returns : |
TRUE if container contains a GstEncodingProfile identical
to profile , else FALSE . |
const GList * gst_encoding_container_profile_get_profiles
(GstEncodingContainerProfile *profile
);
|
a GstEncodingContainerProfile |
Returns : |
the list of contained GstEncodingProfile. [element-type GstPbutils.EncodingProfile][transfer none] |
typedef struct _GstEncodingAudioProfile GstEncodingAudioProfile;
Variant of GstEncodingProfile for audio streams.
GstEncodingAudioProfile * gst_encoding_audio_profile_new (GstCaps *format
,const gchar *preset
,GstCaps *restriction
,guint presence
);
Creates a new GstEncodingAudioProfile
All provided allocatable arguments will be internally copied, so can be safely freed/unreferenced after calling this method.
|
the GstCaps |
|
the preset(s) to use on the encoder, can be NULL. [allow-none] |
|
the GstCaps used to restrict the input to the encoder, can be
NULL. See gst_encoding_profile_get_restriction() for more details. [allow-none]
|
|
the number of time this stream must be used. 0 means any number of times (including never) |
Returns : |
the newly created GstEncodingAudioProfile. |
typedef struct _GstEncodingVideoProfile GstEncodingVideoProfile;
Variant of GstEncodingProfile for video streams, allows specifying the pass
.
GstEncodingVideoProfile * gst_encoding_video_profile_new (GstCaps *format
,const gchar *preset
,GstCaps *restriction
,guint presence
);
Creates a new GstEncodingVideoProfile
All provided allocatable arguments will be internally copied, so can be safely freed/unreferenced after calling this method.
If you wish to control the pass number (in case of multi-pass scenarios),
please refer to the gst_encoding_video_profile_set_pass()
documentation.
If you wish to use/force a constant framerate please refer to the
gst_encoding_video_profile_set_variableframerate()
documentation.
|
the GstCaps |
|
the preset(s) to use on the encoder, can be NULL. [allow-none] |
|
(allow-none) the GstCaps used to restrict the input to the encoder, can be
NULL. See gst_encoding_profile_get_restriction() for more details. |
|
the number of time this stream must be used. 0 means any number of times (including never) |
Returns : |
the newly created GstEncodingVideoProfile. |
guint gst_encoding_video_profile_get_pass (GstEncodingVideoProfile *prof
);
Get the pass number if this is part of a multi-pass profile.
|
a GstEncodingVideoProfile |
Returns : |
The pass number. Starts at 1 for multi-pass. 0 if this is not a multi-pass profile |
gboolean gst_encoding_video_profile_get_variableframerate
(GstEncodingVideoProfile *prof
);
|
a GstEncodingVideoProfile |
Returns : |
Whether non-constant video framerate is allowed for encoding. |
void gst_encoding_video_profile_set_pass (GstEncodingVideoProfile *prof
,guint pass
);
Sets the pass number of this video profile. The first pass profile should have this value set to 1. If this video profile isn't part of a multi-pass profile, you may set it to 0 (the default value).
|
a GstEncodingVideoProfile |
|
the pass number for this profile |
void gst_encoding_video_profile_set_variableframerate (GstEncodingVideoProfile *prof
,gboolean variableframerate
);
If set to TRUE
, then the incoming stream will be allowed to have non-constant
framerate. If set to FALSE
(default value), then the incoming stream will
be normalized by dropping/duplicating frames in order to produce a
constance framerate.
|
a GstEncodingVideoProfile |
|
a boolean |
#define GST_ENCODING_CATEGORY_DEVICE "device"
GstEncodingTarget category for device-specific targets. The name of the target will usually be the constructor and model of the device, and that target will contain GstEncodingProfiles suitable for that device.
#define GST_ENCODING_CATEGORY_ONLINE_SERVICE "online-service"
GstEncodingTarget category for online-services. The name of the target will usually be the name of the online service and that target will contain GstEncodingProfiles suitable for that online service.
#define GST_ENCODING_CATEGORY_STORAGE_EDITING "storage-editing"
GstEncodingTarget category for storage, archiving and editing targets. Those targets can be lossless and/or provide very fast random access content. The name of the target will usually be the container type or editing target, and that target will contain GstEncodingProfiles suitable for editing or storage.
#define GST_ENCODING_CATEGORY_CAPTURE "capture"
GstEncodingTarget category for recording and capture. Targets within this category are optimized for low latency encoding.
typedef struct _GstEncodingTarget GstEncodingTarget;
Collection of GstEncodingProfile for a specific target or use-case.
When being stored/loaded, targets come from a specific category, like GST_ENCODING_CATEGORY_DEVICE.
#define gst_encoding_target_unref(target)
Decreases the reference count of the target
, possibly freeing it.
|
a GstEncodingTarget |
#define gst_encoding_target_ref(target)
Increases the reference count of the target
.
|
a GstEncodingTarget |
GstEncodingTarget * gst_encoding_target_new (const gchar *name
,const gchar *category
,const gchar *description
,const GList *profiles
);
Creates a new GstEncodingTarget.
The name and category can only consist of lowercase ASCII letters for the first character, followed by either lowercase ASCII letters, digits or hyphens ('-').
The category
should be one of the existing
well-defined categories, like GST_ENCODING_CATEGORY_DEVICE, but it
can be a application or user specific category if
needed.
|
The name of the target. |
|
The name of the category to which this target
belongs. For example: GST_ENCODING_CATEGORY_DEVICE. [transfer none]
|
|
A description of GstEncodingTarget in the current locale. [transfer none] |
|
A GList of GstEncodingProfile. [transfer none][element-type GstPbutils.EncodingProfile] |
Returns : |
The newly created GstEncodingTarget or NULL if
there was an error. [transfer full]
|
const gchar * gst_encoding_target_get_name (GstEncodingTarget *target
);
|
a GstEncodingTarget |
Returns : |
The name of the target . [transfer none]
|
const gchar * gst_encoding_target_get_category (GstEncodingTarget *target
);
|
a GstEncodingTarget |
Returns : |
The category of the target . For example:
GST_ENCODING_CATEGORY_DEVICE. [transfer none]
|
const gchar * gst_encoding_target_get_description (GstEncodingTarget *target
);
|
a GstEncodingTarget |
Returns : |
The description of the target . [transfer none]
|
const GList * gst_encoding_target_get_profiles (GstEncodingTarget *target
);
|
a GstEncodingTarget |
Returns : |
A list of
GstEncodingProfile(s) this target handles. [transfer none][element-type GstPbutils.EncodingProfile]
|
GstEncodingProfile * gst_encoding_target_get_profile (GstEncodingTarget *target
,const gchar *name
);
|
a GstEncodingTarget |
|
the name of the profile to retrieve |
Returns : |
The matching GstEncodingProfile, or NULL . [transfer full]
|
gboolean gst_encoding_target_add_profile (GstEncodingTarget *target
,GstEncodingProfile *profile
);
Adds the given profile
to the target
. Each added profile must have
a unique name within the profile.
The target
will steal a reference to the profile
. If you wish to use
the profile after calling this method, you should increase its reference
count.
|
the GstEncodingTarget to add a profile to |
|
the GstEncodingProfile to add. [transfer full] |
Returns : |
TRUE if the profile was added, else FALSE . |
gboolean gst_encoding_target_save (GstEncodingTarget *target
,GError **error
);
Saves the target
to a default user-local directory.
|
a GstEncodingTarget |
|
If an error occured, this field will be filled in. |
Returns : |
TRUE if the target was correctly saved, else FALSE . |
gboolean gst_encoding_target_save_to_file (GstEncodingTarget *target
,const gchar *filepath
,GError **error
);
Saves the target
to the provided file location.
|
a GstEncodingTarget |
|
the location to store the target at. |
|
If an error occured, this field will be filled in. |
Returns : |
TRUE if the target was correctly saved, else FALSE . |
GstEncodingTarget * gst_encoding_target_load (const gchar *name
,const gchar *category
,GError **error
);
Searches for the GstEncodingTarget with the given name, loads it and returns it.
If the category name is specified only targets from that category will be searched for.
|
the name of the GstEncodingTarget to load. |
|
the name of the target category, like
GST_ENCODING_CATEGORY_DEVICE. Can be NULL . [allow-none]
|
|
If an error occured, this field will be filled in. |
Returns : |
The GstEncodingTarget if available, else NULL . [transfer full]
|
GstEncodingTarget * gst_encoding_target_load_from_file (const gchar *filepath
,GError **error
);
Opens the provided file and returns the contained GstEncodingTarget.
|
The file location to load the GstEncodingTarget from |
|
If an error occured, this field will be filled in. |
Returns : |
The GstEncodingTarget contained in the file, else
NULL . [transfer full]
|
GList * gst_encoding_list_all_targets (const gchar *categoryname
);
List all available GstEncodingTarget for the specified category, or all categories
if categoryname
is NULL
.
|
The category, for ex: GST_ENCODING_CATEGORY_DEVICE.
Can be NULL . [allow-none]
|
Returns : |
The list of GstEncodingTarget. [transfer full][element-type GstEncodingTarget] |
GList * gst_encoding_list_available_categories
(void
);
Lists all GstEncodingTarget categories present on disk.
Returns : |
A list of GstEncodingTarget categories. [transfer full][element-type gchar*] |