[vlc-commits] packetizer: mpegvideo: tag profile
Francois Cartegnie
git at videolan.org
Wed Jan 29 18:30:12 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 28 14:46:57 2020 +0100| [730b56d07b80f5c90b1a2231c6e71257570da23c] | committer: Francois Cartegnie
packetizer: mpegvideo: tag profile
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=730b56d07b80f5c90b1a2231c6e71257570da23c
---
modules/packetizer/Makefile.am | 1 +
modules/packetizer/mpegvideo.c | 47 +++++++++++++++++++++++++++++++++++++++++-
modules/packetizer/mpegvideo.h | 32 ++++++++++++++++++++++++++++
3 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index 491426ec8f..756cf75fab 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -6,6 +6,7 @@ libpacketizer_av1_plugin_la_SOURCES = packetizer/av1.c \
packetizer/av1_obu.h
libpacketizer_copy_plugin_la_SOURCES = packetizer/copy.c
libpacketizer_mpegvideo_plugin_la_SOURCES = packetizer/mpegvideo.c \
+ packetizer/mpegvideo.h \
packetizer/iso_color_tables.h
libpacketizer_mpeg4video_plugin_la_SOURCES = packetizer/mpeg4video.c \
packetizer/iso_color_tables.h
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 8e89cce324..0969d8fe8d 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -50,6 +50,7 @@
#include <vlc_block.h>
#include <vlc_codec.h>
#include <vlc_block_helper.h>
+#include "mpegvideo.h"
#include "../codec/cc.h"
#include "packetizer_helper.h"
#include "startcode_helper.h"
@@ -818,13 +819,57 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
{0,1}, {0,1}
};
#endif
-
/* sequence extension */
if( p_sys->p_ext) block_Release( p_sys->p_ext );
p_sys->p_ext = block_Duplicate( p_frag );
if( p_frag->i_buffer >= 10 )
{
+ /* profile and level indication */
+ if( p_dec->fmt_out.i_profile == -1 )
+ {
+ const uint16_t profilelevel = ((p_frag->p_buffer[4] << 4) |
+ (p_frag->p_buffer[5] >> 4)) & 0xFF;
+ int i_profile = -1;
+ int i_level = -1;
+ switch( profilelevel )
+ {
+ case 0x82:
+ i_profile = PROFILE_MPEG2_422;
+ i_level = LEVEL_MPEG2_HIGH;
+ break;
+ case 0x85:
+ i_profile = PROFILE_MPEG2_422;
+ i_level = LEVEL_MPEG2_MAIN;
+ break;
+ case 0x8A:
+ i_profile = PROFILE_MPEG2_MULTIVIEW;
+ i_level = LEVEL_MPEG2_HIGH;
+ break;
+ case 0x8B:
+ i_profile = PROFILE_MPEG2_MULTIVIEW;
+ i_level = LEVEL_MPEG2_HIGH_1440;
+ break;
+ case 0x8D:
+ i_profile = PROFILE_MPEG2_MULTIVIEW;
+ i_level = LEVEL_MPEG2_MAIN;
+ break;
+ case 0x8E:
+ i_profile = PROFILE_MPEG2_MULTIVIEW;
+ i_level = LEVEL_MPEG2_LOW;
+ break;
+ default:
+ if( (profilelevel & 0x80) == 0 ) /* escape bit */
+ {
+ i_profile = (profilelevel >> 4) & 0x07;
+ i_level = profilelevel & 0x0F;
+ }
+ break;
+ }
+ p_dec->fmt_out.i_profile = i_profile;
+ p_dec->fmt_out.i_level = i_level;
+ }
+
p_sys->b_seq_progressive =
p_frag->p_buffer[5]&0x08 ? true : false;
p_sys->b_low_delay =
diff --git a/modules/packetizer/mpegvideo.h b/modules/packetizer/mpegvideo.h
new file mode 100644
index 0000000000..de4fbf56a0
--- /dev/null
+++ b/modules/packetizer/mpegvideo.h
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * mpegvideo.h: MPEG1/2 video stream definitions
+ *****************************************************************************
+ * Copyright (C) 2020 VideoLabs, VLC authors and VideoLAN
+ *
+ * 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.
+ *****************************************************************************/
+
+#define PROFILE_MPEG2_HIGH 1
+#define PROFILE_MPEG2_SPATIALLY_SCALABLE 2
+#define PROFILE_MPEG2_SNR_SCALABLE 3
+#define PROFILE_MPEG2_MAIN 4
+#define PROFILE_MPEG2_SIMPLE 5
+#define PROFILE_MPEG2_422 (0x80 + 2)
+#define PROFILE_MPEG2_MULTIVIEW (0x80 +10)
+
+#define LEVEL_MPEG2_HIGH 4
+#define LEVEL_MPEG2_HIGH_1440 6
+#define LEVEL_MPEG2_MAIN 8
+#define LEVEL_MPEG2_LOW 10
More information about the vlc-commits
mailing list