summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4videodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-07-22 11:56:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-07-22 12:08:52 +0200
commit4095fa903830f8395a26d6ee38c77ad6333a4f5e (patch)
tree828ada22309e543a181997b63c6ffca6868731ac /libavcodec/mpeg4videodec.c
parent657eac048eb267d781de83849fe7616d29320832 (diff)
parentbb32fded3623a20ff8999c2924315841c08c985c (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: dnxhddec: optimise dnxhd_decode_dct_block() rtp: remove disabled code eac3enc: use different numbers of blocks per frame to allow higher bitrates dnxhd: add regression test for 10-bit dnxhd: 10-bit support dsputil: update per-arch init funcs for non-h264 high bit depth dsputil: template get_pixels() for different bit depths dsputil: create 16/32-bit dctcoef versions of some functions jfdctint: add 10-bit version mov: add clcp type track as Subtitle stream. mpeg4: add Mpeg4 Profiles names. mpeg4: decode Level Profile for MPEG4 Part 2. ffprobe: display bitstream level. imgconvert: remove unused glue and xglue macros Conflicts: libavcodec/dsputil_template.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r--libavcodec/mpeg4videodec.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index b2a0187d66..b983a44855 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1527,6 +1527,22 @@ static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){
return 0;
}
+static int mpeg4_decode_profile_level(MpegEncContext * s, GetBitContext *gb){
+ int profile_and_level_indication;
+
+ profile_and_level_indication = get_bits(gb, 8);
+
+ s->avctx->profile = (profile_and_level_indication & 0xf0) >> 4;
+ s->avctx->level = (profile_and_level_indication & 0x0f);
+
+ // for Simple profile, level 0
+ if (s->avctx->profile == 0 && s->avctx->level == 8) {
+ s->avctx->level = 0;
+ }
+
+ return 0;
+}
+
static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
int width, height, vo_ver_id;
@@ -2181,6 +2197,9 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
else if(startcode == GOP_STARTCODE){
mpeg4_decode_gop_header(s, gb);
}
+ else if(startcode == VOS_STARTCODE){
+ mpeg4_decode_profile_level(s, gb);
+ }
else if(startcode == VOP_STARTCODE){
break;
}
@@ -2241,6 +2260,25 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
+static const AVProfile mpeg4_video_profiles[] = {
+ { FF_PROFILE_MPEG4_SIMPLE, "Simple Profile" },
+ { FF_PROFILE_MPEG4_SIMPLE_SCALABLE, "Simple Scalable Profile" },
+ { FF_PROFILE_MPEG4_CORE, "Core Profile" },
+ { FF_PROFILE_MPEG4_MAIN, "Main Profile" },
+ { FF_PROFILE_MPEG4_N_BIT, "N-bit Profile" },
+ { FF_PROFILE_MPEG4_SCALABLE_TEXTURE, "Scalable Texture Profile" },
+ { FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION, "Simple Face Animation Profile" },
+ { FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE, "Basic Animated Texture Profile" },
+ { FF_PROFILE_MPEG4_HYBRID, "Hybrid Profile" },
+ { FF_PROFILE_MPEG4_ADVANCED_REAL_TIME, "Advanced Real Time Simple Profile" },
+ { FF_PROFILE_MPEG4_CORE_SCALABLE, "Code Scalable Profile" },
+ { FF_PROFILE_MPEG4_ADVANCED_CODING, "Advanced Coding Profile" },
+ { FF_PROFILE_MPEG4_ADVANCED_CORE, "Advanced Core Profile" },
+ { FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE, "Advanced Scalable Texture Profile" },
+ { FF_PROFILE_MPEG4_SIMPLE_STUDIO, "Simple Studio Profile" },
+ { FF_PROFILE_MPEG4_ADVANCED_SIMPLE, "Advanced Simple Profile" },
+};
+
AVCodec ff_mpeg4_decoder = {
"mpeg4",
AVMEDIA_TYPE_VIDEO,
@@ -2255,6 +2293,7 @@ AVCodec ff_mpeg4_decoder = {
.max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.pix_fmts= ff_hwaccel_pixfmt_list_420,
+ .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
.update_thread_context= ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context)
};