这篇教程C++ GST_STR_NULL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GST_STR_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_STR_NULL函数的具体用法?C++ GST_STR_NULL怎么用?C++ GST_STR_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GST_STR_NULL函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gst_jack_audio_get_connectionstatic GstJackAudioConnection *gst_jack_audio_get_connection (const gchar * id, const gchar * server, jack_client_t * jclient, jack_status_t * status){ GstJackAudioConnection *conn; GList *found; FindData data; GST_DEBUG ("getting connection for id %s, server %s", id, GST_STR_NULL (server)); data.id = id; data.server = server; G_LOCK (connections_lock); found = g_list_find_custom (connections, &data, (GCompareFunc) connection_find); if (found != NULL && jclient != NULL) { /* we found it, increase refcount and return it */ conn = (GstJackAudioConnection *) found->data; conn->refcount++; GST_DEBUG ("found connection %p", conn); } else { /* make new connection */ conn = gst_jack_audio_make_connection (id, server, jclient, status); if (conn != NULL) { GST_DEBUG ("created connection %p", conn); /* add to list on success */ connections = g_list_prepend (connections, conn); } else { GST_WARNING ("could not create connection"); } } G_UNLOCK (connections_lock); return conn;}
开发者ID:krad-radio,项目名称:gstreamer-plugins-good-krad,代码行数:38,
示例2: print_pluginstatic voidprint_plugin (const gchar * marker, GstRegistry * registry, GstPlugin * plugin){ const gchar *name; GList *features, *f; name = gst_plugin_get_name (plugin); GST_DEBUG ("%s: plugin %p %d %s file: %s", marker, plugin, GST_OBJECT_REFCOUNT (plugin), name, GST_STR_NULL (gst_plugin_get_filename (plugin))); features = gst_registry_get_feature_list_by_plugin (registry, name); for (f = features; f != NULL; f = f->next) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (f->data); GST_LOG ("%s: feature: %p %s", marker, feature, GST_OBJECT_NAME (feature)); } gst_plugin_feature_list_free (features);}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:23,
示例3: gst_element_factory_make/** * gst_element_factory_make: * @factoryname: a named factory to instantiate * @name: (allow-none): name of new element, or NULL to automatically create * a unique name * * Create a new element of the type defined by the given element factory. * If name is NULL, then the element will receive a guaranteed unique name, * consisting of the element factory name and a number. * If name is given, it will be given the name supplied. * * Returns: (transfer full): new #GstElement or NULL if unable to create element */GstElement *gst_element_factory_make (const gchar * factoryname, const gchar * name){ GstElementFactory *factory; GstElement *element; g_return_val_if_fail (factoryname != NULL, NULL); g_return_val_if_fail (gst_is_initialized (), NULL); GST_LOG ("gstelementfactory: make /"%s/" /"%s/"", factoryname, GST_STR_NULL (name)); factory = gst_element_factory_find (factoryname); if (factory == NULL) goto no_factory; GST_LOG_OBJECT (factory, "found factory %p", factory); element = gst_element_factory_create (factory, name); if (element == NULL) goto create_failed; gst_object_unref (factory); return element; /* ERRORS */no_factory: { GST_INFO ("no such element factory /"%s/"!", factoryname); return NULL; }create_failed: { GST_INFO_OBJECT (factory, "couldn't create instance!"); gst_object_unref (factory); return NULL; }}
开发者ID:AlerIl,项目名称:gstreamer0.10,代码行数:50,
示例4: jack_shutdown_cbstatic voidjack_shutdown_cb (void *arg){ GstJackAudioConnection *conn = (GstJackAudioConnection *) arg; GList *walk; GST_DEBUG ("disconnect client %s from server %s", conn->id, GST_STR_NULL (conn->server)); g_mutex_lock (conn->lock); for (walk = conn->src_clients; walk; walk = g_list_next (walk)) { GstJackAudioClient *client = (GstJackAudioClient *) walk->data; if (client->shutdown) client->shutdown (client->user_data); } for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) { GstJackAudioClient *client = (GstJackAudioClient *) walk->data; if (client->shutdown) client->shutdown (client->user_data); } g_mutex_unlock (conn->lock);}
开发者ID:matsu,项目名称:gst-plugins-good,代码行数:24,
示例5: gst_mms_do_seekstatic gbooleangst_mms_do_seek (GstBaseSrc * src, GstSegment * segment){ mms_off_t start; GstMMS *mmssrc = GST_MMS (src); if (segment->format == GST_FORMAT_TIME) { if (!mmsx_time_seek (NULL, mmssrc->connection, (double) segment->start / GST_SECOND)) { GST_LOG_OBJECT (mmssrc, "mmsx_time_seek() failed"); return FALSE; } start = mmsx_get_current_pos (mmssrc->connection); GST_INFO_OBJECT (mmssrc, "sought to %" GST_TIME_FORMAT ", offset after " "seek: %" G_GINT64_FORMAT, GST_TIME_ARGS (segment->start), start); } else if (segment->format == GST_FORMAT_BYTES) { start = mmsx_seek (NULL, mmssrc->connection, segment->start, SEEK_SET); /* mmsx_seek will close and reopen the connection when seeking with the mmsh protocol, if the reopening fails this is indicated with -1 */ if (start == -1) { GST_DEBUG_OBJECT (mmssrc, "connection broken during seek"); return FALSE; } GST_INFO_OBJECT (mmssrc, "sought to: %" G_GINT64_FORMAT " bytes, " "result: %" G_GINT64_FORMAT, segment->start, start); } else { GST_DEBUG_OBJECT (mmssrc, "unsupported seek segment format: %s", GST_STR_NULL (gst_format_get_name (segment->format))); return FALSE; } gst_segment_init (segment, GST_FORMAT_BYTES); gst_segment_set_seek (segment, segment->rate, GST_FORMAT_BYTES, segment->flags, GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_NONE, segment->stop, NULL); return TRUE;}
开发者ID:zsx,项目名称:ossbuild,代码行数:36,
示例6: totem_gst_message_printvoidtotem_gst_message_print (GstMessage *msg, GstElement *play, const char *filename){ GError *err = NULL; char *dbg = NULL; g_return_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR); if (play != NULL) { g_return_if_fail (filename != NULL); GST_DEBUG_BIN_TO_DOT_FILE (GST_BIN_CAST (play), GST_DEBUG_GRAPH_SHOW_ALL ^ GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, filename); } gst_message_parse_error (msg, &err, &dbg); if (err) { char *uri; g_object_get (play, "uri", &uri, NULL); GST_ERROR ("message = %s", GST_STR_NULL (err->message)); GST_ERROR ("domain = %d (%s)", err->domain, GST_STR_NULL (g_quark_to_string (err->domain))); GST_ERROR ("code = %d", err->code); GST_ERROR ("debug = %s", GST_STR_NULL (dbg)); GST_ERROR ("source = %" GST_PTR_FORMAT, msg->src); GST_ERROR ("uri = %s", GST_STR_NULL (uri)); g_free (uri); g_message ("Error: %s/n%s/n", GST_STR_NULL (err->message), GST_STR_NULL (dbg)); g_error_free (err); } g_free (dbg);}
开发者ID:Slaaneshi,项目名称:totem,代码行数:39,
示例7: gst_rtp_g722_depay_setcapsstatic gbooleangst_rtp_g722_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps){ GstStructure *structure; GstRtpG722Depay *rtpg722depay; gint clock_rate, payload, samplerate; gint channels; GstCaps *srccaps; gboolean res; const gchar *channel_order; const GstRTPChannelOrder *order; rtpg722depay = GST_RTP_G722_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); payload = 96; gst_structure_get_int (structure, "payload", &payload); switch (payload) { case GST_RTP_PAYLOAD_G722: channels = 1; clock_rate = 8000; samplerate = 16000; break; default: /* no fixed mapping, we need clock-rate */ channels = 0; clock_rate = 0; samplerate = 0; break; } /* caps can overwrite defaults */ clock_rate = gst_rtp_g722_depay_parse_int (structure, "clock-rate", clock_rate); if (clock_rate == 0) goto no_clockrate; if (clock_rate == 8000) samplerate = 16000; if (samplerate == 0) samplerate = clock_rate; channels = gst_rtp_g722_depay_parse_int (structure, "encoding-params", channels); if (channels == 0) { channels = gst_rtp_g722_depay_parse_int (structure, "channels", channels); if (channels == 0) { /* channels defaults to 1 otherwise */ channels = 1; } } depayload->clock_rate = clock_rate; rtpg722depay->rate = samplerate; rtpg722depay->channels = channels; srccaps = gst_caps_new_simple ("audio/G722", "rate", G_TYPE_INT, samplerate, "channels", G_TYPE_INT, channels, NULL); /* add channel positions */ channel_order = gst_structure_get_string (structure, "channel-order"); order = gst_rtp_channels_get_by_order (channels, channel_order); if (order) { gst_audio_set_channel_positions (gst_caps_get_structure (srccaps, 0), order->pos); } else { GstAudioChannelPosition *pos; GST_ELEMENT_WARNING (rtpg722depay, STREAM, DECODE, (NULL), ("Unknown channel order '%s' for %d channels", GST_STR_NULL (channel_order), channels)); /* create default NONE layout */ pos = gst_rtp_channels_create_default (channels); gst_audio_set_channel_positions (gst_caps_get_structure (srccaps, 0), pos); g_free (pos); } res = gst_pad_set_caps (depayload->srcpad, srccaps); gst_caps_unref (srccaps); return res; /* ERRORS */no_clockrate: { GST_ERROR_OBJECT (depayload, "no clock-rate specified"); return FALSE; }}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:92,
示例8: gst_gsettings_audio_sink_change_childstatic gbooleangst_gsettings_audio_sink_change_child (GstGSettingsAudioSink * sink){ const gchar *key = NULL; gchar *new_string; GError *err = NULL; GstElement *new_kid; GST_OBJECT_LOCK (sink); switch (sink->profile) { case GST_GSETTINGS_AUDIOSINK_PROFILE_SOUNDS: key = GST_GSETTINGS_KEY_SOUNDS_AUDIOSINK; break; case GST_GSETTINGS_AUDIOSINK_PROFILE_MUSIC: key = GST_GSETTINGS_KEY_MUSIC_AUDIOSINK; break; case GST_GSETTINGS_AUDIOSINK_PROFILE_CHAT: key = GST_GSETTINGS_KEY_CHAT_AUDIOSINK; break; default: break; } new_string = g_settings_get_string (sink->settings, key); if (new_string != NULL && sink->gsettings_str != NULL && (strlen (new_string) == 0 || strcmp (sink->gsettings_str, new_string) == 0)) { g_free (new_string); GST_DEBUG_OBJECT (sink, "GSettings key was updated, but it didn't change. Ignoring"); GST_OBJECT_UNLOCK (sink); return TRUE; } GST_OBJECT_UNLOCK (sink); GST_DEBUG_OBJECT (sink, "GSettings key changed from '%s' to '%s'", GST_STR_NULL (sink->gsettings_str), GST_STR_NULL (new_string)); if (new_string) { new_kid = gst_parse_bin_from_description (new_string, TRUE, &err); if (err) { GST_ERROR_OBJECT (sink, "error creating bin '%s': %s", new_string, err->message); g_error_free (err); } } else { new_kid = NULL; } if (new_kid == NULL) { GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL), ("Failed to render audio sink from GSettings")); goto fail; } if (!gst_switch_sink_set_child (GST_SWITCH_SINK (sink), new_kid)) { GST_WARNING_OBJECT (sink, "Failed to update child element"); goto fail; } g_free (sink->gsettings_str); sink->gsettings_str = new_string; return TRUE;fail: g_free (new_string); return FALSE;}
开发者ID:drothlis,项目名称:gst-plugins-bad,代码行数:70,
示例9: gst_pulsesrc_openstatic gbooleangst_pulsesrc_open (GstAudioSrc * asrc){ GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (asrc); gchar *name = gst_pulse_client_name (); pa_threaded_mainloop_lock (pulsesrc->mainloop); g_assert (!pulsesrc->context); g_assert (!pulsesrc->stream); GST_DEBUG_OBJECT (pulsesrc, "opening device"); if (!(pulsesrc->context = pa_context_new (pa_threaded_mainloop_get_api (pulsesrc->mainloop), name))) { GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Failed to create context"), (NULL)); goto unlock_and_fail; } pa_context_set_state_callback (pulsesrc->context, gst_pulsesrc_context_state_cb, pulsesrc); GST_DEBUG_OBJECT (pulsesrc, "connect to server %s", GST_STR_NULL (pulsesrc->server)); if (pa_context_connect (pulsesrc->context, pulsesrc->server, 0, NULL) < 0) { GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror (pa_context_errno (pulsesrc->context))), (NULL)); goto unlock_and_fail; } for (;;) { pa_context_state_t state; state = pa_context_get_state (pulsesrc->context); if (!PA_CONTEXT_IS_GOOD (state)) { GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror (pa_context_errno (pulsesrc->context))), (NULL)); goto unlock_and_fail; } if (state == PA_CONTEXT_READY) break; /* Wait until the context is ready */ pa_threaded_mainloop_wait (pulsesrc->mainloop); } GST_DEBUG_OBJECT (pulsesrc, "connected"); pa_threaded_mainloop_unlock (pulsesrc->mainloop); g_free (name); return TRUE; /* ERRORS */unlock_and_fail: { gst_pulsesrc_destroy_context (pulsesrc); pa_threaded_mainloop_unlock (pulsesrc->mainloop); g_free (name); return FALSE; }}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:68,
示例10: gst_jack_audio_make_connection/* make a connection with @id and @server. Returns NULL on failure with the * status set. */static GstJackAudioConnection *gst_jack_audio_make_connection (const gchar * id, const gchar * server, jack_client_t * jclient, jack_status_t * status){ GstJackAudioConnection *conn; jack_options_t options; gint res; *status = 0; GST_DEBUG ("new client %s, connecting to server %s", id, GST_STR_NULL (server)); /* never start a server */ options = JackNoStartServer; /* if we have a servername, use it */ if (server != NULL) options |= JackServerName; /* open the client */ if (jclient == NULL) jclient = jack_client_open (id, options, status, server); if (jclient == NULL) goto could_not_open; /* now create object */ conn = g_new (GstJackAudioConnection, 1); conn->refcount = 1; g_mutex_init (&conn->lock); g_cond_init (&conn->flush_cond); conn->id = g_strdup (id); conn->server = g_strdup (server); conn->client = jclient; conn->n_clients = 0; conn->src_clients = NULL; conn->sink_clients = NULL; conn->cur_ts = -1; conn->transport_state = GST_STATE_VOID_PENDING; /* set our callbacks */ jack_set_process_callback (jclient, jack_process_cb, conn); /* these callbacks cause us to error */ jack_set_buffer_size_callback (jclient, jack_buffer_size_cb, conn); jack_set_sample_rate_callback (jclient, jack_sample_rate_cb, conn); jack_on_shutdown (jclient, jack_shutdown_cb, conn); /* all callbacks are set, activate the client */ GST_INFO ("activate jack_client %p", jclient); if ((res = jack_activate (jclient))) goto could_not_activate; GST_DEBUG ("opened connection %p", conn); return conn; /* ERRORS */could_not_open: { GST_DEBUG ("failed to open jack client, %d", *status); return NULL; }could_not_activate: { GST_ERROR ("Could not activate client (%d)", res); *status = JackFailure; g_mutex_clear (&conn->lock); g_free (conn->id); g_free (conn->server); g_free (conn); return NULL; }}
开发者ID:GrokImageCompression,项目名称:gst-plugins-good,代码行数:73,
示例11: mainintmain (int argc, char **argv){ GstBus *bus; GOptionContext *ctx; GIOChannel *io_stdin; GError *err = NULL; gboolean res; GOptionEntry options[] = { {NULL} }; GThread *rthread; /* Clear application state */ memset (state, 0, sizeof (*state)); state->animate = TRUE; /* must initialise the threading system before using any other GLib funtion */ if (!g_thread_supported ()) g_thread_init (NULL); ctx = g_option_context_new ("[ADDITIONAL ARGUMENTS]"); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s/n", GST_STR_NULL (err->message)); exit (1); } g_option_context_free (ctx); if (argc != 2) { g_print ("Usage: %s <URI> or <PIPELINE-DESCRIPTION>/n", argv[0]); exit (1); } /* Initialize GStreamer */ gst_init (&argc, &argv); /* initialize inter thread comunnication */ init_intercom (state); TRACE_VC_MEMORY ("state 0"); if (!(rthread = g_thread_new ("render", (GThreadFunc) render_func, NULL))) { g_print ("Render thread create failed/n"); exit (1); } /* Initialize player */ if (gst_uri_is_valid (argv[1])) { res = init_playbin_player (state, argv[1]); } else { res = init_parse_launch_player (state, argv[1]); } if (!res) goto done; /* Create a GLib Main Loop and set it to run */ state->main_loop = g_main_loop_new (NULL, FALSE); /* Add a keyboard watch so we get notified of keystrokes */ io_stdin = g_io_channel_unix_new (fileno (stdin)); g_io_add_watch (io_stdin, G_IO_IN, (GIOFunc) handle_keyboard, state); g_io_channel_unref (io_stdin); /* *INDENT-OFF* */ g_print ("Available commands: /n" " a - Toggle animation /n" " p - Pause playback /n" " r - Resume playback /n" " l - Query position/duration/n" " f - Seek 30 seconds forward /n" " b - Seek 30 seconds backward /n" " q - Quit /n"); /* *INDENT-ON* */ /* Connect the bus handlers */ bus = gst_element_get_bus (state->pipeline); gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, state, NULL); gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH); gst_bus_enable_sync_message_emission (bus); g_signal_connect (G_OBJECT (bus), "message::error", (GCallback) error_cb, state); g_signal_connect (G_OBJECT (bus), "message::buffering", (GCallback) buffering_cb, state); g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback) eos_cb, state); g_signal_connect (G_OBJECT (bus), "message::qos", (GCallback) qos_cb, state); g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback) state_changed_cb, state); gst_object_unref (bus); /* Make player start playing */ gst_element_set_state (state->pipeline, GST_STATE_PLAYING); /* Start the mainloop *///.........这里部分代码省略.........
开发者ID:01org,项目名称:gst-omx,代码行数:101,
示例12: gst_rtp_L16_depay_setcapsstatic gbooleangst_rtp_L16_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps){ GstStructure *structure; GstRtpL16Depay *rtpL16depay; gint clock_rate, payload; gint channels; GstCaps *srccaps; gboolean res; const gchar *channel_order; const GstRTPChannelOrder *order; GstAudioInfo *info; rtpL16depay = GST_RTP_L16_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); payload = 96; gst_structure_get_int (structure, "payload", &payload); switch (payload) { case GST_RTP_PAYLOAD_L16_STEREO: channels = 2; clock_rate = 44100; break; case GST_RTP_PAYLOAD_L16_MONO: channels = 1; clock_rate = 44100; break; default: /* no fixed mapping, we need clock-rate */ channels = 0; clock_rate = 0; break; } /* caps can overwrite defaults */ clock_rate = gst_rtp_L16_depay_parse_int (structure, "clock-rate", clock_rate); if (clock_rate == 0) goto no_clockrate; channels = gst_rtp_L16_depay_parse_int (structure, "encoding-params", channels); if (channels == 0) { channels = gst_rtp_L16_depay_parse_int (structure, "channels", channels); if (channels == 0) { /* channels defaults to 1 otherwise */ channels = 1; } } depayload->clock_rate = clock_rate; info = &rtpL16depay->info; gst_audio_info_init (info); info->finfo = gst_audio_format_get_info (GST_AUDIO_FORMAT_S16BE); info->rate = clock_rate; info->channels = channels; info->bpf = (info->finfo->width / 8) * channels; /* add channel positions */ channel_order = gst_structure_get_string (structure, "channel-order"); order = gst_rtp_channels_get_by_order (channels, channel_order); rtpL16depay->order = order; if (order) { memcpy (info->position, order->pos, sizeof (GstAudioChannelPosition) * channels); gst_audio_channel_positions_to_valid_order (info->position, info->channels); } else { GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE, (NULL), ("Unknown channel order '%s' for %d channels", GST_STR_NULL (channel_order), channels)); /* create default NONE layout */ gst_rtp_channels_create_default (channels, info->position); } srccaps = gst_audio_info_to_caps (info); res = gst_pad_set_caps (depayload->srcpad, srccaps); gst_caps_unref (srccaps); return res; /* ERRORS */no_clockrate: { GST_ERROR_OBJECT (depayload, "no clock-rate specified"); return FALSE; }}
开发者ID:a-martynovich,项目名称:gst-plugins-good,代码行数:90,
示例13: gst_amc_audio_dec_set_format//.........这里部分代码省略......... GstBuffer *codec_data = gst_value_get_buffer (h); GstMapInfo minfo; guint8 *data; gst_buffer_map (codec_data, &minfo, GST_MAP_READ); data = g_memdup (minfo.data, minfo.size); self->codec_datas = g_list_prepend (self->codec_datas, data); gst_amc_format_set_buffer (format, "csd-0", data, minfo.size, &err); if (err) GST_ELEMENT_WARNING_FROM_ERROR (self, err); gst_buffer_unmap (codec_data, &minfo); } else if (gst_structure_has_field (s, "streamheader")) { const GValue *sh = gst_structure_get_value (s, "streamheader"); gint nsheaders = gst_value_array_get_size (sh); GstBuffer *buf; const GValue *h; gint i, j; gchar *fname; GstMapInfo minfo; guint8 *data; for (i = 0, j = 0; i < nsheaders; i++) { h = gst_value_array_get_value (sh, i); buf = gst_value_get_buffer (h); if (strcmp (mime, "audio/vorbis") == 0) { guint8 header_type; gst_buffer_extract (buf, 0, &header_type, 1); /* Only use the identification and setup packets */ if (header_type != 0x01 && header_type != 0x05) continue; } fname = g_strdup_printf ("csd-%d", j); gst_buffer_map (buf, &minfo, GST_MAP_READ); data = g_memdup (minfo.data, minfo.size); self->codec_datas = g_list_prepend (self->codec_datas, data); gst_amc_format_set_buffer (format, fname, data, minfo.size, &err); if (err) GST_ELEMENT_WARNING_FROM_ERROR (self, err); gst_buffer_unmap (buf, &minfo); g_free (fname); j++; } } format_string = gst_amc_format_to_string (format, &err); if (err) GST_ELEMENT_WARNING_FROM_ERROR (self, err); GST_DEBUG_OBJECT (self, "Configuring codec with format: %s", GST_STR_NULL (format_string)); g_free (format_string); if (!gst_amc_codec_configure (self->codec, format, 0, &err)) { GST_ERROR_OBJECT (self, "Failed to configure codec"); GST_ELEMENT_ERROR_FROM_ERROR (self, err); return FALSE; } gst_amc_format_free (format); if (!gst_amc_codec_start (self->codec, &err)) { GST_ERROR_OBJECT (self, "Failed to start codec"); GST_ELEMENT_ERROR_FROM_ERROR (self, err); return FALSE; } self->spf = -1; /* TODO: Implement for other codecs too */ if (gst_structure_has_name (s, "audio/mpeg")) { gint mpegversion = -1; gst_structure_get_int (s, "mpegversion", &mpegversion); if (mpegversion == 1) { gint layer = -1, mpegaudioversion = -1; gst_structure_get_int (s, "layer", &layer); gst_structure_get_int (s, "mpegaudioversion", &mpegaudioversion); if (layer == 1) self->spf = 384; else if (layer == 2) self->spf = 1152; else if (layer == 3 && mpegaudioversion != -1) self->spf = (mpegaudioversion == 1 ? 1152 : 576); } } self->started = TRUE; self->input_caps_changed = TRUE; /* Start the srcpad loop again */ self->flushing = FALSE; self->downstream_flow_ret = GST_FLOW_OK; gst_pad_start_task (GST_AUDIO_DECODER_SRC_PAD (self), (GstTaskFunction) gst_amc_audio_dec_loop, decoder, NULL); return TRUE;}
开发者ID:Distrotech,项目名称:gst-plugins-bad,代码行数:101,
示例14: gst_sunaudiomixer_options_newGstMixerOptions *gst_sunaudiomixer_options_new (GstSunAudioMixerCtrl * mixer, gint track_num){ GstMixerOptions *opts; GstSunAudioMixerOptions *sun_opts; GstMixerTrack *track; const gchar *label; gint i; struct audio_info audioinfo; if ((mixer == NULL) || (mixer->mixer_fd == -1)) { g_warning ("mixer not initialized"); return NULL; } if (track_num != GST_SUNAUDIO_TRACK_RECSRC) { g_warning ("invalid options track"); return (NULL); } label = N_("Record Source"); opts = g_object_new (GST_TYPE_SUNAUDIO_MIXER_OPTIONS, "untranslated-label", label, NULL); sun_opts = GST_SUNAUDIO_MIXER_OPTIONS (opts); track = GST_MIXER_TRACK (opts); GST_DEBUG_OBJECT (opts, "New mixer options, track %d: %s", track_num, GST_STR_NULL (label)); /* save off names for the record sources */ sun_opts->names[0] = g_quark_from_string (_("Microphone")); sun_opts->names[1] = g_quark_from_string (_("Line In")); sun_opts->names[2] = g_quark_from_string (_("Internal CD")); sun_opts->names[3] = g_quark_from_string (_("SPDIF In")); sun_opts->names[4] = g_quark_from_string (_("AUX 1 In")); sun_opts->names[5] = g_quark_from_string (_("AUX 2 In")); sun_opts->names[6] = g_quark_from_string (_("Codec Loopback")); sun_opts->names[7] = g_quark_from_string (_("SunVTS Loopback")); /* set basic information */ track->label = g_strdup (_(label)); track->num_channels = 0; track->min_volume = 0; track->max_volume = 0; track->flags = GST_MIXER_TRACK_INPUT | GST_MIXER_TRACK_WHITELIST | GST_MIXER_TRACK_NO_RECORD; if (ioctl (mixer->mixer_fd, AUDIO_GETINFO, &audioinfo) < 0) { g_warning ("Error getting audio device settings"); g_object_unref (G_OBJECT (sun_opts)); return NULL; } sun_opts->avail = audioinfo.record.avail_ports; sun_opts->track_num = track_num; for (i = 0; i < 8; i++) { if ((1 << i) & audioinfo.record.avail_ports) { const char *s = g_quark_to_string (sun_opts->names[i]); opts->values = g_list_append (opts->values, g_strdup (s)); GST_DEBUG_OBJECT (opts, "option for track %d: %s", track_num, GST_STR_NULL (s)); } } return opts;}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-good,代码行数:69,
示例15: event_loop/* returns TRUE if there was an error or we caught a keyboard interrupt. */static gbooleanevent_loop (GstElement * pipeline, gboolean blocking, GstState target_state){ GstBus *bus; GstMessage *message = NULL; gboolean res = FALSE; gboolean buffering = FALSE; bus = gst_element_get_bus (GST_ELEMENT (pipeline));#ifndef DISABLE_FAULT_HANDLER g_timeout_add (50, (GSourceFunc) check_intr, pipeline);#endif while (TRUE) { message = gst_bus_poll (bus, GST_MESSAGE_ANY, blocking ? -1 : 0); /* if the poll timed out, only when !blocking */ if (message == NULL) goto exit; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_NEW_CLOCK: { GstClock *clock; gst_message_parse_new_clock (message, &clock); g_print ("New clock: %s/n", (clock ? GST_OBJECT_NAME (clock) : "NULL")); break; } case GST_MESSAGE_EOS: g_print ("Got EOS from element /"%s/"./n", GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)))); goto exit; case GST_MESSAGE_TAG: if (tags) { GstTagList *tags; gst_message_parse_tag (message, &tags); g_print ("FOUND TAG : found by element /"%s/"./n", GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)))); gst_tag_list_foreach (tags, print_tag, NULL); gst_tag_list_free (tags); } break; case GST_MESSAGE_INFO:{ GError *gerror; gchar *debug; gchar *name = gst_object_get_path_string (GST_MESSAGE_SRC (message)); gst_message_parse_info (message, &gerror, &debug); if (debug) { g_print ("INFO:/n%s/n", debug); } g_error_free (gerror); g_free (debug); g_free (name); break; } case GST_MESSAGE_WARNING:{ GError *gerror; gchar *debug; gchar *name = gst_object_get_path_string (GST_MESSAGE_SRC (message)); /* dump graph on warning */ GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "gst-launch.warning"); gst_message_parse_warning (message, &gerror, &debug); g_print ("WARNING: from element %s: %s/n", name, gerror->message); if (debug) { g_print ("Additional debug info:/n%s/n", debug); } g_error_free (gerror); g_free (debug); g_free (name); break; } case GST_MESSAGE_ERROR:{ GError *gerror; gchar *debug; /* dump graph on error */ GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "gst-launch.error"); gst_message_parse_error (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); /* we have an error */ res = TRUE; goto exit; } case GST_MESSAGE_STATE_CHANGED:{ GstState old, newX, pending; gst_message_parse_state_changed (message, &old, &newX, &pending);//.........这里部分代码省略.........
开发者ID:RomTok,项目名称:disco-light,代码行数:101,
示例16: gst_cd_paranoia_src_openstatic gbooleangst_cd_paranoia_src_open (GstAudioCdSrc * audiocdsrc, const gchar * device){ GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (audiocdsrc); gint i, cache_size; GST_DEBUG_OBJECT (src, "trying to open device %s (generic-device=%s) ...", device, GST_STR_NULL (src->generic_device)); /* find the device */ if (src->generic_device != NULL) { src->d = cdda_identify_scsi (src->generic_device, device, FALSE, NULL); } else { if (device != NULL) { src->d = cdda_identify (device, FALSE, NULL); } else { src->d = cdda_identify ("/dev/cdrom", FALSE, NULL); } } /* fail if the device couldn't be found */ if (src->d == NULL) goto no_device; /* set verbosity mode */ cdda_verbose_set (src->d, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT); /* open the disc */ if (cdda_open (src->d)) goto open_failed; GST_INFO_OBJECT (src, "set read speed to %d", src->read_speed); cdda_speed_set (src->d, src->read_speed); for (i = 1; i < src->d->tracks + 1; i++) { GstAudioCdSrcTrack track = { 0, }; track.num = i; track.is_audio = IS_AUDIO (src->d, i - 1); track.start = cdda_track_firstsector (src->d, i); track.end = cdda_track_lastsector (src->d, i); track.tags = NULL; gst_audio_cd_src_add_track (GST_AUDIO_CD_SRC (src), &track); } /* create the paranoia struct and set it up */ src->p = paranoia_init (src->d); if (src->p == NULL) goto init_failed; paranoia_modeset (src->p, src->paranoia_mode); GST_INFO_OBJECT (src, "set paranoia mode to 0x%02x", src->paranoia_mode); if (src->search_overlap != -1) { paranoia_overlapset (src->p, src->search_overlap); GST_INFO_OBJECT (src, "search overlap set to %u", src->search_overlap); } cache_size = src->cache_size; if (cache_size == -1) { /* if paranoia mode is low (the default), assume we're doing playback */ if (src->paranoia_mode <= PARANOIA_MODE_FRAGMENT) cache_size = 150; else cache_size = paranoia_cachemodel_size (src->p, -1); } paranoia_cachemodel_size (src->p, cache_size); GST_INFO_OBJECT (src, "set cachemodel size to %u", cache_size); src->next_sector = -1; return TRUE; /* ERRORS */no_device: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (_("Could not open CD device for reading.")), ("cdda_identify failed")); return FALSE; }open_failed: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (_("Could not open CD device for reading.")), ("cdda_open failed")); cdda_close (src->d); src->d = NULL; return FALSE; }init_failed: { GST_ELEMENT_ERROR (src, LIBRARY, INIT, ("failed to initialize paranoia"), ("failed to initialize paranoia")); return FALSE; }}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-base,代码行数:96,
示例17: mainint main (int argc, char *argv[]){ HTTPMgmt *httpmgmt; HTTPStreaming *httpstreaming; GMainLoop *loop; GOptionContext *ctx; GError *err = NULL; gboolean foreground; struct rlimit rlim; GDateTime *datetime; gchar exe_path[512], *date; ctx = g_option_context_new (NULL); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s/n", GST_STR_NULL (err->message)); exit (1); } g_option_context_free (ctx); GST_DEBUG_CATEGORY_INIT (GSTREAMILL, "gstreamill", 0, "gstreamill log"); if (version) { print_version_info (); exit (0); } /* stop gstreamill. */ if (stop) { gchar *pid_str; gint pid; g_file_get_contents (PID_FILE, &pid_str, NULL, NULL); if (pid_str == NULL) { g_print ("File %s not found, check if gstreamill is running./n", PID_FILE); exit (1); } pid = atoi (pid_str); g_free (pid_str); g_print ("stoping gstreamill with pid %d .../n", pid); kill (pid, SIGTERM); exit (0); } /* readlink exe path before setuid, on CentOS, readlink exe path after setgid/setuid failure on permission denied */ memset (exe_path, '/0', sizeof (exe_path)); if (readlink ("/proc/self/exe", exe_path, sizeof (exe_path)) == -1) { g_print ("Read /proc/self/exe error: %s", g_strerror (errno)); exit (2); } if (prepare_gstreamill_run_dir () != 0) { g_print ("Can't create gstreamill run directory/n"); exit (3); }/* if (set_user_and_group () != 0) { g_print ("set user and group failure/n"); exit (4); }*/ if (job_file != NULL) { /* gstreamill command with job, run in foreground */ foreground = TRUE; } else { /* gstreamill command without job, run in background */ foreground = FALSE; } if (gst_debug_get_default_threshold () < GST_LEVEL_WARNING) { gst_debug_set_default_threshold (GST_LEVEL_WARNING); } /* initialize ts segment static plugin */ if (!gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR, "tssegment", "ts segment plugin", ts_segment_plugin_init, "0.1.0", "GPL", "GStreamer", "GStreamer", "http://gstreamer.net/")) { GST_ERROR ("registe tssegment error"); exit (17); } /* subprocess, create_job_process */ if (shm_name != NULL) { gint fd; gchar *job_desc, *p; Job *job; gchar *log_path, *name; gint ret; /* set subprocess maximum of core file */ rlim.rlim_cur = 0; rlim.rlim_max = 0;//.........这里部分代码省略.........
开发者ID:euanmcleod,项目名称:gstreamill,代码行数:101,
示例18: mainintmain (int argc, char **argv){ GPtrArray *files; gchar **args = NULL; guint num, i; GError *err = NULL; GOptionContext *ctx; GOptionEntry options[] = { {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL}, {NULL} }; GTimer *timer; if (!g_thread_supported ()) g_thread_init (NULL); ctx = g_option_context_new ("FILES OR DIRECTORIES WITH AUDIO FILES"); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s/n", GST_STR_NULL (err->message)); exit (1); } g_option_context_free (ctx); if (args == NULL || *args == NULL) { g_print ("Please provide one or more directories with audio files/n/n"); return 1; } files = g_ptr_array_new (); num = g_strv_length (args); for (i = 0; i < num; ++i) { if (g_path_is_absolute (args[i])) { check_arg (files, args[i]); } else { g_warning ("Argument '%s' is not an absolute file path", args[i]); } } if (files->len == 0) { g_print ("Did not find any files/n/n"); return 1; } timer = g_timer_new (); while (g_timer_elapsed (timer, NULL) < TEST_RUNTIME) { gint32 idx; idx = g_random_int_range (0, files->len); play_file ((const gchar *) g_ptr_array_index (files, idx)); } g_strfreev (args); g_timer_destroy (timer); return 0;}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:61,
示例19: gst_test_http_src_createstatic GstFlowReturngst_test_http_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** retbuf){ GstTestHTTPSrc *src = GST_TEST_HTTP_SRC (basesrc); guint bytes_read; GstFlowReturn ret = GST_FLOW_OK; guint blocksize; fail_unless (gst_test_http_src_callbacks != NULL); fail_unless (gst_test_http_src_callbacks->src_create != NULL); GST_OBJECT_LOCK (src); blocksize = basesrc->blocksize; GST_OBJECT_UNLOCK (src); g_mutex_lock (&src->mutex); GST_DEBUG ("gst_test_http_src_create feeding from %" G_GUINT64_FORMAT, src->position); if (src->uri == NULL) { GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM); g_mutex_unlock (&src->mutex); return GST_FLOW_ERROR; } if (src->input.status_code < 200 || src->input.status_code >= 300) { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("%s", "Generated requested error"), ("%s (%d), URL: %s, Redirect to: %s", "Generated requested error", src->input.status_code, src->uri, GST_STR_NULL (NULL))); g_mutex_unlock (&src->mutex); return GST_FLOW_ERROR; } if (src->http_method == METHOD_INVALID) { GST_ELEMENT_ERROR (src, RESOURCE, READ, ("%s", "Invalid HTTP method"), ("%s (%s), URL: %s", "Invalid HTTP method", src->http_method_name, src->uri)); g_mutex_unlock (&src->mutex); return GST_FLOW_ERROR; } else if (src->http_method == METHOD_HEAD) { ret = GST_FLOW_EOS; goto http_events; } fail_unless_equals_uint64 (offset, src->position); bytes_read = MIN ((src->segment_end - src->position), blocksize); if (bytes_read == 0) { ret = GST_FLOW_EOS; goto http_events; } ret = gst_test_http_src_callbacks->src_create (src, offset, bytes_read, retbuf, src->input.context, gst_test_http_src_callback_user_data); if (ret != GST_FLOW_OK) { goto http_events; } GST_BUFFER_OFFSET (*retbuf) = src->position; GST_BUFFER_OFFSET_END (*retbuf) = src->position + bytes_read; src->position += bytes_read;http_events: if (src->http_headers_event) { gst_pad_push_event (GST_BASE_SRC_PAD (src), src->http_headers_event); src->http_headers_event = NULL; } if (src->duration_changed) { src->duration_changed = FALSE; gst_element_post_message (GST_ELEMENT (src), gst_message_new_duration_changed (GST_OBJECT (src))); } g_mutex_unlock (&src->mutex); return ret;}
开发者ID:asrashley,项目名称:gst-plugins-bad,代码行数:73,
示例20: maingintmain (gint argc, gchar * argv[]){ GstStateChangeReturn ret; GstElement *pipeline; GstElement *filter, *sink; GstElement *sourcebin; GError *error = NULL; GtkWidget *window; GtkWidget *screen; GtkWidget *vbox, *combo; GtkWidget *hbox; GtkWidget *play, *pause, *null, *ready; gchar **source_desc_array = NULL; gchar *source_desc = NULL; GOptionContext *context; GOptionEntry options[] = { {"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array, "Use a custom source bin description (gst-launch style)", NULL} , {NULL} }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, gst_init_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print ("Inizialization error: %s/n", GST_STR_NULL (error->message)); return -1; } g_option_context_free (context); if (source_desc_array != NULL) { source_desc = g_strjoinv (" ", source_desc_array); g_strfreev (source_desc_array); } if (source_desc == NULL) { source_desc = g_strdup ("videotestsrc ! video/x-raw, width=352, height=288 ! identity"); } sourcebin = gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error); g_free (source_desc); if (error) { g_print ("Error while parsing source bin description: %s/n", GST_STR_NULL (error->message)); return -1; } g_set_application_name ("gst-gl-effects test app"); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 3); pipeline = gst_pipeline_new ("pipeline"); filter = gst_element_factory_make ("gleffects", "flt"); sink = gst_element_factory_make ("glimagesink", "glsink"); gst_bin_add_many (GST_BIN (pipeline), sourcebin, filter, sink, NULL); if (!gst_element_link_many (sourcebin, filter, sink, NULL)) { g_print ("Failed to link one or more elements!/n"); return -1; } g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (destroy_cb), pipeline); g_signal_connect (G_OBJECT (window), "destroy-event", G_CALLBACK (destroy_cb), pipeline); screen = gtk_drawing_area_new (); gtk_widget_set_size_request (screen, 640, 480); // 500 x 376 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_box_pack_start (GTK_BOX (vbox), screen, TRUE, TRUE, 0); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "identity"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "mirror"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "squeeze"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "stretch"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "fisheye"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "twirl"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "bulge"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "tunnel"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "square"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "heat"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "xpro"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "lumaxpro"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "sepia");//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:101,
示例21: gst_vcdsrc_start/* open the file, necessary to go to RUNNING state */static gbooleangst_vcdsrc_start (GstBaseSrc * bsrc){ int i; GstVCDSrc *src = GST_VCDSRC (bsrc); struct stat buf; /* open the device */ src->fd = open (src->device, O_RDONLY); if (src->fd < 0) goto open_failed; if (fstat (src->fd, &buf) < 0) goto toc_failed; /* If it's not a block device, then we need to try and * parse the cue file if there is one * FIXME implement */ if (!S_ISBLK (buf.st_mode)) { GST_DEBUG ("Reading CUE files not handled yet, cannot process %s", GST_STR_NULL (src->device)); goto toc_failed; } /* read the table of contents */ if (ioctl (src->fd, CDROMREADTOCHDR, &src->tochdr)) goto toc_failed; /* allocate enough track structs for disk */ src->numtracks = (src->tochdr.cdth_trk1 - src->tochdr.cdth_trk0) + 1; src->tracks = g_new (struct cdrom_tocentry, src->numtracks + 1); /* read each track entry */ for (i = 0; i <= src->numtracks; i++) { src->tracks[i].cdte_track = i == src->numtracks ? CDROM_LEADOUT : i + 1; src->tracks[i].cdte_format = CDROM_MSF; if (ioctl (src->fd, CDROMREADTOCENTRY, &src->tracks[i])) goto toc_entry_failed; GST_DEBUG ("track %d begins at %d:%02d.%02d", i, src->tracks[i].cdte_addr.msf.minute, src->tracks[i].cdte_addr.msf.second, src->tracks[i].cdte_addr.msf.frame); } src->curoffset = 0; gst_vcdsrc_recalculate (src); return TRUE; /* ERRORS */open_failed: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM); return FALSE; }toc_failed: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM); close (src->fd); return FALSE; }toc_entry_failed: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM); g_free (src->tracks); close (src->fd); return FALSE; }}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:71,
示例22: bindtextdomainGstElement *mmsGstLaunch(const char *pipeline_description) { GError *error = NULL; gint res = 0;#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE);#endif if (!g_thread_supported ()) g_thread_init (NULL); gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE);#ifndef DISABLE_FAULT_HANDLER fault_setup (); sigint_setup (); play_signal_setup ();#endif // parse the pipeline description pipeline = gst_parse_launch(pipeline_description, &error); if (!pipeline) { if (error) { fprintf (stderr, "ERROR: pipeline could not be constructed: %s./n", GST_STR_NULL (error->message)); g_error_free (error); } else { fprintf (stderr, "ERROR: pipeline could not be constructed./n"); } return NULL; } else if (error) { fprintf (stderr, "WARNING: erroneous pipeline: %s/n", GST_STR_NULL (error->message)); g_error_free (error); return NULL; } GstState state; GstStateChangeReturn ret; /* If the top-level object is not a pipeline, place it in a pipeline. */ if (!GST_IS_PIPELINE (pipeline)) { GstElement *real_pipeline = gst_element_factory_make ("pipeline", NULL); if (real_pipeline == NULL) { fprintf (stderr, "ERROR: the 'pipeline' element wasn't found./n"); return NULL; } gst_bin_add (GST_BIN (real_pipeline), pipeline); pipeline = real_pipeline; } fprintf (stderr, "Setting pipeline to PAUSED .../n"); ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); switch (ret) { case GST_STATE_CHANGE_FAILURE: fprintf (stderr, "ERROR: Pipeline doesn't want to pause./n"); res = -1; event_loop (pipeline, FALSE, GST_STATE_VOID_PENDING); goto end; case GST_STATE_CHANGE_NO_PREROLL: fprintf (stderr, "Pipeline is live and does not need PREROLL .../n"); is_live = TRUE; break; case GST_STATE_CHANGE_ASYNC: fprintf (stderr, "Pipeline is PREROLLING .../n"); caught_error = event_loop (pipeline, TRUE, GST_STATE_PAUSED); if (caught_error) { fprintf (stderr, "ERROR: pipeline doesn't want to preroll./n"); goto end; } state = GST_STATE_PAUSED; // fallthrough case GST_STATE_CHANGE_SUCCESS: fprintf (stderr, "Pipeline is PREROLLED .../n"); break; } // pipe successfully created return pipeline;end: mmsGstFree(); return NULL;}
开发者ID:RomTok,项目名称:disco-light,代码行数:91,
示例23: gst_rdt_manager_chain_rtcp//.........这里部分代码省略......... guint count, i; ssrc = gst_rtcp_packet_rr_get_ssrc (&packet); GST_DEBUG_OBJECT (src, "got RR packet: SSRC %08x", ssrc); count = gst_rtcp_packet_get_rb_count (&packet); for (i = 0; i < count; i++) { guint32 ssrc, exthighestseq, jitter, lsr, dlsr; guint8 fractionlost; gint32 packetslost; gst_rtcp_packet_get_rb (&packet, i, &ssrc, &fractionlost, &packetslost, &exthighestseq, &jitter, &lsr, &dlsr); GST_DEBUG_OBJECT (src, "got RB packet %d: SSRC %08x, FL %u" ", PL %u, HS %u, JITTER %u, LSR %u, DLSR %u", ssrc, fractionlost, packetslost, exthighestseq, jitter, lsr, dlsr); } break; } case GST_RTCP_TYPE_SDES: { guint chunks, i, j; gboolean more_chunks, more_items; chunks = gst_rtcp_packet_sdes_get_chunk_count (&packet); GST_DEBUG_OBJECT (src, "got SDES packet with %d chunks", chunks); more_chunks = gst_rtcp_packet_sdes_first_chunk (&packet); i = 0; while (more_chunks) { guint32 ssrc; ssrc = gst_rtcp_packet_sdes_get_ssrc (&packet); GST_DEBUG_OBJECT (src, "chunk %d, SSRC %08x", i, ssrc); more_items = gst_rtcp_packet_sdes_first_item (&packet); j = 0; while (more_items) { GstRTCPSDESType type; guint8 len; gchar *data; gst_rtcp_packet_sdes_get_item (&packet, &type, &len, &data); GST_DEBUG_OBJECT (src, "item %d, type %d, len %d, data %s", j, type, len, data); more_items = gst_rtcp_packet_sdes_next_item (&packet); j++; } more_chunks = gst_rtcp_packet_sdes_next_chunk (&packet); i++; } break; } case GST_RTCP_TYPE_BYE: { guint count, i; gchar *reason; reason = gst_rtcp_packet_bye_get_reason (&packet); GST_DEBUG_OBJECT (src, "got BYE packet (reason: %s)", GST_STR_NULL (reason)); g_free (reason); count = gst_rtcp_packet_bye_get_ssrc_count (&packet); for (i = 0; i < count; i++) { guint32 ssrc; ssrc = gst_rtcp_packet_bye_get_nth_ssrc (&packet, i); GST_DEBUG_OBJECT (src, "SSRC: %08x", ssrc); } break; } case GST_RTCP_TYPE_APP: GST_DEBUG_OBJECT (src, "got APP packet"); break; default: GST_WARNING_OBJECT (src, "got unknown RTCP packet"); break; } more = gst_rtcp_packet_move_to_next (&packet); } gst_buffer_unref (buffer); return GST_FLOW_OK;bad_packet: { GST_WARNING_OBJECT (src, "got invalid RTCP packet"); return GST_FLOW_OK; }#else return GST_FLOW_OK;#endif}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:101,
示例24: gst_split_file_src_startstatic gbooleangst_split_file_src_start (GstBaseSrc * basesrc){ GstSplitFileSrc *src = GST_SPLIT_FILE_SRC (basesrc); GCancellable *cancel; gboolean ret = FALSE; guint64 offset; GError *err = NULL; gchar *basename = NULL; gchar *dirname = NULL; gchar **files; guint i; GST_OBJECT_LOCK (src); if (src->location != NULL && src->location[0] != '/0') { basename = g_path_get_basename (src->location); dirname = g_path_get_dirname (src->location); } GST_OBJECT_UNLOCK (src); files = gst_split_file_src_find_files (src, dirname, basename, &err); if (files == NULL || *files == NULL) goto no_files; src->num_parts = g_strv_length (files); src->parts = g_new0 (GstFilePart, src->num_parts); cancel = src->cancellable; offset = 0; for (i = 0; i < src->num_parts; ++i) { GFileInputStream *stream; GFileInfo *info; goffset size; GFile *file; file = g_file_new_for_path (files[i]); stream = g_file_read (file, cancel, &err); g_object_unref (file); if (err != NULL) goto open_read_error; info = g_file_input_stream_query_info (stream, "standard::*", NULL, &err); if (err != NULL) { g_object_unref (stream); goto query_info_error; } size = g_file_info_get_size (info); g_object_unref (info); src->parts[i].stream = stream; src->parts[i].path = g_strdup (files[i]); src->parts[i].start = offset; src->parts[i].stop = offset + size - 1; GST_DEBUG ("[%010" G_GUINT64_FORMAT "-%010" G_GUINT64_FORMAT "] %s", src->parts[i].start, src->parts[i].stop, src->parts[i].path); offset += size; } GST_INFO ("Successfully opened %u file parts for reading", src->num_parts); src->cur_part = 0; src->cancellable = g_cancellable_new (); ret = TRUE;done: if (err != NULL) g_error_free (err); g_strfreev (files); g_free (basename); g_free (dirname); return ret;/* ERRORS */no_files: { if (err->code == G_IO_ERROR_CANCELLED) goto cancelled; GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("%s", err->message), ("Failed to find files in '%s' for pattern '%s'", GST_STR_NULL (dirname), GST_STR_NULL (basename))); goto done; }open_read_error: { if (err->code == G_IO_ERROR_CANCELLED) goto cancelled; GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("%s", err->message), ("Failed to open file '%s' for reading", files[i])); goto done; }//.........这里部分代码省略.........
开发者ID:TheBigW,项目名称:gst-plugins-good,代码行数:101,
示例25: mainintmain (int argc, char **argv){ GstPlay *play; GPtrArray *playlist; gboolean verbose = FALSE; gboolean print_version = FALSE; gboolean interactive = TRUE; gboolean gapless = FALSE; gboolean shuffle = FALSE; gdouble volume = -1; gchar **filenames = NULL; gchar *audio_sink = NULL; gchar *video_sink = NULL; gchar **uris; gchar *flags = NULL; guint num, i; GError *err = NULL; GOptionContext *ctx; gchar *playlist_file = NULL; GOptionEntry options[] = { {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Output status information and property notifications"), NULL}, {"flags", 0, 0, G_OPTION_ARG_STRING, &flags, N_("Control playback behaviour setting playbin 'flags' property"), NULL}, {"version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print version information and exit"), NULL}, {"videosink", 0, 0, G_OPTION_ARG_STRING, &video_sink, N_("Video sink to use (default is autovideosink)"), NULL}, {"audiosink", 0, 0, G_OPTION_ARG_STRING, &audio_sink, N_("Audio sink to use (default is autoaudiosink)"), NULL}, {"gapless", 0, 0, G_OPTION_ARG_NONE, &gapless, N_("Enable gapless playback"), NULL}, {"shuffle", 0, 0, G_OPTION_ARG_NONE, &shuffle, N_("Shuffle playlist"), NULL}, {"no-interactive", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &interactive, N_("Disable interactive control via the keyboard"), NULL}, {"volume", 0, 0, G_OPTION_ARG_DOUBLE, &volume, N_("Volume"), NULL}, {"playlist", 0, 0, G_OPTION_ARG_FILENAME, &playlist_file, N_("Playlist file containing input media files"), NULL}, {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Do not print any output (apart from errors)"), NULL}, {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL}, {NULL} }; setlocale (LC_ALL, "");#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE);#endif g_set_prgname ("gst-play-" GST_API_VERSION); ctx = g_option_context_new ("FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ..."); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s/n", GST_STR_NULL (err->message)); g_option_context_free (ctx); g_clear_error (&err); return 1; } g_option_context_free (ctx); GST_DEBUG_CATEGORY_INIT (play_debug, "play", 0, "gst-play"); if (print_version) { gchar *version_str; version_str = gst_version_string (); g_print ("%s version %s/n", g_get_prgname (), PACKAGE_VERSION); g_print ("%s/n", version_str); g_print ("%s/n", GST_PACKAGE_ORIGIN); g_free (version_str); g_free (audio_sink); g_free (video_sink); g_free (playlist_file); return 0; } playlist = g_ptr_array_new (); if (playlist_file != NULL) { gchar *playlist_contents = NULL; gchar **lines = NULL; if (g_file_get_contents (playlist_file, &playlist_contents, NULL, &err)) { lines = g_strsplit (playlist_contents, "/n", 0); num = g_strv_length (lines); for (i = 0; i < num; i++) { if (lines[i][0] != '/0') {//.........这里部分代码省略.........
开发者ID:GrokImageCompression,项目名称:gst-plugins-base,代码行数:101,
示例26: mainintmain (int argc, char **argv){ GstPlay *play; GPtrArray *playlist; gboolean print_version = FALSE; gboolean interactive = FALSE; /* FIXME: maybe enable by default? */ gboolean shuffle = FALSE; gdouble volume = 1.0; gchar **filenames = NULL; gchar **uris; guint num, i; GError *err = NULL; GOptionContext *ctx; gchar *playlist_file = NULL; GOptionEntry options[] = { {"version", 0, 0, G_OPTION_ARG_NONE, &print_version, "Print version information and exit", NULL}, {"shuffle", 0, 0, G_OPTION_ARG_NONE, &shuffle, "Shuffle playlist", NULL}, {"interactive", 0, 0, G_OPTION_ARG_NONE, &interactive, "Interactive control via keyboard", NULL}, {"volume", 0, 0, G_OPTION_ARG_DOUBLE, &volume, "Volume", NULL}, {"playlist", 0, 0, G_OPTION_ARG_FILENAME, &playlist_file, "Playlist file containing input media files", NULL}, {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL}, {NULL} }; g_set_prgname ("gst-play"); ctx = g_option_context_new ("FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ..."); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s/n", GST_STR_NULL (err->message)); return 1; } g_option_context_free (ctx); GST_DEBUG_CATEGORY_INIT (play_debug, "play", 0, "gst-play"); if (print_version) { gchar *version_str; version_str = gst_version_string (); g_print ("%s version %s/n", g_get_prgname (), "1.0"); g_print ("%s/n", version_str); g_free (version_str); g_free (playlist_file); return 0; } playlist = g_ptr_array_new (); if (playlist_file != NULL) { gchar *playlist_contents = NULL; gchar **lines = NULL; if (g_file_get_contents (playlist_file, &playlist_contents, NULL, &err)) { lines = g_strsplit (playlist_contents, "/n", 0); num = g_strv_length (lines); for (i = 0; i < num; i++) { if (lines[i][0] != '/0') { GST_LOG ("Playlist[%d]: %s", i + 1, lines[i]); add_to_playlist (playlist, lines[i]); } } g_strfreev (lines); g_free (playlist_contents); } else { g_printerr ("Could not read playlist: %s/n", err->message); g_clear_error (&err); } g_free (playlist_file); playlist_file = NULL; } if (playlist->len == 0 && (filenames == NULL || *filenames == NULL)) { g_printerr ("Usage: %s FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...", "gst-play"); g_printerr ("/n/n"), g_printerr ("%s/n/n", "You must provide at least one filename or URI to play."); /* No input provided. Free array */ g_ptr_array_free (playlist, TRUE); return 1; } /* fill playlist */ if (filenames != NULL && *filenames != NULL) { num = g_strv_length (filenames); for (i = 0; i < num; ++i) { GST_LOG ("command line argument: %s", filenames[i]); add_to_playlist (playlist, filenames[i]);//.........这里部分代码省略.........
开发者ID:ajaysusarla,项目名称:gst-player,代码行数:101,
注:本文中的GST_STR_NULL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GST_TIME_ARGS函数代码示例 C++ GST_STATIC_PAD_TEMPLATE函数代码示例 |