libs: codecparsers: drop use of GSlice

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
This commit is contained in:
Tim-Philipp Müller 2023-01-08 18:02:47 +00:00 committed by GStreamer Marge Bot
parent e6da8deb8e
commit 32384c0c69
6 changed files with 30 additions and 29 deletions

View file

@ -544,7 +544,7 @@ gst_av1_parse_reset_state (GstAV1Parser * parser, gboolean free_sps)
parser->state.sequence_changed = FALSE;
if (parser->seq_header) {
g_slice_free (GstAV1SequenceHeaderOBU, parser->seq_header);
g_free (parser->seq_header);
parser->seq_header = NULL;
}
}
@ -1440,10 +1440,10 @@ gst_av1_parser_parse_sequence_header_obu (GstAV1Parser * parser,
sizeof (GstAV1SequenceHeaderOBU)))
goto success;
g_slice_free (GstAV1SequenceHeaderOBU, parser->seq_header);
g_free (parser->seq_header);
}
parser->seq_header = g_slice_dup (GstAV1SequenceHeaderOBU, seq_header);
parser->seq_header = g_memdup2 (seq_header, sizeof (GstAV1SequenceHeaderOBU));
gst_av1_parse_reset_state (parser, FALSE);
/* choose_operating_point() set the operating_point */
@ -4664,7 +4664,7 @@ gst_av1_parser_set_operating_point (GstAV1Parser * parser,
GstAV1Parser *
gst_av1_parser_new (void)
{
return g_slice_new0 (GstAV1Parser);
return g_new0 (GstAV1Parser, 1);
}
/**
@ -4683,6 +4683,6 @@ gst_av1_parser_free (GstAV1Parser * parser)
g_return_if_fail (parser != NULL);
if (parser->seq_header)
g_slice_free (GstAV1SequenceHeaderOBU, parser->seq_header);
g_slice_free (GstAV1Parser, parser);
g_free (parser->seq_header);
g_free (parser);
}

View file

@ -1432,7 +1432,7 @@ gst_h264_nal_parser_new (void)
{
GstH264NalParser *nalparser;
nalparser = g_slice_new0 (GstH264NalParser);
nalparser = g_new0 (GstH264NalParser, 1);
return nalparser;
}
@ -1452,7 +1452,7 @@ gst_h264_nal_parser_free (GstH264NalParser * nalparser)
gst_h264_sps_clear (&nalparser->sps[i]);
for (i = 0; i < GST_H264_MAX_PPS_COUNT; i++)
gst_h264_pps_clear (&nalparser->pps[i]);
g_slice_free (GstH264NalParser, nalparser);
g_free (nalparser);
nalparser = NULL;
}

View file

@ -1357,7 +1357,7 @@ gst_h265_parser_new (void)
{
GstH265Parser *parser;
parser = g_slice_new0 (GstH265Parser);
parser = g_new0 (GstH265Parser, 1);
return parser;
}
@ -1371,7 +1371,7 @@ gst_h265_parser_new (void)
void
gst_h265_parser_free (GstH265Parser * parser)
{
g_slice_free (GstH265Parser, parser);
g_free (parser);
parser = NULL;
}

View file

@ -47,18 +47,17 @@ gst_mpeg_video_meta_free (GstMpegVideoMeta * mpeg_video_meta,
GstBuffer * buffer)
{
if (mpeg_video_meta->sequencehdr)
g_slice_free (GstMpegVideoSequenceHdr, mpeg_video_meta->sequencehdr);
g_free (mpeg_video_meta->sequencehdr);
if (mpeg_video_meta->sequenceext)
g_slice_free (GstMpegVideoSequenceExt, mpeg_video_meta->sequenceext);
g_free (mpeg_video_meta->sequenceext);
if (mpeg_video_meta->sequencedispext)
g_slice_free (GstMpegVideoSequenceDisplayExt,
mpeg_video_meta->sequencedispext);
g_free (mpeg_video_meta->sequencedispext);
if (mpeg_video_meta->pichdr)
g_slice_free (GstMpegVideoPictureHdr, mpeg_video_meta->pichdr);
g_free (mpeg_video_meta->pichdr);
if (mpeg_video_meta->picext)
g_slice_free (GstMpegVideoPictureExt, mpeg_video_meta->picext);
g_free (mpeg_video_meta->picext);
if (mpeg_video_meta->quantext)
g_slice_free (GstMpegVideoQuantMatrixExt, mpeg_video_meta->quantext);
g_free (mpeg_video_meta->quantext);
}
static gboolean
@ -160,19 +159,21 @@ gst_buffer_add_mpeg_video_meta (GstBuffer * buffer,
if (seq_hdr)
mpeg_video_meta->sequencehdr =
g_slice_dup (GstMpegVideoSequenceHdr, seq_hdr);
g_memdup2 (seq_hdr, sizeof (GstMpegVideoSequenceHdr));
if (seq_ext)
mpeg_video_meta->sequenceext =
g_slice_dup (GstMpegVideoSequenceExt, seq_ext);
g_memdup2 (seq_ext, sizeof (GstMpegVideoSequenceExt));
if (disp_ext)
mpeg_video_meta->sequencedispext =
g_slice_dup (GstMpegVideoSequenceDisplayExt, disp_ext);
mpeg_video_meta->pichdr = g_slice_dup (GstMpegVideoPictureHdr, pic_hdr);
g_memdup2 (disp_ext, sizeof (GstMpegVideoSequenceDisplayExt));
mpeg_video_meta->pichdr =
g_memdup2 (pic_hdr, sizeof (GstMpegVideoPictureHdr));
if (pic_ext)
mpeg_video_meta->picext = g_slice_dup (GstMpegVideoPictureExt, pic_ext);
mpeg_video_meta->picext =
g_memdup2 (pic_ext, sizeof (GstMpegVideoPictureExt));
if (quant_ext)
mpeg_video_meta->quantext =
g_slice_dup (GstMpegVideoQuantMatrixExt, quant_ext);
g_memdup2 (quant_ext, sizeof (GstMpegVideoQuantMatrixExt));
return mpeg_video_meta;
}

View file

@ -2154,7 +2154,7 @@ failed:
GstVC1BitPlanes *
gst_vc1_bitplanes_new (void)
{
return g_slice_new0 (GstVC1BitPlanes);
return g_new0 (GstVC1BitPlanes, 1);
}
/**
@ -2167,7 +2167,7 @@ void
gst_vc1_bitplanes_free (GstVC1BitPlanes * bitplanes)
{
gst_vc1_bitplanes_free_1 (bitplanes);
g_slice_free (GstVC1BitPlanes, bitplanes);
g_free (bitplanes);
}
/**

View file

@ -637,11 +637,11 @@ gst_vp9_parser_new (void)
INITIALIZE_DEBUG_CATEGORY;
GST_DEBUG ("Create VP9 Parser");
parser = g_slice_new0 (GstVp9Parser);
parser = g_new0 (GstVp9Parser, 1);
if (!parser)
return NULL;
priv = g_slice_new0 (GstVp9ParserPrivate);
priv = g_new0 (GstVp9ParserPrivate, 1);
if (!priv)
return NULL;
@ -664,10 +664,10 @@ gst_vp9_parser_free (GstVp9Parser * parser)
{
if (parser) {
if (parser->priv) {
g_slice_free (GstVp9ParserPrivate, parser->priv);
g_free (parser->priv);
parser->priv = NULL;
}
g_slice_free (GstVp9Parser, parser);
g_free (parser);
}
}