[vlc-commits] [Git][videolan/vlc][master] 4 commits: sout: hls: directly extract constraint/profile bytes
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Nov 8 10:55:48 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
7f558d88 by François Cartegnie at 2024-11-08T10:22:40+00:00
sout: hls: directly extract constraint/profile bytes
- - - - -
dd1d197d by François Cartegnie at 2024-11-08T10:22:40+00:00
hxxx_helper: remove non generic constraints helper
- - - - -
a827651b by François Cartegnie at 2024-11-08T10:22:40+00:00
packetizer: h264: remove unused constraints helper
- - - - -
00853756 by François Cartegnie at 2024-11-08T10:22:40+00:00
hxxx_helper: remove unused non generic dpb helper
- - - - -
5 changed files:
- modules/codec/hxxx_helper.c
- modules/codec/hxxx_helper.h
- modules/packetizer/h264_nal.c
- modules/packetizer/h264_nal.h
- modules/stream_out/hls/codecs.c
Changes:
=====================================
modules/codec/hxxx_helper.c
=====================================
@@ -858,17 +858,6 @@ hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den
return VLC_EGENERIC;
}
-int
-h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
- uint8_t *p_depth, unsigned *p_delay)
-{
- const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
- if (hsps == NULL)
- return VLC_EGENERIC;
- return h264_get_dpb_values(hsps->h264_sps, p_depth, p_delay) ?
- VLC_SUCCESS : VLC_EGENERIC;
-}
-
int
hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
uint8_t *p_profile, uint8_t *p_level)
@@ -890,17 +879,6 @@ hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
return VLC_EGENERIC;
}
-int h264_helper_get_constraint_flag(const struct hxxx_helper *hh,
- uint8_t *pi_constraints) {
-
- assert(hh->i_codec == VLC_CODEC_H264);
- const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
- if (hsps && hsps->h264_sps &&
- h264_get_constraints_set(hsps->h264_sps, pi_constraints))
- return VLC_SUCCESS;
- return VLC_EGENERIC;
-}
-
int
hxxx_helper_get_chroma_chroma(const struct hxxx_helper *hh, uint8_t *pi_chroma_format,
uint8_t *pi_depth_luma, uint8_t *pi_depth_chroma)
=====================================
modules/codec/hxxx_helper.h
=====================================
@@ -118,13 +118,8 @@ int hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
int hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den);
-int h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
- uint8_t *p_depth, unsigned *pi_delay);
-
int hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
uint8_t *p_profile, uint8_t *p_level);
-int h264_helper_get_constraint_flag(const struct hxxx_helper *hh,
- uint8_t *pi_constraints);
int
hxxx_helper_get_chroma_chroma(const struct hxxx_helper *hh, uint8_t *pi_chroma_format,
=====================================
modules/packetizer/h264_nal.c
=====================================
@@ -878,13 +878,6 @@ bool h264_get_sps_profile_tier_level( const h264_sequence_parameter_set_t *p_sps
return true;
}
-bool h264_get_constraints_set( const h264_sequence_parameter_set_t *p_sps,
- uint8_t *pi_constraints )
-{
- *pi_constraints = p_sps->i_constraint_set_flags;
- return true;
-}
-
bool h264_get_picture_size( const h264_sequence_parameter_set_t *p_sps,
unsigned *p_ox, unsigned *p_oy,
unsigned *p_w, unsigned *p_h,
=====================================
modules/packetizer/h264_nal.h
=====================================
@@ -217,8 +217,6 @@ bool h264_using_adaptive_frames( const h264_sequence_parameter_set_t * );
bool h264_get_sps_profile_tier_level( const h264_sequence_parameter_set_t *,
uint8_t *pi_profile, uint8_t *pi_level );
-bool h264_get_constraints_set( const h264_sequence_parameter_set_t *p_sps,
- uint8_t *pi_constraints );
bool h264_get_picture_size( const h264_sequence_parameter_set_t *,
unsigned *p_ox, unsigned *p_oy,
unsigned *p_w, unsigned *p_h,
=====================================
modules/stream_out/hls/codecs.c
=====================================
@@ -25,7 +25,7 @@
#include <vlc_memstream.h>
-#include "../../codec/hxxx_helper.h"
+#include "../../packetizer/h264_nal.h"
#include "../../packetizer/hevc_nal.h"
#include "../../packetizer/hxxx_ep3b.h"
#include "../../packetizer/hxxx_nal.h"
@@ -34,17 +34,29 @@
static int FormatAVC(struct vlc_memstream *ms, const es_format_t *fmt)
{
/* Parse the h264 constraint flag. */
- uint8_t constraints = 0;
- uint8_t profile = 0;
- uint8_t level = 0;
- struct hxxx_helper hh;
- hxxx_helper_init(&hh, NULL, fmt->i_codec, 0, 0);
- if (hxxx_helper_set_extra(&hh, fmt->p_extra, fmt->i_extra) == VLC_SUCCESS)
+ hxxx_iterator_ctx_t it;
+ hxxx_iterator_init(&it, fmt->p_extra, fmt->i_extra, 0);
+ const uint8_t *nal = NULL;
+ size_t nal_size;
+ if (hxxx_annexb_iterate_next(&it, &nal, &nal_size))
{
- h264_helper_get_constraint_flag(&hh, &constraints);
- hxxx_helper_get_current_profile_level(&hh, &profile, &level);
+ switch (h264_getNALType(nal))
+ {
+ case H264_NAL_SPS:
+ break;
+ default:
+ nal = NULL;
+ break;
+ }
}
- hxxx_helper_clean(&hh);
+
+ /* NAL units aren't provisioned. Codec description will be minimal. */
+ if (unlikely(nal == NULL || nal_size<4))
+ return VLC_SUCCESS;
+
+ uint8_t profile = nal[1];
+ uint8_t constraints = nal[2];
+ uint8_t level = nal[3];
const int written = vlc_memstream_printf(
ms, "avc1.%02X%02X%02X", profile, constraints, level);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db84152afd27430362d539e54f1650e7c57eb4cc...0085375629d4d424a86a144d347e0febbfc9cbea
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db84152afd27430362d539e54f1650e7c57eb4cc...0085375629d4d424a86a144d347e0febbfc9cbea
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list