本文整理汇总了C++中GST_APP_SINK函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_APP_SINK函数的具体用法?C++ GST_APP_SINK怎么用?C++ GST_APP_SINK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_APP_SINK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gst_app_sink_is_eos
bool ofGstUtils::getIsMovieDone(){
if(isAppSink){
return gst_app_sink_is_eos(GST_APP_SINK(gstSink));
}else{
return bIsMovieDone;
}
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:7,代码来源:ofGstUtils.cpp
示例2: create_pipeline
static gboolean create_pipeline(SpiceGstDecoder *decoder)
{
gchar *desc;
gboolean auto_enabled;
guint opt;
GstAppSinkCallbacks appsink_cbs = { NULL };
GError *err = NULL;
GstBus *bus;
auto_enabled = (g_getenv("SPICE_GSTVIDEO_AUTO") != NULL);
if (auto_enabled || !VALID_VIDEO_CODEC_TYPE(decoder->base.codec_type)) {
SPICE_DEBUG("Trying %s for codec type %d %s",
gst_opts[0].dec_name, decoder->base.codec_type,
(auto_enabled) ? "(SPICE_GSTVIDEO_AUTO is set)" : "");
opt = 0;
} else {
opt = decoder->base.codec_type;
}
/* - We schedule the frame display ourselves so set sync=false on appsink
* so the pipeline decodes them as fast as possible. This will also
* minimize the risk of frames getting lost when we rebuild the
* pipeline.
* - Set max-bytes=0 on appsrc so it does not drop frames that may be
* needed by those that follow.
*/
desc = g_strdup_printf("appsrc name=src is-live=true format=time max-bytes=0 block=true "
"%s ! %s ! videoconvert ! appsink name=sink "
"caps=video/x-raw,format=BGRx sync=false drop=false",
gst_opts[opt].dec_caps, gst_opts[opt].dec_name);
SPICE_DEBUG("GStreamer pipeline: %s", desc);
decoder->pipeline = gst_parse_launch_full(desc, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &err);
g_free(desc);
if (!decoder->pipeline) {
spice_warning("GStreamer error: %s", err->message);
g_clear_error(&err);
return FALSE;
}
decoder->appsrc = GST_APP_SRC(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "src"));
decoder->appsink = GST_APP_SINK(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "sink"));
appsink_cbs.new_sample = new_sample;
gst_app_sink_set_callbacks(decoder->appsink, &appsink_cbs, decoder, NULL);
bus = gst_pipeline_get_bus(GST_PIPELINE(decoder->pipeline));
gst_bus_add_watch(bus, handle_pipeline_message, decoder);
gst_object_unref(bus);
decoder->clock = gst_pipeline_get_clock(GST_PIPELINE(decoder->pipeline));
if (gst_element_set_state(decoder->pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
SPICE_DEBUG("GStreamer error: Unable to set the pipeline to the playing state.");
free_pipeline(decoder);
return FALSE;
}
return TRUE;
}
开发者ID:fgouget,项目名称:spice-gtk,代码行数:59,代码来源:channel-display-gst.c
示例3: gst_app_sink_pull_buffer
GstFlowReturn GStreamerWrapper::onNewBufferFromAudioSource( GstAppSink* appsink, void* listener )
{
GstBuffer* gstAudioSinkBuffer = gst_app_sink_pull_buffer( GST_APP_SINK( appsink ) );
( ( GStreamerWrapper * )listener )->newAudioSinkBufferCallback( gstAudioSinkBuffer );
gst_buffer_unref( gstAudioSinkBuffer );
return GST_FLOW_OK;
}
开发者ID:brucelane,项目名称:_2RealGStreamerWrapper,代码行数:8,代码来源:_2RealGStreamerWrapper.cpp
示例4: gst_app_sink_pull_preroll
GstFlowReturn GStreamerWrapper::onNewPrerollFromVideoSource( GstAppSink* appsink, void* listener )
{
GstBuffer* gstVideoSinkBuffer = gst_app_sink_pull_preroll( GST_APP_SINK( appsink ) );
( ( GStreamerWrapper *)listener )->newVideoSinkPrerollCallback( gstVideoSinkBuffer );
gst_buffer_unref( gstVideoSinkBuffer );
return GST_FLOW_OK;
}
开发者ID:brucelane,项目名称:_2RealGStreamerWrapper,代码行数:8,代码来源:_2RealGStreamerWrapper.cpp
示例5: gst_app_sink_render_common
static GstFlowReturn
gst_app_sink_render_common (GstBaseSink * psink, GstMiniObject * data,
gboolean is_list)
{
GstAppSink *appsink = GST_APP_SINK (psink);
gboolean emit;
g_mutex_lock (appsink->priv->mutex);
if (appsink->priv->flushing)
goto flushing;
GST_DEBUG_OBJECT (appsink, "pushing render buffer%s %p on queue (%d)",
is_list ? " list" : "", data, appsink->priv->queue->length);
while (appsink->priv->max_buffers > 0 &&
appsink->priv->queue->length >= appsink->priv->max_buffers) {
if (appsink->priv->drop) {
GstMiniObject *obj;
/* we need to drop the oldest buffer/list and try again */
obj = g_queue_pop_head (appsink->priv->queue);
GST_DEBUG_OBJECT (appsink, "dropping old buffer/list %p", obj);
gst_mini_object_unref (obj);
} else {
GST_DEBUG_OBJECT (appsink, "waiting for free space, length %d >= %d",
appsink->priv->queue->length, appsink->priv->max_buffers);
/* wait for a buffer to be removed or flush */
g_cond_wait (appsink->priv->cond, appsink->priv->mutex);
if (appsink->priv->flushing)
goto flushing;
}
}
/* we need to ref the buffer when pushing it in the queue */
g_queue_push_tail (appsink->priv->queue, gst_mini_object_ref (data));
g_cond_signal (appsink->priv->cond);
emit = appsink->priv->emit_signals;
g_mutex_unlock (appsink->priv->mutex);
if (is_list) {
if (appsink->priv->callbacks.new_buffer_list)
appsink->priv->callbacks.new_buffer_list (appsink,
appsink->priv->user_data);
} else {
if (appsink->priv->callbacks.new_buffer)
appsink->priv->callbacks.new_buffer (appsink, appsink->priv->user_data);
else if (emit)
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_BUFFER], 0);
}
return GST_FLOW_OK;
flushing:
{
GST_DEBUG_OBJECT (appsink, "we are flushing");
g_mutex_unlock (appsink->priv->mutex);
return GST_FLOW_WRONG_STATE;
}
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:57,代码来源:gstappsink.c
示例6: on_new_preroll_from_source
static GstFlowReturn on_new_preroll_from_source (GstAppSink * elt, void * data){
#if GST_VERSION_MAJOR==0
GstBuffer *buffer;
#else
GstSample *buffer;
#endif
buffer = gst_app_sink_pull_preroll(GST_APP_SINK (elt));
return ((ofGstUtils*)data)->preroll_cb(buffer);
}
开发者ID:AsmaM,项目名称:openFrameworks,代码行数:9,代码来源:ofGstUtils.cpp
示例7: Initialize
void GstAppSinkPipeline::Initialize(std::string pipelineString)
{
GstPipelineWrapper::InitializePipelineWithString(pipelineString);
// setup appsink
appsink = GstPipelineWrapper::GetElementByName(APPSINK_NAME);
GstAppSinkCallbacks appsinkCallbacks;
appsinkCallbacks.new_preroll = &GstAppSinkPipeline::NewPrerollCallback;
appsinkCallbacks.new_sample = &GstAppSinkPipeline::NewSampleCallback;
appsinkCallbacks.eos = &GstAppSinkPipeline::EndOfStreamCallback;
// std::cout << pipelineString << std::endl;
gst_app_sink_set_drop (GST_APP_SINK(appsink), true);
gst_app_sink_set_max_buffers (GST_APP_SINK(appsink), 1);
//gst_app_sink_set_emit_signals (GST_APP_SINK(appsink), true);
gst_app_sink_set_callbacks (GST_APP_SINK(appsink), &appsinkCallbacks, this, (GDestroyNotify)GstAppSinkPipeline::DestroyCallback);
}
开发者ID:Samsung,项目名称:kv2streamer,代码行数:18,代码来源:GstAppSinkPipeline.cpp
示例8: createElement
GstElement *MediaPlayer::createVideoSink()
{
GstElement * sink = createElement("appsink", "videosink");
if ( !sink )
return 0;
// Set the caps - so far we only want our image to be RGB
GstCaps *sinkCaps = gst_caps_new_simple( "video/x-raw", "format", G_TYPE_STRING, "BGRA", NULL );
gst_app_sink_set_caps( GST_APP_SINK( sink ), sinkCaps );
gst_caps_unref(sinkCaps);
// Set up the callbacks
GstAppSinkCallbacks callbacks = { 0, 0, 0, 0, 0 };
callbacks.new_sample = cb_new_sample;
gst_app_sink_set_callbacks( GST_APP_SINK(sink), &callbacks, this, NULL );
return sink;
}
开发者ID:renielcanlas,项目名称:spivak,代码行数:19,代码来源:mediaplayer.cpp
示例9: gst_buffer_unref
//
// start the pipeline, grab a buffer, and pause again
//
bool CvCapture_GStreamer::grabFrame()
{
if(!pipeline)
return false;
if(gst_app_sink_is_eos(GST_APP_SINK(sink)))
return false;
if(buffer)
gst_buffer_unref(buffer);
handleMessage();
buffer = gst_app_sink_pull_buffer(GST_APP_SINK(sink));
if(!buffer)
return false;
return true;
}
开发者ID:hksonngan,项目名称:neocortex,代码行数:22,代码来源:cap_gstreamer.cpp
示例10: gst_app_sink_finalize
static void
gst_app_sink_finalize (GObject * obj)
{
GstAppSink *appsink = GST_APP_SINK (obj);
g_mutex_free (appsink->priv->mutex);
g_cond_free (appsink->priv->cond);
g_queue_free (appsink->priv->queue);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:11,代码来源:gstappsink.c
示例11: gst_app_sink_pull_sample
GstFlowReturn MediaImpl::gstNewSampleCallback(GstElement*, MediaImpl *p)
{
GstSample *sample;
sample = gst_app_sink_pull_sample(GST_APP_SINK(p->_videoSink));
//g_signal_emit_by_name (p->_videoSink, "pull-sample", &sample);
p->get_queue_input_buf()->put(sample);
if (p->get_queue_output_buf()->size() > 1) {
sample = p->get_queue_output_buf()->get();
gst_sample_unref(sample);
}
return GST_FLOW_OK;
}
开发者ID:MatiasDelera,项目名称:mapmap,代码行数:12,代码来源:MediaImpl.cpp
示例12: gst_app_sink_start
static gboolean
gst_app_sink_start (GstBaseSink * psink)
{
GstAppSink *appsink = GST_APP_SINK (psink);
g_mutex_lock (appsink->priv->mutex);
GST_DEBUG_OBJECT (appsink, "starting");
appsink->priv->started = TRUE;
g_mutex_unlock (appsink->priv->mutex);
return TRUE;
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:12,代码来源:gstappsink.c
示例13: gst_caps_make_writable
/*!
* \brief OpenIMAJCapGStreamer::removeFilter
* \param filter filter to remove
* remove the specified filter from the appsink template caps
*/
void OpenIMAJCapGStreamer::removeFilter(const char *filter)
{
if(!caps)
return;
if (! gst_caps_is_writable(caps))
caps = gst_caps_make_writable (caps);
GstStructure *s = gst_caps_get_structure(caps, 0);
gst_structure_remove_field(s, filter);
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
}
开发者ID:Garfield2005,项目名称:openimaj,代码行数:18,代码来源:OpenIMAJ_GStreamer.cpp
示例14: gst_app_sink_unlock_stop
static gboolean
gst_app_sink_unlock_stop (GstBaseSink * bsink)
{
GstAppSink *appsink = GST_APP_SINK (bsink);
g_mutex_lock (appsink->priv->mutex);
GST_DEBUG_OBJECT (appsink, "unlock stop");
appsink->priv->flushing = FALSE;
g_cond_signal (appsink->priv->cond);
g_mutex_unlock (appsink->priv->mutex);
return TRUE;
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:13,代码来源:gstappsink.c
示例15: gst_app_sink_stop
static gboolean
gst_app_sink_stop (GstBaseSink * psink)
{
GstAppSink *appsink = GST_APP_SINK (psink);
g_mutex_lock (appsink->priv->mutex);
GST_DEBUG_OBJECT (appsink, "stopping");
appsink->priv->flushing = TRUE;
appsink->priv->started = FALSE;
gst_app_sink_flush_unlocked (appsink);
g_mutex_unlock (appsink->priv->mutex);
return TRUE;
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:14,代码来源:gstappsink.c
示例16: gstHandleMessage
void ofGstUtils::update(){
gstHandleMessage();
if (bLoaded == true){
if(!bFrameByFrame){
ofGstDataLock(&gstData);
bHavePixelsChanged = gstData.bHavePixelsChanged;
if (bHavePixelsChanged){
gstData.bHavePixelsChanged=false;
bIsMovieDone = false;
memcpy(pixels,gstData.pixels,width*height*bpp);
}
ofGstDataUnlock(&gstData);
}else{
GstBuffer *buffer;
//get the buffer from appsink
if(bPaused) buffer = gst_app_sink_pull_preroll (GST_APP_SINK (gstSink));
else buffer = gst_app_sink_pull_buffer (GST_APP_SINK (gstSink));
if(buffer){
guint size = GST_BUFFER_SIZE (buffer);
if(pixels){
memcpy (pixels, GST_BUFFER_DATA (buffer), size);
bHavePixelsChanged=true;
}
/// we don't need the appsink buffer anymore
gst_buffer_unref (buffer);
}
}
}
bIsFrameNew = bHavePixelsChanged;
bHavePixelsChanged = false;
}
开发者ID:6301158,项目名称:SmileFile,代码行数:36,代码来源:ofGstUtils.cpp
示例17: gst_app_sink_pull_buffer
void CGstDecoder::OnDecodedBuffer(GstElement *appsink, void *data)
{
CGstDecoder *decoder = (CGstDecoder *)data;
GstBuffer *buffer = gst_app_sink_pull_buffer(GST_APP_SINK(appsink));
if (buffer)
{
if (decoder->m_callback)
decoder->m_callback->OnDecodedBuffer(buffer);
else
gst_buffer_unref(buffer);
}
else
printf("GStreamer: OnDecodedBuffer - Null Buffer\n");
}
开发者ID:megacoder,项目名称:xbmc,代码行数:15,代码来源:GstDecoder.cpp
示例18: gst_app_sink_getcaps
static GstCaps *
gst_app_sink_getcaps (GstBaseSink * psink)
{
GstCaps *caps;
GstAppSink *appsink = GST_APP_SINK (psink);
GST_OBJECT_LOCK (appsink);
if ((caps = appsink->priv->caps))
gst_caps_ref (caps);
GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
GST_OBJECT_UNLOCK (appsink);
return caps;
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:15,代码来源:gstappsink.c
示例19: gst_app_sink_pull_buffer
void ofGstVideoUtils::update(){
if (isLoaded()){
if(!isFrameByFrame()){
mutex.lock();
bHavePixelsChanged = bBackPixelsChanged;
if (bHavePixelsChanged){
bBackPixelsChanged=false;
pixels.swap(backPixels);
if(prevBuffer) gst_buffer_unref (prevBuffer);
prevBuffer = buffer;
}
mutex.unlock();
}else{
GstBuffer *buffer;
//get the buffer from appsink
if(isPaused()) buffer = gst_app_sink_pull_preroll (GST_APP_SINK (getSink()));
else buffer = gst_app_sink_pull_buffer (GST_APP_SINK (getSink()));
if(buffer){
if(pixels.isAllocated()){
if(prevBuffer) gst_buffer_unref (prevBuffer);
//memcpy (pixels.getPixels(), GST_BUFFER_DATA (buffer), size);
pixels.setFromExternalPixels(GST_BUFFER_DATA (buffer),pixels.getWidth(),pixels.getHeight(),pixels.getNumChannels());
prevBuffer = buffer;
bHavePixelsChanged=true;
}
}
}
}else{
ofLog(OF_LOG_WARNING,"ofGstVideoUtils not loaded");
}
bIsFrameNew = bHavePixelsChanged;
bHavePixelsChanged = false;
}
开发者ID:CNCBASHER,项目名称:openFrameworks,代码行数:36,代码来源:ofGstUtils.cpp
示例20: gst_caps_make_writable
/*!
* \brief CvCapture_GStreamer::removeFilter
* \param filter filter to remove
* remove the specified filter from the appsink template caps
*/
void CvCapture_GStreamer::removeFilter(const char *filter)
{
if(!caps)
return;
#if GST_VERSION_MAJOR > 0
if (! gst_caps_is_writable(caps))
caps = gst_caps_make_writable (caps);
#endif
GstStructure *s = gst_caps_get_structure(caps, 0);
gst_structure_remove_field(s, filter);
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
}
开发者ID:KristofWyffels,项目名称:opencv,代码行数:20,代码来源:cap_gstreamer.cpp
注:本文中的GST_APP_SINK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论