Make thread-safe.
#include <gst/base/gstbitreader.h>
#include <string.h>
-GST_DEBUG_CATEGORY_STATIC (h264_parser_debug);
-#define GST_CAT_DEFAULT h264_parser_debug
+#ifndef GST_DISABLE_GST_DEBUG
+#define GST_CAT_DEFAULT gst_h264_debug_category_get()
+static GstDebugCategory *
+gst_h264_debug_category_get (void)
+{
+ static gsize cat_gonce = 0;
+
+ if (g_once_init_enter (&cat_gonce)) {
+ GstDebugCategory *cat = NULL;
+
+ GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_h264", 0, "h264 parse library");
-static gboolean initialized = FALSE;
-#define INITIALIZE_DEBUG_CATEGORY \
- if (!initialized) { \
- GST_DEBUG_CATEGORY_INIT (h264_parser_debug, "codecparsers_h264", 0, \
- "h264 parser library"); \
- initialized = TRUE; \
+ g_once_init_leave (&cat_gonce, (gsize) cat);
}
+ return (GstDebugCategory *) cat_gonce;
+}
+#endif /* GST_DISABLE_GST_DEBUG */
+
/**** Default scaling_lists according to Table 7-2 *****/
static const guint8 default_4x4_intra[16] = {
6, 13, 13, 20, 20, 20, 28, 28, 28, 28, 32, 32,
GstH264NalParser *nalparser;
nalparser = g_slice_new0 (GstH264NalParser);
- INITIALIZE_DEBUG_CATEGORY;
return nalparser;
}
{
NalReader nr;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing SPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
{
NalReader nr;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing Subset SPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
guint8 pic_scaling_matrix_present_flag;
gint qp_bd_offset;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing PPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
#include <string.h>
#include <math.h>
-GST_DEBUG_CATEGORY_STATIC (h265_parser_debug);
-#define GST_CAT_DEFAULT h265_parser_debug
+#ifndef GST_DISABLE_GST_DEBUG
+#define GST_CAT_DEFAULT gst_h265_debug_category_get()
+static GstDebugCategory *
+gst_h265_debug_category_get (void)
+{
+ static gsize cat_gonce = 0;
+
+ if (g_once_init_enter (&cat_gonce)) {
+ GstDebugCategory *cat = NULL;
+
+ GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_h265", 0, "h265 parse library");
-static gboolean initialized = FALSE;
-#define INITIALIZE_DEBUG_CATEGORY \
- if (!initialized) { \
- GST_DEBUG_CATEGORY_INIT (h265_parser_debug, "codecparsers_h265", 0, \
- "h265 parser library"); \
- initialized = TRUE; \
+ g_once_init_leave (&cat_gonce, (gsize) cat);
}
+ return (GstDebugCategory *) cat_gonce;
+}
+#endif /* GST_DISABLE_GST_DEBUG */
+
/**** Default scaling_lists according to Table 7-5 and 7-6 *****/
/* Table 7-5 */
GstH265Parser *parser;
parser = g_slice_new0 (GstH265Parser);
- INITIALIZE_DEBUG_CATEGORY;
return parser;
}
NalReader nr;
guint i, j;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing VPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
guint subhc[] = { 1, 2, 1, 1, 1 };
GstH265VUIParams *vui = NULL;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing SPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
guint32 CtbSizeY, MinCbLog2SizeY, CtbLog2SizeY, MaxBitDepthY, MaxBitDepthC;
guint8 i;
- INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("parsing PPS");
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
{GST_MPEG_VIDEO_MACROBLOCK_ESCAPE, 0x08, 11}
};
-GST_DEBUG_CATEGORY_STATIC (mpegvideo_parser_debug);
-#define GST_CAT_DEFAULT mpegvideo_parser_debug
+#ifndef GST_DISABLE_GST_DEBUG
+#define GST_CAT_DEFAULT gst_mpegvideo_debug_category_get()
+static GstDebugCategory *
+gst_mpegvideo_debug_category_get (void)
+{
+ static gsize cat_gonce = 0;
+
+ if (g_once_init_enter (&cat_gonce)) {
+ GstDebugCategory *cat = NULL;
-#define INITIALIZE_DEBUG_CATEGORY \
- GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo", \
- 0, "Mpegvideo parser library");
+ GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_mpegvideo", 0,
+ "mpegvideo parser library");
+ g_once_init_leave (&cat_gonce, (gsize) cat);
+ }
+
+ return (GstDebugCategory *) cat_gonce;
+}
+#endif /* GST_DISABLE_GST_DEBUG */
/* Set the Pixel Aspect Ratio in our hdr from a ASR code in the data */
static void
gint off;
GstByteReader br;
- INITIALIZE_DEBUG_CATEGORY;
-
if (size <= offset) {
GST_DEBUG ("Can't parse from offset %d, buffer is to small", offset);
return FALSE;
if (packet->size < 8)
return FALSE;
- INITIALIZE_DEBUG_CATEGORY;
-
gst_bit_reader_init (&br, &packet->data[packet->offset], packet->size);
/* Setting the height/width codes */
#include "gstvp8rangedecoder.h"
#include "vp8utils.h"
-GST_DEBUG_CATEGORY_STATIC (vp8_parser_debug);
-#define GST_CAT_DEFAULT vp8_parser_debug
-
-#define INITIALIZE_DEBUG_CATEGORY ensure_debug_category ()
-static void
-ensure_debug_category (void)
-{
#ifndef GST_DISABLE_GST_DEBUG
- static gsize is_initialized;
+#define GST_CAT_DEFAULT gst_vp8_debug_category_get()
+static GstDebugCategory *
+gst_vp8_debug_category_get (void)
+{
+ static gsize cat_gonce = 0;
- if (g_once_init_enter (&is_initialized)) {
- GST_DEBUG_CATEGORY_INIT (vp8_parser_debug, "codecparsers_vp8", 0,
- "vp8 parser library");
- g_once_init_leave (&is_initialized, TRUE);
+ if (g_once_init_enter (&cat_gonce)) {
+ GstDebugCategory *cat = NULL;
+
+ GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_vp8", 0, "vp8 parser library");
+
+ g_once_init_leave (&cat_gonce, (gsize) cat);
}
-#endif
+
+ return (GstDebugCategory *) cat_gonce;
}
+#endif /* GST_DISABLE_GST_DEBUG */
static GstVp8MvProbs vp8_mv_update_probs;
static GstVp8TokenProbs vp8_token_update_probs;
GstVp8RangeDecoderState rd_state;
GstVp8ParserResult result;
- ensure_debug_category ();
ensure_prob_tables ();
g_return_val_if_fail (frame_hdr != NULL, GST_VP8_PARSER_ERROR);