本文整理汇总了C++中GST_BUFFER_IS_DISCONT函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_BUFFER_IS_DISCONT函数的具体用法?C++ GST_BUFFER_IS_DISCONT怎么用?C++ GST_BUFFER_IS_DISCONT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_BUFFER_IS_DISCONT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_throttle_chain
/* chain function
* this function does the actual processing
*/
static GstFlowReturn gst_throttle_chain(GstPad * pad, GstBuffer * buf)
{
GstThrottle * filter = GST_THROTTLE(GST_OBJECT_PARENT(pad));
if (filter->printOnly)
{
GstCaps * caps = gst_buffer_get_caps(buf);
gchar * capsStr = gst_caps_to_string(caps);
gst_caps_unref(caps);
GST_LOG_OBJECT(filter, "ts: %" GST_TIME_FORMAT " %sof type %s",
GST_TIME_ARGS(buf->timestamp),
GST_BUFFER_IS_DISCONT(buf) ? "and discontinuity " : "",
capsStr
);
g_free(capsStr);
GstFlowReturn ret = gst_pad_push(filter->srcpad, buf);
GST_TRACE_OBJECT(filter, "ts: %" GST_TIME_FORMAT " processed with status %d", GST_TIME_ARGS(buf->timestamp), ret);
return ret;
}
if (filter->clock == NULL)
{
return gst_pad_push(filter->srcpad, buf);
}
GstClockTime realTs = gst_clock_get_time(filter->clock);
if (filter->haveStartTime)
{
const char * discont = GST_BUFFER_IS_DISCONT(buf) ? " with discotinuity" : "";
GstClockTime expectedRealTs = filter->streamStartRealTime + buf->timestamp;
gboolean early = realTs < expectedRealTs;
if (early)
{
GstClockID * cid = gst_clock_new_single_shot_id(filter->clock, expectedRealTs);
GST_TRACE_OBJECT(filter, "ts: %" GST_TIME_FORMAT " %s, waiting for %ld ms", GST_TIME_ARGS(buf->timestamp), discont, (expectedRealTs - realTs)/1000000);
gst_clock_id_wait(cid, NULL);
gst_clock_id_unref(cid);
}
else
{
GST_TRACE_OBJECT(filter, "ts: %" GST_TIME_FORMAT " %s, pad on time", GST_TIME_ARGS(buf->timestamp), discont);
}
}
else
{
filter->streamStartRealTime = realTs - buf->timestamp;
filter->haveStartTime = TRUE;
}
return gst_pad_push(filter->srcpad, buf);
}
示例2: gst_rtp_mp4v_depay_process
static GstBuffer *
gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
{
GstRtpMP4VDepay *rtpmp4vdepay;
GstBuffer *pbuf, *outbuf = NULL;
GstRTPBuffer rtp = { NULL };
gboolean marker;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf))
gst_adapter_clear (rtpmp4vdepay->adapter);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
pbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
gst_rtp_buffer_unmap (&rtp);
gst_adapter_push (rtpmp4vdepay->adapter, pbuf);
/* if this was the last packet of the VOP, create and push a buffer */
if (marker) {
guint avail;
avail = gst_adapter_available (rtpmp4vdepay->adapter);
outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail);
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
}
return outbuf;
}
示例3: gst_wavpack_parse_chain
static GstFlowReturn
gst_wavpack_parse_chain (GstPad * pad, GstBuffer * buf)
{
GstWavpackParse *wvparse = GST_WAVPACK_PARSE (GST_PAD_PARENT (pad));
GstFlowReturn ret = GST_FLOW_OK;
WavpackHeader wph;
const guint8 *tmp_buf;
if (!wvparse->adapter) {
wvparse->adapter = gst_adapter_new ();
}
if (GST_BUFFER_IS_DISCONT (buf)) {
gst_adapter_clear (wvparse->adapter);
wvparse->discont = TRUE;
}
gst_adapter_push (wvparse->adapter, buf);
if (gst_adapter_available (wvparse->adapter) < sizeof (WavpackHeader))
return ret;
if (!gst_wavpack_parse_resync_adapter (wvparse->adapter))
return ret;
tmp_buf = gst_adapter_peek (wvparse->adapter, sizeof (WavpackHeader));
gst_wavpack_read_header (&wph, (guint8 *) tmp_buf);
while (gst_adapter_available (wvparse->adapter) >= wph.ckSize + 4 * 1 + 4) {
GstBuffer *outbuf =
gst_adapter_take_buffer (wvparse->adapter, wph.ckSize + 4 * 1 + 4);
if (!outbuf)
return GST_FLOW_ERROR;
if (wvparse->srcpad == NULL) {
if (!gst_wavpack_parse_create_src_pad (wvparse, outbuf, &wph)) {
GST_ERROR_OBJECT (wvparse, "Failed to create src pad");
ret = GST_FLOW_ERROR;
break;
}
}
ret = gst_wavpack_parse_push_buffer (wvparse, outbuf, &wph);
if (ret != GST_FLOW_OK)
break;
if (gst_adapter_available (wvparse->adapter) >= sizeof (WavpackHeader)) {
tmp_buf = gst_adapter_peek (wvparse->adapter, sizeof (WavpackHeader));
if (!gst_wavpack_parse_resync_adapter (wvparse->adapter))
break;
gst_wavpack_read_header (&wph, (guint8 *) tmp_buf);
}
}
return ret;
}
示例4: gst_fluid_dec_chain
static GstFlowReturn
gst_fluid_dec_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buffer)
{
GstFlowReturn res = GST_FLOW_OK;
GstFluidDec *fluiddec;
GstClockTime pts;
fluiddec = GST_FLUID_DEC (parent);
if (GST_BUFFER_IS_DISCONT (buffer)) {
fluiddec->discont = TRUE;
}
pts = GST_BUFFER_PTS (buffer);
if (pts != GST_CLOCK_TIME_NONE) {
guint64 sample =
gst_util_uint64_scale_int (pts, FLUID_DEC_RATE, GST_SECOND);
if (fluiddec->last_pts == GST_CLOCK_TIME_NONE) {
fluiddec->last_pts = pts;
fluiddec->last_sample = sample;
} else if (fluiddec->last_pts < pts) {
/* generate samples for the elapsed time */
res = produce_samples (fluiddec, pts, sample);
}
}
if (res == GST_FLOW_OK) {
handle_buffer (fluiddec, buffer);
}
gst_buffer_unref (buffer);
return res;
}
示例5: gst_rdt_depay_chain
static GstFlowReturn
gst_rdt_depay_chain (GstPad * pad, GstBuffer * buf)
{
GstRDTDepay *rdtdepay;
GstFlowReturn ret;
GstClockTime timestamp;
gboolean more;
GstRDTPacket packet;
rdtdepay = GST_RDT_DEPAY (GST_PAD_PARENT (pad));
if (GST_BUFFER_IS_DISCONT (buf)) {
GST_LOG_OBJECT (rdtdepay, "received discont");
rdtdepay->discont = TRUE;
}
if (rdtdepay->header) {
GstBuffer *out;
out = rdtdepay->header;
rdtdepay->header = NULL;
/* push header data first */
ret = gst_rdt_depay_push (rdtdepay, out);
}
/* save timestamp */
timestamp = GST_BUFFER_TIMESTAMP (buf);
ret = GST_FLOW_OK;
GST_LOG_OBJECT (rdtdepay, "received buffer timestamp %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
/* data is in RDT format. */
more = gst_rdt_buffer_get_first_packet (buf, &packet);
while (more) {
GstRDTType type;
type = gst_rdt_packet_get_type (&packet);
GST_DEBUG_OBJECT (rdtdepay, "Have packet of type %04x", type);
if (GST_RDT_IS_DATA_TYPE (type)) {
GST_DEBUG_OBJECT (rdtdepay, "We have a data packet");
ret = gst_rdt_depay_handle_data (rdtdepay, timestamp, &packet);
} else {
switch (type) {
default:
GST_DEBUG_OBJECT (rdtdepay, "Ignoring packet");
break;
}
}
if (ret != GST_FLOW_OK)
break;
more = gst_rdt_packet_move_to_next (&packet);
}
return ret;
}
示例6: lose_and_recover_test
static void
lose_and_recover_test (GstHarness * h, guint16 lost_seq,
gconstpointer recbuf, gsize recbuf_size)
{
guint64 duration = 222222;
guint64 timestamp = 111111;
GstBuffer *bufout;
push_lost_event (h, lost_seq, timestamp, duration, FALSE);
bufout = gst_harness_pull (h);
fail_unless_equals_int (gst_buffer_get_size (bufout), recbuf_size);
fail_unless_equals_int (GST_BUFFER_PTS (bufout), timestamp);
fail_unless (gst_buffer_memcmp (bufout, 0, recbuf, recbuf_size) == 0);
fail_unless (!GST_BUFFER_FLAG_IS_SET (bufout, GST_RTP_BUFFER_FLAG_REDUNDANT));
gst_buffer_unref (bufout);
/* Pushing the next buffer with discont flag set */
bufout = gst_buffer_new ();
GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_FLAG_DISCONT);
bufout = gst_harness_push_and_pull (h, bufout);
/* Checking the flag was unset */
fail_unless (!GST_BUFFER_IS_DISCONT (bufout));
gst_buffer_unref (bufout);
}
示例7: gst_rtp_mp4v_depay_process
static GstBuffer *
gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstRtpMP4VDepay *rtpmp4vdepay;
GstBuffer *outbuf;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf))
gst_adapter_clear (rtpmp4vdepay->adapter);
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
gst_adapter_push (rtpmp4vdepay->adapter, outbuf);
/* if this was the last packet of the VOP, create and push a buffer */
if (gst_rtp_buffer_get_marker (buf)) {
guint avail;
avail = gst_adapter_available (rtpmp4vdepay->adapter);
outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail);
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
return outbuf;
}
return NULL;
}
示例8: test_discont_stream_instance
/* this tests that the output is a correct discontinuous stream
* if the input is; ie input drops in time come out the same way */
static void
test_discont_stream_instance (int inrate, int outrate, int samples,
int numbuffers)
{
GstElement *audioresample;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
GstClockTime ints;
int i, j;
gint16 *p;
audioresample = setup_audioresample (2, inrate, outrate);
caps = gst_pad_get_negotiated_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
for (j = 1; j <= numbuffers; ++j) {
inbuffer = gst_buffer_new_and_alloc (samples * 4);
GST_BUFFER_DURATION (inbuffer) = samples * GST_SECOND / inrate;
/* "drop" half the buffers */
ints = GST_BUFFER_DURATION (inbuffer) * 2 * (j - 1);
GST_BUFFER_TIMESTAMP (inbuffer) = ints;
GST_BUFFER_OFFSET (inbuffer) = (j - 1) * 2 * samples;
GST_BUFFER_OFFSET_END (inbuffer) = j * 2 * samples + samples;
gst_buffer_set_caps (inbuffer, caps);
p = (gint16 *) GST_BUFFER_DATA (inbuffer);
/* create a 16 bit signed ramp */
for (i = 0; i < samples; ++i) {
*p = -32767 + i * (65535 / samples);
++p;
*p = -32767 + i * (65535 / samples);
++p;
}
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* check if the timestamp of the pushed buffer matches the incoming one */
outbuffer = g_list_nth_data (buffers, g_list_length (buffers) - 1);
fail_if (outbuffer == NULL);
fail_unless_equals_uint64 (ints, GST_BUFFER_TIMESTAMP (outbuffer));
if (j > 1) {
fail_unless (GST_BUFFER_IS_DISCONT (outbuffer),
"expected discont buffer");
}
}
/* cleanup */
gst_caps_unref (caps);
cleanup_audioresample (audioresample);
}
示例9: GetDeliveryBuffer
HRESULT COutputPin::DeliverSample(GstBuffer *pBuffer)
{
HRESULT hr = S_OK;
IMediaSample *pSample = NULL;
REFERENCE_TIME start = -1;
REFERENCE_TIME stop = -1;
hr = m_pAlloc->SetGstBuffer(pBuffer);
if (FAILED(hr))
return hr;
hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0);
if (FAILED(hr))
return hr;
// Set media time
pSample->SetMediaTime(NULL, NULL);
// Set time
if (GST_BUFFER_TIMESTAMP_IS_VALID(pBuffer))
{
start = GST_BUFFER_TIMESTAMP(pBuffer) / 100;
if (GST_BUFFER_DURATION_IS_VALID(pBuffer))
{
stop = (GST_BUFFER_TIMESTAMP(pBuffer) + GST_BUFFER_DURATION(pBuffer)) / 100;
}
else
{
stop = start + 1;
}
if (stop <= start) // Sometimes it may happen
stop = start + 1;
pSample->SetTime(&start, &stop);
}
else
{
pSample->SetTime(NULL, NULL);
}
if (GST_BUFFER_IS_DISCONT(pBuffer))
pSample->SetDiscontinuity(TRUE);
hr = Deliver(pSample);
pSample->Release();
if (FAILED(hr))
return hr;
return S_OK;
}
示例10: gst_rtp_mpv_pay_handle_buffer
static GstFlowReturn
gst_rtp_mpv_pay_handle_buffer (GstRTPBasePayload * basepayload,
GstBuffer * buffer)
{
GstRTPMPVPay *rtpmpvpay;
guint avail, packet_len;
GstClockTime timestamp, duration;
GstFlowReturn ret = GST_FLOW_OK;
rtpmpvpay = GST_RTP_MPV_PAY (basepayload);
timestamp = GST_BUFFER_TIMESTAMP (buffer);
duration = GST_BUFFER_DURATION (buffer);
if (GST_BUFFER_IS_DISCONT (buffer)) {
GST_DEBUG_OBJECT (rtpmpvpay, "DISCONT");
gst_rtp_mpv_pay_reset (rtpmpvpay);
}
avail = gst_adapter_available (rtpmpvpay->adapter);
if (duration == -1)
duration = 0;
if (rtpmpvpay->first_ts == GST_CLOCK_TIME_NONE || avail == 0)
rtpmpvpay->first_ts = timestamp;
if (avail == 0) {
rtpmpvpay->duration = duration;
} else {
rtpmpvpay->duration += duration;
}
gst_adapter_push (rtpmpvpay->adapter, buffer);
avail = gst_adapter_available (rtpmpvpay->adapter);
/* get packet length of previous data and this new data,
* payload length includes a 4 byte MPEG video-specific header */
packet_len = gst_rtp_buffer_calc_packet_len (avail, 4, 0);
GST_LOG_OBJECT (rtpmpvpay, "available %d, rtp packet length %d", avail,
packet_len);
if (gst_rtp_base_payload_is_filled (basepayload,
packet_len, rtpmpvpay->duration)) {
ret = gst_rtp_mpv_pay_flush (rtpmpvpay);
} else {
rtpmpvpay->first_ts = timestamp;
}
return ret;
}
示例11: gst_rtp_mpa_pay_handle_buffer
static GstFlowReturn
gst_rtp_mpa_pay_handle_buffer (GstRTPBasePayload * basepayload,
GstBuffer * buffer)
{
GstRtpMPAPay *rtpmpapay;
GstFlowReturn ret;
guint size, avail;
guint packet_len;
GstClockTime duration, timestamp;
rtpmpapay = GST_RTP_MPA_PAY (basepayload);
size = gst_buffer_get_size (buffer);
duration = GST_BUFFER_DURATION (buffer);
timestamp = GST_BUFFER_PTS (buffer);
if (GST_BUFFER_IS_DISCONT (buffer)) {
GST_DEBUG_OBJECT (rtpmpapay, "DISCONT");
gst_rtp_mpa_pay_reset (rtpmpapay);
}
avail = gst_adapter_available (rtpmpapay->adapter);
/* get packet length of previous data and this new data,
* payload length includes a 4 byte header */
packet_len = gst_rtp_buffer_calc_packet_len (4 + avail + size, 0, 0);
/* if this buffer is going to overflow the packet, flush what we
* have. */
if (gst_rtp_base_payload_is_filled (basepayload,
packet_len, rtpmpapay->duration + duration)) {
ret = gst_rtp_mpa_pay_flush (rtpmpapay);
avail = 0;
} else {
ret = GST_FLOW_OK;
}
if (avail == 0) {
GST_DEBUG_OBJECT (rtpmpapay,
"first packet, save timestamp %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
rtpmpapay->first_ts = timestamp;
rtpmpapay->duration = 0;
}
gst_adapter_push (rtpmpapay->adapter, buffer);
rtpmpapay->duration = duration;
return ret;
}
示例12: gst_smart_encoder_chain
static GstFlowReturn
gst_smart_encoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstSmartEncoder *smart_encoder;
GstFlowReturn res = GST_FLOW_OK;
gboolean discont, keyframe;
smart_encoder = GST_SMART_ENCODER (parent);
discont = GST_BUFFER_IS_DISCONT (buf);
keyframe = !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
GST_DEBUG ("New buffer %s %s %" GST_TIME_FORMAT,
discont ? "discont" : "",
keyframe ? "keyframe" : "", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
if (keyframe) {
GST_DEBUG ("Got a keyframe");
/* If there's a pending GOP, flush it out */
if (smart_encoder->pending_gop) {
/* Mark gop_stop */
smart_encoder->gop_stop = GST_BUFFER_TIMESTAMP (buf);
/* flush pending */
res = gst_smart_encoder_push_pending_gop (smart_encoder);
if (G_UNLIKELY (res != GST_FLOW_OK))
goto beach;
}
/* Mark gop_start for new gop */
smart_encoder->gop_start = GST_BUFFER_TIMESTAMP (buf);
}
/* Store buffer */
smart_encoder->pending_gop = g_list_append (smart_encoder->pending_gop, buf);
/* Update GOP stop position */
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
smart_encoder->gop_stop = GST_BUFFER_TIMESTAMP (buf);
if (GST_BUFFER_DURATION_IS_VALID (buf))
smart_encoder->gop_stop += GST_BUFFER_DURATION (buf);
}
GST_DEBUG ("Buffer stored , Current GOP : %" GST_TIME_FORMAT " -- %"
GST_TIME_FORMAT, GST_TIME_ARGS (smart_encoder->gop_start),
GST_TIME_ARGS (smart_encoder->gop_stop));
beach:
return res;
}
示例13: gst_rtp_mp4g_pay_handle_buffer
/* we expect buffers as exactly one complete AU
*/
static GstFlowReturn
gst_rtp_mp4g_pay_handle_buffer (GstRTPBasePayload * basepayload,
GstBuffer * buffer)
{
GstRtpMP4GPay *rtpmp4gpay;
rtpmp4gpay = GST_RTP_MP4G_PAY (basepayload);
rtpmp4gpay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
rtpmp4gpay->first_duration = GST_BUFFER_DURATION (buffer);
rtpmp4gpay->discont = GST_BUFFER_IS_DISCONT (buffer);
/* we always encode and flush a full AU */
gst_adapter_push (rtpmp4gpay->adapter, buffer);
return gst_rtp_mp4g_pay_flush (rtpmp4gpay);
}
示例14: opus_dec_chain
static GstFlowReturn
opus_dec_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn res;
GstOpusDec *dec;
dec = GST_OPUS_DEC (gst_pad_get_parent (pad));
if (GST_BUFFER_IS_DISCONT (buf)) {
dec->discont = TRUE;
}
res = opus_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
GST_BUFFER_DURATION (buf));
//done:
dec->packetno++;
gst_buffer_unref (buf);
gst_object_unref (dec);
return res;
}
示例15: gst_rdt_manager_chain_rdt
static GstFlowReturn
gst_rdt_manager_chain_rdt (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{
GstFlowReturn res;
GstRDTManager *rdtmanager;
GstRDTManagerSession *session;
GstClockTime timestamp;
GstRDTPacket packet;
guint32 ssrc;
guint8 pt;
gboolean more;
rdtmanager = GST_RDT_MANAGER (parent);
GST_DEBUG_OBJECT (rdtmanager, "got RDT packet");
ssrc = 0;
pt = 0;
GST_DEBUG_OBJECT (rdtmanager, "SSRC %08x, PT %d", ssrc, pt);
/* find session */
session = gst_pad_get_element_private (pad);
/* see if we have the pad */
if (!session->active) {
activate_session (rdtmanager, session, ssrc, pt);
session->active = TRUE;
}
if (GST_BUFFER_IS_DISCONT (buffer)) {
GST_DEBUG_OBJECT (rdtmanager, "received discont");
session->discont = TRUE;
}
res = GST_FLOW_OK;
/* take the timestamp of the buffer. This is the time when the packet was
* received and is used to calculate jitter and clock skew. We will adjust
* this timestamp with the smoothed value after processing it in the
* jitterbuffer. */
timestamp = GST_BUFFER_TIMESTAMP (buffer);
/* bring to running time */
timestamp = gst_segment_to_running_time (&session->segment, GST_FORMAT_TIME,
timestamp);
more = gst_rdt_buffer_get_first_packet (buffer, &packet);
while (more) {
GstRDTType type;
type = gst_rdt_packet_get_type (&packet);
GST_DEBUG_OBJECT (rdtmanager, "Have packet of type %04x", type);
if (GST_RDT_IS_DATA_TYPE (type)) {
GST_DEBUG_OBJECT (rdtmanager, "We have a data packet");
res = gst_rdt_manager_handle_data_packet (session, timestamp, &packet);
} else {
switch (type) {
default:
GST_DEBUG_OBJECT (rdtmanager, "Ignoring packet");
break;
}
}
if (res != GST_FLOW_OK)
break;
more = gst_rdt_packet_move_to_next (&packet);
}
gst_buffer_unref (buffer);
return res;
}