encoding-profile

encoding-profile — Encoding profile library

Functions

#define gst_encoding_profile_unref()
#define gst_encoding_profile_ref()
GstEncodingProfile * gst_encoding_profile_find ()
GstEncodingProfile * gst_encoding_profile_from_discoverer ()
const gchar * gst_encoding_profile_get_name ()
const gchar * gst_encoding_profile_get_description ()
GstCaps * gst_encoding_profile_get_format ()
const gchar * gst_encoding_profile_get_preset ()
const gchar * gst_encoding_profile_get_preset_name ()
guint gst_encoding_profile_get_presence ()
GstCaps * gst_encoding_profile_get_restriction ()
const gchar * gst_encoding_profile_get_file_extension ()
void gst_encoding_profile_set_name ()
void gst_encoding_profile_set_description ()
void gst_encoding_profile_set_format ()
void gst_encoding_profile_set_preset ()
void gst_encoding_profile_set_preset_name ()
void gst_encoding_profile_set_restriction ()
void gst_encoding_profile_set_presence ()
gboolean gst_encoding_profile_is_equal ()
GstCaps * gst_encoding_profile_get_input_caps ()
const gchar * gst_encoding_profile_get_type_nick ()
GstEncodingContainerProfile * gst_encoding_container_profile_new ()
gboolean gst_encoding_container_profile_add_profile ()
gboolean gst_encoding_container_profile_contains_profile ()
const GList * gst_encoding_container_profile_get_profiles ()
GstEncodingAudioProfile * gst_encoding_audio_profile_new ()
GstEncodingVideoProfile * gst_encoding_video_profile_new ()
guint gst_encoding_video_profile_get_pass ()
gboolean gst_encoding_video_profile_get_variableframerate ()
void gst_encoding_video_profile_set_pass ()
void gst_encoding_video_profile_set_variableframerate ()
#define gst_encoding_target_unref()
#define gst_encoding_target_ref()
GstEncodingTarget * gst_encoding_target_new ()
const gchar * gst_encoding_target_get_name ()
const gchar * gst_encoding_target_get_category ()
const gchar * gst_encoding_target_get_description ()
const GList * gst_encoding_target_get_profiles ()
GstEncodingProfile * gst_encoding_target_get_profile ()
gboolean gst_encoding_target_add_profile ()
gboolean gst_encoding_target_save ()
gboolean gst_encoding_target_save_to_file ()
GstEncodingTarget * gst_encoding_target_load ()
GstEncodingTarget * gst_encoding_target_load_from_file ()
GList * gst_encoding_list_all_targets ()
GList * gst_encoding_list_available_categories ()

Properties

GstCaps * restriction-caps Read / Write

Types and Values

Object Hierarchy

    GObject
    ├── GstEncodingProfile
       ├── GstEncodingAudioProfile
       ├── GstEncodingContainerProfile
       ╰── GstEncodingVideoProfile
    ├── GstEncodingProfile
       ├── GstEncodingVideoProfile
       ├── GstEncodingAudioProfile
       ╰── GstEncodingContainerProfile
    ╰── GstEncodingTarget

Includes

#include <gst/pbutils/encoding-profile.h>

Description

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.


Example: Creating a profile

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;
}


Example: Using an encoder preset with a profile

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;
}


Example: Listing categories, targets and profiles

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);

...

Functions

gst_encoding_profile_unref()

#define gst_encoding_profile_unref(profile) (g_object_unref ((GObject*) profile))

Decreases the reference count of the profile , possibly freeing the profile .

Parameters

profile

a GstEncodingProfile

 

gst_encoding_profile_ref()

#define gst_encoding_profile_ref(profile) (g_object_ref ((GObject*) profile))

Increases the reference count of the profile .

Parameters

profile

a GstEncodingProfile

 

gst_encoding_profile_find ()

GstEncodingProfile *
gst_encoding_profile_find (const gchar *targetname,
                           const gchar *profilename,
                           const gchar *category);

Find the GstEncodingProfile with the specified name and category.

Parameters

targetname

The name of the target.

[transfer none]

profilename

The name of the profile.

[transfer none]

category

The target category. Can be NULL.

[transfer none][allow-none]

Returns

The matching GstEncodingProfile or NULL.

[transfer full]


gst_encoding_profile_from_discoverer ()

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.

Parameters

info

The GstDiscovererInfo to read from.

[transfer none]

Returns

The new GstEncodingProfile or NULL.

[transfer full]


gst_encoding_profile_get_name ()

const gchar *
gst_encoding_profile_get_name (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the name of the profile, can be NULL.


gst_encoding_profile_get_description ()

const gchar *
gst_encoding_profile_get_description (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the description of the profile, can be NULL.


gst_encoding_profile_get_format ()

GstCaps *
gst_encoding_profile_get_format (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the GstCaps corresponding to the media format used in the profile. Unref after usage.

[transfer full]


gst_encoding_profile_get_preset ()

const gchar *
gst_encoding_profile_get_preset (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the name of the GstPreset to be used in the profile. This is the name that has been set when saving the preset.


gst_encoding_profile_get_preset_name ()

const gchar *
gst_encoding_profile_get_preset_name (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the name of the GstPreset factory to be used in the profile.


gst_encoding_profile_get_presence ()

guint
gst_encoding_profile_get_presence (GstEncodingProfile *profile);

Parameters

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.


gst_encoding_profile_get_restriction ()

GstCaps *
gst_encoding_profile_get_restriction (GstEncodingProfile *profile);

Parameters

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]


gst_encoding_profile_get_file_extension ()

const gchar *
gst_encoding_profile_get_file_extension
                               (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

a suitable file extension for profile , or NULL.


gst_encoding_profile_set_name ()

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.

Parameters

profile

a GstEncodingProfile

 

name

the name to set on the profile

 

gst_encoding_profile_set_description ()

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.

Parameters

profile

a GstEncodingProfile

 

description

the description to set on the profile

 

gst_encoding_profile_set_format ()

void
gst_encoding_profile_set_format (GstEncodingProfile *profile,
                                 GstCaps *format);

Sets the media format used in the profile.

Parameters

profile

a GstEncodingProfile

 

format

the media format to use in the profile.

 

gst_encoding_profile_set_preset ()

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.

Parameters

profile

a GstEncodingProfile

 

preset

the element preset to use

 

gst_encoding_profile_set_preset_name ()

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.

Parameters

profile

a GstEncodingProfile

 

preset_name

The name of the preset to use in this profile .

 

gst_encoding_profile_set_restriction ()

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.

Parameters

profile

a GstEncodingProfile

 

restriction

the restriction to apply.

[transfer full]

gst_encoding_profile_set_presence ()

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

Parameters

profile

a GstEncodingProfile

 

presence

the number of time the profile can be used

 

gst_encoding_profile_is_equal ()

gboolean
gst_encoding_profile_is_equal (GstEncodingProfile *a,
                               GstEncodingProfile *b);

Checks whether the two GstEncodingProfile are equal

Parameters

Returns

TRUE if a and b are equal, else FALSE.


gst_encoding_profile_get_input_caps ()

GstCaps *
gst_encoding_profile_get_input_caps (GstEncodingProfile *profile);

Computes the full output caps that this profile will be able to consume.

Parameters

profile

a GstEncodingProfile

 

Returns

The full caps the given profile can consume. Call gst_caps_unref() when you are done with the caps.

[transfer full]


gst_encoding_profile_get_type_nick ()

const gchar *
gst_encoding_profile_get_type_nick (GstEncodingProfile *profile);

Parameters

profile

a GstEncodingProfile

 

Returns

the human-readable name of the type of profile .


gst_encoding_container_profile_new ()

GstEncodingContainerProfile *
gst_encoding_container_profile_new (const gchar *name,
                                    const gchar *description,
                                    GstCaps *format,
                                    const gchar *preset);

Creates a new GstEncodingContainerProfile.

Parameters

name

The name of the container profile, can be NULL.

[allow-none]

description

The description of the container profile, can be NULL.

[allow-none]

format

The format to use for this profile

 

preset

The preset to use for this profile.

[allow-none]

Returns

The newly created GstEncodingContainerProfile.