| Top |
GObject ├── GstEncodingProfile │ ├── GstEncodingAudioProfile │ ├── GstEncodingContainerProfile │ ╰── GstEncodingVideoProfile ├── GstEncodingProfile │ ├── GstEncodingVideoProfile │ ├── GstEncodingAudioProfile │ ╰── GstEncodingContainerProfile ╰── 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 28 29 30 31 32 33 34 35 36 |
#include <gst/pbutils/encoding-profile.h> ... GstEncodingProfile * create_ogg_theora_profile(void) { GstEncodingVideoProfile *v; GstEncodingAudioProfile *a; GstEncodingContainerProfile *prof; GstCaps *caps; GstPreset *preset; 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); preset = GST_PRESET (gst_element_factory_make ("theoraenc", "theorapreset")); g_object_set (preset, "bitrate", 1000, NULL); // The preset will be saved on the filesystem, // so try to use a descriptive name gst_preset_save_preset (preset, "theora_bitrate_preset"); gst_object_unref (preset); caps = gst_caps_from_string ("video/x-theora"); v = gst_encoding_video_profile_new (caps, "theorapreset", NULL, 0); gst_encoding_container_profile_add_profile (prof, (GstEncodingProfile*) v); gst_caps_unref (caps); caps = gst_caps_from_string ("audio/x-vorbis"); a = gst_encoding_audio_profile_new (caps, NULL, NULL, 0); gst_encoding_container_profile_add_profile (prof, (GstEncodingProfile*) a); 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_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_list_all_targets (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); ... |
#define gst_encoding_profile_unref(profile) (g_object_unref ((GObject*) profile))
Decreases the reference count of the profile
, possibly freeing the profile
.
#define gst_encoding_profile_ref(profile) (g_object_ref ((GObject*) profile))
Increases the reference count of the profile
.
GstEncodingProfile * gst_encoding_profile_find (const gchar *targetname,const gchar *profilename,const gchar *category);
Find the GstEncodingProfile with the specified name and category.
targetname |
The name of the target. |
[transfer none] |
profilename |
The name of the profile. |
[transfer none] |
category |
The target category. Can be |
[transfer none][allow-none] |
GstEncodingProfile *
gst_encoding_profile_from_discoverer (GstDiscovererInfo *info);
Creates a GstEncodingProfile matching the formats from the given GstDiscovererInfo. Streams other than audio or video (eg, subtitles), are currently ignored.
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);
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);
the name of the GstPreset to be used in the profile. This is the name that has been set when saving the preset.
const gchar *
gst_encoding_profile_get_preset_name (GstEncodingProfile *profile);
guint
gst_encoding_profile_get_presence (GstEncodingProfile *profile);
GstCaps *
gst_encoding_profile_get_restriction (GstEncodingProfile *profile);
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]
const gchar *
gst_encoding_profile_get_file_extension
(GstEncodingProfile *profile);
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.
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.
void gst_encoding_profile_set_format (GstEncodingProfile *profile,GstCaps *format);
Sets the media format used in the profile.
void gst_encoding_profile_set_preset (GstEncodingProfile *profile,const gchar *preset);
Sets the name of the GstElement that implements the GstPreset interface to use for the profile. This is the name that has been set when saving the preset.
void gst_encoding_profile_set_preset_name (GstEncodingProfile *profile,const gchar *preset_name);
Sets the name of the GstPreset's factory to be used in the profile.
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_get_restriction()
for more about restrictions. Does not apply to GstEncodingContainerProfile.
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
gboolean gst_encoding_profile_is_equal (GstEncodingProfile *a,GstEncodingProfile *b);
Checks whether the two GstEncodingProfile are equal
GstCaps *
gst_encoding_profile_get_input_caps (GstEncodingProfile *profile);
Computes the full output caps that this profile
will be able to consume.
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);
GstEncodingContainerProfile * gst_encoding_container_profile_new (const gchar *name,const gchar *description,GstCaps *format,const gchar *preset);
Creates a new GstEncodingContainerProfile.