h265parser: Add private method to update slice header

Adding a method to allow linking already parsed slice header
with parser's own sps/pps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8673>
This commit is contained in:
Seungha Yang 2025-03-25 02:41:29 +09:00 committed by GStreamer Marge Bot
parent c1835644f5
commit 4898020c28
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/* GStreamer
* Copyright (C) 2025 Seungha Yang <seungha@centricular.com>
*
* 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.
*/
#pragma once
#include <gst/gst.h>
#include <gst/codecparsers/gsth265parser.h>
G_BEGIN_DECLS
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_link_slice_hdr (GstH265Parser * parser,
GstH265SliceHdr * slice,
guint pps_id);
G_END_DECLS

View File

@ -66,6 +66,7 @@
#include "nalutils.h"
#include "gsth265parser.h"
#include "gsth265parser-private.h"
#include <gst/base/gstbytereader.h>
#include <gst/base/gstbitreader.h>
@ -5133,3 +5134,32 @@ error:
#undef READ_CONFIG_UINT16
#undef SKIP_CONFIG_BITS
}
GstH265ParserResult
gst_h265_parser_link_slice_hdr (GstH265Parser * parser, GstH265SliceHdr * slice,
guint pps_id)
{
GstH265ParserResult ret;
GstH265PPS *pps;
g_return_val_if_fail (parser, GST_H265_PARSER_ERROR);
g_return_val_if_fail (slice, GST_H265_PARSER_ERROR);
g_return_val_if_fail (pps_id < GST_H265_MAX_PPS_COUNT, GST_H265_PARSER_ERROR);
pps = gst_h265_parser_get_pps (parser, pps_id);
if (!pps) {
GST_WARNING
("couldn't find associated picture parameter set with id: %d", pps_id);
return GST_H265_PARSER_BROKEN_LINK;
}
ret = gst_h265_parser_fill_pps (parser, pps);
if (ret != GST_H265_PARSER_OK) {
GST_WARNING ("couldn't fill pps id: %d", pps_id);
return ret;
}
slice->pps = pps;
return GST_H265_PARSER_OK;
}