2014-04-07 13:49:59 +00:00
|
|
|
/* GStreamer
|
2014-06-25 10:40:57 +00:00
|
|
|
* Copyright (C) 2011 David Schleef <ds@schleef.org>
|
|
|
|
* Copyright (C) 2011 Tim-Philipp Müller <tim.muller@collabora.co.uk>
|
|
|
|
* Copyright (C) 2014 Tim-Philipp Müller <tim@centricular.com>
|
2014-04-07 13:49:59 +00:00
|
|
|
* Copyright (C) 2014 Vincent Penquerc'h <vincent@collabora.co.uk>
|
|
|
|
*
|
|
|
|
* gstelements_private.c: Shared code for core elements
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
#include "gst/gst.h"
|
|
|
|
#include "gstelements_private.h"
|
|
|
|
|
2014-06-28 16:58:26 +00:00
|
|
|
#define BUFFER_FLAG_SHIFT 4
|
|
|
|
|
|
|
|
G_STATIC_ASSERT ((1 << BUFFER_FLAG_SHIFT) == GST_MINI_OBJECT_FLAG_LAST);
|
|
|
|
|
2014-06-25 10:40:57 +00:00
|
|
|
/* Returns a newly allocated string describing the flags on this buffer */
|
2014-04-07 13:49:59 +00:00
|
|
|
char *
|
|
|
|
gst_buffer_get_flags_string (GstBuffer * buffer)
|
|
|
|
{
|
2014-06-28 16:58:26 +00:00
|
|
|
static const char flag_strings[] =
|
|
|
|
"\000\000\000\000live\000decode-only\000discont\000resync\000corrupted\000"
|
|
|
|
"marker\000header\000gap\000droppable\000delta-unit\000tag-memory\000"
|
|
|
|
"FIXME";
|
|
|
|
static const guint8 flag_idx[] = { 0, 1, 2, 3, 4, 9, 21, 29, 36, 46, 53,
|
|
|
|
60, 64, 74, 85, 96
|
2014-04-07 13:49:59 +00:00
|
|
|
};
|
|
|
|
int i, max_bytes;
|
|
|
|
char *flag_str, *end;
|
|
|
|
|
2014-06-28 16:58:26 +00:00
|
|
|
/* max size is all flag strings plus a space or terminator after each one */
|
|
|
|
max_bytes = sizeof (flag_strings);
|
2014-04-07 13:49:59 +00:00
|
|
|
flag_str = g_malloc (max_bytes);
|
|
|
|
|
|
|
|
end = flag_str;
|
|
|
|
end[0] = '\0';
|
2014-06-28 16:58:26 +00:00
|
|
|
for (i = BUFFER_FLAG_SHIFT; i < G_N_ELEMENTS (flag_idx); i++) {
|
2014-04-07 13:49:59 +00:00
|
|
|
if (GST_MINI_OBJECT_CAST (buffer)->flags & (1 << i)) {
|
2014-06-28 16:58:26 +00:00
|
|
|
strcpy (end, flag_strings + flag_idx[i]);
|
2014-04-07 13:49:59 +00:00
|
|
|
end += strlen (end);
|
|
|
|
end[0] = ' ';
|
|
|
|
end[1] = '\0';
|
|
|
|
end++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return flag_str;
|
|
|
|
}
|