本文整理汇总了C++中GST_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_INFO函数的具体用法?C++ GST_INFO怎么用?C++ GST_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_INFO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gst_element_factory_create
/**
* gst_element_factory_create:
* @factory: 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 elementfactory.
* It will be given the name supplied, since all elements require a name as
* their first argument.
*
* Returns: (transfer full): new #GstElement or NULL if the element couldn't
* be created
*/
GstElement *
gst_element_factory_create (GstElementFactory * factory, const gchar * name)
{
GstElement *element;
GstElementClass *oclass;
GstElementFactory *newfactory;
g_return_val_if_fail (factory != NULL, NULL);
newfactory =
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
(factory)));
if (newfactory == NULL)
goto load_failed;
factory = newfactory;
if (name)
GST_INFO ("creating element \"%s\" named \"%s\"",
GST_PLUGIN_FEATURE_NAME (factory), GST_STR_NULL (name));
else
GST_INFO ("creating element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
if (factory->type == 0)
goto no_type;
/* create an instance of the element, cast so we don't assert on NULL
* also set name as early as we can
*/
if (name)
element =
GST_ELEMENT_CAST (g_object_new (factory->type, "name", name, NULL));
else
element = GST_ELEMENT_CAST (g_object_newv (factory->type, 0, NULL));
if (G_UNLIKELY (element == NULL))
goto no_element;
/* fill in the pointer to the factory in the element class. The
* class will not be unreffed currently.
* Be thread safe as there might be 2 threads creating the first instance of
* an element at the same moment
*/
oclass = GST_ELEMENT_GET_CLASS (element);
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&oclass->elementfactory, NULL,
factory))
gst_object_unref (factory);
GST_DEBUG ("created element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
return element;
/* ERRORS */
load_failed:
{
GST_WARNING_OBJECT (factory,
"loading plugin containing feature %s returned NULL!", name);
return NULL;
}
no_type:
{
GST_WARNING_OBJECT (factory, "factory has no type");
gst_object_unref (factory);
return NULL;
}
no_element:
{
GST_WARNING_OBJECT (factory, "could not create element");
gst_object_unref (factory);
return NULL;
}
}
开发者ID:AlerIl,项目名称:gstreamer0.10,代码行数:85,代码来源:gstelementfactory.c
示例2: _check_directory
static gboolean
_check_directory (GstValidateSsim * self, const gchar * ref_dir,
const gchar * compared_dir, gfloat * mean, gfloat * lowest,
gfloat * highest, const gchar * outfolder)
{
gint nfiles = 0, nnotfound = 0, nfailures = 0;
gboolean res = TRUE;
GFileInfo *info;
GFileEnumerator *fenum;
gfloat min_avg = 1.0, min_min = 1.0, total_avg = 0;
GFile *file = g_file_new_for_path (ref_dir);
if (!(fenum = g_file_enumerate_children (file,
"standard::*", G_FILE_QUERY_INFO_NONE, NULL, NULL))) {
GST_INFO ("%s is not a folder", ref_dir);
res = FALSE;
goto done;
}
for (info = g_file_enumerator_next_file (fenum, NULL, NULL);
info; info = g_file_enumerator_next_file (fenum, NULL, NULL)) {
if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR ||
g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK) {
gchar *compared_file = g_build_path (G_DIR_SEPARATOR_S,
compared_dir, g_file_info_get_name (info), NULL);
gchar *ref_file = NULL;
if (!g_file_test (compared_file, G_FILE_TEST_IS_REGULAR)) {
GST_INFO_OBJECT (self, "Could not find file %s", compared_file);
nnotfound++;
res = FALSE;
} else {
ref_file =
g_build_path (G_DIR_SEPARATOR_S, ref_dir,
g_file_info_get_name (info), NULL);
if (!gst_validate_ssim_compare_image_files (self, ref_file,
compared_file, mean, lowest, highest, outfolder)) {
nfailures++;
res = FALSE;
} else {
nfiles++;
}
}
min_avg = MIN (min_avg, *mean);
min_min = MIN (min_min, *lowest);
total_avg += *mean;
gst_validate_printf (NULL,
"<position: %s duration: %" GST_TIME_FORMAT
" avg: %f min: %f (Passed: %d failed: %d, %d not found)/>\r",
g_file_info_get_display_name (info),
GST_TIME_ARGS (GST_CLOCK_TIME_NONE),
*mean, *lowest, nfiles, nfailures, nnotfound);
g_free (compared_file);
g_free (ref_file);
}
g_object_unref (info);
}
if (nfiles == 0) {
gst_validate_printf (NULL, "\nNo files to verify.\n");
} else {
gst_validate_printf (NULL,
"\nAverage similarity: %f, min_avg: %f, min_min: %f\n",
total_avg / nfiles, min_avg, min_min);
}
done:
gst_object_unref (file);
if (fenum)
gst_object_unref (fenum);
return res;
}
开发者ID:thiblahute,项目名称:gst-devtools,代码行数:79,代码来源:gstvalidatessim.c
示例3: gst_lv2_filter_base_init
static void
gst_lv2_filter_base_init (gpointer g_class)
{
GstLV2FilterClass *klass = (GstLV2FilterClass *) g_class;
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
LilvPlugin *lv2plugin;
LilvNode *val;
/* FIXME Handle channels positionning
* GstAudioChannelPosition position = GST_AUDIO_CHANNEL_POSITION_INVALID; */
guint j, in_pad_index = 0, out_pad_index = 0;
gchar *longname, *author;
lv2plugin = (LilvPlugin *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
descriptor_quark);
g_assert (lv2plugin);
GST_INFO ("base_init %p, plugin %s", g_class,
lilv_node_get_turtle_token (lilv_plugin_get_uri (lv2plugin)));
klass->in_group.ports = g_array_new (FALSE, TRUE, sizeof (GstLV2FilterPort));
klass->out_group.ports = g_array_new (FALSE, TRUE, sizeof (GstLV2FilterPort));
klass->control_in_ports =
g_array_new (FALSE, TRUE, sizeof (GstLV2FilterPort));
klass->control_out_ports =
g_array_new (FALSE, TRUE, sizeof (GstLV2FilterPort));
/* find ports and groups */
for (j = 0; j < lilv_plugin_get_num_ports (lv2plugin); j++) {
const LilvPort *port = lilv_plugin_get_port_by_index (lv2plugin, j);
const gboolean is_input = lilv_port_is_a (lv2plugin, port, input_class);
struct _GstLV2FilterPort desc = { j, 0, };
LilvNodes *lv2group = lilv_port_get (lv2plugin, port, group_pred);
if (lv2group) {
/* port is part of a group */
const gchar *group_uri = lilv_node_as_uri (lv2group);
GstLV2FilterGroup *group =
is_input ? &klass->in_group : &klass->out_group;
if (group->uri == NULL) {
group->uri = g_strdup (group_uri);
group->pad = is_input ? in_pad_index++ : out_pad_index++;
group->ports = g_array_new (FALSE, TRUE, sizeof (GstLV2FilterPort));
}
/* FIXME Handle channels positionning
position = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
sub_values = lilv_port_get_value (lv2plugin, port, has_role_pred);
if (lilv_nodes_size (sub_values) > 0) {
LilvNode *role = lilv_nodes_get_at (sub_values, 0);
position = gst_lv2_filter_role_to_position (role);
}
lilv_nodes_free (sub_values);
if (position != GST_AUDIO_CHANNEL_POSITION_INVALID) {
desc.position = position;
} */
g_array_append_val (group->ports, desc);
} else {
/* port is not part of a group, or it is part of a group but that group
* is illegal so we just ignore it */
if (lilv_port_is_a (lv2plugin, port, audio_class)) {
desc.pad = is_input ? in_pad_index++ : out_pad_index++;
if (is_input)
g_array_append_val (klass->in_group.ports, desc);
else
g_array_append_val (klass->out_group.ports, desc);
} else if (lilv_port_is_a (lv2plugin, port, control_class)) {
if (is_input)
g_array_append_val (klass->control_in_ports, desc);
else
g_array_append_val (klass->control_out_ports, desc);
} else {
/* unknown port type */
GST_INFO ("unhandled port %d", j);
continue;
}
}
}
gst_lv2_filter_type_class_add_pad_templates (klass);
val = lilv_plugin_get_name (lv2plugin);
if (val) {
longname = g_strdup (lilv_node_as_string (val));
lilv_node_free (val);
} else {
longname = g_strdup ("no description available");
}
val = lilv_plugin_get_author_name (lv2plugin);
if (val) {
author = g_strdup (lilv_node_as_string (val));
lilv_node_free (val);
} else {
author = g_strdup ("no author available");
}
gst_element_class_set_metadata (element_class, longname,
//.........这里部分代码省略.........
开发者ID:reynaldo-samsung,项目名称:gst-plugins-bad,代码行数:101,代码来源:gstlv2filter.c
示例4: main
//.........这里部分代码省略.........
if ((job_desc != NULL) && (!jobdesc_is_valid (job_desc))) {
exit (6);
}
/* initialize log */
name = (gchar *)jobdesc_get_name (job_desc);
if (!jobdesc_is_live (job_desc)) {
gchar *p;
p = jobdesc_get_log_path (job_desc);
log_path = g_build_filename (p, "gstreamill.log", NULL);
g_free (p);
} else {
log_path = g_build_filename (log_dir, name, "gstreamill.log", NULL);
}
ret = init_log (log_path);
g_free (log_path);
if (ret != 0) {
exit (7);
}
/* launch a job. */
datetime = g_date_time_new_now_local ();
date = g_date_time_format (datetime, "%b %d %H:%M:%S");
fprintf (_log->log_hd, "\n*** %s : job %s starting ***\n\n", date, name);
g_date_time_unref (datetime);
g_free (date);
job = job_new ("name", name, "job", job_desc, NULL);
job->is_live = jobdesc_is_live (job_desc);
job->eos = FALSE;
loop = g_main_loop_new (NULL, FALSE);
GST_INFO ("Initializing job ...");
if (job_initialize (job, TRUE) != 0) {
GST_ERROR ("initialize job failure, exit");
exit (8);
}
GST_INFO ("Initializing job done");
GST_INFO ("Initializing job's encoders output ...");
if (job_encoders_output_initialize (job) != 0) {
GST_ERROR ("initialize job encoders' output failure, exit");
exit (8);
}
GST_INFO ("Initializing job's encoders output done");
GST_INFO ("Starting job ...");
if (job_start (job) != 0) {
GST_ERROR ("start livejob failure, exit");
exit (9);
}
datetime = g_date_time_new_now_local ();
date = g_date_time_format (datetime, "%b %d %H:%M:%S");
fprintf (_log->log_hd, "\n*** %s : job %s started ***\n\n", date, name);
g_date_time_unref (datetime);
g_free (date);
g_free (name);
g_free (job_desc);
signal (SIGPIPE, SIG_IGN);
signal (SIGUSR1, sighandler);
signal (SIGTERM, stop_job);
g_main_loop_run (loop);
开发者ID:euanmcleod,项目名称:gstreamill,代码行数:66,代码来源:main.c
示例5: gst_dasf_enable
static void
gst_dasf_enable (GstDasfSrc* self)
{
GST_INFO ("");
GstPad *peer;
GstElement *next_element;
GooComponent *component;
GstBaseSrc *base_src;
if (self->component != NULL)
{
return;
}
peer = gst_pad_get_peer (GST_BASE_SRC_PAD (self));
if (G_UNLIKELY (peer == NULL))
{
GST_INFO ("No next pad");
return;
}
next_element = GST_ELEMENT (gst_pad_get_parent (peer));
if (G_UNLIKELY (next_element == NULL))
{
GST_INFO ("Cannot find a next element");
goto done;
}
/** expecting a capsfilter between dasfsrc and goo audio component **/
while (GST_IS_BASE_TRANSFORM (next_element))
{
GST_DEBUG_OBJECT(self, "next element name: %s", gst_element_get_name (next_element));
gst_object_unref (peer);
peer = gst_pad_get_peer (GST_BASE_TRANSFORM_SRC_PAD (next_element));
gst_object_unref (next_element);
next_element = GST_ELEMENT(gst_pad_get_parent (peer)) ;
GST_DEBUG_OBJECT (self, "one after element name: %s", gst_element_get_name(next_element));
}
/** capsfilter might be found
* element next to the caps filter should be goo **/
component = GOO_COMPONENT (g_object_get_data
(G_OBJECT (next_element), "goo"));
if (G_UNLIKELY (component == NULL))
{
GST_INFO ("Previous element does not have a Goo component");
goto done;
}
if (!GOO_IS_TI_AUDIO_COMPONENT (component))
{
GST_WARNING ("The component in previous element is not TI Audio");
goto done;
}
self->component = GOO_TI_AUDIO_COMPONENT (component);
goo_ti_audio_component_set_dasf_mode (self->component, TRUE);
GST_DEBUG_OBJECT (self, "set data path");
goo_ti_audio_component_set_data_path (self->component, 0);
/** getting num-buffers from base src **/
base_src = GST_BASE_SRC (self);
goo_ti_audio_encoder_set_number_buffers (GOO_TI_AUDIO_ENCODER (component), base_src->num_buffers);
done:
gst_object_unref (peer);
gst_object_unref (next_element);
GST_DEBUG_OBJECT (self, "peer refcount = %d",
G_OBJECT (peer)->ref_count);
GST_DEBUG_OBJECT (self, "next element refcount = %d",
G_OBJECT (next_element)->ref_count);
return;
}
开发者ID:ceyusa,项目名称:gst-goo,代码行数:82,代码来源:gstdasfsrc.c
示例6: gst_rtsp_mount_points_match
/**
* gst_rtsp_mount_points_match:
* @mounts: a #GstRTSPMountPoints
* @path: a mount point
* @matched: (out): the amount of @path matched
*
* Find the factory in @mounts that has the longest match with @path.
*
* If @matched is %NULL, @path will match the factory exactly otherwise
* the amount of characters that matched is returned in @matched.
*
* Returns: (transfer full): the #GstRTSPMediaFactory for @path.
* g_object_unref() after usage.
*/
GstRTSPMediaFactory *
gst_rtsp_mount_points_match (GstRTSPMountPoints * mounts,
const gchar * path, gint * matched)
{
GstRTSPMountPointsPrivate *priv;
GstRTSPMediaFactory *result = NULL;
GSequenceIter *iter, *best;
DataItem item, *ritem;
g_return_val_if_fail (GST_IS_RTSP_MOUNT_POINTS (mounts), NULL);
g_return_val_if_fail (path != NULL, NULL);
priv = mounts->priv;
item.path = (gchar *) path;
item.len = strlen (path);
g_mutex_lock (&priv->lock);
if (priv->dirty) {
g_sequence_sort (priv->mounts, data_item_compare, mounts);
g_sequence_foreach (priv->mounts, (GFunc) data_item_dump,
(gpointer) "sort :");
priv->dirty = FALSE;
}
/* find the location of the media in the hashtable we only use the absolute
* path of the uri to find a media factory. If the factory depends on other
* properties found in the url, this method should be overridden. */
iter = g_sequence_get_begin_iter (priv->mounts);
best = NULL;
while (!g_sequence_iter_is_end (iter)) {
ritem = g_sequence_get (iter);
data_item_dump (ritem, "inspect: ");
if (best == NULL) {
if (has_prefix (&item, ritem)) {
data_item_dump (ritem, "prefix: ");
best = iter;
}
} else {
if (!has_prefix (&item, ritem))
break;
best = iter;
data_item_dump (ritem, "new best: ");
}
iter = g_sequence_iter_next (iter);
}
if (best) {
ritem = g_sequence_get (best);
data_item_dump (ritem, "result: ");
if (matched || ritem->len == item.len) {
result = g_object_ref (ritem->factory);
if (matched)
*matched = ritem->len;
}
}
g_mutex_unlock (&priv->lock);
GST_INFO ("found media factory %p for path %s", result, path);
return result;
}
开发者ID:alleen,项目名称:gst-rtsp-server-wfd,代码行数:78,代码来源:rtsp-mount-points.c
示例7: find_goo_component_in_elem
/**
* recursively iterate all our pads and search adjacent elements
*/
static GooComponent *
find_goo_component_in_elem (GstElement *elem, SearchContext *ctx)
{
GstIterator *itr;
gpointer item;
GooComponent *component = NULL;
/* check if we've already examined this element, to prevent loops: */
if (already_visited (ctx->visited_nodes, elem))
{
GST_INFO ("already visited elem=%s (%s)", gst_element_get_name (elem), G_OBJECT_TYPE_NAME (elem));
return NULL;
}
GST_INFO ("elem=%s (%s)", gst_element_get_name (elem), G_OBJECT_TYPE_NAME (elem));
/* note: we don't handle the case of the underlying data structure changing
* while iterating.. we just bail out and the user needs to restart.
*/
for( itr = gst_element_iterate_pads (elem);
gst_iterator_next (itr, &item) == GST_ITERATOR_OK && !component;
gst_object_unref (item) )
{
GstElement *adjacent_elem = NULL;
GstPad *pad = GST_PAD (item);
GstPad *peer = gst_pad_get_peer (pad);
GST_INFO ("found pad: %s (%s)", gst_pad_get_name (pad), G_OBJECT_TYPE_NAME (pad));
if (G_UNLIKELY (peer == NULL))
{
GST_INFO ("NULL peer.. not connected yet?");
continue;
}
/* in the case of GstGhostPad (and probably other proxy pads)
* the parent is actually the pad we are a proxy for, so
* keep looping until we find the GstElement
*/
while(TRUE)
{
GstObject *obj = gst_pad_get_parent (peer);
if( GST_IS_PAD(obj) )
{
gst_object_unref (peer);
peer = GST_PAD (obj);
}
else
{
adjacent_elem = GST_ELEMENT (obj);
break;
}
}
if (G_UNLIKELY (adjacent_elem == NULL))
{
gst_object_unref (peer);
GST_INFO ("Cannot find a adjacent element");
continue;
}
GST_INFO ("found adjacent_elem: %s", gst_element_get_name (adjacent_elem));
component = find_goo_component (adjacent_elem, ctx);
/* cleanup: */
gst_object_unref (adjacent_elem);
gst_object_unref (peer);
}
gst_iterator_free (itr);
return component;
}
开发者ID:mrchapp,项目名称:gst-goo,代码行数:77,代码来源:gstgooutils.c
示例8: test_add_pad
/* check if adding pads work as expected */
void test_add_pad()
{
GstElement *bin, *src1, *src2, *adder, *sink;
GstBus *bus;
gboolean res;
//xmlfile = "test_add_pad";
std_log(LOG_FILENAME_LINE, "Test Started test_add_pad");
GST_INFO ("preparing test");
/* build pipeline */
bin = gst_pipeline_new ("pipeline");
bus = gst_element_get_bus (bin);
gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
src1 = gst_element_factory_make ("audiotestsrc", "src1");
g_object_set (src1, "num-buffers", 4, NULL);
g_object_set (src1, "wave", 4, NULL); /* silence */
src2 = gst_element_factory_make ("audiotestsrc", "src2");
/* one buffer less, we connect with 1 buffer of delay */
g_object_set (src2, "num-buffers", 3, NULL);
g_object_set (src2, "wave", 4, NULL); /* silence */
adder = gst_element_factory_make ("adder", "adder");
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add_many (GST_BIN (bin), src1, adder, sink, NULL);
res = gst_element_link (src1, adder);
fail_unless (res == TRUE, NULL);
res = gst_element_link (adder, sink);
fail_unless (res == TRUE, NULL);
main_loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
bin);
g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
GST_INFO ("starting test");
/* prepare playing */
res = gst_element_set_state (bin, GST_STATE_PAUSED);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* wait for completion */
res =
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
GST_CLOCK_TIME_NONE);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* add other element */
gst_bin_add_many (GST_BIN (bin), src2, NULL);
/* now link the second element */
res = gst_element_link (src2, adder);
fail_unless (res == TRUE, NULL);
/* set to PAUSED as well */
res = gst_element_set_state (src2, GST_STATE_PAUSED);
/* now play all */
res = gst_element_set_state (bin, GST_STATE_PLAYING);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
g_main_loop_run (main_loop);
res = gst_element_set_state (bin, GST_STATE_NULL);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* cleanup */
g_main_loop_unref (main_loop);
gst_object_unref (G_OBJECT (bus));
gst_object_unref (G_OBJECT (bin));
std_log(LOG_FILENAME_LINE, "Test Successful");
create_xml(0);
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:76,代码来源:adder.c
示例9: test_remove_pad
/* check if removing pads work as expected */
void test_remove_pad()
{
GstElement *bin, *src, *adder, *sink;
GstBus *bus;
GstPad *pad;
gboolean res;
//xmlfile = "test_remove_pad";
std_log(LOG_FILENAME_LINE, "Test Started test_remove_pad");
GST_INFO ("preparing test");
/* build pipeline */
bin = gst_pipeline_new ("pipeline");
bus = gst_element_get_bus (bin);
gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
src = gst_element_factory_make ("audiotestsrc", "src");
g_object_set (src, "num-buffers", 4, NULL);
g_object_set (src, "wave", 4, NULL);
adder = gst_element_factory_make ("adder", "adder");
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add_many (GST_BIN (bin), src, adder, sink, NULL);
res = gst_element_link (src, adder);
fail_unless (res == TRUE, NULL);
res = gst_element_link (adder, sink);
fail_unless (res == TRUE, NULL);
/* create an unconnected sinkpad in adder */
pad = gst_element_get_request_pad (adder, "sink%d");
fail_if (pad == NULL, NULL);
main_loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
bin);
g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
GST_INFO ("starting test");
/* prepare playing, this will not preroll as adder is waiting
* on the unconnected sinkpad. */
res = gst_element_set_state (bin, GST_STATE_PAUSED);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* wait for completion for one second, will return ASYNC */
res = gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_SECOND);
fail_unless (res == GST_STATE_CHANGE_ASYNC, NULL);
/* get rid of the pad now, adder should stop waiting on it and
* continue the preroll */
gst_element_release_request_pad (adder, pad);
gst_object_unref (pad);
/* wait for completion, should work now */
res =
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
GST_CLOCK_TIME_NONE);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* now play all */
res = gst_element_set_state (bin, GST_STATE_PLAYING);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
g_main_loop_run (main_loop);
res = gst_element_set_state (bin, GST_STATE_NULL);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* cleanup */
g_main_loop_unref (main_loop);
gst_object_unref (G_OBJECT (bus));
gst_object_unref (G_OBJECT (bin));
std_log(LOG_FILENAME_LINE, "Test Successful");
create_xml(0);
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:77,代码来源:adder.c
示例10: gst_ks_video_device_read_frame
//.........这里部分代码省略.........
if (hdr->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEVALID)
timestamp = hdr->PresentationTime.Time * 100;
if (hdr->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_DURATIONVALID)
duration = hdr->Duration * 100;
UNREF_BUFFER (buf);
if (G_LIKELY (hdr->DataUsed != 0)) {
/* Assume it's a good frame */
GST_BUFFER_SIZE (req->buf) = hdr->DataUsed;
*buf = gst_buffer_ref (req->buf);
}
if (G_LIKELY (presentation_time != NULL))
*presentation_time = timestamp;
if (G_UNLIKELY (GST_DEBUG_IS_ENABLED ())) {
gchar *options_flags_str =
ks_options_flags_to_string (hdr->OptionsFlags);
GST_DEBUG ("PictureNumber=%" G_GUINT64_FORMAT ", DropCount=%"
G_GUINT64_FORMAT ", PresentationTime=%" GST_TIME_FORMAT
", Duration=%" GST_TIME_FORMAT ", OptionsFlags=%s: %lu bytes",
frame_info->PictureNumber, frame_info->DropCount,
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration),
options_flags_str, hdr->DataUsed);
g_free (options_flags_str);
}
/* Protect against old frames. This should never happen, see previous
* comment on last_timestamp. */
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (priv->last_timestamp) &&
timestamp < priv->last_timestamp)) {
GST_INFO ("got an old frame (last_timestamp=%" GST_TIME_FORMAT
", timestamp=%" GST_TIME_FORMAT ")",
GST_TIME_ARGS (priv->last_timestamp),
GST_TIME_ARGS (timestamp));
UNREF_BUFFER (buf);
} else {
priv->last_timestamp = timestamp;
}
}
} else if (GetLastError () != ERROR_OPERATION_ABORTED) {
goto error_get_result;
}
/* Submit a new request immediately */
if (!gst_ks_video_device_request_frame (self, req, error_code, error_str))
goto error_request_failed;
}
} while (*buf == NULL);
return GST_FLOW_OK;
/* ERRORS */
error_request_failed:
{
UNREF_BUFFER (buf);
return GST_FLOW_ERROR;
}
error_timeout:
{
GST_DEBUG ("IOCTL_KS_READ_STREAM timed out");
if (error_code != NULL)
*error_code = 0;
if (error_str != NULL)
*error_str = NULL;
return GST_FLOW_UNEXPECTED;
}
error_wait:
{
gst_ks_video_device_parse_win32_error ("WaitForMultipleObjects",
GetLastError (), error_code, error_str);
return GST_FLOW_ERROR;
}
error_cancel:
{
if (error_code != NULL)
*error_code = 0;
if (error_str != NULL)
*error_str = NULL;
return GST_FLOW_FLUSHING;
}
error_get_result:
{
gst_ks_video_device_parse_win32_error ("GetOverlappedResult",
GetLastError (), error_code, error_str);
return GST_FLOW_ERROR;
}
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:101,代码来源:gstksvideodevice.c
示例11: test_play_twice
void test_play_twice()
{
GstElement *bin, *src1, *src2, *adder, *sink;
GstBus *bus;
gboolean res;
//xmlfile = "test_play_twice";
std_log(LOG_FILENAME_LINE, "Test Started test_play_twice");
GST_INFO ("preparing test");
/* build pipeline */
bin = gst_pipeline_new ("pipeline");
bus = gst_element_get_bus (bin);
gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
src1 = gst_element_factory_make ("audiotestsrc", "src1");
g_object_set (src1, "wave", 4, NULL); /* silence */
src2 = gst_element_factory_make ("audiotestsrc", "src2");
g_object_set (src2, "wave", 4, NULL); /* silence */
adder = gst_element_factory_make ("adder", "adder");
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
res = gst_element_link (src1, adder);
fail_unless (res == TRUE, NULL);
res = gst_element_link (src2, adder);
fail_unless (res == TRUE, NULL);
res = gst_element_link (adder, sink);
fail_unless (res == TRUE, NULL);
play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_SET, (GstClockTime) 0,
GST_SEEK_TYPE_SET, (GstClockTime) 2 * GST_SECOND);
play_count = 0;
main_loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (bus, "message::segment-done",
(GCallback) test_play_twice_message_received, bin);
g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
GST_INFO ("starting test");
/* prepare playing */
res = gst_element_set_state (bin, GST_STATE_PAUSED);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
/* wait for completion */
res =
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
GST_CLOCK_TIME_NONE);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
res = gst_element_send_event (bin, gst_event_ref (play_seek_event));
fail_unless (res == TRUE, NULL);
/* run pipeline */
res = gst_element_set_state (bin, GST_STATE_PLAYING);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
g_main_loop_run (main_loop);
res = gst_element_set_state (bin, GST_STATE_NULL);
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
fail_unless (play_count == 2, NULL);
/* cleanup */
g_main_loop_unref (main_loop);
gst_object_unref (G_OBJECT (bus));
gst_object_unref (G_OBJECT (bin));
std_log(LOG_FILENAME_LINE, "Test Successful");
create_xml(0);
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:76,代码来源:adder.c
示例12: _2d_texture_renderer_init_fbo
static gboolean
_2d_texture_renderer_init_fbo (GstAmc2DTextureRenderer * renderer)
{
GstGLFuncs *gl;
GLuint fake_texture = 0;
guint out_width, out_height;
out_width = GST_VIDEO_INFO_WIDTH (&renderer->info);
out_height = GST_VIDEO_INFO_HEIGHT (&renderer->info);
gl = renderer->context->gl_vtable;
if (!gl->GenFramebuffers) {
/* turn off the pipeline because Frame buffer object is a not present */
gst_gl_context_set_error (renderer->context,
"Context, EXT_framebuffer_object supported: no");
return FALSE;
}
GST_INFO ("Context, EXT_framebuffer_object supported: yes");
/* setup FBO */
gl->GenFramebuffers (1, &renderer->fbo);
gl->BindFramebuffer (GL_FRAMEBUFFER, renderer->fbo);
/* setup the render buffer for depth */
gl->GenRenderbuffers (1, &renderer->depth_buffer);
gl->BindRenderbuffer (GL_RENDERBUFFER, renderer->depth_buffer);
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
out_width, out_height);
/* a fake texture is attached to the render FBO (cannot init without it) */
gl->GenTextures (1, &fake_texture);
gl->BindTexture (GL_TEXTURE_2D, fake_texture);
gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, out_width, out_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
/* attach the texture to the FBO to renderer to */
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, fake_texture, 0);
/* attach the depth render buffer to the FBO */
gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, renderer->depth_buffer);
if (!gst_gl_context_check_framebuffer_status (renderer->context)) {
gst_gl_context_set_error (renderer->context,
"GL framebuffer status incomplete");
return FALSE;
}
/* unbind the FBO */
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
gl->DeleteTextures (1, &fake_texture);
return TRUE;
}
开发者ID:mbouron,项目名称:gst-plugins-bad,代码行数:61,代码来源:gstamc2dtexturerenderer.c
示例13: gst_gl_context_glx_choose_format
static gboolean
gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
{
GstGLContextGLX *context_glx;
GstGLWindow *window;
GstGLWindowX11 *window_x11;
gint error_base;
gint event_base;
Display *device;
context_glx = GST_GL_CONTEXT_GLX (context);
window = gst_gl_context_get_window (context);
if (!GST_IS_GL_WINDOW_X11 (window)) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Cannot create an GLX context from a non-X11 window");
goto failure;
}
window_x11 = GST_GL_WINDOW_X11 (window);
device = (Display *) gst_gl_display_get_handle (window->display);
if (!device) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "Invalid Display handle");
goto failure;
}
if (!glXQueryExtension (device, &error_base, &event_base)) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension");
goto failure;
}
if (!glXQueryVersion (device, &context_glx->priv->glx_major,
&context_glx->priv->glx_minor)) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
"Failed to query GLX version (glXQueryVersion failed)");
goto failure;
}
GST_INFO ("GLX Version: %d.%d", context_glx->priv->glx_major,
context_glx->priv->glx_minor);
/* legacy case */
if (context_glx->priv->glx_major < 1 || (context_glx->priv->glx_major == 1
&& context_glx->priv->glx_minor < 3)) {
gint attribs[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 16,
GLX_DOUBLEBUFFER,
None
};
window_x11->visual_info = glXChooseVisual (device,
window_x11->screen_num, attribs);
if (!window_x11->visual_info) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Bad attributes in glXChooseVisual");
goto failure;
}
} else {
gint attribs[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 16,
GLX_DOUBLEBUFFER, True,
None
};
int fbcount;
context_glx->priv->fbconfigs = glXChooseFBConfig (device,
DefaultScreen (device), attribs, &fbcount);
if (!context_glx->priv->fbconfigs) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Could not find any FBConfig's to use (check attributes?)");
goto failure;
}
_describe_fbconfig (device, context_glx->priv->fbconfigs[0]);
window_x11->visual_info = glXGetVisualFromFBConfig (device,
context_glx->priv->fbconfigs[0]);
if (!window_x11->visual_info) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Bad attributes in FBConfig");
goto failure;
}
}
//.........这里部分代码省略.........
开发者ID:alessandrod,项目名称:gst-plugins-bad,代码行数:101,代码来源:gstglcontext_glx.c
示例14: test_rgb_to_rgb
/* Note: lots of this code here is also in the videotestsrc.c unit test */
void test_rgb_to_rgb()
{
const struct
{
const gchar *pattern_name;
gint pattern_enum;
guint8 r_expected;
guint8 g_expected;
guint8 b_expected;
} test_patterns[] = {
{
"white", 3, 0xff, 0xff, 0xff}, {
"red", 4, 0xff, 0x00, 0x00}, {
"green", 5, 0x00, 0xff, 0x00}, {
"blue", 6, 0x00, 0x00, 0xff}, {
"black", 2, 0x00, 0x00, 0x00}
};
GstElement *pipeline, *src, *filter1, *csp, *filter2, *sink;
const GstCaps *template_caps;
GstBuffer *buf = NULL;
GstPad *srcpad;
GList *conversions, *l;
gint p;
/* test check function */
fail_unless (right_shift_colour (0x00ff0000, 0x11223344) == 0x22);
pipeline = gst_pipeline_new ("pipeline");
src = gst_check_setup_element ("videotestsrc");
filter1 = gst_check_setup_element ("capsfilter");
csp = gst_check_setup_element ("ffmpegcolorspace");
filter2 = gst_element_factory_make ("capsfilter", "to_filter");
sink = gst_check_setup_element ("fakesink");
gst_bin_add_many (GST_BIN (pipeline), src, filter1, csp, filter2, sink, NULL);
fail_unless (gst_element_link (src, filter1));
fail_unless (gst_element_link (filter1, csp));
fail_unless (gst_element_link (csp, filter2));
fail_unless (gst_element_link (filter2, sink));
srcpad = gst_element_get_pad (src, "src");
template_caps = gst_pad_get_pad_template_caps (srcpad);
gst_object_unref (srcpad);
g_object_set (sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
GST_LOG ("videotestsrc src template caps: %" GST_PTR_FORMAT, template_caps);
conversions = create_rgb_conversions ();
for (l = conversions; l != NULL; l = l->next) {
RGBConversion *conv = (RGBConversion *) l->data;
/* does videotestsrc support the from_caps? */
if (!gst_caps_is_subset (conv->from_caps, template_caps)) {
GST_DEBUG ("videotestsrc doesn't support from_caps %" GST_PTR_FORMAT,
conv->from_caps);
continue;
}
/* caps are supported, let's run some tests then ... */
for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
GstStateChangeReturn state_ret;
RGBFormat *from = &conv->from_fmt;
RGBFormat *to = &conv->to_fmt;
/* trick compiler into thinking from is used, might throw warning
* otherwise if the debugging system is disabled */
fail_unless (from != NULL);
gst_element_set_state (pipeline, GST_STATE_NULL);
g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u => "
"%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
from->nick, from->bpp, from->depth, from->red_mask,
from->green_mask, from->blue_mask, from->alpha_mask,
from->endianness, to->nick, to->bpp, to->depth, to->red_mask,
to->green_mask, to->blue_mask, to->alpha_mask, to->endianness,
test_patterns[p].pattern_name);
/* now get videotestsrc to produce a buffer with the given caps */
g_object_set (filter1, "caps", conv->from_caps, NULL);
/* ... and force ffmpegcolorspace to convert to our target caps */
g_object_set (filter2, "caps", conv->to_caps, NULL);
state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
if (state_ret == GST_STATE_CHANGE_FAILURE) {
GstMessage *msg;
GError *err = NULL;
msg = gst_bus_poll (GST_ELEMENT_BUS (pipeline), GST_MESSAGE_ERROR, 0);
fail_if (msg == NULL, "expected ERROR message on the bus");
fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
gst_message_parse_error (msg, &err, NULL);
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:101,代码来源:ffmpegcolorspace.c
示例15: gst_gl_context_egl_create_context
static gboolean
gst_gl_context_egl_create_context (GstGLContext * context,
GstGLAPI gl_api, GstGLContext * other_context, GError ** error)
{
GstGLContextEGL *egl;
GstGLWindow *window = NULL;
EGLNativeWindowType window_handle = (EGLNativeWindowType) 0;
gint i = 0;
EGLint context_attrib[3];
EGLint majorVersion;
EGLint minorVersion;
const gchar *egl_exts;
gboolean need_surface = TRUE;
guintptr external_gl_context = 0;
GstGLDisplay *display;
egl = GST_GL_CONTEXT_EGL (context);
window = gst_gl_context_get_window (context);
if (other_context) {
if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_EGL) {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Cannot share context with non-EGL context");
goto failure;
}
external_gl_context = gst_gl_context_get_gl_context (other_context);
}
if ((gl_api & (GST_GL_API_OPENGL | GST_GL_API_GLES2)) == GST_GL_API_NONE) {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
"EGL supports opengl or gles2");
goto failure;
}
display = gst_gl_context_get_display (context);
if (display->type == GST_GL_DISPLAY_TYPE_EGL) {
egl->egl_display = (EGLDisplay) gst_gl_display_get_handle (display);
} else {
guintptr native_display = gst_gl_display_get_handle (display);
if (!native_display) {
GstGLWindow *window = NULL;
GST_WARNING ("Failed to get a global display handle, falling back to "
"per-window display handles. Context sharing may not work");
if (other_context)
window = gst_gl_context_get_window (other_context);
if (!window)
window = gst_gl_context_get_window (context);
if (window) {
native_display = gst_gl_window_get_display (window);
gst_object_unref (window);
}
}
egl->egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display);
}
gst_object_unref (display);
if (eglInitialize (egl->egl_display, &majorVersion, &minorVersion)) {
GST_INFO ("egl initialized, version: %d.%d", majorVersion, minorVersion);
} else {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
"Failed to initialize egl: %s", gst_gl_context_egl_get_error_string ());
goto failure;
}
if (gl_api & GST_GL_API_OPENGL) {
/* egl + opengl only available with EGL 1.4+ */
if (majorVersion == 1 && minorVersion <= 3) {
if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS,
"EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
majorVersion, minorVersion);
goto failure;
} else {
GST_WARNING
("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
majorVersion, minorVersion);
if (gl_api & GST_GL_API_GLES2) {
goto try_gles2;
} else {
g_set_error (error, GST_GL_CONTEXT_ERROR,
G
|
请发表评论