Commit 1eacc8c9 authored by François Cartegnie's avatar François Cartegnie 🤞

mux: mp4: move in mpeg_parser_helpers remains

parent d99478cb
/*****************************************************************************
* packetizer_helper.h: Packetizer helpers
*****************************************************************************
* Copyright (C) 2014 VLC authors and VideoLAN
* $Id$
*
* Authors: Denis Charmet <typx@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MPEG_PARSER_HELPERS_H
#define MPEG_PARSER_HELPERS_H
#include <stdint.h>
#include <vlc_bits.h>
static inline void hevc_skip_profile_tiers_level( bs_t * bs, int32_t max_sub_layer_minus1 )
{
uint8_t sub_layer_profile_present_flag[8];
uint8_t sub_layer_level_present_flag[8];
/* skipping useless fields of the VPS see https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201304-I!!PDF-E&type=item */
bs_skip( bs, 2 + 1 + 5 + 32 + 1 + 1 + 1 + 1 + 44 + 8 );
for( int32_t i = 0; i < max_sub_layer_minus1; i++ )
{
sub_layer_profile_present_flag[i] = bs_read1( bs );
sub_layer_level_present_flag[i] = bs_read1( bs );
}
if(max_sub_layer_minus1 > 0)
bs_skip( bs, (8 - max_sub_layer_minus1) * 2 );
for( int32_t i = 0; i < max_sub_layer_minus1; i++ )
{
if( sub_layer_profile_present_flag[i] )
bs_skip( bs, 2 + 1 + 5 + 32 + 1 + 1 + 1 + 1 + 44 );
if( sub_layer_level_present_flag[i] )
bs_skip( bs, 8 );
}
}
#endif /*MPEG_PARSER_HELPERS_H*/
......@@ -7,7 +7,6 @@ libmux_avi_plugin_la_SOURCES = mux/avi.c
libmux_mp4_plugin_la_SOURCES = mux/mp4/mp4.c \
mux/mp4/libmp4mux.c mux/mp4/libmp4mux.h \
packetizer/hxxx_nal.h demux/mp4/libmp4.h \
demux/mpeg/mpeg_parser_helpers.h \
packetizer/h264_nal.c packetizer/h264_nal.h
libmux_mpjpeg_plugin_la_SOURCES = mux/mpjpeg.c
libmux_ps_plugin_la_SOURCES = \
......
......@@ -22,7 +22,6 @@
*****************************************************************************/
#include "libmp4mux.h"
#include "../demux/mp4/libmp4.h" /* flags */
#include "../demux/mpeg/mpeg_parser_helpers.h"
#include "../packetizer/hevc_nal.h"
#include "../packetizer/h264_nal.h" /* h264_get_spspps */
#include "../packetizer/hxxx_nal.h"
......@@ -33,6 +32,7 @@
#include <vlc_es.h>
#include <vlc_iso_lang.h>
#include <vlc_bits.h>
#include <assert.h>
#include <time.h>
......@@ -529,6 +529,32 @@ static void hevcParseVPS(uint8_t * p_buffer, size_t i_buffer, uint8_t *general,
general[i] = bs_read( &bs, 8 );
}
static inline void hevc_skip_profile_tiers_level( bs_t * bs, int32_t max_sub_layer_minus1 )
{
uint8_t sub_layer_profile_present_flag[8];
uint8_t sub_layer_level_present_flag[8];
/* skipping useless fields of the VPS see https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201304-I!!PDF-E&type=item */
bs_skip( bs, 2 + 1 + 5 + 32 + 1 + 1 + 1 + 1 + 44 + 8 );
for( int32_t i = 0; i < max_sub_layer_minus1; i++ )
{
sub_layer_profile_present_flag[i] = bs_read1( bs );
sub_layer_level_present_flag[i] = bs_read1( bs );
}
if(max_sub_layer_minus1 > 0)
bs_skip( bs, (8 - max_sub_layer_minus1) * 2 );
for( int32_t i = 0; i < max_sub_layer_minus1; i++ )
{
if( sub_layer_profile_present_flag[i] )
bs_skip( bs, 2 + 1 + 5 + 32 + 1 + 1 + 1 + 1 + 44 );
if( sub_layer_level_present_flag[i] )
bs_skip( bs, 8 );
}
}
static void hevcParseSPS(uint8_t * p_buffer, size_t i_buffer, uint8_t * chroma_idc,
uint8_t *bit_depth_luma_minus8, uint8_t *bit_depth_chroma_minus8)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment