mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
codecparsers: fix debug category initialisation
Make thread-safe.
This commit is contained in:
parent
1c712ca555
commit
0d59589935
4 changed files with 63 additions and 47 deletions
|
@ -80,17 +80,25 @@
|
|||
#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;
|
||||
|
||||
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; \
|
||||
if (g_once_init_enter (&cat_gonce)) {
|
||||
GstDebugCategory *cat = NULL;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_h264", 0, "h264 parse library");
|
||||
|
||||
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,
|
||||
|
@ -1267,7 +1275,6 @@ gst_h264_nal_parser_new (void)
|
|||
GstH264NalParser *nalparser;
|
||||
|
||||
nalparser = g_slice_new0 (GstH264NalParser);
|
||||
INITIALIZE_DEBUG_CATEGORY;
|
||||
|
||||
return nalparser;
|
||||
}
|
||||
|
@ -1800,7 +1807,6 @@ gst_h264_parse_sps (GstH264NalUnit * nalu, GstH264SPS * sps,
|
|||
{
|
||||
NalReader nr;
|
||||
|
||||
INITIALIZE_DEBUG_CATEGORY;
|
||||
GST_DEBUG ("parsing SPS");
|
||||
|
||||
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
|
||||
|
@ -1887,7 +1893,6 @@ gst_h264_parse_subset_sps (GstH264NalUnit * nalu, GstH264SPS * sps,
|
|||
{
|
||||
NalReader nr;
|
||||
|
||||
INITIALIZE_DEBUG_CATEGORY;
|
||||
GST_DEBUG ("parsing Subset SPS");
|
||||
|
||||
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
|
||||
|
@ -1936,7 +1941,6 @@ gst_h264_parse_pps (GstH264NalParser * nalparser, GstH264NalUnit * nalu,
|
|||
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,
|
||||
|
|
|
@ -72,17 +72,25 @@
|
|||
#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;
|
||||
|
||||
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; \
|
||||
if (g_once_init_enter (&cat_gonce)) {
|
||||
GstDebugCategory *cat = NULL;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (cat, "codecparsers_h265", 0, "h265 parse library");
|
||||
|
||||
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 */
|
||||
|
@ -1239,7 +1247,6 @@ gst_h265_parser_new (void)
|
|||
GstH265Parser *parser;
|
||||
|
||||
parser = g_slice_new0 (GstH265Parser);
|
||||
INITIALIZE_DEBUG_CATEGORY;
|
||||
|
||||
return parser;
|
||||
}
|
||||
|
@ -1514,7 +1521,6 @@ gst_h265_parse_vps (GstH265NalUnit * nalu, GstH265VPS * vps)
|
|||
NalReader nr;
|
||||
guint i, j;
|
||||
|
||||
INITIALIZE_DEBUG_CATEGORY;
|
||||
GST_DEBUG ("parsing VPS");
|
||||
|
||||
nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
|
||||
|
@ -1693,7 +1699,6 @@ gst_h265_parse_sps (GstH265Parser * parser, GstH265NalUnit * nalu,
|
|||
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,
|
||||
|
@ -1916,7 +1921,6 @@ gst_h265_parse_pps (GstH265Parser * parser, GstH265NalUnit * nalu,
|
|||
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,
|
||||
|
|
|
@ -119,13 +119,25 @@ static const VLCTable mpeg2_mbaddr_vlc_table[] = {
|
|||
{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;
|
||||
|
||||
#define INITIALIZE_DEBUG_CATEGORY \
|
||||
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo", \
|
||||
0, "Mpegvideo parser library");
|
||||
if (g_once_init_enter (&cat_gonce)) {
|
||||
GstDebugCategory *cat = NULL;
|
||||
|
||||
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
|
||||
|
@ -233,8 +245,6 @@ gst_mpeg_video_parse (GstMpegVideoPacket * packet,
|
|||
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;
|
||||
|
@ -300,8 +310,6 @@ gst_mpeg_video_packet_parse_sequence_header (const GstMpegVideoPacket * packet,
|
|||
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 */
|
||||
|
|
|
@ -39,23 +39,24 @@
|
|||
#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;
|
||||
|
@ -529,7 +530,6 @@ gst_vp8_parser_parse_frame_header (GstVp8Parser * parser,
|
|||
GstVp8RangeDecoderState rd_state;
|
||||
GstVp8ParserResult result;
|
||||
|
||||
ensure_debug_category ();
|
||||
ensure_prob_tables ();
|
||||
|
||||
g_return_val_if_fail (frame_hdr != NULL, GST_VP8_PARSER_ERROR);
|
||||
|
|
Loading…
Reference in a new issue