本文整理汇总了C++中GST_IS_CAPS函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_IS_CAPS函数的具体用法?C++ GST_IS_CAPS怎么用?C++ GST_IS_CAPS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_IS_CAPS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_pb_utils_add_codec_description_to_tag_list
/**
* gst_pb_utils_add_codec_description_to_tag_list:
* @taglist: a #GstTagList
* @codec_tag: a GStreamer codec tag such as #GST_TAG_AUDIO_CODEC,
* #GST_TAG_VIDEO_CODEC or #GST_TAG_CODEC
* @caps: the (fixed) #GstCaps for which a codec tag should be added.
*
* Adds a codec tag describing the format specified by @caps to @taglist.
*
* Returns: TRUE if a codec tag was added, FALSE otherwise.
*/
gboolean
gst_pb_utils_add_codec_description_to_tag_list (GstTagList * taglist,
const gchar * codec_tag, const GstCaps * caps)
{
const FormatInfo *info;
gchar *desc;
g_return_val_if_fail (taglist != NULL, FALSE);
g_return_val_if_fail (GST_IS_TAG_LIST (taglist), FALSE);
g_return_val_if_fail (codec_tag != NULL, FALSE);
g_return_val_if_fail (gst_tag_exists (codec_tag), FALSE);
g_return_val_if_fail (gst_tag_get_type (codec_tag) == G_TYPE_STRING, FALSE);
g_return_val_if_fail (caps != NULL, FALSE);
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
info = find_format_info (caps);
if (info == NULL)
return FALSE;
desc = format_info_get_desc (info, caps);
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, codec_tag, desc, NULL);
g_free (desc);
return TRUE;
}
示例2: gst_pb_utils_get_encoder_description
/**
* gst_pb_utils_get_encoder_description:
* @caps: the (fixed) #GstCaps for which an encoder description is needed
*
* Returns a localised string describing an encoder for the format specified
* in @caps, for use in error dialogs or other messages to be seen by the user.
* Should never return NULL unless @factory_name or @caps are invalid.
*
* This function is mainly for internal use, applications would typically
* use gst_missing_plugin_message_get_description() to get a description of
* a missing feature from a missing-plugin message.
*
* Returns: a newly-allocated description string, or NULL on error. Free
* string with g_free() when not needed any longer.
*/
gchar *
gst_pb_utils_get_encoder_description (const GstCaps * caps)
{
gchar *str, *ret;
GstCaps *tmp;
g_return_val_if_fail (caps != NULL, NULL);
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
tmp = copy_and_clean_caps (caps);
g_return_val_if_fail (gst_caps_is_fixed (tmp), NULL);
/* special-case RTP caps */
if (caps_are_rtp_caps (tmp, "video", &str)) {
ret = g_strdup_printf (_("%s video RTP payloader"), str);
} else if (caps_are_rtp_caps (tmp, "audio", &str)) {
ret = g_strdup_printf (_("%s audio RTP payloader"), str);
} else if (caps_are_rtp_caps (tmp, "application", &str)) {
ret = g_strdup_printf (_("%s RTP payloader"), str);
} else {
const FormatInfo *info;
str = gst_pb_utils_get_codec_description (tmp);
info = find_format_info (tmp);
if (info != NULL && (info->flags & FLAG_CONTAINER) != 0) {
ret = g_strdup_printf (_("%s muxer"), str);
} else {
ret = g_strdup_printf (_("%s encoder"), str);
}
}
g_free (str);
gst_caps_unref (tmp);
return ret;
}
示例3: gst_vaapi_decoder_new
GstVaapiDecoder *
gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass,
GstVaapiDisplay * display, GstCaps * caps)
{
GstVaapiDecoder *decoder;
g_return_val_if_fail (display != NULL, NULL);
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
decoder = (GstVaapiDecoder *)
gst_vaapi_mini_object_new (GST_VAAPI_MINI_OBJECT_CLASS (klass));
if (!decoder)
return NULL;
if (!gst_vaapi_decoder_init (decoder, display, caps))
goto error;
return decoder;
/* ERRORS */
error:
{
gst_vaapi_decoder_unref (decoder);
return NULL;
}
}
示例4: gst_missing_encoder_message_new
/**
* gst_missing_encoder_message_new:
* @element: the #GstElement posting the message
* @encode_caps: the (fixed) caps for which an encoder element is needed
*
* Creates a missing-plugin message for @element to notify the application
* that an encoder element for a particular set of (fixed) caps is missing.
* This function is mainly for use in plugins.
*
* Returns: (transfer full): a new #GstMessage, or NULL on error
*/
GstMessage *
gst_missing_encoder_message_new (GstElement * element,
const GstCaps * encode_caps)
{
GstStructure *s;
GstCaps *caps;
gchar *description;
g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (encode_caps != NULL, NULL);
g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL);
g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL);
g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL);
g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL);
description = gst_pb_utils_get_encoder_description (encode_caps);
caps = copy_and_clean_caps (encode_caps);
s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
"encoder", "detail", GST_TYPE_CAPS, caps, "name", G_TYPE_STRING,
description, NULL);
gst_caps_unref (caps);
g_free (description);
return gst_message_new_element (GST_OBJECT_CAST (element), s);
}
示例5: getVideoSizeAndFormatFromCaps
bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
{
#ifdef GST_API_VERSION_1
GstVideoInfo info;
if (!gst_video_info_from_caps(&info, caps))
return false;
format = GST_VIDEO_INFO_FORMAT(&info);
size.setWidth(GST_VIDEO_INFO_WIDTH(&info));
size.setHeight(GST_VIDEO_INFO_HEIGHT(&info));
pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0);
#else
gint width, height;
if (!GST_IS_CAPS(caps) || !gst_caps_is_fixed(caps)
|| !gst_video_format_parse_caps(caps, &format, &width, &height)
|| !gst_video_parse_caps_pixel_aspect_ratio(caps, &pixelAspectRatioNumerator,
&pixelAspectRatioDenominator))
return false;
size.setWidth(width);
size.setHeight(height);
stride = size.width() * 4;
#endif
return true;
}
示例6: gst_codec_utils_h265_caps_set_level_tier_and_profile
/**
* gst_codec_utils_h265_caps_set_level_tier_and_profile:
* @caps: the #GstCaps to which the level, tier and profile are to be added
* @profile_tier_level: Pointer to the profile_tier_level struct
* @len: Length of the data available in @profile_tier_level.
*
* Sets the level, tier and profile in @caps if it can be determined from
* @profile_tier_level. See gst_codec_utils_h265_get_level(),
* gst_codec_utils_h265_get_tier() and gst_codec_utils_h265_get_profile()
* for more details on the parameters.
*
* Returns: %TRUE if the level, tier, profile could be set, %FALSE otherwise.
*
* Since 1.4
*/
gboolean
gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps,
const guint8 * profile_tier_level, guint len)
{
const gchar *level, *tier, *profile;
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), FALSE);
g_return_val_if_fail (GST_SIMPLE_CAPS_HAS_NAME (caps, "video/x-h265"), FALSE);
g_return_val_if_fail (profile_tier_level != NULL, FALSE);
level = gst_codec_utils_h265_get_level (profile_tier_level, len);
if (level != NULL)
gst_caps_set_simple (caps, "level", G_TYPE_STRING, level, NULL);
tier = gst_codec_utils_h265_get_tier (profile_tier_level, len);
if (tier != NULL)
gst_caps_set_simple (caps, "tier", G_TYPE_STRING, tier, NULL);
profile = gst_codec_utils_h265_get_profile (profile_tier_level, len);
if (profile != NULL)
gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL);
GST_LOG ("profile : %s", (profile) ? profile : "---");
GST_LOG ("tier : %s", (tier) ? tier : "---");
GST_LOG ("level : %s", (level) ? level : "---");
return (level != NULL && tier != NULL && profile != NULL);
}
示例7: setFilter
/*!
* \brief OpenIMAJCapGStreamer::setFilter
* \param prop the property name
* \param type glib property type
* \param v1 the value
* \param v2 second value of property type requires it, else NULL
* Filter the output formats by setting appsink caps properties
*/
void OpenIMAJCapGStreamer::setFilter(const char *prop, GType type, int v1, int v2)
{
if(!caps || !( GST_IS_CAPS (caps) ))
{
if(type == G_TYPE_INT)
{
caps = gst_caps_new_simple("video/x-raw","format",G_TYPE_STRING,"BGR", prop, type, v1, NULL);
}
else
{
caps = gst_caps_new_simple("video/x-raw","format",G_TYPE_STRING,"BGR", prop, type, v1, v2, NULL);
}
}
else
{
if (! gst_caps_is_writable(caps))
caps = gst_caps_make_writable (caps);
if(type == G_TYPE_INT){
gst_caps_set_simple(caps, prop, type, v1, NULL);
}else{
gst_caps_set_simple(caps, prop, type, v1, v2, NULL);
}
}
caps = gst_caps_fixate(caps);
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
}
示例8: IntSize
// Returns the size of the video
IntSize MediaPlayerPrivate::naturalSize() const
{
if (!hasVideo())
return IntSize();
// TODO: handle possible clean aperture data. See
// https://bugzilla.gnome.org/show_bug.cgi?id=596571
// TODO: handle possible transformation matrix. See
// https://bugzilla.gnome.org/show_bug.cgi?id=596326
int width = 0, height = 0;
if (GstPad* pad = gst_element_get_static_pad(m_videoSink, "sink")) {
GstCaps* caps = GST_PAD_CAPS(pad);
gfloat pixelAspectRatio;
gint pixelAspectRatioNumerator, pixelAspectRatioDenominator;
if (!GST_IS_CAPS(caps) || !gst_caps_is_fixed(caps) ||
!gst_video_format_parse_caps(caps, NULL, &width, &height) ||
!gst_video_parse_caps_pixel_aspect_ratio(caps, &pixelAspectRatioNumerator,
&pixelAspectRatioDenominator)) {
gst_object_unref(GST_OBJECT(pad));
return IntSize();
}
pixelAspectRatio = (gfloat) pixelAspectRatioNumerator / (gfloat) pixelAspectRatioDenominator;
width *= pixelAspectRatio;
height /= pixelAspectRatio;
gst_object_unref(GST_OBJECT(pad));
}
return IntSize(width, height);
}
示例9: gst_pb_utils_get_codec_description
/**
* gst_pb_utils_get_codec_description:
* @caps: the (fixed) #GstCaps for which an format description is needed
*
* Returns a localised (as far as this is possible) string describing the
* media format specified in @caps, for use in error dialogs or other messages
* to be seen by the user. Should never return NULL unless @caps is invalid.
*
* Also see the convenience function
* gst_pb_utils_add_codec_description_to_tag_list().
*
* Returns: a newly-allocated description string, or NULL on error. Free
* string with g_free() when not needed any longer.
*/
gchar *
gst_pb_utils_get_codec_description (const GstCaps * caps)
{
const FormatInfo *info;
gchar *str, *comma;
GstCaps *tmp;
g_return_val_if_fail (caps != NULL, NULL);
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
tmp = copy_and_clean_caps (caps);
g_return_val_if_fail (gst_caps_is_fixed (tmp), NULL);
info = find_format_info (tmp);
if (info) {
str = format_info_get_desc (info, tmp);
} else {
str = gst_caps_to_string (tmp);
/* cut off everything after the media type, if there is anything */
if ((comma = strchr (str, ','))) {
*comma = '\0';
g_strchomp (str);
/* we could do something more elaborate here, like taking into account
* audio/, video/, image/ and application/ prefixes etc. */
}
GST_WARNING ("No description available for media type: %s", str);
}
gst_caps_unref (tmp);
return str;
}
示例10: gst_vdp_yuv_to_video_caps
GstCaps *
gst_vdp_yuv_to_video_caps (GstCaps * yuv_caps)
{
GstCaps *video_caps;
gint i;
g_return_val_if_fail (GST_IS_CAPS (yuv_caps), NULL);
video_caps = gst_caps_copy (yuv_caps);
for (i = 0; i < gst_caps_get_size (video_caps); i++) {
GstStructure *structure;
guint32 fourcc;
VdpChromaType chroma_type;
structure = gst_caps_get_structure (video_caps, i);
if (!gst_structure_has_name (structure, "video/x-raw-yuv"))
goto not_yuv_error;
if (!gst_structure_get_fourcc (structure, "format", &fourcc))
goto no_format_error;
chroma_type = -1;
for (i = 0; i < G_N_ELEMENTS (formats); i++) {
if (formats[i].fourcc == fourcc) {
chroma_type = formats[i].chroma_type;
break;
}
}
if (chroma_type == -1)
goto no_chroma_error;
/* now we transform the caps */
gst_structure_set_name (structure, "video/x-vdpau-video");
gst_structure_remove_field (structure, "format");
gst_structure_set (structure, "chroma-type", G_TYPE_INT, chroma_type, NULL);
}
return video_caps;
error:
gst_caps_unref (video_caps);
return NULL;
not_yuv_error:
GST_WARNING ("The caps weren't of type \"video/x-raw-yuv\"");
goto error;
no_format_error:
GST_WARNING ("The caps didn't have a \"fourcc\" field");
goto error;
no_chroma_error:
GST_WARNING ("The caps had an invalid \"fourcc\" field");
goto error;
}
示例11: gst_encoding_container_profile_new
/**
* gst_encoding_container_profile_new:
* @name: (allow-none): The name of the container profile, can be %NULL
* @description: (allow-none): The description of the container profile,
* can be %NULL
* @format: The format to use for this profile
* @preset: (allow-none): The preset to use for this profile.
*
* Creates a new #GstEncodingContainerProfile.
*
* Returns: The newly created #GstEncodingContainerProfile.
*/
GstEncodingContainerProfile *
gst_encoding_container_profile_new (const gchar * name,
const gchar * description, GstCaps * format, const gchar * preset)
{
g_return_val_if_fail (GST_IS_CAPS (format), NULL);
return (GstEncodingContainerProfile *)
common_creation (GST_TYPE_ENCODING_CONTAINER_PROFILE, format, preset,
name, description, NULL, 0);
}
示例12: update_session_stream_from_caps
/* Create new stream from params in caps
*/
static GstSrtpDecSsrcStream *
update_session_stream_from_caps (GstSrtpDec * filter, guint32 ssrc,
GstCaps * caps)
{
GstSrtpDecSsrcStream *stream = NULL;
GstSrtpDecSsrcStream *old_stream = NULL;
err_status_t err;
g_return_val_if_fail (GST_IS_SRTP_DEC (filter), NULL);
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
stream = get_stream_from_caps (filter, caps, ssrc);
old_stream = find_stream_by_ssrc (filter, ssrc);
if (stream && old_stream &&
stream->rtp_cipher == old_stream->rtp_cipher &&
stream->rtcp_cipher == old_stream->rtcp_cipher &&
stream->rtp_auth == old_stream->rtp_auth &&
stream->rtcp_auth == old_stream->rtcp_auth &&
stream->key && old_stream->key &&
gst_buffer_get_size (stream->key) ==
gst_buffer_get_size (old_stream->key)) {
GstMapInfo info;
if (gst_buffer_map (old_stream->key, &info, GST_MAP_READ)) {
gboolean equal;
equal = (gst_buffer_memcmp (stream->key, 0, info.data, info.size) == 0);
gst_buffer_unmap (old_stream->key, &info);
if (equal) {
free_stream (stream);
return old_stream;
}
}
}
/* Remove existing stream, if any */
gst_srtp_dec_remove_stream (filter, ssrc);
if (stream) {
/* Create new session stream */
err = init_session_stream (filter, ssrc, stream);
if (err != err_status_ok) {
if (stream->key)
gst_buffer_unref (stream->key);
g_slice_free (GstSrtpDecSsrcStream, stream);
stream = NULL;
}
}
return stream;
}
示例13: gst_encoding_profile_set_restriction
/**
* gst_encoding_profile_set_restriction:
* @profile: a #GstEncodingProfile
* @restriction: (transfer full): the restriction to apply
*
* 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_restriction (GstEncodingProfile * profile,
GstCaps * restriction)
{
g_return_if_fail (GST_IS_CAPS (restriction));
g_return_if_fail (GST_IS_ENCODING_PROFILE (profile));
if (profile->restriction)
gst_caps_unref (profile->restriction);
profile->restriction = restriction;
g_object_notify_by_pspec (G_OBJECT (profile),
_properties[PROP_RESTRICTION_CAPS]);
}
示例14: gst_my_base_source_class_add_pad_template
/*
* Boilerplates BaseSrc add pad.
*/
void
gst_my_base_source_class_add_pad_template (GstBaseSrcClass * base_class,
GstCaps * srccaps)
{
GstElementClass *elem_class = GST_ELEMENT_CLASS (base_class);
GstPadTemplate *pad_template;
g_return_if_fail (GST_IS_CAPS (srccaps));
pad_template =
gst_pad_template_new (GST_BASE_TRANSFORM_SRC_NAME, GST_PAD_SRC,
GST_PAD_ALWAYS, srccaps);
gst_element_class_add_pad_template (elem_class, pad_template);
}
示例15: gst_raw_parse_class_set_src_pad_template
void
gst_raw_parse_class_set_src_pad_template (GstRawParseClass * klass,
const GstCaps * allowed_caps)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
g_return_if_fail (GST_IS_RAW_PARSE_CLASS (klass));
g_return_if_fail (allowed_caps != NULL);
g_return_if_fail (GST_IS_CAPS (allowed_caps));
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
gst_caps_copy (allowed_caps)));
}