From 9552d12ee8a331d7dd51a7a9ac13d67cad9fa9d6 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 21 Jul 2019 02:42:52 +0200 Subject: [PATCH] codecs/hevc: Add shared codec data for HEVC --- CMakeLists.txt | 2 ++ data/locale/en-US.ini | 10 ++++++ source/codecs/hevc.cpp | 0 source/codecs/hevc.hpp | 78 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 source/codecs/hevc.cpp create mode 100644 source/codecs/hevc.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index bb68b34..04650f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,6 +264,8 @@ set(PROJECT_PRIVATE "${PROJECT_SOURCE_DIR}/source/utility.cpp" "${PROJECT_SOURCE_DIR}/source/utility.hpp" "${PROJECT_SOURCE_DIR}/source/strings.hpp" + "${PROJECT_SOURCE_DIR}/source/codecs/hevc.hpp" + "${PROJECT_SOURCE_DIR}/source/codecs/hevc.cpp" "${PROJECT_SOURCE_DIR}/source/encoders/generic.hpp" "${PROJECT_SOURCE_DIR}/source/encoders/generic.cpp" "${PROJECT_SOURCE_DIR}/source/encoders/prores_aw.hpp" diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index e2181a7..5634a15 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -60,3 +60,13 @@ ProRes.Profile.Light="Light (LT)" ProRes.Profile.Standard="Standard" ProRes.Profile.HighQuality="High Quality (HQ)" +# Codec: HEVC +Codec.HEVC="HEVC" +Codec.HEVC.Profile="Profile" +Codec.HEVC.Profile.main="Main" +Codec.HEVC.Profile.main10="Main 10-bit" +Codec.HEVC.Profile.rext="Range Extended" +Codec.HEVC.Tier="Tier" +Codec.HEVC.Tier.main="Main" +Codec.HEVC.Tier.high="High" +Codec.HEVC.Level="Level" diff --git a/source/codecs/hevc.cpp b/source/codecs/hevc.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/codecs/hevc.hpp b/source/codecs/hevc.hpp new file mode 100644 index 0000000..5befe2d --- /dev/null +++ b/source/codecs/hevc.hpp @@ -0,0 +1,78 @@ +// FFMPEG Video Encoder Integration for OBS Studio +// Copyright (C) 2018 - 2019 Michael Fabian Dirks +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 + +#pragma once +#include + +// Codec: HEVC +#define P_HEVC "Codec.HEVC" +#define P_HEVC_PROFILE "Codec.HEVC.Profile" +#define P_HEVC_TIER "Codec.HEVC.Tier" +#define P_HEVC_LEVEL "Codec.HEVC.Level" + +namespace obsffmpeg { + namespace codecs { + namespace hevc { + enum class profile { + MAIN, + MAIN10, + RANGE_EXTENDED, + UNKNOWN = -1, + }; + + enum class tier { + MAIN, + HIGH, + UNKNOWN = -1, + }; + + enum class level { + L1_0 = 30, + L2_0 = 60, + L3_0 = 90, + L3_1 = 93, + L4_0 = 120, + L4_1 = 123, + L5_0 = 150, + L5_1 = 153, + L5_2 = 156, + L6_0 = 180, + L6_1 = 183, + L6_2 = 186, + UNKNOWN = -1, + }; + + std::map profiles{ + {profile::MAIN, "main"}, + {profile::MAIN10, "main10"}, + {profile::RANGE_EXTENDED, "rext"}, + }; + + std::map profile_tiers{ + {tier::MAIN, "main"}, + {tier::HIGH, "high"}, + }; + + std::map levels{ + {level::L1_0, "1.0"}, {level::L2_0, "2.0"}, {level::L3_0, "3.0"}, {level::L3_1, "3.1"}, + {level::L4_0, "4.0"}, {level::L4_1, "4.1"}, {level::L5_0, "5.0"}, {level::L5_1, "5.1"}, + {level::L5_2, "5.2"}, {level::L6_0, "6.0"}, {level::L6_1, "6.1"}, {level::L6_2, "6.2"}, + }; + + } // namespace hevc + } // namespace codecs +} // namespace obsffmpeg