您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GST_OBJECT函数代码示例

51自学网 2021-06-01 20:56:43
  C++
这篇教程C++ GST_OBJECT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GST_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_OBJECT函数的具体用法?C++ GST_OBJECT怎么用?C++ GST_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GST_OBJECT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: music_destroy_pipeline

void music_destroy_pipeline(struct music_rtp_pipeline *pipe){	gst_object_unref(GST_OBJECT(pipe->pipeline));}
开发者ID:drv5455,项目名称:sdes_music,代码行数:4,


示例2: main

int main(int argc, char *argv[]){	GstElement *pipeline;  	GstElement *src, *colorspace, *codec, *wrapper, *netsink;  	gboolean status;  	GstCaps *capsRaw;  	gchar *params;  	FILE *lf;	int width, height;	/* Initialize GStreamer */	gst_init (&argc, &argv);	loop = g_main_loop_new(NULL, FALSE);	/* Create pipeline */	pipeline = gst_pipeline_new("truba");	//src = gst_element_factory_make("videotestsrc", "src");	src = gst_element_factory_make("appsrc", "src");	colorspace = gst_element_factory_make("ffmpegcolorspace", "colorspaceconverter");	codec = gst_element_factory_make(CODEC, "codec");	wrapper = gst_element_factory_make("rtph264pay", "wrapper");	netsink = gst_element_factory_make("udpsink", "netsink");		if (NULL == getenv("VIT_WIDTH")) {		width = IMWIDTH;	}	else {		width = atoi(getenv("VIT_WIDTH"));	}	if (NULL == getenv("VIT_HEIGHT")) {		height = IMHEIGHT;	}	else {		height = atoi(getenv("VIT_HEIGHT"));	}	/* Set up pipeline */	capsRaw = gst_caps_new_simple(	"video/x-raw-gray",					"bpp", G_TYPE_INT, 8,					"depth", G_TYPE_INT, 8,					"width", G_TYPE_INT, width,					"height", G_TYPE_INT, height,					"framerate", GST_TYPE_FRACTION, 25, 1,					NULL);	g_signal_connect(src, "need-data", G_CALLBACK(cb_need_data), NULL);	g_object_set(G_OBJECT(src), "caps", capsRaw, NULL);	g_object_set(G_OBJECT(src), "stream-type", 0, "format",		         GST_FORMAT_TIME, NULL);	if (NULL == getenv("VIT_HOST"))		g_object_set(G_OBJECT(netsink), "host", HOST, NULL);	else {			g_object_set(G_OBJECT(netsink), "host", getenv("VIT_HOST"), NULL);		printf("Connected to host %s/n", getenv("VIT_HOST"));	}	g_object_set(G_OBJECT(netsink), "port", PORT, NULL);	gst_bin_add_many(GST_BIN(pipeline), src, colorspace, codec, wrapper,		             netsink, NULL);	status = gst_element_link_many(src, colorspace, codec, wrapper, netsink,		                           NULL);	if(!status) {		printf("Linking elements failed!/n");	}	else {		printf("Linking elements succeed!/n");	}	params = NULL;	/* Create lock file */	lf = fopen(LOCKFILE, "w");	fprintf(lf, "%d", getpid());	fclose(lf);	/* Setup signal handler */	if (SIG_ERR == signal(SIGUSR1, _t_sigusr1))	{		printf("Failed to spoof signal handler/n");	}	//Run	gst_element_set_state(pipeline, GST_STATE_PLAYING);	g_main_loop_run (loop);	gst_element_set_state(pipeline, GST_STATE_NULL);	//Deinit	gst_object_unref(GST_OBJECT(pipeline));	g_main_loop_unref(loop);	return 0;}
开发者ID:player999,项目名称:SharedMemoryBroadcast,代码行数:91,


示例3: gst_gme_dec_src_event

static gbooleangst_gme_dec_src_event (GstPad * pad, GstObject * parent, GstEvent * event){  GstGmeDec *gme = GST_GME_DEC (parent);  gboolean result = FALSE;  switch (GST_EVENT_TYPE (event)) {    case GST_EVENT_SEEK:    {      gdouble rate;      GstFormat format;      GstSeekFlags flags;      GstSeekType start_type, stop_type;      gint64 start, stop;      gboolean flush;      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,          &stop_type, &stop);      gst_event_unref (event);      if (format != GST_FORMAT_TIME) {        GST_DEBUG_OBJECT (gme, "seeking is only supported in TIME format");        break;      }      if (start_type != GST_SEEK_TYPE_SET || stop_type != GST_SEEK_TYPE_NONE) {        GST_DEBUG_OBJECT (gme, "unsupported seek type");        break;      }      if (stop_type == GST_SEEK_TYPE_NONE)        stop = GST_CLOCK_TIME_NONE;      if (start_type == GST_SEEK_TYPE_SET) {        GstSegment seg;        guint64 cur = gme_tell (gme->player) * GST_MSECOND;        guint64 dest = (guint64) start;        if (gme->total_duration != GST_CLOCK_TIME_NONE)          dest = CLAMP (dest, 0, gme->total_duration);        else          dest = MAX (0, dest);        if (dest == cur)          break;        flush = (flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH;        if (flush) {          gst_pad_push_event (gme->srcpad, gst_event_new_flush_start ());        } else {          gst_pad_stop_task (gme->srcpad);        }        GST_PAD_STREAM_LOCK (gme->srcpad);        if (flags & GST_SEEK_FLAG_SEGMENT) {          gst_element_post_message (GST_ELEMENT (gme),              gst_message_new_segment_start (GST_OBJECT (gme), format, cur));        }        if (flush) {          gst_pad_push_event (gme->srcpad, gst_event_new_flush_stop (TRUE));        }        if (stop == GST_CLOCK_TIME_NONE            && gme->total_duration != GST_CLOCK_TIME_NONE)          stop = gme->total_duration;        gst_segment_init (&seg, GST_FORMAT_TIME);        seg.rate = rate;        seg.start = dest;        seg.stop = stop;        seg.time = dest;        gst_pad_push_event (gme->srcpad, gst_event_new_segment (&seg));        gme->seekpoint = dest / GST_MSECOND;    /* nsecs to msecs */        gme->seeking = TRUE;        gst_pad_start_task (gme->srcpad, (GstTaskFunction) gst_gme_play,            gme->srcpad, NULL);        GST_PAD_STREAM_UNLOCK (gme->srcpad);        result = TRUE;      }      break;    }    default:      result = gst_pad_push_event (gme->sinkpad, event);      break;  }  return result;}
开发者ID:GStreamer,项目名称:gst-plugins-bad,代码行数:95,


示例4: debug_dump_element

/* * debug_dump_element: * @bin: the bin that should be analyzed * @out: file to write to * @indent: level of graph indentation * * Helper for gst_debug_bin_to_dot_file() to recursively dump a pipeline. */static voiddebug_dump_element (GstBin * bin, GstDebugGraphDetails details,    GString * str, const gint indent){  GstIterator *element_iter, *pad_iter;  gboolean elements_done, pads_done;  GValue item = { 0, };  GValue item2 = { 0, };  GstElement *element;  GstPad *pad = NULL;  guint src_pads, sink_pads;  gchar *src_pad_name = NULL, *sink_pad_name = NULL;  gchar *element_name;  gchar *state_name = NULL;  gchar *param_name = NULL;  const gchar *spc = MAKE_INDENT (indent);  element_iter = gst_bin_iterate_elements (bin);  elements_done = FALSE;  while (!elements_done) {    switch (gst_iterator_next (element_iter, &item)) {      case GST_ITERATOR_OK:        element = g_value_get_object (&item);        element_name = debug_dump_make_object_name (GST_OBJECT (element));        if (details & GST_DEBUG_GRAPH_SHOW_STATES) {          state_name = debug_dump_get_element_state (GST_ELEMENT (element));        }        if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {          param_name = debug_dump_get_object_params (G_OBJECT (element),              details, NULL);        }        /* elements */        g_string_append_printf (str, "%ssubgraph cluster_%s {/n", spc,            element_name);        g_string_append_printf (str, "%s  fontname=/"Bitstream Vera Sans/";/n",            spc);        g_string_append_printf (str, "%s  fontsize=/"8/";/n", spc);        g_string_append_printf (str, "%s  style=/"filled,rounded/";/n", spc);        g_string_append_printf (str, "%s  color=black;/n", spc);        g_string_append_printf (str, "%s  label=/"%s//n%s%s%s/";/n", spc,            G_OBJECT_TYPE_NAME (element), GST_OBJECT_NAME (element),            (state_name ? state_name : ""), (param_name ? param_name : "")            );        if (state_name) {          g_free (state_name);          state_name = NULL;        }        if (param_name) {          g_free (param_name);          param_name = NULL;        }        src_pads = sink_pads = 0;        if ((pad_iter = gst_element_iterate_sink_pads (element))) {          gchar *cluster_name = g_strdup_printf ("%s_sink", element_name);          debug_dump_element_pads (pad_iter, pad, element, details, str,              indent + 1, &sink_pads, cluster_name, &sink_pad_name);          g_free (cluster_name);          gst_iterator_free (pad_iter);        }        if ((pad_iter = gst_element_iterate_src_pads (element))) {          gchar *cluster_name = g_strdup_printf ("%s_src", element_name);          debug_dump_element_pads (pad_iter, pad, element, details, str,              indent + 1, &src_pads, cluster_name, &src_pad_name);          g_free (cluster_name);          gst_iterator_free (pad_iter);        }        if (sink_pads && src_pads) {          /* add invisible link from first sink to first src pad */          g_string_append_printf (str,              "%s  %s_%s -> %s_%s [style=/"invis/"];/n",              spc, element_name, sink_pad_name, element_name, src_pad_name);        }        g_free (sink_pad_name);        g_free (src_pad_name);        g_free (element_name);        sink_pad_name = src_pad_name = NULL;        if (GST_IS_BIN (element)) {          g_string_append_printf (str, "%s  fillcolor=/"#ffffff/";/n", spc);          /* recurse */          debug_dump_element (GST_BIN (element), details, str, indent + 1);        } else {          if (src_pads && !sink_pads)            g_string_append_printf (str, "%s  fillcolor=/"#ffaaaa/";/n", spc);          else if (!src_pads && sink_pads)            g_string_append_printf (str, "%s  fillcolor=/"#aaaaff/";/n", spc);          else if (src_pads && sink_pads)            g_string_append_printf (str, "%s  fillcolor=/"#aaffaa/";/n", spc);          else            g_string_append_printf (str, "%s  fillcolor=/"#ffffff/";/n", spc);        }//.........这里部分代码省略.........
开发者ID:ndufresne,项目名称:gstreamer,代码行数:101,


示例5: debug_dump_element_pad_link

static voiddebug_dump_element_pad_link (GstPad * pad, GstElement * element,    GstDebugGraphDetails details, FILE * out, const gint indent){  GstElement *peer_element;  GstPad *peer_pad;  GstCaps *caps, *peer_caps;  gchar *media = NULL;  gchar *media_src = NULL, *media_sink = NULL;  gchar *pad_name, *element_name;  gchar *peer_pad_name, *peer_element_name;  const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)];  if ((peer_pad = gst_pad_get_peer (pad))) {    if ((details & GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE) ||        (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS)        ) {      caps = gst_pad_get_current_caps (pad);      if (!caps)        caps = gst_pad_get_pad_template_caps (pad);      peer_caps = gst_pad_get_current_caps (peer_pad);      if (!peer_caps)        peer_caps = gst_pad_get_pad_template_caps (peer_pad);      media = debug_dump_describe_caps (caps, details);      /* check if peer caps are different */      if (peer_caps && !gst_caps_is_equal (caps, peer_caps)) {        gchar *tmp;        tmp = debug_dump_describe_caps (peer_caps, details);        if (gst_pad_get_direction (pad) == GST_PAD_SRC) {          media_src = media;          media_sink = tmp;        } else {          media_src = tmp;          media_sink = media;        }        media = NULL;      }      gst_caps_unref (peer_caps);      gst_caps_unref (caps);    }    pad_name = debug_dump_make_object_name (GST_OBJECT (pad));    if (element) {      element_name = debug_dump_make_object_name (GST_OBJECT (element));    } else {      element_name = g_strdup ("");    }    peer_pad_name = debug_dump_make_object_name (GST_OBJECT (peer_pad));    if ((peer_element = gst_pad_get_parent_element (peer_pad))) {      peer_element_name =          debug_dump_make_object_name (GST_OBJECT (peer_element));    } else {      peer_element_name = g_strdup ("");    }    /* pad link */    if (media) {      fprintf (out, "%s%s_%s -> %s_%s [label=/"%s/"]/n", spc,          element_name, pad_name, peer_element_name, peer_pad_name, media);      g_free (media);    } else if (media_src && media_sink) {      /* dot has some issues with placement of head and taillabels,       * we need an empty label to make space */      fprintf (out, "%s%s_%s -> %s_%s [labeldistance=/"10/", labelangle=/"0/", "          "label=/"                                                  /", "          "taillabel=/"%s/", headlabel=/"%s/"]/n",          spc, element_name, pad_name, peer_element_name, peer_pad_name,          media_src, media_sink);      g_free (media_src);      g_free (media_sink);    } else {      fprintf (out, "%s%s_%s -> %s_%s/n", spc,          element_name, pad_name, peer_element_name, peer_pad_name);    }    g_free (pad_name);    g_free (element_name);    g_free (peer_pad_name);    g_free (peer_element_name);    if (peer_element)      gst_object_unref (peer_element);    gst_object_unref (peer_pad);  }}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:86,


示例6: vorbis_handle_comment_packet

static GstFlowReturnvorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet){  guint bitrate = 0;  gchar *encoder = NULL;  GstTagList *list, *old_list;  GstBuffer *buf;  GST_DEBUG_OBJECT (vd, "parsing comment packet");  buf = gst_buffer_new ();  GST_BUFFER_DATA (buf) = gst_ogg_packet_data (packet);  GST_BUFFER_SIZE (buf) = gst_ogg_packet_size (packet);  list =      gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "/003vorbis", 7,      &encoder);  old_list = vd->taglist;  vd->taglist = gst_tag_list_merge (vd->taglist, list, GST_TAG_MERGE_REPLACE);  if (old_list)    gst_tag_list_free (old_list);  gst_tag_list_free (list);  gst_buffer_unref (buf);  if (!vd->taglist) {    GST_ERROR_OBJECT (vd, "couldn't decode comments");    vd->taglist = gst_tag_list_new ();  }  if (encoder) {    if (encoder[0])      gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,          GST_TAG_ENCODER, encoder, NULL);    g_free (encoder);  }  gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,      GST_TAG_ENCODER_VERSION, vd->vi.version,      GST_TAG_AUDIO_CODEC, "Vorbis", NULL);  if (vd->vi.bitrate_nominal > 0 && vd->vi.bitrate_nominal <= 0x7FFFFFFF) {    gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,        GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);    bitrate = vd->vi.bitrate_nominal;  }  if (vd->vi.bitrate_upper > 0 && vd->vi.bitrate_upper <= 0x7FFFFFFF) {    gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,        GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);    if (!bitrate)      bitrate = vd->vi.bitrate_upper;  }  if (vd->vi.bitrate_lower > 0 && vd->vi.bitrate_lower <= 0x7FFFFFFF) {    gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,        GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);    if (!bitrate)      bitrate = vd->vi.bitrate_lower;  }  if (bitrate) {    gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,        GST_TAG_BITRATE, (guint) bitrate, NULL);  }  if (vd->initialized) {    gst_element_found_tags_for_pad (GST_ELEMENT_CAST (vd), vd->srcpad,        vd->taglist);    vd->taglist = NULL;  } else {    /* Only post them as messages for the time being. *     * They will be pushed on the pad once the decoder is initialized */    gst_element_post_message (GST_ELEMENT_CAST (vd),        gst_message_new_tag (GST_OBJECT (vd), gst_tag_list_copy (vd->taglist)));  }  return GST_FLOW_OK;}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:74,


示例7: debug_dump_pad

static voiddebug_dump_pad (GstPad * pad, const gchar * color_name,    const gchar * element_name, GstDebugGraphDetails details, GString * str,    const gint indent){  GstPadTemplate *pad_templ;  GstPadPresence presence;  gchar *pad_name, *param_name = NULL;  const gchar *style_name;  static const char *const ignore_propnames[] =      { "parent", "direction", "template",    "caps", NULL  };  const gchar *spc = MAKE_INDENT (indent);  pad_name = debug_dump_make_object_name (GST_OBJECT (pad));  /* pad availability */  style_name = "filled,solid";  if ((pad_templ = gst_pad_get_pad_template (pad))) {    presence = GST_PAD_TEMPLATE_PRESENCE (pad_templ);    gst_object_unref (pad_templ);    if (presence == GST_PAD_SOMETIMES) {      style_name = "filled,dotted";    } else if (presence == GST_PAD_REQUEST) {      style_name = "filled,dashed";    }  }  param_name =      debug_dump_get_object_params (G_OBJECT (pad), details, ignore_propnames);  if (details & GST_DEBUG_GRAPH_SHOW_STATES) {    gchar pad_flags[4];    const gchar *activation_mode = "-><";    const gchar *task_mode = "";    GstTask *task;    GST_OBJECT_LOCK (pad);    task = GST_PAD_TASK (pad);    if (task) {      switch (gst_task_get_state (task)) {        case GST_TASK_STARTED:          task_mode = "[T]";          break;        case GST_TASK_PAUSED:          task_mode = "[t]";          break;        default:          /* Invalid task state, ignoring */          break;      }    }    GST_OBJECT_UNLOCK (pad);    /* check if pad flags */    pad_flags[0] =        GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED) ? 'B' : 'b';    pad_flags[1] =        GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING) ? 'F' : 'f';    pad_flags[2] =        GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING) ? 'B' : 'b';    pad_flags[3] = '/0';    g_string_append_printf (str,        "%s  %s_%s [color=black, fillcolor=/"%s/", label=/"%s%s//n[%c][%s]%s/", height=/"0.2/", style=/"%s/"];/n",        spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),        (param_name ? param_name : ""),        activation_mode[pad->mode], pad_flags, task_mode, style_name);  } else {    g_string_append_printf (str,        "%s  %s_%s [color=black, fillcolor=/"%s/", label=/"%s%s/", height=/"0.2/", style=/"%s/"];/n",        spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),        (param_name ? param_name : ""), style_name);  }  g_free (param_name);  g_free (pad_name);}
开发者ID:ndufresne,项目名称:gstreamer,代码行数:78,


示例8: gst_swfdec_render

//.........这里部分代码省略.........    SwfdecBuffer *audio_buffer;    SwfdecBuffer *video_buffer;    GstBuffer *videobuf;    GstBuffer *audiobuf;    gboolean ret;    GstFlowReturn res;    const char *url;    GST_DEBUG_OBJECT (swfdec, "render:SWF_EOF");    swfdec_decoder_set_mouse (swfdec->decoder, swfdec->x, swfdec->y,        swfdec->button);    ret = swfdec_render_iterate (swfdec->decoder);    if (swfdec->decoder->using_experimental) {      GST_ELEMENT_ERROR (swfdec, LIBRARY, FAILED,          ("SWF file contains features known to trigger bugs."),          ("SWF file contains features known to trigger bugs."));      gst_task_stop (swfdec->task);    }    if (!ret) {      gst_task_stop (swfdec->task);      res = gst_pad_push_event (swfdec->videopad, gst_event_new_eos ());      res = gst_pad_push_event (swfdec->audiopad, gst_event_new_eos ());      return;    }    if (swfdec->send_discont) {      GstEvent *event;      swfdec->timestamp = swfdec_render_get_frame_index (swfdec->decoder) *          swfdec->interval;      GST_DEBUG ("sending discont %" G_GINT64_FORMAT, swfdec->timestamp);      event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,          swfdec->timestamp, GST_CLOCK_TIME_NONE, 0);      gst_pad_push_event (swfdec->videopad, event);      event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,          swfdec->timestamp, GST_CLOCK_TIME_NONE, 0);      gst_pad_push_event (swfdec->audiopad, event);      swfdec->send_discont = FALSE;    }    GST_DEBUG ("pushing image/sound %" G_GINT64_FORMAT, swfdec->timestamp);    if (swfdec->skip_index) {      video_buffer = NULL;      swfdec->skip_index--;    } else {      video_buffer = swfdec_render_get_image (swfdec->decoder);      if (!video_buffer) {        gst_task_stop (swfdec->task);        gst_pad_push_event (swfdec->videopad, gst_event_new_eos ());        gst_pad_push_event (swfdec->audiopad, gst_event_new_eos ());        return;      }      swfdec->skip_index = swfdec->skip_frames - 1;      videobuf = gst_swfdec_buffer_from_swf (video_buffer);      GST_BUFFER_TIMESTAMP (videobuf) = swfdec->timestamp;      gst_buffer_set_caps (videobuf, GST_PAD_CAPS (swfdec->videopad));      gst_pad_push (swfdec->videopad, videobuf);    }    audio_buffer = swfdec_render_get_audio (swfdec->decoder);    if (audio_buffer) {      audiobuf = gst_swfdec_buffer_from_swf (audio_buffer);      GST_BUFFER_TIMESTAMP (audiobuf) = swfdec->timestamp;      gst_buffer_set_caps (audiobuf, GST_PAD_CAPS (swfdec->audiopad));      gst_pad_push (swfdec->audiopad, audiobuf);    }    swfdec->timestamp += swfdec->interval;    url = swfdec_decoder_get_url (swfdec->decoder);    if (url) {      GstStructure *s;      GstMessage *msg;      s = gst_structure_new ("embedded-url", "url", G_TYPE_STRING, url,          "target", G_TYPE_STRING, "_self", NULL);      msg = gst_message_new_element (GST_OBJECT (swfdec), s);      gst_element_post_message (GST_ELEMENT (swfdec), msg);    }  }}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:101,


示例9: gst_object_unref

Pipeline::~Pipeline(){    gst_object_unref(GST_OBJECT(camerabin));}
开发者ID:Igalia,项目名称:aura,代码行数:4,


示例10: gst_video_rate_transform_ip

static GstFlowReturngst_video_rate_transform_ip (GstBaseTransform * trans, GstBuffer * buffer){  GstVideoRate *videorate;  GstFlowReturn res = GST_BASE_TRANSFORM_FLOW_DROPPED;  GstClockTime intime, in_ts, in_dur;  GstClockTime avg_period;  gboolean skip = FALSE;  videorate = GST_VIDEO_RATE (trans);  /* make sure the denominators are not 0 */  if (videorate->from_rate_denominator == 0 ||      videorate->to_rate_denominator == 0)    goto not_negotiated;  GST_OBJECT_LOCK (videorate);  avg_period = videorate->average_period_set;  GST_OBJECT_UNLOCK (videorate);  /* MT-safe switching between modes */  if (G_UNLIKELY (avg_period != videorate->average_period)) {    gboolean switch_mode = (avg_period == 0 || videorate->average_period == 0);    videorate->average_period = avg_period;    videorate->last_ts = GST_CLOCK_TIME_NONE;    if (switch_mode) {      if (avg_period) {        /* enabling average mode */        videorate->average = 0;        /* make sure no cached buffers from regular mode are left */        gst_video_rate_swap_prev (videorate, NULL, 0);      } else {        /* enable regular mode */        videorate->next_ts = GST_CLOCK_TIME_NONE;        skip = TRUE;      }      /* max averaging mode has a no latency, normal mode does */      gst_element_post_message (GST_ELEMENT (videorate),          gst_message_new_latency (GST_OBJECT (videorate)));    }  }  if (videorate->average_period > 0)    return gst_video_rate_trans_ip_max_avg (videorate, buffer);  in_ts = GST_BUFFER_TIMESTAMP (buffer);  in_dur = GST_BUFFER_DURATION (buffer);  if (G_UNLIKELY (in_ts == GST_CLOCK_TIME_NONE)) {    in_ts = videorate->last_ts;    if (G_UNLIKELY (in_ts == GST_CLOCK_TIME_NONE))      goto invalid_buffer;  }  /* get the time of the next expected buffer timestamp, we use this when the   * next buffer has -1 as a timestamp */  videorate->last_ts = in_ts;  if (in_dur != GST_CLOCK_TIME_NONE)    videorate->last_ts += in_dur;  GST_DEBUG_OBJECT (videorate, "got buffer with timestamp %" GST_TIME_FORMAT,      GST_TIME_ARGS (in_ts));  /* the input time is the time in the segment + all previously accumulated   * segments */  intime = in_ts + videorate->segment.base;  /* we need to have two buffers to compare */  if (videorate->prevbuf == NULL) {    gst_video_rate_swap_prev (videorate, buffer, intime);    videorate->in++;    if (!GST_CLOCK_TIME_IS_VALID (videorate->next_ts)) {      /* new buffer, we expect to output a buffer that matches the first       * timestamp in the segment */      if (videorate->skip_to_first || skip) {        videorate->next_ts = intime;        videorate->base_ts = in_ts - videorate->segment.start;        videorate->out_frame_count = 0;      } else {        videorate->next_ts = videorate->segment.start + videorate->segment.base;      }    }  } else {    GstClockTime prevtime;    gint count = 0;    gint64 diff1, diff2;    prevtime = videorate->prev_ts;    GST_LOG_OBJECT (videorate,        "BEGINNING prev buf %" GST_TIME_FORMAT " new buf %" GST_TIME_FORMAT        " outgoing ts %" GST_TIME_FORMAT, GST_TIME_ARGS (prevtime),        GST_TIME_ARGS (intime), GST_TIME_ARGS (videorate->next_ts));    videorate->in++;    /* drop new buffer if it's before previous one */    if (intime < prevtime) {//.........这里部分代码省略.........
开发者ID:enermysong,项目名称:gst-plugins-base,代码行数:101,


示例11: message_loop_to_state_change

static gbooleanmessage_loop_to_state_change (MetadataExtractor *extractor,			      GstState           state){	GstBus         *bus;	GstMessageType  events;	g_return_val_if_fail (extractor, FALSE);	g_return_val_if_fail (extractor->playbin, FALSE);	bus = gst_element_get_bus (extractor->playbin);	events = (GST_MESSAGE_TAG | GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS);	for (;;) {		GstMessage *message;		message = gst_bus_timed_pop_filtered (bus, GST_SECOND * 5, events);		if (message == NULL)			goto timed_out;		switch (GST_MESSAGE_TYPE (message)) {		case GST_MESSAGE_STATE_CHANGED: {			GstState old_state;			GstState new_state;			old_state = new_state = GST_STATE_NULL;			gst_message_parse_state_changed (message, &old_state, &new_state, NULL);			if (old_state == new_state)				break;			/* we only care about playbin (pipeline) state changes */			if (GST_MESSAGE_SRC (message) != GST_OBJECT (extractor->playbin))				break;			if ((old_state == GST_STATE_READY) && (new_state == GST_STATE_PAUSED))				update_stream_info (extractor);			else if ((old_state == GST_STATE_PAUSED) && (new_state == GST_STATE_READY))				reset_extractor_data (extractor);			if (new_state == state) {				gst_message_unref (message);				goto success;			}			break;		}		case GST_MESSAGE_TAG: {			GstTagList *tag_list;			GstTagList *result;			tag_list = NULL;			gst_message_parse_tag (message, &tag_list);			result = gst_tag_list_merge (extractor->tagcache, tag_list, GST_TAG_MERGE_KEEP);			if (extractor->tagcache != NULL)				gst_tag_list_unref (extractor->tagcache);			extractor->tagcache = result;			gst_tag_list_free (tag_list);			break;		}		case GST_MESSAGE_ERROR: {			gchar  *debug    = NULL;			GError *gsterror = NULL;			gst_message_parse_error (message, &gsterror, &debug);			/*g_warning ("Error: %s (%s)", gsterror->message, debug);*/			g_error_free (gsterror);			gst_message_unref (message);			g_free (debug);			goto error;		}			break;		case GST_MESSAGE_EOS: {			g_warning ("Media file could not be played.");			gst_message_unref (message);			goto error;		}			break;		default:			g_assert_not_reached ();			break;		}		gst_message_unref (message);	}	g_assert_not_reached (); success:	/* state change succeeded */	GST_DEBUG ("state change to %s succeeded", gst_element_state_get_name (state));//.........这里部分代码省略.........
开发者ID:cormac-w,项目名称:gthumb,代码行数:101,


示例12: build_pipeline

static voidbuild_pipeline (SjExtractor *extractor){  SjExtractorPrivate *priv;  GstBus *bus;  g_return_if_fail (SJ_IS_EXTRACTOR (extractor));  priv = extractor->priv;  if (priv->pipeline != NULL) {    gst_object_unref (GST_OBJECT (priv->pipeline));  }  priv->pipeline = gst_pipeline_new ("pipeline");  bus = gst_element_get_bus (priv->pipeline);  gst_bus_add_signal_watch (bus);  g_signal_connect (G_OBJECT (bus), "message::error", G_CALLBACK (error_cb), extractor);  /* Read from CD */  priv->cdsrc = gst_element_make_from_uri (GST_URI_SRC, "cdda://1", "cd_src", NULL);  if (priv->cdsrc == NULL) {    g_set_error (&priv->construct_error,                 SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,                 _("Could not create GStreamer CD reader"));    return;  }  g_object_set (G_OBJECT (priv->cdsrc), "device", priv->device_path, NULL);  if (g_object_class_find_property (G_OBJECT_GET_CLASS (priv->cdsrc), "paranoia-mode")) {	  g_object_set (G_OBJECT (priv->cdsrc), "paranoia-mode", priv->paranoia_mode, NULL);  }  /* Get the track format for seeking later */  priv->track_format = gst_format_get_by_nick ("track");  g_assert (priv->track_format != 0);  /* Encode */  priv->encodebin = build_encoder (extractor);  if (priv->encodebin == NULL) {    g_set_error (&priv->construct_error,                 SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,                 _("Could not create GStreamer encoders for %s"),                 gst_encoding_profile_get_name (priv->profile));    return;  }  /* Connect to the eos so we know when its finished */  g_signal_connect (bus, "message::eos", G_CALLBACK (eos_cb), extractor);  /* Write to disk */  priv->filesink = gst_element_factory_make (FILE_SINK, "file_sink");  if (priv->filesink == NULL) {    g_set_error (&priv->construct_error,                 SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,                 _("Could not create GStreamer file output"));    return;  }#if 0  g_signal_connect (G_OBJECT (priv->filesink), "allow-overwrite", G_CALLBACK (just_say_yes), extractor);#endif  /* Add the elements to the pipeline */  gst_bin_add_many (GST_BIN (priv->pipeline), priv->cdsrc, priv->encodebin, priv->filesink, NULL);  /* Link it all together */  if (!gst_element_link_many (priv->cdsrc, priv->encodebin, priv->filesink, NULL)) {    g_set_error (&priv->construct_error,                 SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,                 _("Could not link pipeline"));    return;  }  priv->rebuild_pipeline = FALSE;}
开发者ID:Salamandar,项目名称:sound-juicer,代码行数:74,


示例13: main

gintmain (gint argc, gchar ** argv){  GstElement *pipeline;  GstElement *shapewipe;  GstControlSource *cs;  GMainLoop *loop;  GstBus *bus;  gchar *pipeline_string;  gfloat border = 0.05;  if (argc < 2) {    g_print ("Usage: shapewipe mask.png <border>/n");    return -1;  }  gst_init (&argc, &argv);  if (argc > 2) {    border = atof (argv[2]);  }  pipeline_string =      g_strdup_printf      ("videotestsrc ! video/x-raw,format=(string)AYUV,width=640,height=480 ! shapewipe name=shape border=%f ! videomixer name=mixer ! videoconvert ! autovideosink     filesrc location=%s ! typefind ! decodebin2 ! videoconvert ! videoscale ! queue ! shape.mask_sink    videotestsrc pattern=snow ! video/x-raw,format=(string)AYUV,width=640,height=480 ! queue ! mixer.",      border, argv[1]);  pipeline = gst_parse_launch (pipeline_string, NULL);  g_free (pipeline_string);  if (pipeline == NULL) {    g_print ("Failed to create pipeline/n");    return -2;  }  shapewipe = gst_bin_get_by_name (GST_BIN (pipeline), "shape");  cs = gst_lfo_control_source_new ();  gst_object_add_control_binding (GST_OBJECT_CAST (shapewipe),      gst_direct_control_binding_new (GST_OBJECT_CAST (shapewipe), "position",          cs));  g_object_set (cs,      "amplitude", 0.5,      "offset", 0.5, "frequency", 0.25, "timeshift", 500 * GST_MSECOND, NULL);  g_object_unref (cs);  loop = g_main_loop_new (NULL, FALSE);  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));  gst_bus_add_signal_watch (bus);  g_signal_connect (G_OBJECT (bus), "message", G_CALLBACK (on_message), loop);  gst_object_unref (GST_OBJECT (bus));  if (gst_element_set_state (pipeline,          GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {    g_error ("Failed to go into PLAYING state");    return -4;  }  g_main_loop_run (loop);  gst_element_set_state (pipeline, GST_STATE_NULL);  g_main_loop_unref (loop);  gst_object_unref (G_OBJECT (pipeline));  return 0;}
开发者ID:Lachann,项目名称:gst-plugins-good,代码行数:72,


示例14: gst_element_post_message

void PlaybackPipeline::notifyDurationChanged(){    gst_element_post_message(GST_ELEMENT(m_webKitMediaSrc.get()), gst_message_new_duration_changed(GST_OBJECT(m_webKitMediaSrc.get())));    // WebKitMediaSrc will ask MediaPlayerPrivateGStreamerMSE for the new duration later, when somebody asks for it.}
开发者ID:caiolima,项目名称:webkit,代码行数:5,


示例15: gst_visual_gl_change_state

static GstStateChangeReturngst_visual_gl_change_state (GstElement * element, GstStateChange transition){  GstVisualGL *visual = GST_VISUAL_GL (element);  GstStateChangeReturn ret;  switch (transition) {    case GST_STATE_CHANGE_NULL_TO_READY:      break;    case GST_STATE_CHANGE_READY_TO_PAUSED:    {      GstElement *parent = GST_ELEMENT (gst_element_get_parent (visual));      GstStructure *structure = NULL;      GstQuery *query = NULL;      gboolean isPerformed = FALSE;      gchar *name;      if (!parent) {        GST_ELEMENT_ERROR (visual, CORE, STATE_CHANGE, (NULL),            ("A parent bin is required"));        return FALSE;      }      name = gst_element_get_name (visual);      structure = gst_structure_new (name, NULL);      query = gst_query_new_application (GST_QUERY_CUSTOM, structure);      g_free (name);      isPerformed = gst_element_query (parent, query);      if (isPerformed) {        const GValue *id_value =            gst_structure_get_value (structure, "gstgldisplay");        if (G_VALUE_HOLDS_POINTER (id_value))          /* at least one gl element is after in our gl chain */          visual->display =              gst_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));        else {          /* this gl filter is a sink in terms of the gl chain */          visual->display = gst_gl_display_new ();          gst_gl_display_create_context (visual->display, 0);          //TODO visual->external_gl_context);        }        gst_visual_gl_reset (visual);        visual->actor =            visual_actor_new (GST_VISUAL_GL_GET_CLASS (visual)->plugin->info->            plugname);        visual->video = visual_video_new ();        visual->audio = visual_audio_new ();        if (!visual->actor || !visual->video)          goto actor_setup_failed;        gst_gl_display_thread_add (visual->display,            (GstGLDisplayThreadFunc) actor_setup, visual);        if (visual->actor_setup_result != 0)          goto actor_setup_failed;        else          visual_actor_set_video (visual->actor, visual->video);      }      gst_query_unref (query);      gst_object_unref (GST_OBJECT (parent));      if (!isPerformed)        return GST_STATE_CHANGE_FAILURE;    }      break;    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:      break;    default:      break;  }  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);  switch (transition) {    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:      break;    case GST_STATE_CHANGE_PAUSED_TO_READY:    {      if (visual->fbo) {        gst_gl_display_del_fbo (visual->display, visual->fbo,            visual->depthbuffer);        visual->fbo = 0;        visual->depthbuffer = 0;      }      if (visual->midtexture) {        gst_gl_display_del_texture (visual->display, visual->midtexture,            visual->width, visual->height);        visual->midtexture = 0;      }      if (visual->display) {        gst_object_unref (visual->display);        visual->display = NULL;      }//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:gst-plugins-bad,代码行数:101,


示例16: gst_segment_init

//.........这里部分代码省略.........    g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);    g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_),                 nullptr);  }  // Create a pad on the outside of the audiobin and connect it to the pad of  // the first element.  GstPad* pad = gst_element_get_static_pad(queue_, "sink");  gst_element_add_pad(audiobin_, gst_ghost_pad_new("sink", pad));  gst_object_unref(pad);  // Add a data probe on the src pad of the audioconvert element for our scope.  // We do it here because we want pre-equalized and pre-volume samples  // so that our visualization are not be affected by them.  pad = gst_element_get_static_pad(event_probe, "src");  gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,                    &EventHandoffCallback, this, NULL);  gst_object_unref(pad);  // Configure the fakesink properly  g_object_set(G_OBJECT(probe_sink), "sync", TRUE, nullptr);  // Setting the equalizer bands:  //  // GStreamer's GstIirEqualizerNBands sets up shelve filters for the first and  // last bands as corner cases. That was causing the "inverted slider" bug.  // As a workaround, we create two dummy bands at both ends of the spectrum.  // This causes the actual first and last adjustable bands to be  // implemented using band-pass filters.  g_object_set(G_OBJECT(equalizer_), "num-bands", 10 + 2, nullptr);  // Dummy first band (bandwidth 0, cutting below 20Hz):  GstObject* first_band = GST_OBJECT(      gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), 0));  g_object_set(G_OBJECT(first_band), "freq", 20.0, "bandwidth", 0, "gain", 0.0f,               nullptr);  g_object_unref(G_OBJECT(first_band));  // Dummy last band (bandwidth 0, cutting over 20KHz):  GstObject* last_band = GST_OBJECT(gst_child_proxy_get_child_by_index(      GST_CHILD_PROXY(equalizer_), kEqBandCount + 1));  g_object_set(G_OBJECT(last_band), "freq", 20000.0, "bandwidth", 0, "gain",               0.0f, nullptr);  g_object_unref(G_OBJECT(last_band));  int last_band_frequency = 0;  for (int i = 0; i < kEqBandCount; ++i) {    const int index_in_eq = i + 1;    GstObject* band = GST_OBJECT(gst_child_proxy_get_child_by_index(        GST_CHILD_PROXY(equalizer_), index_in_eq));    const float frequency = kEqBandFrequencies[i];    const float bandwidth = frequency - last_band_frequency;    last_band_frequency = frequency;    g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth,                 "gain", 0.0f, nullptr);    g_object_unref(G_OBJECT(band));  }  // Set the stereo balance.  g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_,               nullptr);  // Set the buffer duration.  We set this on this queue instead of the
开发者ID:selumin,项目名称:Clementine,代码行数:67,


示例17: main

intmain (int   argc,      char *argv[]){  GMainLoop *loop;  GstElement *pipeline, *source, *demuxer, *parser, *decoder, *conv, *sink;  GstBus *bus;  guint bus_watch_id;  /* Initialisation */  gst_init (&argc, &argv);  loop = g_main_loop_new (NULL, FALSE);  /* Check input arguments */  if (argc != 2) {    g_printerr ("Usage: %s <AVI filename>/n", argv[0]);    return -1;  }  /* Create gstreamer elements */  pipeline = gst_pipeline_new ("avi-player");  source   = gst_element_factory_make ("filesrc",       "file-source");  demuxer  = gst_element_factory_make ("avidemux",      "a.i-demuxer");  parser   = gst_element_factory_make ("h264parse",     "h264-parser");  decoder  = gst_element_factory_make ("avdec_h264",    "h264-decoder");  conv     = gst_element_factory_make ("videoconvert",  "converter");  sink     = gst_element_factory_make ("sdlvideosink",  "video-output");  if (!pipeline || !source || !demuxer || !parser || !decoder || !conv || !sink) {    g_printerr ("One element could not be created. Exiting./n");    return -1;  }  /* Set up the pipeline */  /* we set the input filename to the source element */  g_object_set (G_OBJECT (source), "location", argv[1], NULL);  /* we add a message handler */  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));  bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);  gst_object_unref (bus);  /* we add all elements into the pipeline */  /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */  gst_bin_add_many (GST_BIN (pipeline),                    source, demuxer, parser, decoder, conv, sink, NULL);  /* we link the elements together */  /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */  gst_element_link (source, demuxer);  gst_element_link_many (parser, decoder, conv, sink, NULL);  g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), parser);  /* note that the demuxer will be linked to the decoder dynamically.     The reason is that Ogg may contain various streams (for example     audio and video). The source pad(s) will be created at run time,     by the demuxer when it detects the amount and nature of streams.     Therefore we connect a callback function which will be executed     when the "pad-added" is emitted.*/  /* Set the pipeline to "playing" state*/  g_print ("Now playing: %s/n", argv[1]);  gst_element_set_state (pipeline, GST_STATE_PLAYING);  /* Iterate */  g_print ("Running.../n");  g_main_loop_run (loop);  /* Out of the main loop, clean up nicely */  g_print ("Returned, stopping playback/n");  gst_element_set_state (pipeline, GST_STATE_NULL);  g_print ("Deleting pipeline/n");  gst_object_unref (GST_OBJECT (pipeline));  g_source_remove (bus_watch_id);  g_main_loop_unref (loop);  return 0;}
开发者ID:stillwuyan,项目名称:SP2R,代码行数:87,


示例18: gstbt_audio_synth_create

//.........这里部分代码省略.........    } else {      partial_buffer = ((src->n_samples_stop < src->n_samples) &&          (src->n_samples_stop >= src->n_samples - samples_per_buffer));    }  }  if (G_UNLIKELY (partial_buffer)) {    /* calculate only partial buffer */    if (!src->reverse) {      src->generate_samples_per_buffer =          (guint) (src->n_samples_stop - src->n_samples);      ticktime = src->stop_time - src->running_time;    } else {      src->generate_samples_per_buffer =          (guint) (src->n_samples - src->n_samples_stop);      ticktime = src->running_time - src->stop_time;    }    if (G_UNLIKELY (!src->generate_samples_per_buffer)) {      GST_WARNING_OBJECT (src, "0 samples left -> EOS reached");      src->eos_reached = TRUE;      return GST_FLOW_EOS;    }    n_samples = src->n_samples_stop;    src->eos_reached = TRUE;    GST_INFO_OBJECT (src, "partial buffer: %u, ticktime: %" GST_TIME_FORMAT,        src->generate_samples_per_buffer, GST_TIME_ARGS (ticktime));  } else {    /* calculate full buffer */    src->generate_samples_per_buffer = samples_per_buffer;    n_samples =        src->n_samples +        (src->reverse ? (-samples_per_buffer) : samples_per_buffer);    ticktime = src->ticktime;  }  next_running_time =      src->running_time + (src->reverse ? (-ticktime) : ticktime);  src->ticktime_err_accum =      src->ticktime_err_accum +      (src->reverse ? (-src->ticktime_err) : src->ticktime_err);  res = GST_BASE_SRC_GET_CLASS (basesrc)->alloc (basesrc, src->n_samples,      gstbt_audio_synth_calculate_buffer_size (src), &buf);  if (G_UNLIKELY (res != GST_FLOW_OK)) {    return res;  }  if (!src->reverse) {    GST_BUFFER_TIMESTAMP (buf) =        src->running_time + (GstClockTime) src->ticktime_err_accum;    GST_BUFFER_DURATION (buf) = next_running_time - src->running_time;    GST_BUFFER_OFFSET (buf) = src->n_samples;    GST_BUFFER_OFFSET_END (buf) = n_samples;  } else {    GST_BUFFER_TIMESTAMP (buf) =        next_running_time + (GstClockTime) src->ticktime_err_accum;    GST_BUFFER_DURATION (buf) = src->running_time - next_running_time;    GST_BUFFER_OFFSET (buf) = n_samples;    GST_BUFFER_OFFSET_END (buf) = src->n_samples;  }  if (src->subtick_count >= src->subticks_per_beat) {    src->subtick_count = 1;  } else {    src->subtick_count++;  }  if (src->discont) {    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);    if (klass->reset) {      klass->reset (src);    }    src->discont = FALSE;  }  gst_object_sync_values (GST_OBJECT (src), GST_BUFFER_TIMESTAMP (buf));  GST_DEBUG_OBJECT (src, "generate_samples %6u, offset %12" G_GUINT64_FORMAT      ", offset_end %12" G_GUINT64_FORMAT " timestamp %" GST_TIME_FORMAT      ", duration %" GST_TIME_FORMAT, src->generate_samples_per_buffer,      GST_BUFFER_OFFSET (buf),      GST_BUFFER_OFFSET_END (buf),      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),      GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));  src->running_time = next_running_time;  src->n_samples = n_samples;  if (gst_buffer_map (buf, &info, GST_MAP_WRITE)) {    if (!klass->process (src, buf, &info)) {      memset (info.data, 0, info.size);      GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_GAP);    }    gst_buffer_unmap (buf, &info);  } else {    GST_WARNING_OBJECT (src, "unable to map buffer for write");  }  *buffer = buf;  return GST_FLOW_OK;}
开发者ID:Buzztrax,项目名称:buzztrax,代码行数:101,


示例19: debug_dump_element_pad

static voiddebug_dump_element_pad (GstPad * pad, GstElement * element,    GstDebugGraphDetails details, GString * str, const gint indent){  GstElement *target_element;  GstPad *target_pad, *tmp_pad;  GstPadDirection dir;  gchar *element_name;  gchar *target_element_name;  const gchar *color_name;  dir = gst_pad_get_direction (pad);  element_name = debug_dump_make_object_name (GST_OBJECT (element));  if (GST_IS_GHOST_PAD (pad)) {    color_name =        (dir == GST_PAD_SRC) ? "#ffdddd" : ((dir ==            GST_PAD_SINK) ? "#ddddff" : "#ffffff");    /* output target-pad so that it belongs to this element */    if ((tmp_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad)))) {      if ((target_pad = gst_pad_get_peer (tmp_pad))) {        gchar *pad_name, *target_pad_name;        const gchar *spc = MAKE_INDENT (indent);        if ((target_element = gst_pad_get_parent_element (target_pad))) {          target_element_name =              debug_dump_make_object_name (GST_OBJECT (target_element));        } else {          target_element_name = g_strdup ("");        }        debug_dump_pad (target_pad, color_name, target_element_name, details,            str, indent);        /* src ghostpad relationship */        pad_name = debug_dump_make_object_name (GST_OBJECT (pad));        target_pad_name = debug_dump_make_object_name (GST_OBJECT (target_pad));        if (dir == GST_PAD_SRC) {          g_string_append_printf (str,              "%s%s_%s -> %s_%s [style=dashed, minlen=0]/n", spc,              target_element_name, target_pad_name, element_name, pad_name);        } else {          g_string_append_printf (str,              "%s%s_%s -> %s_%s [style=dashed, minlen=0]/n", spc,              element_name, pad_name, target_element_name, target_pad_name);        }        g_free (target_pad_name);        g_free (target_element_name);        if (target_element)          gst_object_unref (target_element);        gst_object_unref (target_pad);        g_free (pad_name);      }      gst_object_unref (tmp_pad);    }  } else {    color_name =        (dir == GST_PAD_SRC) ? "#ffaaaa" : ((dir ==            GST_PAD_SINK) ? "#aaaaff" : "#cccccc");  }  /* pads */  debug_dump_pad (pad, color_name, element_name, details, str, indent);  g_free (element_name);}
开发者ID:ndufresne,项目名称:gstreamer,代码行数:61,


示例20: gst_imx_blitter_video_transform_change_state

static GstStateChangeReturn gst_imx_blitter_video_transform_change_state(GstElement *element, GstStateChange transition){	GstImxBlitterVideoTransform *blitter_video_transform = GST_IMX_BLITTER_VIDEO_TRANSFORM(element);	GstImxBlitterVideoTransformClass *klass = GST_IMX_BLITTER_VIDEO_TRANSFORM_CLASS(G_OBJECT_GET_CLASS(element));	GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;	g_assert(blitter_video_transform != NULL);	switch (transition)	{		case GST_STATE_CHANGE_NULL_TO_READY:		{			GST_IMX_BLITTER_VIDEO_TRANSFORM_LOCK(blitter_video_transform);			blitter_video_transform->initialized = TRUE;			if ((klass->start != NULL) && !(klass->start(blitter_video_transform)))			{				GST_ERROR_OBJECT(blitter_video_transform, "start() failed");				blitter_video_transform->initialized = FALSE;				GST_IMX_BLITTER_VIDEO_TRANSFORM_UNLOCK(blitter_video_transform);				return GST_STATE_CHANGE_FAILURE;			}			if (!gst_imx_blitter_video_transform_acquire_blitter(blitter_video_transform))			{				GST_ERROR_OBJECT(blitter_video_transform, "acquiring blitter failed");				GST_IMX_BLITTER_VIDEO_TRANSFORM_UNLOCK(blitter_video_transform);				return GST_STATE_CHANGE_FAILURE;			}			GST_IMX_BLITTER_VIDEO_TRANSFORM_UNLOCK(blitter_video_transform);			break;		}		default:			break;	}	ret = GST_ELEMENT_CLASS(gst_imx_blitter_video_transform_parent_class)->change_state(element, transition);	if (ret == GST_STATE_CHANGE_FAILURE)		return ret;	switch (transition)	{		case GST_STATE_CHANGE_PAUSED_TO_READY:		{			GST_IMX_BLITTER_VIDEO_TRANSFORM_LOCK(blitter_video_transform);			blitter_video_transform->last_frame_with_cropdata = FALSE;			GST_IMX_BLITTER_VIDEO_TRANSFORM_UNLOCK(blitter_video_transform);			break;		}		case GST_STATE_CHANGE_READY_TO_NULL:		{			GST_IMX_BLITTER_VIDEO_TRANSFORM_LOCK(blitter_video_transform);			blitter_video_transform->initialized = FALSE;			if ((klass->stop != NULL) && !(klass->stop(blitter_video_transform)))				GST_ERROR_OBJECT(blitter_video_transform, "stop() failed");			if (blitter_video_transform->blitter != NULL)			{				gst_object_unref(GST_OBJECT(blitter_video_transform->blitter));				blitter_video_transform->blitter = NULL;			}			GST_IMX_BLITTER_VIDEO_TRANSFORM_UNLOCK(blitter_video_transform);			break;		}		default:			break;	}	return ret;}
开发者ID:gale320,项目名称:gstreamer-imx,代码行数:80,


示例21: _buid_pipeline

static GstElement_buid_pipeline(gchar *filename, Ecore_Pipe *pipe){   GstElement *pipeline;   GstElement *filesrc;   GstElement *demuxer;   GstElement *decoder;   GstElement *sink;   GstStateChangeReturn res;   pipeline = gst_pipeline_new("pipeline");   if (!pipeline)     return NULL;   filesrc = gst_element_factory_make("filesrc", "filesrc");   if (!filesrc)     {        printf("no filesrc");        goto failure;     }   g_object_set(G_OBJECT(filesrc), "location", filename, NULL);   demuxer = gst_element_factory_make("oggdemux", "demuxer");   if (!demuxer)     {        printf("no demux");        goto failure;     }   decoder = gst_element_factory_make("theoradec", "decoder");   if (!decoder)     {        printf("no dec");        goto failure;     }   g_signal_connect(demuxer, "pad-added",                    G_CALLBACK(new_decoded_pad_cb), decoder);   sink = gst_element_factory_make("fakesink", "sink");   if (!sink)     {        printf("no sink");        goto failure;     }   g_object_set(G_OBJECT(sink), "sync", EINA_TRUE, NULL);   g_object_set(G_OBJECT(sink), "signal-handoffs", EINA_TRUE, NULL);   g_signal_connect(sink, "handoff",                    G_CALLBACK(handoff), pipe);   gst_bin_add_many(GST_BIN(pipeline),                    filesrc, demuxer, decoder, sink, NULL);   if (!gst_element_link(filesrc, demuxer))     goto failure;   if (!gst_element_link(decoder, sink))     goto failure;   res = gst_element_set_state(pipeline, GST_STATE_PAUSED);   if (res == GST_STATE_CHANGE_FAILURE)     goto failure;   res = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);   if (res != GST_STATE_CHANGE_SUCCESS)     goto failure;   return pipeline;failure:   gst_object_unref(GST_OBJECT(pipeline));   return NULL;}
开发者ID:Limsik,项目名称:e17,代码行数:72,


示例22: gst_timidity_loop

//.........这里部分代码省略.........    /* extract tags */    text = mid_song_get_meta (timidity->song, MID_SONG_TEXT);    if (text) {      tags = gst_tag_list_new ();      gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_TITLE, text, NULL);      //g_free (text);    }    text = mid_song_get_meta (timidity->song, MID_SONG_COPYRIGHT);    if (text) {      if (tags == NULL)        tags = gst_tag_list_new ();      gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,          GST_TAG_COPYRIGHT, text, NULL);      //g_free (text);    }    if (tags) {      gst_element_found_tags (GST_ELEMENT (timidity), tags);    }    GST_DEBUG_OBJECT (timidity, "Parsing song done");    return;  }  if (timidity->o_segment_changed) {    GstSegment *segment = gst_timidity_get_segment (timidity, GST_FORMAT_TIME,        !timidity->o_new_segment);    GST_LOG_OBJECT (timidity,        "sending newsegment from %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT        ", pos=%" GST_TIME_FORMAT, GST_TIME_ARGS ((guint64) segment->start),        GST_TIME_ARGS ((guint64) segment->stop),        GST_TIME_ARGS ((guint64) segment->time));    if (timidity->o_segment->flags & GST_SEEK_FLAG_SEGMENT) {      gst_element_post_message (GST_ELEMENT (timidity),          gst_message_new_segment_start (GST_OBJECT (timidity),              segment->format, segment->start));    }    gst_segment_free (segment);    timidity->o_segment_changed = FALSE;    return;  }  if (timidity->o_seek) {    /* perform a seek internally */    timidity->o_segment->last_stop = timidity->o_segment->time;    mid_song_seek (timidity->song,        (timidity->o_segment->last_stop * timidity->time_per_frame) /        GST_MSECOND);  }  out = gst_timidity_get_buffer (timidity);  if (!out) {    GST_LOG_OBJECT (timidity, "Song ended, generating eos");    gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());    timidity->o_seek = FALSE;    goto paused;  }  if (timidity->o_seek) {    GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT);    timidity->o_seek = FALSE;  }  gst_buffer_set_caps (out, timidity->out_caps);  ret = gst_pad_push (timidity->srcpad, out);  if (ret == GST_FLOW_UNEXPECTED)    goto eos;  else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED)    goto error;  return;paused:  {    GST_DEBUG_OBJECT (timidity, "pausing task");    gst_pad_pause_task (timidity->sinkpad);    return;  }eos:  {    gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());    goto paused;  }error:  {    GST_ELEMENT_ERROR (timidity, STREAM, FAILED,        ("Internal data stream error"),        ("Streaming stopped, reason %s", gst_flow_get_name (ret)));    gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());    goto paused;  }}
开发者ID:Haifen,项目名称:gst-plugins-bad,代码行数:101,


示例23: debug_dump_element

/* * debug_dump_element: * @bin: the bin that should be analyzed * @out: file to write to * @indent: level of graph indentation * * Helper for gst_debug_bin_to_dot_file() to recursively dump a pipeline. */static voiddebug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out,    const gint indent){  GstIterator *element_iter, *pad_iter;  gboolean elements_done, pads_done;  GValue item = { 0, };  GValue item2 = { 0, };  GstElement *element;  GstPad *pad = NULL;  guint src_pads, sink_pads;  gchar *element_name;  gchar *state_name = NULL;  gchar *param_name = NULL;  const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)];  element_iter = gst_bin_iterate_elements (bin);  elements_done = FALSE;  while (!elements_done) {    switch (gst_iterator_next (element_iter, &item)) {      case GST_ITERATOR_OK:        element = g_value_get_object (&item);        element_name = debug_dump_make_object_name (GST_OBJECT (element));        if (details & GST_DEBUG_GRAPH_SHOW_STATES) {          state_name = debug_dump_get_element_state (GST_ELEMENT (element));        }        if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {          param_name = debug_dump_get_element_params (GST_ELEMENT (element));        }        /* elements */        fprintf (out, "%ssubgraph cluster_%s {/n", spc, element_name);        fprintf (out, "%s  fontname=/"Bitstream Vera Sans/";/n", spc);        fprintf (out, "%s  fontsize=/"8/";/n", spc);        fprintf (out, "%s  style=filled;/n", spc);        fprintf (out, "%s  color=black;/n/n", spc);        fprintf (out, "%s  label=/"%s//n%s%s%s/";/n", spc,            G_OBJECT_TYPE_NAME (element), GST_OBJECT_NAME (element),            (state_name ? state_name : ""), (param_name ? param_name : "")            );        if (state_name) {          g_free (state_name);          state_name = NULL;        }        if (param_name) {          g_free (param_name);          param_name = NULL;        }        g_free (element_name);        src_pads = sink_pads = 0;        if ((pad_iter = gst_element_iterate_sink_pads (element))) {          debug_dump_element_pads (pad_iter, pad, element, details, out, indent,              &src_pads, &sink_pads);          gst_iterator_free (pad_iter);        }        if ((pad_iter = gst_element_iterate_src_pads (element))) {          debug_dump_element_pads (pad_iter, pad, element, details, out, indent,              &src_pads, &sink_pads);          gst_iterator_free (pad_iter);        }        if (GST_IS_BIN (element)) {          fprintf (out, "%s  fillcolor=/"#ffffff/";/n", spc);          /* recurse */          debug_dump_element (GST_BIN (element), details, out, indent + 1);        } else {          if (src_pads && !sink_pads)            fprintf (out, "%s  fillcolor=/"#ffaaaa/";/n", spc);          else if (!src_pads && sink_pads)            fprintf (out, "%s  fillcolor=/"#aaaaff/";/n", spc);          else if (src_pads && sink_pads)            fprintf (out, "%s  fillcolor=/"#aaffaa/";/n", spc);          else            fprintf (out, "%s  fillcolor=/"#ffffff/";/n", spc);        }        fprintf (out, "%s}/n/n", spc);        if ((pad_iter = gst_element_iterate_pads (element))) {          pads_done = FALSE;          while (!pads_done) {            switch (gst_iterator_next (pad_iter, &item2)) {              case GST_ITERATOR_OK:                pad = g_value_get_object (&item2);                if (gst_pad_is_linked (pad)) {                  if (gst_pad_get_direction (pad) == GST_PAD_SRC) {                    debug_dump_element_pad_link (pad, element, details, out,                        indent);                  } else {                    GstPad *peer_pad = gst_pad_get_peer (pad);                    if (peer_pad) {                      if (!GST_IS_GHOST_PAD (peer_pad)                          && GST_IS_PROXY_PAD (peer_pad)) {//.........这里部分代码省略.........
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:101,


示例24: gst_real_audio_demux_loop

//.........这里部分代码省略.........    case REAL_AUDIO_DEMUX_STATE_DATA:      if (demux->packet_size > 0) {        /* TODO: should probably take into account width/height as well? */        bytes_needed = demux->packet_size;      } else {        bytes_needed = 1024;      }      break;    default:      g_assert_not_reached ();  }  /* now get the data */  GST_LOG_OBJECT (demux, "getting data: %5u bytes @ %8" G_GINT64_MODIFIER "u",      bytes_needed, demux->offset);  if (demux->upstream_size > 0 && demux->offset >= demux->upstream_size)    goto eos;  ret = gst_pad_pull_range (demux->sinkpad, demux->offset, bytes_needed, &buf);  if (ret != GST_FLOW_OK)    goto pull_range_error;  if (GST_BUFFER_SIZE (buf) != bytes_needed)    goto pull_range_short_read;  ret = gst_real_audio_demux_handle_buffer (demux, buf);  if (ret != GST_FLOW_OK)    goto handle_flow_error;  /* TODO: increase this in chain function too (for timestamps)? */  demux->offset += bytes_needed;  /* check for the end of the segment */  if (demux->segment.stop != -1 && demux->segment.last_stop != -1 &&      demux->segment.last_stop > demux->segment.stop) {    GST_DEBUG_OBJECT (demux, "reached end of segment");    goto eos;  }  return;/* ERRORS */parse_header_error:  {    GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL), (NULL));    goto pause_task;  }handle_flow_error:  {    GST_WARNING_OBJECT (demux, "handle_buf flow: %s", gst_flow_get_name (ret));    goto pause_task;  }pull_range_error:  {    GST_WARNING_OBJECT (demux, "pull range flow: %s", gst_flow_get_name (ret));    goto pause_task;  }pull_range_short_read:  {    GST_WARNING_OBJECT (demux, "pull range short read: wanted %u bytes, but "        "got only %u bytes", bytes_needed, GST_BUFFER_SIZE (buf));    gst_buffer_unref (buf);    goto eos;  }eos:  {    if (demux->state != REAL_AUDIO_DEMUX_STATE_DATA) {      GST_WARNING_OBJECT (demux, "reached EOS before finished parsing header");      goto parse_header_error;    }    GST_INFO_OBJECT (demux, "EOS");    if ((demux->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0) {      gint64 stop;      /* for segment playback we need to post when (in stream time)       * we stopped, this is either stop (when set) or the duration. */      if ((stop = demux->segment.stop) == -1)        stop = demux->segment.duration;      GST_DEBUG_OBJECT (demux, "sending segment done, at end of segment");      gst_element_post_message (GST_ELEMENT (demux),          gst_message_new_segment_done (GST_OBJECT (demux), GST_FORMAT_TIME,              stop));    } else {      /* normal playback, send EOS event downstream */      GST_DEBUG_OBJECT (demux, "sending EOS event, at end of stream");      gst_pad_push_event (demux->srcpad, gst_event_new_eos ());    }    goto pause_task;  }pause_task:  {    demux->segment_running = FALSE;    gst_pad_pause_task (demux->sinkpad);    GST_DEBUG_OBJECT (demux, "pausing task");    return;  }}
开发者ID:zsx,项目名称:ossbuild,代码行数:101,


示例25: gst_alsasink_prepare

static gbooleangst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec){  GstAlsaSink *alsa;  gint err;  alsa = GST_ALSA_SINK (asink);  if (spec->format == GST_IEC958) {    snd_pcm_close (alsa->handle);    alsa->handle = gst_alsa_open_iec958_pcm (GST_OBJECT (alsa));    if (G_UNLIKELY (!alsa->handle)) {      goto no_iec958;    }  }  if (!alsasink_parse_spec (alsa, spec))    goto spec_parse;  CHECK (set_hwparams (alsa), hw_params_failed);  CHECK (set_swparams (alsa), sw_params_failed);  alsa->bytes_per_sample = spec->bytes_per_sample;  spec->segsize = alsa->period_size * spec->bytes_per_sample;  spec->segtotal = alsa->buffer_size / alsa->period_size;  {    snd_output_t *out_buf = NULL;    char *msg = NULL;    snd_output_buffer_open (&out_buf);    snd_pcm_dump_hw_setup (alsa->handle, out_buf);    snd_output_buffer_string (out_buf, &msg);    GST_DEBUG_OBJECT (alsa, "Hardware setup: /n%s", msg);    snd_output_close (out_buf);    snd_output_buffer_open (&out_buf);    snd_pcm_dump_sw_setup (alsa->handle, out_buf);    snd_output_buffer_string (out_buf, &msg);    GST_DEBUG_OBJECT (alsa, "Software setup: /n%s", msg);    snd_output_close (out_buf);  }  return TRUE;  /* ERRORS */no_iec958:  {    GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_WRITE, (NULL),        ("Could not open IEC958 (SPDIF) device for playback"));    return FALSE;  }spec_parse:  {    GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),        ("Error parsing spec"));    return FALSE;  }hw_params_failed:  {    GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),        ("Setting of hwparams failed: %s", snd_strerror (err)));    return FALSE;  }sw_params_failed:  {    GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),        ("Setting of swparams failed: %s", snd_strerror (err)));    return FALSE;  }}
开发者ID:Sandec,项目名称:openjfx-8u-dev-rt,代码行数:70,


示例26: gst_real_audio_demux_handle_seek

static gbooleangst_real_audio_demux_handle_seek (GstRealAudioDemux * demux, GstEvent * event){  GstFormat format;  GstSeekFlags flags;  GstSeekType cur_type, stop_type;  gboolean flush, update;  gdouble rate;  guint64 seek_pos;  gint64 cur, stop;  if (!demux->seekable)    goto not_seekable;  if (demux->byterate_num == 0 || demux->byterate_denom == 0)    goto no_bitrate;  gst_event_parse_seek (event, &rate, &format, &flags,      &cur_type, &cur, &stop_type, &stop);  if (format != GST_FORMAT_TIME)    goto only_time_format_supported;  if (rate <= 0.0)    goto cannot_do_backwards_playback;  flush = ((flags & GST_SEEK_FLAG_FLUSH) != 0);  GST_DEBUG_OBJECT (demux, "flush=%d, rate=%g", flush, rate);  /* unlock streaming thread and make streaming stop */  if (flush) {    gst_pad_push_event (demux->sinkpad, gst_event_new_flush_start ());    gst_pad_push_event (demux->srcpad, gst_event_new_flush_start ());  } else {    gst_pad_pause_task (demux->sinkpad);  }  GST_PAD_STREAM_LOCK (demux->sinkpad);  if (demux->segment_running && !flush) {    GstEvent *newseg;    newseg = gst_event_new_new_segment_full (TRUE, demux->segment.rate,        demux->segment.applied_rate, GST_FORMAT_TIME, demux->segment.start,        demux->segment.last_stop, demux->segment.time);    GST_DEBUG_OBJECT (demux, "sending NEWSEGMENT event to close the current "        "segment: %" GST_PTR_FORMAT, newseg);    gst_pad_push_event (demux->srcpad, newseg);  }  gst_segment_set_seek (&demux->segment, rate, format, flags,      cur_type, cur, stop_type, stop, &update);  GST_DEBUG_OBJECT (demux, "segment: %" GST_SEGMENT_FORMAT, &demux->segment);  seek_pos = gst_util_uint64_scale (demux->segment.start,      demux->byterate_num, demux->byterate_denom * GST_SECOND);  if (demux->packet_size > 0) {    seek_pos -= seek_pos % demux->packet_size;  }  seek_pos += demux->data_offset;  GST_DEBUG_OBJECT (demux, "seek_pos = %" G_GUINT64_FORMAT, seek_pos);  /* stop flushing */  gst_pad_push_event (demux->sinkpad, gst_event_new_flush_stop ());  gst_pad_push_event (demux->srcpad, gst_event_new_flush_stop ());  demux->offset = seek_pos;  demux->need_newsegment = TRUE;  /* notify start of new segment */  if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {    gst_element_post_message (GST_ELEMENT (demux),        gst_message_new_segment_start (GST_OBJECT (demux),            GST_FORMAT_TIME, demux->segment.last_stop));  }  demux->segment_running = TRUE;  /* restart our task since it might have been stopped when we did the flush */  gst_pad_start_task (demux->sinkpad,      (GstTaskFunction) gst_real_audio_demux_loop, demux);  /* streaming can continue now */  GST_PAD_STREAM_UNLOCK (demux->sinkpad);  return TRUE;/* ERRORS */not_seekable:  {    GST_DEBUG_OBJECT (demux, "seek failed: cannot seek in streaming mode");    return FALSE;  }no_bitrate:  {    GST_DEBUG_OBJECT (demux, "seek failed: bitrate unknown");//.........这里部分代码省略.........
开发者ID:zsx,项目名称:ossbuild,代码行数:101,


示例27: GST_START_TEST

GST_END_TEST/* End of test check_push_buffer */GST_START_TEST (check_emit_encoded_media){  guint bus_watch_id1, bus_watch_id2;  GstBus *srcbus, *testbus;  GstCaps *caps;  GST_INFO ("Running test check_push_buffer");  loop = g_main_loop_new (NULL, FALSE);  /* Create source pipeline */  src_pipeline = gst_pipeline_new ("src-pipeline");  uridecodebin = gst_element_factory_make ("uridecodebin", NULL);  appsink = gst_element_factory_make ("appsink", NULL);  srcbus = gst_pipeline_get_bus (GST_PIPELINE (src_pipeline));  bus_watch_id1 = gst_bus_add_watch (srcbus, gst_bus_async_signal_func, NULL);  g_signal_connect (srcbus, "message", G_CALLBACK (bus_msg_cb), src_pipeline);  g_object_unref (srcbus);  gst_bin_add_many (GST_BIN (src_pipeline), uridecodebin, appsink, NULL);  caps = gst_caps_new_any ();  g_object_set (G_OBJECT (uridecodebin), "uri", VIDEO_PATH, "caps", caps, NULL);  gst_caps_unref (caps);  g_signal_connect (G_OBJECT (uridecodebin), "pad-added", G_CALLBACK (link_pad),      appsink);  g_object_set (appsink, "emit-signals", TRUE, NULL);  g_signal_connect (appsink, "new-sample", G_CALLBACK (post_recv_sample), NULL);  g_signal_connect (appsink, "eos", G_CALLBACK (appsink_eos_cb), NULL);  /* Create test pipeline */  test_pipeline = gst_pipeline_new ("test-pipeline");  httpep = gst_element_factory_make ("httppostendpoint", NULL);  g_object_set (httpep, "use-encoded-media", TRUE, NULL);  testbus = gst_pipeline_get_bus (GST_PIPELINE (test_pipeline));  bus_watch_id2 = gst_bus_add_watch (testbus, gst_bus_async_signal_func, NULL);  g_signal_connect (testbus, "message", G_CALLBACK (bus_msg_cb), test_pipeline);  g_object_unref (testbus);  gst_bin_add (GST_BIN (test_pipeline), httpep);  g_signal_connect (G_OBJECT (httpep), "eos", G_CALLBACK (http_eos_cb), NULL);  /* Set pipeline to start state */  gst_element_set_state (test_pipeline, GST_STATE_PLAYING);  g_object_get (G_OBJECT (httpep), "http-method", &method, NULL);  GST_INFO ("Http end point configured as %d", method);  mark_point ();  g_timeout_add_seconds (WAIT_TIMEOUT, timer_cb, NULL);  g_main_loop_run (loop);  mark_point ();  GST_DEBUG ("Main loop stopped");  GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (src_pipeline),      GST_DEBUG_GRAPH_SHOW_ALL, "src_after_main_loop");  GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (test_pipeline),      GST_DEBUG_GRAPH_SHOW_ALL, "test_after_main_loop");  gst_element_set_state (src_pipeline, GST_STATE_NULL);  gst_object_unref (GST_OBJECT (src_pipeline));  gst_element_set_state (test_pipeline, GST_STATE_NULL);  gst_object_unref (GST_OBJECT (test_pipeline));  g_source_remove (bus_watch_id1);  g_source_remove (bus_watch_id2);  g_main_loop_unref (loop);}
开发者ID:TribeMedia,项目名称:kms-elements,代码行数:82,


示例28: main

intmain (int   argc,      char *argv[]){  GMainLoop *loop;  GstBus *bus;	xmlfile = "helloworld";  std_log(LOG_FILENAME_LINE, "Test Started helloworld");  /* initialize GStreamer pt 1*/   gst_init (&argc, &argv);  loop = g_main_loop_new (NULL, FALSE);   /* check input arguments */   if (argc != 2) {    g_print ("Usage: %s <wave file filename>/n", argv[0]);    std_log(LOG_FILENAME_LINE, "Test Failed wave file as an argument need to be passed");    create_xml(1);     exit (-1);  }    /* create elements  pt2*/   pipeline = gst_pipeline_new ("audio-player");  source = gst_element_factory_make ("filesrc", "file-source");    // Path hardcoded need to change   // g_object_set(source,"location",argv[1],NULL);    g_object_set(source,"location",argv[1],NULL);    parser = gst_element_factory_make ("wavparse", "waveparser");      if (!pipeline || !source || !parser ) {    g_print ("One element could not be created/n");    return -1;  }  /* set filename property on the file source. Also add a message   * handler.  pt3*/    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));  gst_bus_add_watch (bus, bus_call, loop);  gst_object_unref (bus);  /* put all elements in a bin pt4*/  gst_bin_add_many (GST_BIN (pipeline),		    source, parser,  NULL);  /* link together - note that we cannot link the parser and   * decoder yet, becuse the parser uses dynamic pads. For that,   * we set a pad-added signal handler. pt5*/  gst_element_link (source, parser);   g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad), NULL);  /* Now set to playing and iterate. pt6*/  g_print ("Setting to PLAYING/n");  gst_element_set_state (pipeline, GST_STATE_PLAYING);  g_print ("Running/n");  g_main_loop_run (loop);  /* clean up nicely pt7*/  g_print ("Returned, stopping playback/n");  gst_element_set_state (pipeline, GST_STATE_NULL);  g_print ("Deleting pipeline/n");  gst_object_unref (GST_OBJECT (pipeline));  std_log(LOG_FILENAME_LINE, "Test Successful");  create_xml(0);  return 0;}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:77,



注:本文中的GST_OBJECT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GST_OBJECT_FLAG_SET函数代码示例
C++ GST_MINI_OBJECT_CAST函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。