From f8bf587f9227e37fc131c9ac747be61bc015e808 Mon Sep 17 00:00:00 2001 From: Pavel Tcherniaev Date: Fri, 5 Apr 2024 05:15:15 -0700 Subject: [PATCH] added frame rate calculation to AVC parser (#307) * added frame rate calculation to AVC parser * fixed typo in avc_parser.h and removed cout debug statements from avc_parser.cpp * made all changes discussed with Jeff --------- Co-authored-by: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> --- src/parser/avc_parser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/parser/avc_parser.cpp b/src/parser/avc_parser.cpp index 9b56085498..13da9c7e7a 100644 --- a/src/parser/avc_parser.cpp +++ b/src/parser/avc_parser.cpp @@ -1142,6 +1142,17 @@ ParserResult AvcVideoParser::ParseSliceHeader(uint8_t *p_stream, size_t stream_s new_sps_activated_ = true; // Note: clear this flag after the actions are taken. } + // Set frame rate if available + if (new_sps_activated_) { + if (p_sps->vui_seq_parameters.timing_info_present_flag) { + frame_rate_.numerator = p_sps->vui_seq_parameters.time_scale; + frame_rate_.denominator = 2 * p_sps->vui_seq_parameters.num_units_in_tick; + } else { + frame_rate_.numerator = 0; + frame_rate_.denominator = 0; + } + } + if (p_sps->separate_colour_plane_flag == 1) { p_slice_header->colour_plane_id = Parser::ReadBits(p_stream, offset, 2); }