本文整理汇总了C++中GST_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_LOG函数的具体用法?C++ GST_LOG怎么用?C++ GST_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_LOG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main (int argc, char **argv)
{
GstPlay *play;
GPtrArray *playlist;
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;
guint num, i;
GError *err = NULL;
GOptionContext *ctx;
gchar *playlist_file = NULL;
GOptionEntry options[] = {
{"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));
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') {
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);
//.........这里部分代码省略.........
开发者ID:Myoungsun-Lee,项目名称:gst-plugins-base,代码行数:101,代码来源:gst-play.c
示例2: dump_image_description
void
dump_image_description (ImageDescription * desc)
{
GST_LOG ("Description %p , size:%" G_GSIZE_FORMAT, desc, desc->idSize);
#if DEBUG_DUMP
gst_util_dump_mem ((const guchar *) desc, desc->idSize);
#endif
GST_LOG ("cType : %" GST_FOURCC_FORMAT, QT_FOURCC_ARGS (desc->cType));
GST_LOG ("version:%d", desc->version);
GST_LOG ("revisionLevel:%d", desc->revisionLevel);
GST_LOG ("vendor:%" GST_FOURCC_FORMAT, QT_FOURCC_ARGS (desc->vendor));
GST_LOG ("temporalQuality:%lu", desc->temporalQuality);
GST_LOG ("spatialQuality:%lu", desc->spatialQuality);
GST_LOG ("width:%u", desc->width);
GST_LOG ("height:%u", desc->height);
GST_LOG ("hres:%f", desc->hRes / 65536.0);
GST_LOG ("vres:%f", desc->vRes / 65536.0);
GST_LOG ("dataSize:%" G_GSIZE_FORMAT, desc->dataSize);
GST_LOG ("frameCount:%d", desc->frameCount);
GST_LOG ("name:%.*s", desc->name[0], desc->name + 1);
GST_LOG ("depth:%d", desc->depth);
GST_LOG ("clutID:%d", desc->clutID);
if (desc->idSize > sizeof (ImageDescription)) {
guint8 *extradata = (guint8 *) desc + sizeof (ImageDescription);
guint32 type = QT_READ_UINT32 (extradata + 4);
GST_LOG ("Extra Data size:%lu",
(gulong) desc->idSize - (gulong) sizeof (ImageDescription));
#if DEBUG_DUMP
gst_util_dump_mem ((gpointer) (gulong) desc +
(gulong) sizeof (ImageDescription),
(gulong) desc->idSize - (gulong) sizeof (ImageDescription));
#endif
GST_LOG ("Extra Data Type : %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (type));
if (type == QT_MAKE_FOURCC ('a', 'v', 'c', 'C'))
dump_avcc_atom (extradata);
}
}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:41,代码来源:qtutils.c
示例3: gst_rtmp_src_create
/*
* Read a new buffer from src->reqoffset, takes care of events
* and seeking and such.
*/
static GstFlowReturn
gst_rtmp_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
{
GstRTMPSrc *src;
GstBuffer *buf;
GstMapInfo map;
guint8 *data;
guint todo;
gsize bsize;
int read;
int size;
src = GST_RTMP_SRC (pushsrc);
g_return_val_if_fail (src->rtmp != NULL, GST_FLOW_ERROR);
size = GST_BASE_SRC_CAST (pushsrc)->blocksize;
GST_DEBUG ("reading from %" G_GUINT64_FORMAT
", size %u", src->cur_offset, size);
buf = gst_buffer_new_allocate (NULL, size, NULL);
if (G_UNLIKELY (buf == NULL)) {
GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
return GST_FLOW_ERROR;
}
bsize = todo = size;
gst_buffer_map (buf, &map, GST_MAP_WRITE);
data = map.data;
read = bsize = 0;
while (todo > 0) {
read = RTMP_Read (src->rtmp, (char *) data, todo);
if (G_UNLIKELY (read == 0 && todo == size)) {
goto eos;
} else if (G_UNLIKELY (read == 0)) {
todo = 0;
break;
}
if (G_UNLIKELY (read < 0))
goto read_failed;
if (read < todo) {
data += read;
todo -= read;
bsize += read;
} else {
bsize += todo;
todo = 0;
}
GST_LOG (" got size %d", read);
}
gst_buffer_unmap (buf, &map);
gst_buffer_resize (buf, 0, bsize);
if (src->discont) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
src->discont = FALSE;
}
GST_BUFFER_TIMESTAMP (buf) = src->last_timestamp;
GST_BUFFER_OFFSET (buf) = src->cur_offset;
src->cur_offset += size;
if (src->last_timestamp == GST_CLOCK_TIME_NONE)
src->last_timestamp = src->rtmp->m_mediaStamp * GST_MSECOND;
else
src->last_timestamp =
MAX (src->last_timestamp, src->rtmp->m_mediaStamp * GST_MSECOND);
GST_LOG_OBJECT (src, "Created buffer of size %u at %" G_GINT64_FORMAT
" with timestamp %" GST_TIME_FORMAT, size, GST_BUFFER_OFFSET (buf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
/* we're done, return the buffer */
*buffer = buf;
return GST_FLOW_OK;
read_failed:
{
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), ("Failed to read data"));
return GST_FLOW_ERROR;
}
eos:
{
gst_buffer_unref (buf);
GST_DEBUG_OBJECT (src, "Reading data gave EOS");
return GST_FLOW_EOS;
}
}
开发者ID:ylatuya,项目名称:gst-plugins-bad,代码行数:100,代码来源:gstrtmpsrc.c
示例4: _handoff_handler
static void
_handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
gpointer user_data)
{
struct SimpleTestStream *st = user_data;
int i;
gboolean stop = TRUE;
GList *codecs = NULL;
if (st->dat->session == NULL)
return;
g_object_get (st->dat->session,
"codecs", &codecs,
NULL);
ts_fail_if (codecs == NULL, "Could not get codecs");
if (st->flags & WAITING_ON_LAST_CODEC)
{
if (fs_codec_are_equal (
g_list_last (codecs)->data,
g_object_get_data (G_OBJECT (element), "codec")))
{
st->flags &= ~WAITING_ON_LAST_CODEC;
st->flags |= SHOULD_BE_LAST_CODEC;
max_buffer_count += st->buffer_count;
GST_DEBUG ("We HAVE last codec");
}
else
{
#if 0
gchar *str = fs_codec_to_string (
g_object_get_data (G_OBJECT (element), "codec"));
gchar *str2 = fs_codec_to_string (g_list_last (codecs)->data);
GST_DEBUG ("not yet the last codec, skipping (we have %s, we want %s)",
str, str2);
g_free (str);
g_free (str2);
#endif
fs_codec_list_destroy (codecs);
return;
}
}
if (select_last_codec || st->flags & SHOULD_BE_LAST_CODEC)
{
if (!fs_codec_are_equal (
g_list_last (codecs)->data,
g_object_get_data (G_OBJECT (element), "codec")))
{
if (!reset_to_last_codec)
ts_fail ("The handoff handler got a buffer from the wrong codec"
" (ie. not the last)");
fs_codec_list_destroy (codecs);
return;
}
}
else
ts_fail_unless (
fs_codec_are_equal (
g_list_first (codecs)->data,
g_object_get_data (G_OBJECT (element), "codec")),
"The handoff handler got a buffer from the wrong codec");
fs_codec_list_destroy (codecs);
st->buffer_count++;
GST_LOG ("%d:%d: Buffer %d", st->dat->id, st->target->id, st->buffer_count);
/*
ts_fail_if (dat->buffer_count > max_buffer_count,
"Too many buffers %d > max_buffer_count", dat->buffer_count);
*/
for (i = 0; i < count && !stop ; i++)
{
GList *item;
for (item = g_list_first (dats[i]->streams);
item;
item = g_list_next (item))
{
struct SimpleTestStream *st2 = item->data;
if (st2->buffer_count < max_buffer_count)
{
stop = FALSE;
break;
}
}
}
if (stop)
{
if (reset_to_last_codec && !(st->flags & HAS_BEEN_RESET)) {
//.........这里部分代码省略.........
开发者ID:mssurajkaiga,项目名称:farstream,代码行数:101,代码来源:conference.c
示例5: run_test
static int
run_test (const char *format, ...)
{
GstStateChangeReturn ret;
GstElement *pipe, *src, *sink;
GstBuffer *buf = NULL;
GstMessage *msg;
gchar *url;
va_list args;
int rc = -1;
pipe = gst_pipeline_new (NULL);
src = gst_element_factory_make ("souphttpsrc", NULL);
fail_unless (src != NULL);
sink = gst_element_factory_make ("fakesink", NULL);
fail_unless (sink != NULL);
gst_bin_add (GST_BIN (pipe), src);
gst_bin_add (GST_BIN (pipe), sink);
fail_unless (gst_element_link (src, sink));
if (http_port == 0) {
GST_DEBUG ("failed to start soup http server");
}
fail_unless (http_port != 0);
va_start (args, format);
g_vasprintf (&url, format, args);
va_end (args);
fail_unless (url != NULL);
g_object_set (src, "location", url, NULL);
g_free (url);
g_object_set (src, "automatic-redirect", redirect, NULL);
if (cookies != NULL)
g_object_set (src, "cookies", cookies, NULL);
g_object_set (sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (sink, "preroll-handoff", G_CALLBACK (handoff_cb), &buf);
if (user_id != NULL)
g_object_set (src, "user-id", user_id, NULL);
if (user_pw != NULL)
g_object_set (src, "user-pw", user_pw, NULL);
ret = gst_element_set_state (pipe, GST_STATE_PAUSED);
if (ret != GST_STATE_CHANGE_ASYNC) {
GST_DEBUG ("failed to start up soup http src, ret = %d", ret);
goto done;
}
gst_element_set_state (pipe, GST_STATE_PLAYING);
msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),
GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
gchar *debug = NULL;
GError *err = NULL;
gst_message_parse_error (msg, &err, &debug);
GST_INFO ("error: %s", err->message);
if (g_str_has_suffix (err->message, "Not Found"))
rc = 404;
else if (g_str_has_suffix (err->message, "Forbidden"))
rc = 403;
else if (g_str_has_suffix (err->message, "Unauthorized"))
rc = 401;
else if (g_str_has_suffix (err->message, "Found"))
rc = 302;
GST_INFO ("debug: %s", debug);
g_error_free (err);
g_free (debug);
gst_message_unref (msg);
goto done;
}
gst_message_unref (msg);
/* don't wait for more than 10 seconds */
ret = gst_element_get_state (pipe, NULL, NULL, 10 * GST_SECOND);
GST_LOG ("ret = %u", ret);
if (buf == NULL) {
/* we want to test the buffer offset, nothing else; if there's a failure
* it might be for lots of reasons (no network connection, whatever), we're
* not interested in those */
GST_DEBUG ("didn't manage to get data within 10 seconds, skipping test");
goto done;
}
GST_DEBUG ("buffer offset = %" G_GUINT64_FORMAT, GST_BUFFER_OFFSET (buf));
/* first buffer should have a 0 offset */
fail_unless (GST_BUFFER_OFFSET (buf) == 0);
gst_buffer_unref (buf);
//.........这里部分代码省略.........
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:101,代码来源:souphttpsrc.c
示例6: mpegts_base_apply_pat
static gboolean
mpegts_base_apply_pat (MpegTSBase * base, GstMpegtsSection * section)
{
GPtrArray *pat = gst_mpegts_section_get_pat (section);
GPtrArray *old_pat;
MpegTSBaseProgram *program;
gint i;
if (G_UNLIKELY (pat == NULL))
return FALSE;
GST_INFO_OBJECT (base, "PAT");
/* Applying a new PAT does two things:
* * It adds the new programs to the list of programs this element handles
* and increments at the same time the number of times a program is referenced.
*
* * If there was a previously active PAT, It decrements the reference count
* of all program it used. If a program is no longer needed, it is removed.
*/
old_pat = base->pat;
base->pat = pat;
GST_LOG ("Activating new Program Association Table");
/* activate the new table */
for (i = 0; i < pat->len; ++i) {
GstMpegtsPatProgram *patp = g_ptr_array_index (pat, i);
program = mpegts_base_get_program (base, patp->program_number);
if (program) {
/* IF the program already existed, just check if the PMT PID changed */
if (program->pmt_pid != patp->network_or_program_map_PID) {
if (program->pmt_pid != G_MAXUINT16) {
/* pmt pid changed */
/* FIXME: when this happens it may still be pmt pid of another
* program, so setting to False may make it go through expensive
* path in is_psi unnecessarily */
MPEGTS_BIT_UNSET (base->known_psi, program->pmt_pid);
}
program->pmt_pid = patp->network_or_program_map_PID;
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, program->pmt_pid)))
GST_FIXME
("Refcounting issue. Setting twice a PMT PID (0x%04x) as know PSI",
program->pmt_pid);
MPEGTS_BIT_SET (base->known_psi, patp->network_or_program_map_PID);
}
} else {
/* Create a new program */
program =
mpegts_base_add_program (base, patp->program_number,
patp->network_or_program_map_PID);
}
/* We mark this program as being referenced by one PAT */
program->patcount += 1;
}
if (old_pat) {
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
/* deactivate the old table */
GST_LOG ("Deactivating old Program Association Table");
for (i = 0; i < old_pat->len; ++i) {
GstMpegtsPatProgram *patp = g_ptr_array_index (old_pat, i);
program = mpegts_base_get_program (base, patp->program_number);
if (G_UNLIKELY (program == NULL)) {
GST_DEBUG_OBJECT (base, "broken PAT, duplicated entry for program %d",
patp->program_number);
continue;
}
if (--program->patcount > 0)
/* the program has been referenced by the new pat, keep it */
continue;
GST_INFO_OBJECT (base, "PAT removing program 0x%04x 0x%04x",
patp->program_number, patp->network_or_program_map_PID);
if (klass->can_remove_program (base, program)) {
mpegts_base_deactivate_program (base, program);
mpegts_base_remove_program (base, patp->program_number);
}
/* FIXME: when this happens it may still be pmt pid of another
* program, so setting to False may make it go through expensive
* path in is_psi unnecessarily */
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi,
patp->network_or_program_map_PID))) {
GST_FIXME
("Program refcounting : Setting twice a pid (0x%04x) as known PSI",
patp->network_or_program_map_PID);
}
MPEGTS_BIT_SET (base->known_psi, patp->network_or_program_map_PID);
mpegts_packetizer_remove_stream (base->packetizer,
patp->network_or_program_map_PID);
}
g_ptr_array_unref (old_pat);
}
//.........这里部分代码省略.........
开发者ID:jhgorse,项目名称:gst-plugins-bad,代码行数:101,代码来源:mpegtsbase.c
示例7: gst_ladspa_base_init
//.........这里部分代码省略.........
GST_DEBUG ("uri (id=%d) : %s", desc->UniqueID, uri);
/* we can take this directly from 'desc', keep this example for future
attributes.
if ((str = lrdf_get_setting_metadata (uri, "title"))) {
GST_DEBUG ("title : %s", str);
}
if ((str = lrdf_get_setting_metadata (uri, "creator"))) {
GST_DEBUG ("creator : %s", str);
}
*/
/* get the rdf:type for this plugin */
query.subject = uri;
query.predicate = (char *) RDF_BASE "type";
query.object = (char *) "?";
query.next = NULL;
uris = lrdf_match_multi (&query);
if (uris) {
if (uris->count == 1) {
base_type = g_strdup (uris->items[0]);
GST_DEBUG ("base_type : %s", base_type);
}
lrdf_free_uris (uris);
}
/* query taxonomy */
if (base_type) {
uris = lrdf_get_all_superclasses (base_type);
if (uris) {
guint32 j;
for (j = 0; j < uris->count; j++) {
GST_LOG ("parent_type_uri : %s", uris->items[j]);
if ((str = lrdf_get_label (uris->items[j]))) {
GST_DEBUG ("parent_type_label : %s", str);
if (extra_klass_tags) {
gchar *old_tags = extra_klass_tags;
extra_klass_tags = g_strconcat (extra_klass_tags, "/", str, NULL);
g_free (old_tags);
} else {
extra_klass_tags = g_strconcat ("/", str, NULL);
}
}
}
lrdf_free_uris (uris);
}
g_free (base_type);
}
/* we can use this for the presets
uris = lrdf_get_setting_uris (desc->UniqueID);
if (uris) {
guint32 j;
for (j = 0; j < uris->count; j++) {
GST_INFO ("setting_uri : %s", uris->items[j]);
if ((str = lrdf_get_label (uris->items[j]))) {
GST_INFO ("setting_label : %s", str);
}
}
lrdf_free_uris (uris);
}
*/
}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:67,代码来源:gstladspa.c
示例8: main
gint
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
GST_DEBUG_CATEGORY_INIT (cat_default, "GST_Check_default", 0,
"default category for this test");
GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0,
"second category for this test");
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
gst_debug_add_log_function (check_message, NULL);
count = 0;
GST_ERROR ("This is an error.");
++count;
GST_WARNING ("This is a warning.");
++count;
GST_INFO ("This is an info message.");
++count;
GST_DEBUG ("This is a debug message.");
++count;
GST_LOG ("This is a log message.");
++count;
GST_CAT_ERROR (cat2, "This is an error with category.");
++count;
GST_CAT_WARNING (cat2, "This is a warning with category.");
++count;
GST_CAT_INFO (cat2, "This is an info message with category.");
++count;
GST_CAT_DEBUG (cat2, "This is a debug message with category.");
++count;
GST_CAT_LOG (cat2, "This is a log message with category.");
count = -1;
pipeline = gst_element_factory_make ("pipeline", "testelement");
count = 10;
GST_ERROR_OBJECT (pipeline, "This is an error with object.");
++count;
GST_WARNING_OBJECT (pipeline, "This is a warning with object.");
++count;
GST_INFO_OBJECT (pipeline, "This is an info message with object.");
++count;
GST_DEBUG_OBJECT (pipeline, "This is a debug message with object.");
++count;
GST_LOG_OBJECT (pipeline, "This is a log message with object.");
++count;
GST_CAT_ERROR_OBJECT (cat2, pipeline,
"This is an error with category and object.");
++count;
GST_CAT_WARNING_OBJECT (cat2, pipeline,
"This is a warning with category and object.");
++count;
GST_CAT_INFO_OBJECT (cat2, pipeline,
"This is an info message with category and object.");
++count;
GST_CAT_DEBUG_OBJECT (cat2, pipeline,
"This is a debug message with category and object.");
++count;
GST_CAT_LOG_OBJECT (cat2, pipeline,
"This is a log message with category and object.");
count = -1;
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (check_message) == 1);
#endif
return 0;
}
开发者ID:WangCrystal,项目名称:gstreamer,代码行数:70,代码来源:output.c
示例9: decode_file
static gboolean
decode_file (const gchar * file, gboolean push_mode)
{
GstStateChangeReturn state_ret;
GstElement *sink, *src, *dec, *queue, *pipeline;
GstMessage *msg;
GstBus *bus;
gchar *path;
pipeline = gst_pipeline_new ("pipeline");
fail_unless (pipeline != NULL, "Failed to create pipeline!");
src = gst_element_factory_make ("filesrc", "filesrc");
fail_unless (src != NULL, "Failed to create filesrc!");
if (push_mode) {
queue = gst_element_factory_make ("queue", "queue");
} else {
queue = gst_element_factory_make ("identity", "identity");
}
dec = gst_element_factory_make ("decodebin", "decodebin");
fail_unless (dec != NULL, "Failed to create decodebin!");
sink = gst_element_factory_make ("fakesink", "fakesink");
fail_unless (sink != NULL, "Failed to create fakesink!");
bus = gst_element_get_bus (pipeline);
/* kids, don't use a sync handler for this at home, really; we do because
* we just want to abort and nothing else */
gst_bus_set_sync_handler (bus, error_cb, (gpointer) file, NULL);
gst_bin_add_many (GST_BIN (pipeline), src, queue, dec, sink, NULL);
gst_element_link_many (src, queue, dec, NULL);
path = g_build_filename (GST_TEST_FILES_PATH, file, NULL);
GST_LOG ("reading file '%s'", path);
g_object_set (src, "location", path, NULL);
/* can't link uridecodebin and sink yet, do that later */
g_signal_connect (dec, "pad-added", G_CALLBACK (pad_added_cb), pipeline);
state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
fail_unless (state_ret != GST_STATE_CHANGE_FAILURE);
if (state_ret == GST_STATE_CHANGE_ASYNC) {
GST_LOG ("waiting for pipeline to reach PAUSED state");
state_ret = gst_element_get_state (pipeline, NULL, NULL, -1);
fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS);
}
state_ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (state_ret != GST_STATE_CHANGE_FAILURE);
GST_LOG ("PAUSED, let's decode");
msg = gst_bus_timed_pop_filtered (bus, 10 * GST_SECOND, GST_MESSAGE_EOS);
GST_LOG ("Done, got EOS message");
fail_unless (msg != NULL);
gst_message_unref (msg);
gst_object_unref (bus);
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);
gst_object_unref (pipeline);
g_free (path);
return TRUE;
}
开发者ID:cablelabs,项目名称:gst-libav,代码行数:70,代码来源:avdec_adpcm.c
示例10: gst_isoff_sidx_parser_add_buffer
GstIsoffParserResult
gst_isoff_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buffer,
guint * consumed)
{
GstIsoffParserResult res = GST_ISOFF_PARSER_OK;
GstByteReader reader;
GstMapInfo info;
gsize remaining;
guint32 fourcc;
if (!gst_buffer_map (buffer, &info, GST_MAP_READ)) {
*consumed = 0;
return GST_ISOFF_PARSER_ERROR;
}
gst_byte_reader_init (&reader, info.data, info.size);
switch (parser->status) {
case GST_ISOFF_SIDX_PARSER_INIT:
if (gst_byte_reader_get_remaining (&reader) < GST_ISOFF_FULL_BOX_SIZE) {
break;
}
parser->size = gst_byte_reader_get_uint32_be_unchecked (&reader);
fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
if (fourcc != GST_ISOFF_FOURCC_SIDX) {
res = GST_ISOFF_PARSER_UNEXPECTED;
gst_byte_reader_set_pos (&reader, 0);
break;
}
if (parser->size == 1) {
if (gst_byte_reader_get_remaining (&reader) < 12) {
gst_byte_reader_set_pos (&reader, 0);
break;
}
parser->size = gst_byte_reader_get_uint64_be_unchecked (&reader);
}
if (parser->size == 0) {
res = GST_ISOFF_PARSER_ERROR;
gst_byte_reader_set_pos (&reader, 0);
break;
}
parser->sidx.version = gst_byte_reader_get_uint8_unchecked (&reader);
parser->sidx.flags = gst_byte_reader_get_uint24_le_unchecked (&reader);
parser->status = GST_ISOFF_SIDX_PARSER_HEADER;
case GST_ISOFF_SIDX_PARSER_HEADER:
remaining = gst_byte_reader_get_remaining (&reader);
if (remaining < 12 + (parser->sidx.version == 0 ? 8 : 16)) {
break;
}
parser->sidx.ref_id = gst_byte_reader_get_uint32_be_unchecked (&reader);
parser->sidx.timescale =
gst_byte_reader_get_uint32_be_unchecked (&reader);
if (parser->sidx.version == 0) {
parser->sidx.earliest_pts =
gst_byte_reader_get_uint32_be_unchecked (&reader);
parser->sidx.first_offset = parser->sidx.earliest_pts =
gst_byte_reader_get_uint32_be_unchecked (&reader);
} else {
parser->sidx.earliest_pts =
gst_byte_reader_get_uint64_be_unchecked (&reader);
parser->sidx.first_offset =
gst_byte_reader_get_uint64_be_unchecked (&reader);
}
/* skip 2 reserved bytes */
gst_byte_reader_skip_unchecked (&reader, 2);
parser->sidx.entries_count =
gst_byte_reader_get_uint16_be_unchecked (&reader);
GST_LOG ("Timescale: %" G_GUINT32_FORMAT, parser->sidx.timescale);
GST_LOG ("Earliest pts: %" G_GUINT64_FORMAT, parser->sidx.earliest_pts);
GST_LOG ("First offset: %" G_GUINT64_FORMAT, parser->sidx.first_offset);
parser->cumulative_pts =
gst_util_uint64_scale_int_round (parser->sidx.earliest_pts,
GST_SECOND, parser->sidx.timescale);
if (parser->sidx.entries_count) {
parser->sidx.entries =
g_malloc (sizeof (GstSidxBoxEntry) * parser->sidx.entries_count);
}
parser->sidx.entry_index = 0;
parser->status = GST_ISOFF_SIDX_PARSER_DATA;
case GST_ISOFF_SIDX_PARSER_DATA:
while (parser->sidx.entry_index < parser->sidx.entries_count) {
GstSidxBoxEntry *entry =
&parser->sidx.entries[parser->sidx.entry_index];
remaining = gst_byte_reader_get_remaining (&reader);;
if (remaining < 12)
break;
entry->offset = parser->cumulative_entry_size;
entry->pts = parser->cumulative_pts;
//.........这里部分代码省略.........
开发者ID:ego5710,项目名称:gst-plugins-bad,代码行数:101,代码来源:gstisoff.c
示例11: process_file
static void
process_file (const gchar * file, gboolean push_mode, gint repeat,
gint num_buffers)
{
GstElement *src, *sep, *sink, *flvdemux, *pipeline;
GstBus *bus;
gchar *path;
gint counter;
pipeline = gst_pipeline_new ("pipeline");
fail_unless (pipeline != NULL, "Failed to create pipeline!");
bus = gst_element_get_bus (pipeline);
/* kids, don't use a sync handler for this at home, really; we do because
* we just want to abort and nothing else */
gst_bus_set_sync_handler (bus, error_cb, (gpointer) file, NULL);
src = gst_element_factory_make ("filesrc", "filesrc");
fail_unless (src != NULL, "Failed to create 'filesrc' element!");
if (push_mode) {
sep = gst_element_factory_make ("queue", "queue");
fail_unless (sep != NULL, "Failed to create 'queue' element");
} else {
sep = gst_element_factory_make ("identity", "identity");
fail_unless (sep != NULL, "Failed to create 'identity' element");
}
flvdemux = gst_element_factory_make ("flvdemux", "flvdemux");
fail_unless (flvdemux != NULL, "Failed to create 'flvdemux' element!");
sink = gst_element_factory_make ("fakesink", "fakesink");
fail_unless (sink != NULL, "Failed to create 'fakesink' element!");
g_object_set (sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (sink, "handoff", G_CALLBACK (handoff_cb), &counter);
gst_bin_add_many (GST_BIN (pipeline), src, sep, flvdemux, sink, NULL);
fail_unless (gst_element_link (src, sep));
fail_unless (gst_element_link (sep, flvdemux));
/* can't link flvdemux and sink yet, do that later */
g_signal_connect (flvdemux, "pad-added", G_CALLBACK (pad_added_cb), pipeline);
path = g_build_filename (GST_TEST_FILES_PATH, file, NULL);
GST_LOG ("processing file '%s'", path);
g_object_set (src, "location", path, NULL);
do {
GstStateChangeReturn state_ret;
GstMessage *msg;
GST_LOG ("repeat=%d", repeat);
counter = 0;
state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
fail_unless (state_ret != GST_STATE_CHANGE_FAILURE);
if (state_ret == GST_STATE_CHANGE_ASYNC) {
GST_LOG ("waiting for pipeline to reach PAUSED state");
state_ret = gst_element_get_state (pipeline, NULL, NULL, -1);
fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS);
}
GST_LOG ("PAUSED, let's read all of it");
state_ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (state_ret != GST_STATE_CHANGE_FAILURE);
msg = gst_bus_poll (bus, GST_MESSAGE_EOS, -1);
fail_unless (msg != NULL, "Expected EOS message on bus! (%s)", file);
gst_message_unref (msg);
if (num_buffers >= 0) {
fail_unless_equals_int (counter, num_buffers);
}
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);
--repeat;
} while (repeat > 0);
gst_object_unref (bus);
gst_object_unref (pipeline);
g_free (path);
}
开发者ID:DylanZA,项目名称:gst-plugins-good,代码行数:92,代码来源:flvdemux.c
示例12: parse_encoding_profile
/**
* parse_encoding_profile:
* @in: a #GKeyFile
* @parentprofilename: the parent profile name (including 'profile-' or 'streamprofile-' header)
* @profilename: the profile name group to parse
* @nbgroups: the number of top-level groups
* @groups: the top-level groups
*/
static GstEncodingProfile *
parse_encoding_profile (GKeyFile * in, gchar * parentprofilename,
gchar * profilename, gsize nbgroups, gchar ** groups)
{
GstEncodingProfile *sprof = NULL;
gchar **parent;
gchar *proftype, *format, *preset, *restriction, *pname, *description,
*locale;
GstCaps *formatcaps = NULL;
GstCaps *restrictioncaps = NULL;
gboolean variableframerate;
gint pass, presence;
gsize i, nbencprofiles;
GST_DEBUG ("parentprofilename : %s , profilename : %s",
parentprofilename, profilename);
if (parentprofilename) {
gboolean found = FALSE;
parent =
g_key_file_get_string_list (in, profilename, "parent",
&nbencprofiles, NULL);
if (!parent || !nbencprofiles) {
return NULL;
}
/* Check if this streamprofile is used in <profilename> */
for (i = 0; i < nbencprofiles; i++) {
if (!g_strcmp0 (parent[i], parentprofilename)) {
found = TRUE;
break;
}
}
g_strfreev (parent);
if (!found) {
GST_DEBUG ("Stream profile '%s' isn't used in profile '%s'",
profilename, parentprofilename);
return NULL;
}
}
pname = g_key_file_get_value (in, profilename, "name", NULL);
locale = get_locale ();
/* will try to fall back to untranslated string if no translation found */
description = g_key_file_get_locale_string (in, profilename,
"description", locale, NULL);
g_free (locale);
/* Note: a missing description is normal for non-container profiles */
if (description == NULL) {
GST_LOG ("Missing 'description' field for streamprofile %s", profilename);
}
/* Parse the remaining fields */
proftype = g_key_file_get_value (in, profilename, "type", NULL);
if (!proftype) {
GST_WARNING ("Missing 'type' field for streamprofile %s", profilename);
return NULL;
}
format = g_key_file_get_value (in, profilename, "format", NULL);
if (format) {
formatcaps = gst_caps_from_string (format);
g_free (format);
}
preset = g_key_file_get_value (in, profilename, "preset", NULL);
restriction = g_key_file_get_value (in, profilename, "restriction", NULL);
if (restriction) {
restrictioncaps = gst_caps_from_string (restriction);
g_free (restriction);
}
presence = g_key_file_get_integer (in, profilename, "presence", NULL);
pass = g_key_file_get_integer (in, profilename, "pass", NULL);
variableframerate =
g_key_file_get_boolean (in, profilename, "variableframerate", NULL);
/* Build the streamprofile ! */
if (!g_strcmp0 (proftype, "container")) {
GstEncodingProfile *pprof;
sprof =
(GstEncodingProfile *) gst_encoding_container_profile_new (pname,
description, formatcaps, preset);
/* Now look for the stream profiles */
for (i = 0; i < nbgroups; i++) {
if (!g_ascii_strncasecmp (groups[i], "streamprofile-", 13)) {
//.........这里部分代码省略.........
开发者ID:MathieuDuponchelle,项目名称:gst-plugins-base,代码行数:101,代码来源:encoding-target.c
示例13: gst_missing_plugin_message_get_description
/**
* gst_missing_plugin_message_get_description:
* @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT
*
* Returns a localised string describing the missing feature, for use in
* error dialogs and the like. Should never return NULL unless @msg is not
* a valid missing-plugin message.
*
* This function is mainly for applications that need a human-readable string
* describing a missing plugin, given a previously collected missing-plugin
* message
*
* Returns: a newly-allocated description string, or NULL on error. Free
* string with g_free() when not needed any longer.
*/
gchar *
gst_missing_plugin_message_get_description (GstMessage * msg)
{
GstMissingType missing_type;
const gchar *desc;
gchar *ret = NULL;
g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL);
GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure);
desc = gst_structure_get_string (msg->structure, "name");
if (desc != NULL && *desc != '\0') {
ret = g_strdup (desc);
goto done;
}
/* fallback #1 */
missing_type = missing_structure_get_type (msg->structure);
switch (missing_type) {
case GST_MISSING_TYPE_URISOURCE:
case GST_MISSING_TYPE_URISINK:
case GST_MISSING_TYPE_ELEMENT:{
gchar *detail = NULL;
if (missing_structure_get_string_detail (msg->structure, &detail)) {
if (missing_type == GST_MISSING_TYPE_URISOURCE)
ret = gst_pb_utils_get_source_description (detail);
else if (missing_type == GST_MISSING_TYPE_URISINK)
ret = gst_pb_utils_get_sink_description (detail);
else
ret = gst_pb_utils_get_sink_description (detail);
g_free (detail);
}
break;
}
case GST_MISSING_TYPE_DECODER:
case GST_MISSING_TYPE_ENCODER:{
GstCaps *caps = NULL;
if (missing_structure_get_caps_detail (msg->structure, &caps)) {
if (missing_type == GST_MISSING_TYPE_DECODER)
ret = gst_pb_utils_get_decoder_description (caps);
else
ret = gst_pb_utils_get_encoder_description (caps);
gst_caps_unref (caps);
}
break;
}
default:
break;
}
if (ret)
goto done;
/* fallback #2 */
switch (missing_type) {
case GST_MISSING_TYPE_URISOURCE:
desc = _("Unknown source element");
break;
case GST_MISSING_TYPE_URISINK:
desc = _("Unknown sink element");
break;
case GST_MISSING_TYPE_ELEMENT:
desc = _("Unknown element");
break;
case GST_MISSING_TYPE_DECODER:
desc = _("Unknown decoder element");
break;
case GST_MISSING_TYPE_ENCODER:
desc = _("Unknown encoder element");
break;
default:
/* we should really never get here, but we better still return
* something if we do */
desc = _("Plugin or element of unknown type");
break;
}
ret = g_strdup (desc);
done:
GST_LOG ("returning '%s'", ret);
//.........这里部分代码省略.........
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:101,代码来源:missing-plugins.c
示例14: check_pad_template
static void
check_pad_template (GstPadTemplate * tmpl)
{
const GValue *list_val, *fmt_val;
GstStructure *s;
gboolean *formats_supported;
GstCaps *caps;
guint i, num_formats;
num_formats = get_num_formats ();
formats_supported = g_new0 (gboolean, num_formats);
caps = gst_pad_template_get_caps (tmpl);
/* If this fails, we need to update this unit test */
fail_unless_equals_int (gst_caps_get_size (caps), 2);
/* Remove the ANY caps features structure */
caps = gst_caps_truncate (caps);
s = gst_caps_get_structure (caps, 0);
fail_unless (gst_structure_has_name (s, "video/x-raw"));
list_val = gst_structure_get_value (s, "format");
fail_unless (list_val != NULL);
/* If this fails, we need to update this unit test */
fail_unless (GST_VALUE_HOLDS_LIST (list_val));
for (i = 0; i < gst_value_list_get_size (list_val); ++i) {
GstVideoFormat fmt;
const gchar *fmt_str;
fmt_val = gst_value_list_get_value (list_val, i);
fail_unless (G_VALUE_HOLDS_STRING (fmt_val));
fmt_str = g_value_get_string (fmt_val);
GST_LOG ("format string: '%s'", fmt_str);
fmt = gst_video_format_from_string (fmt_str);
if (fmt == GST_VIDEO_FORMAT_UNKNOWN)
g_error ("Unknown raw format '%s' in pad template caps", fmt_str);
formats_supported[(guint) fmt] = TRUE;
}
gst_caps_unref (caps);
for (i = 2; i < num_formats; ++i) {
if (!formats_supported[i]) {
const gchar *fmt_str = gst_video_format_to_string ((GstVideoFormat) i);
switch (i) {
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_v216:
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV16:
case GST_VIDEO_FORMAT_NV21:
case GST_VIDEO_FORMAT_NV24:
case GST_VIDEO_FORMAT_UYVP:
case GST_VIDEO_FORMAT_A420:
case GST_VIDEO_FORMAT_YUV9:
case GST_VIDEO_FORMAT_YVU9:
case GST_VIDEO_FORMAT_IYU1:
case GST_VIDEO_FORMAT_r210:{
static gboolean shown_fixme[100] = { FALSE, };
if (!shown_fixme[i]) {
GST_FIXME ("FIXME: add %s support to videoscale", fmt_str);
shown_fixme[i] = TRUE;
}
break;
}
case GST_VIDEO_FORMAT_BGR16:
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_RGB8P:
case GST_VIDEO_FORMAT_I420_10BE:
case GST_VIDEO_FORMAT_I420_10LE:
case GST_VIDEO_FORMAT_I422_10BE:
case GST_VIDEO_FORMAT_I422_10LE:
case GST_VIDEO_FORMAT_Y444_10BE:
case GST_VIDEO_FORMAT_Y444_10LE:
case GST_VIDEO_FORMAT_GBR:
case GST_VIDEO_FORMAT_GBR_10BE:
case GST_VIDEO_FORMAT_GBR_10LE:
GST_LOG ("Ignoring lack of support for format %s", fmt_str);
break;
default:
g_error ("videoscale doesn't support format '%s'", fmt_str);
break;
}
}
}
g_free (formats_supported);
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:91,代码来源:videoscale.c
示例15: mpegts_base_chain
static GstFlowReturn
mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstFlowReturn res = GST_FLOW_OK;
MpegTSBase *base;
MpegTSPacketizerPacketReturn pret;
MpegTSPacketizer2 *packetizer;
MpegTSPacketizerPacket packet;
MpegTSBaseClass *klass;
base = GST_MPEGTS_BASE (parent);
klass = GST_MPEGTS_BASE_GET_CLASS (base);
packetizer = base->packetizer;
if (klass->input_done)
gst_buffer_ref (buf);
if (GST_BUFFER_IS_DISCONT (buf)) {
GST_DEBUG_OBJECT (base, "Got DISCONT buffer, flushing");
res = mpegts_base_drain (base);
if (G_UNLIKELY (res != GST_FLOW_OK))
return res;
mpegts_base_flush (base, FALSE);
/* In the case of discontinuities in push-mode with TIME segment
* we want to drop all previous observations (hard:TRUE) from
* the packetizer */
if (base->mode == BASE_MODE_PUSHING
&& base->segment.format == GST_FORMAT_TIME)
mpegts_packetizer_flush (base->packetizer, TRUE);
else
mpegts_packetizer_flush (base->packetizer, FALSE);
}
mpegts_packetizer_push (base->packetizer, buf);
while (res == GST_FLOW_OK) {
pret = mpegts_packetizer_next_packet (base->packetizer, &packet);
/* If we don't have enough data, return */
if (G_UNLIKELY (pret == PACKET_NEED_MORE))
break;
if (G_UNLIKELY (pret == PACKET_BAD)) {
/* bad header, skip the packet */
GST_DEBUG_OBJECT (base, "bad packet, skipping");
goto next;
}
if (klass->inspect_packet)
klass->inspect_packet (base, &packet);
/* If it's a known PES, push it */
if (MPEGTS_BIT_IS_SET (base->
|
请发表评论