本文整理汇总了C++中GST_PAD_CAPS函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_PAD_CAPS函数的具体用法?C++ GST_PAD_CAPS怎么用?C++ GST_PAD_CAPS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_PAD_CAPS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_deinterlace2_set_property
static void
gst_deinterlace2_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstDeinterlace2 *self;
g_return_if_fail (GST_IS_DEINTERLACE2 (object));
self = GST_DEINTERLACE2 (object);
switch (prop_id) {
case PROP_METHOD:
gst_deinterlace2_set_method (self, g_value_get_enum (value));
break;
case PROP_FIELDS:{
gint oldfields;
GST_OBJECT_LOCK (self);
oldfields = self->fields;
self->fields = g_value_get_enum (value);
if (self->fields != oldfields && GST_PAD_CAPS (self->srcpad))
gst_deinterlace2_setcaps (self->sinkpad, GST_PAD_CAPS (self->sinkpad));
GST_OBJECT_UNLOCK (self);
break;
}
case PROP_FIELD_LAYOUT:
self->field_layout = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
}
}
示例2: gst_aspect_ratio_crop_set_property
static void
gst_aspect_ratio_crop_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstAspectRatioCrop *aspect_ratio_crop;
gboolean recheck = FALSE;
aspect_ratio_crop = GST_ASPECT_RATIO_CROP (object);
GST_OBJECT_LOCK (aspect_ratio_crop);
switch (prop_id) {
case ARG_ASPECT_RATIO_CROP:
if (GST_VALUE_HOLDS_FRACTION (value)) {
aspect_ratio_crop->ar_num = gst_value_get_fraction_numerator (value);
aspect_ratio_crop->ar_denom =
gst_value_get_fraction_denominator (value);
recheck = (GST_PAD_CAPS (aspect_ratio_crop->sink) != NULL);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (aspect_ratio_crop);
if (recheck) {
gst_aspect_ratio_crop_set_caps (aspect_ratio_crop->sink,
GST_PAD_CAPS (aspect_ratio_crop->sink));
}
}
示例3: get_buffer
static GstFlowReturn
get_buffer (GstMonoscope * monoscope, GstBuffer ** outbuf)
{
GstFlowReturn ret;
if (GST_PAD_CAPS (monoscope->srcpad) == NULL) {
if (!gst_monoscope_src_negotiate (monoscope))
return GST_FLOW_NOT_NEGOTIATED;
}
GST_LOG_OBJECT (monoscope, "allocating output buffer of size %d with caps %"
GST_PTR_FORMAT, monoscope->outsize, GST_PAD_CAPS (monoscope->srcpad));
ret =
gst_pad_alloc_buffer_and_set_caps (monoscope->srcpad,
GST_BUFFER_OFFSET_NONE, monoscope->outsize,
GST_PAD_CAPS (monoscope->srcpad), outbuf);
if (ret != GST_FLOW_OK)
return ret;
if (*outbuf == NULL)
return GST_FLOW_ERROR;
return GST_FLOW_OK;
}
示例4: gst_vdp_output_src_pad_push
GstFlowReturn
gst_vdp_output_src_pad_push (GstVdpOutputSrcPad * vdp_pad,
GstVdpOutputBuffer * output_buf, GError ** error)
{
GstPad *pad;
GstBuffer *outbuf;
g_return_val_if_fail (GST_IS_VDP_OUTPUT_SRC_PAD (vdp_pad), GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_VDP_OUTPUT_BUFFER (output_buf), GST_FLOW_ERROR);
pad = (GstPad *) vdp_pad;
if (G_UNLIKELY (!GST_PAD_CAPS (pad)))
return GST_FLOW_NOT_NEGOTIATED;
switch (vdp_pad->output_format) {
case GST_VDP_OUTPUT_SRC_PAD_FORMAT_RGB:
{
GstFlowReturn ret;
guint size;
gst_vdp_output_buffer_calculate_size (output_buf, &size);
vdp_pad->lock_caps = TRUE;
ret = gst_pad_alloc_buffer (pad, 0, size, GST_PAD_CAPS (vdp_pad),
&outbuf);
vdp_pad->lock_caps = FALSE;
if (ret != GST_FLOW_OK) {
gst_buffer_unref (GST_BUFFER_CAST (output_buf));
return ret;
}
if (!gst_vdp_output_buffer_download (output_buf, outbuf, error)) {
gst_buffer_unref (GST_BUFFER_CAST (output_buf));
gst_buffer_unref (outbuf);
return GST_FLOW_ERROR;
}
gst_buffer_copy_metadata (outbuf, (const GstBuffer *) output_buf,
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
gst_buffer_unref (GST_BUFFER_CAST (output_buf));
break;
}
case GST_VDP_OUTPUT_SRC_PAD_FORMAT_VDPAU:
{
outbuf = GST_BUFFER_CAST (output_buf);
break;
}
default:
g_assert_not_reached ();
break;
}
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (vdp_pad));
return gst_pad_push (pad, outbuf);
}
示例5: gst_ffmpegdeinterlace_chain
static GstFlowReturn
gst_ffmpegdeinterlace_chain (GstPad * pad, GstBuffer * inbuf)
{
GstFFMpegDeinterlace *deinterlace =
GST_FFMPEGDEINTERLACE (gst_pad_get_parent (pad));
GstBuffer *outbuf = NULL;
GstFlowReturn result;
GST_OBJECT_LOCK (deinterlace);
if (deinterlace->reconfigure) {
if (deinterlace->new_mode != -1)
deinterlace->mode = deinterlace->new_mode;
deinterlace->new_mode = -1;
deinterlace->reconfigure = FALSE;
GST_OBJECT_UNLOCK (deinterlace);
if (GST_PAD_CAPS (deinterlace->srcpad))
gst_ffmpegdeinterlace_sink_setcaps (deinterlace->sinkpad,
GST_PAD_CAPS (deinterlace->sinkpad));
} else {
GST_OBJECT_UNLOCK (deinterlace);
}
if (deinterlace->passthrough)
return gst_pad_push (deinterlace->srcpad, inbuf);
result =
gst_pad_alloc_buffer (deinterlace->srcpad, GST_BUFFER_OFFSET_NONE,
deinterlace->to_size, GST_PAD_CAPS (deinterlace->srcpad), &outbuf);
if (result == GST_FLOW_OK) {
gst_ffmpeg_avpicture_fill (&deinterlace->from_frame,
GST_BUFFER_DATA (inbuf), deinterlace->pixfmt, deinterlace->width,
deinterlace->height);
gst_ffmpeg_avpicture_fill (&deinterlace->to_frame, GST_BUFFER_DATA (outbuf),
deinterlace->pixfmt, deinterlace->width, deinterlace->height);
avpicture_deinterlace (&deinterlace->to_frame, &deinterlace->from_frame,
deinterlace->pixfmt, deinterlace->width, deinterlace->height);
gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS);
result = gst_pad_push (deinterlace->srcpad, outbuf);
}
gst_buffer_unref (inbuf);
return result;
}
示例6: gst_xvidenc_getcaps
static GstCaps *
gst_xvidenc_getcaps (GstPad * pad)
{
GstXvidEnc *xvidenc;
GstPad *peer;
GstCaps *caps;
/* If we already have caps return them */
if (GST_PAD_CAPS (pad))
return gst_caps_ref (GST_PAD_CAPS (pad));
xvidenc = GST_XVIDENC (gst_pad_get_parent (pad));
if (!xvidenc)
return gst_caps_new_empty ();
peer = gst_pad_get_peer (xvidenc->srcpad);
if (peer) {
const GstCaps *templcaps;
GstCaps *peercaps;
guint i, n;
peercaps = gst_pad_get_caps (peer);
/* Translate peercaps to YUV */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_set_name (s, "video/x-raw-yuv");
gst_structure_remove_field (s, "mpegversion");
gst_structure_remove_field (s, "systemstream");
}
templcaps = gst_pad_get_pad_template_caps (pad);
caps = gst_caps_intersect (peercaps, templcaps);
gst_caps_unref (peercaps);
gst_object_unref (peer);
peer = NULL;
} else {
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
}
gst_object_unref (xvidenc);
return caps;
}
示例7: gst_wildmidi_do_play
static GstFlowReturn
gst_wildmidi_do_play (GstWildmidi * wildmidi)
{
GstBuffer *out;
GstFlowReturn ret;
if (!(out = gst_wildmidi_get_buffer (wildmidi)))
goto eos;
if (wildmidi->discont) {
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT);
wildmidi->discont = FALSE;
}
gst_buffer_set_caps (out, GST_PAD_CAPS (wildmidi->srcpad));
ret = gst_pad_push (wildmidi->srcpad, out);
return ret;
/* ERRORS */
eos:
{
GST_LOG_OBJECT (wildmidi, "Song ended");
return GST_FLOW_UNEXPECTED;
}
}
示例8: gst_rtp_pt_demux_get_caps
static GstCaps *
gst_rtp_pt_demux_get_caps (GstRtpPtDemux * rtpdemux, guint pt)
{
GstCaps *caps;
GValue ret = { 0 };
GValue args[2] = { {0}, {0} };
/* figure out the caps */
g_value_init (&args[0], GST_TYPE_ELEMENT);
g_value_set_object (&args[0], rtpdemux);
g_value_init (&args[1], G_TYPE_UINT);
g_value_set_uint (&args[1], pt);
g_value_init (&ret, GST_TYPE_CAPS);
g_value_set_boxed (&ret, NULL);
g_signal_emitv (args, gst_rtp_pt_demux_signals[SIGNAL_REQUEST_PT_MAP], 0,
&ret);
g_value_unset (&args[0]);
g_value_unset (&args[1]);
caps = g_value_dup_boxed (&ret);
g_value_unset (&ret);
if (caps == NULL) {
caps = GST_PAD_CAPS (rtpdemux->sink);
if (caps)
gst_caps_ref (caps);
}
GST_DEBUG ("pt %d, got caps %" GST_PTR_FORMAT, pt, caps);
return caps;
}
示例9: gst_kate_parse_push_buffer
static GstFlowReturn
gst_kate_parse_push_buffer (GstKateParse * parse, GstBuffer * buf,
gint64 granulepos)
{
GST_LOG_OBJECT (parse, "granulepos %16" G_GINT64_MODIFIER "x", granulepos);
if (granulepos < 0) {
/* packets coming not from Ogg won't have a granpos in the offset end,
so we have to synthesize one here - only problem is we don't know
the backlink - pretend there's none for now */
GST_INFO_OBJECT (parse, "No granulepos on buffer, synthesizing one");
granulepos =
kate_duration_granule (&parse->ki,
GST_BUFFER_TIMESTAMP (buf) /
(double) GST_SECOND) << kate_granule_shift (&parse->ki);
}
GST_BUFFER_OFFSET (buf) =
kate_granule_time (&parse->ki, granulepos) * GST_SECOND;
GST_BUFFER_OFFSET_END (buf) = granulepos;
GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_OFFSET (buf);
/* Hack to flush each packet on its own page - taken off the CMML encoder element */
/* TODO: this is shite and needs to go once I find a way to tell Ogg to flush
as it messes up Matroska's track duration */
GST_BUFFER_DURATION (buf) = G_MAXINT64;
gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
return gst_pad_push (parse->srcpad, buf);
}
示例10: gst_rdt_depay_push
static GstFlowReturn
gst_rdt_depay_push (GstRDTDepay * rdtdepay, GstBuffer * buffer)
{
GstFlowReturn ret;
if (rdtdepay->need_newsegment) {
GstEvent *event;
event = create_segment_event (rdtdepay, FALSE, 0);
gst_pad_push_event (rdtdepay->srcpad, event);
rdtdepay->need_newsegment = FALSE;
}
buffer = gst_buffer_make_metadata_writable (buffer);
gst_buffer_set_caps (buffer, GST_PAD_CAPS (rdtdepay->srcpad));
if (rdtdepay->discont) {
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
rdtdepay->discont = FALSE;
}
ret = gst_pad_push (rdtdepay->srcpad, buffer);
return ret;
}
示例11: new_packet_common_init
static void
new_packet_common_init (MpegTsMux * mux, GstBuffer * buf, guint8 * data,
guint len)
{
/* Packets should be at least 188 bytes, but check anyway */
g_return_if_fail (len >= 2);
if (!mux->streamheader_sent) {
guint pid = ((data[1] & 0x1f) << 8) | data[2];
/* if it's a PAT or a PMT */
if (pid == 0x00 || (pid >= TSMUX_START_PMT_PID && pid < TSMUX_START_ES_PID)) {
mux->streamheader =
g_list_append (mux->streamheader, gst_buffer_copy (buf));
} else if (mux->streamheader) {
mpegtsdemux_set_header_on_caps (mux);
mux->streamheader_sent = TRUE;
}
}
/* Set the caps on the buffer only after possibly setting the stream headers
* into the pad caps above */
gst_buffer_set_caps (buf, GST_PAD_CAPS (mux->srcpad));
if (mux->is_delta) {
GST_LOG_OBJECT (mux, "marking as delta unit");
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
} else {
GST_DEBUG_OBJECT (mux, "marking as non-delta unit");
mux->is_delta = TRUE;
}
}
示例12: gst_tiprepencbuf_prepare_output_buffer
/*****************************************************************************
* gst_tiprepencbuf_prepare_output_buffer
* Function is used to allocate output buffer
*****************************************************************************/
static GstFlowReturn
gst_tiprepencbuf_prepare_output_buffer(GstBaseTransform * trans,
GstBuffer * inBuf, gint size, GstCaps * caps, GstBuffer ** outBuf)
{
GstTIPrepEncBuf *prepencbuf = GST_TIPREPENCBUF(trans);
Buffer_Handle hOutBuf;
GST_LOG("begin prepare output buffer\n");
/* Get free buffer from buftab */
if (!(hOutBuf = gst_tidmaibuftab_get_buf(prepencbuf->hOutBufTab))) {
GST_ELEMENT_ERROR(prepencbuf, RESOURCE, READ,
("failed to get free buffer\n"), (NULL));
return GST_FLOW_ERROR;
}
/* Create a DMAI transport buffer object to carry a DMAI buffer to
* the source pad. The transport buffer knows how to release the
* buffer for re-use in this element when the source pad calls
* gst_buffer_unref().
*/
GST_LOG("creating dmai transport buffer\n");
*outBuf = gst_tidmaibuffertransport_new(hOutBuf, prepencbuf->hOutBufTab, NULL, NULL);
gst_buffer_set_data(*outBuf, (guint8 *) Buffer_getUserPtr(hOutBuf),
Buffer_getSize(hOutBuf));
gst_buffer_set_caps(*outBuf, GST_PAD_CAPS(trans->srcpad));
GST_LOG("end prepare output buffer\n");
return GST_FLOW_OK;
}
示例13: _rtpbin_pad_added
static void
_rtpbin_pad_added (GstElement *rtpbin, GstPad *new_pad,
gpointer user_data)
{
FsRtpConference *self = FS_RTP_CONFERENCE (user_data);
gchar *name;
GST_DEBUG_OBJECT (self, "pad %s added %" GST_PTR_FORMAT,
GST_PAD_NAME (new_pad), GST_PAD_CAPS (new_pad));
name = gst_pad_get_name (new_pad);
if (g_str_has_prefix (name, "recv_rtp_src_"))
{
guint session_id, ssrc, pt;
if (sscanf (name, "recv_rtp_src_%u_%u_%u",
&session_id, &ssrc, &pt) == 3 && ssrc <= G_MAXUINT32)
{
FsRtpSession *session =
fs_rtp_conference_get_session_by_id (self, session_id);
if (session)
{
fs_rtp_session_new_recv_pad (session, new_pad, ssrc, pt);
g_object_unref (session);
}
}
}
g_free (name);
}
示例14: 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);
}
示例15: gst_vdp_mpeg_dec_alloc_buffer
static GstFlowReturn
gst_vdp_mpeg_dec_alloc_buffer (GstVdpMpegDec * mpeg_dec, GstBuffer ** outbuf)
{
GstFlowReturn ret;
ret = gst_pad_alloc_buffer_and_set_caps (mpeg_dec->src, 0, 0,
GST_PAD_CAPS (mpeg_dec->src), outbuf);
if (ret != GST_FLOW_OK)
return ret;
if (!mpeg_dec->device) {
GstVdpDevice *device;
VdpStatus status;
device = mpeg_dec->device =
g_object_ref (GST_VDP_VIDEO_BUFFER (*outbuf)->device);
status = device->vdp_decoder_create (device->device, mpeg_dec->profile,
mpeg_dec->width, mpeg_dec->height, 2, &mpeg_dec->decoder);
if (status != VDP_STATUS_OK) {
GST_ELEMENT_ERROR (mpeg_dec, RESOURCE, READ,
("Could not create vdpau decoder"),
("Error returned from vdpau was: %s",
device->vdp_get_error_string (status)));
ret = GST_FLOW_ERROR;
}
}
return ret;
}