[vlc-commits] Move h264_get_profile_level from OMX to the h264_nal helper file
Jean-Baptiste Kempf
git at videolan.org
Sun Jun 15 16:59:48 CEST 2014
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jun 15 16:49:53 2014 +0200| [15714d17ea17ee6968721cf9e97ac0d111780df2] | committer: Jean-Baptiste Kempf
Move h264_get_profile_level from OMX to the h264_nal helper file
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15714d17ea17ee6968721cf9e97ac0d111780df2
---
modules/codec/h264_nal.h | 34 +++++++++++++++++++++++++++++++++-
modules/codec/omxil/omxil_utils.h | 2 --
modules/codec/omxil/utils.c | 29 -----------------------------
3 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/modules/codec/h264_nal.h b/modules/codec/h264_nal.h
index 7fd3526..856ca05 100644
--- a/modules/codec/h264_nal.h
+++ b/modules/codec/h264_nal.h
@@ -38,7 +38,7 @@ static int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
}
/* Read infos in first 6 bytes */
- i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
+ i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
if (p_nal_size)
*p_nal_size = (p_buf[4] & 0x03) + 1;
p_buf += 5;
@@ -142,3 +142,35 @@ static void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
}
}
}
+
+/* Get level and Profile */
+static bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
+ size_t *p_level, size_t *p_nal_size)
+{
+ uint8_t *p = (uint8_t*)p_fmt->p_extra;
+ if(!p || !p_fmt->p_extra) return false;
+
+ /* Check the profile / level */
+ if (p_fmt->i_original_fourcc == VLC_FOURCC('a','v','c','1') && p[0] == 1)
+ {
+ if (p_fmt->i_extra < 12) return false;
+ if (p_nal_size) *p_nal_size = 1 + (p[4]&0x03);
+ if (!(p[5]&0x1f)) return false;
+ p += 8;
+ }
+ else
+ {
+ if (p_fmt->i_extra < 8) return false;
+ if (!p[0] && !p[1] && !p[2] && p[3] == 1) p += 4;
+ else if (!p[0] && !p[1] && p[2] == 1) p += 3;
+ else return false;
+ }
+
+ if ( ((*p++)&0x1f) != 7) return false;
+
+ /* Get profile/level out of first SPS */
+ if (p_profile) *p_profile = p[0];
+ if (p_level) *p_level = p[2];
+ return true;
+}
+
diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h
index 0a5dc17..943e836 100644
--- a/modules/codec/omxil/omxil_utils.h
+++ b/modules/codec/omxil/omxil_utils.h
@@ -260,8 +260,6 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index);
/*****************************************************************************
* H264 specific code
*****************************************************************************/
-bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size);
-
size_t convert_omx_to_profile_idc(OMX_VIDEO_AVCPROFILETYPE profile_type);
size_t convert_omx_to_level_idc(OMX_VIDEO_AVCLEVELTYPE level_type);
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index 2cb6358..aba95bd 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -1044,35 +1044,6 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
}
}
-bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size)
-{
- uint8_t *p = (uint8_t*)p_fmt->p_extra;
- if(!p || !p_fmt->p_extra) return false;
-
- /* Check the profile / level */
- if (p_fmt->i_original_fourcc == VLC_FOURCC('a','v','c','1') && p[0] == 1)
- {
- if (p_fmt->i_extra < 12) return false;
- if (p_nal_size) *p_nal_size = 1 + (p[4]&0x03);
- if (!(p[5]&0x1f)) return false;
- p += 8;
- }
- else
- {
- if (p_fmt->i_extra < 8) return false;
- if (!p[0] && !p[1] && !p[2] && p[3] == 1) p += 4;
- else if (!p[0] && !p[1] && p[2] == 1) p += 3;
- else return false;
- }
-
- if ( ((*p++)&0x1f) != 7) return false;
-
- /* Get profile/level out of first SPS */
- if (p_profile) *p_profile = p[0];
- if (p_level) *p_level = p[2];
- return true;
-}
-
static const struct
{
OMX_VIDEO_AVCPROFILETYPE omx_profile;
More information about the vlc-commits
mailing list