diff options
Diffstat (limited to 'libavcodec/h264_sei.c')
-rw-r--r-- | libavcodec/h264_sei.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index 2e5fb65..81edeb2 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -2,20 +2,20 @@ * H.26L/H.264/AVC/JVT/14496-10/... sei decoding * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg 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. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg 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 Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -47,8 +47,8 @@ void ff_h264_reset_sei(H264Context *h) { static int decode_picture_timing(H264Context *h){ MpegEncContext * const s = &h->s; if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag){ - h->sei_cpb_removal_delay = get_bits(&s->gb, h->sps.cpb_removal_delay_length); - h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length); + h->sei_cpb_removal_delay = get_bits_long(&s->gb, h->sps.cpb_removal_delay_length); + h->sei_dpb_output_delay = get_bits_long(&s->gb, h->sps.dpb_output_delay_length); } if(h->sps.pic_struct_present_flag){ unsigned int i, num_clock_ts; @@ -111,6 +111,8 @@ static int decode_unregistered_user_data(H264Context *h, int size){ e= sscanf(user_data+16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build); if(e==1 && build>0) h->x264_build= build; + if(e==1 && build==1 && !strncmp(user_data+16, "x264 - core 0000", 16)) + h->x264_build = 67; if(s->avctx->debug & FF_DEBUG_BUGS) av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data+16); @@ -146,13 +148,13 @@ static int decode_buffering_period(H264Context *h){ // NOTE: This is really so duplicated in the standard... See H.264, D.1.1 if (sps->nal_hrd_parameters_present_flag) { for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) { - h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length); + h->initial_cpb_removal_delay[sched_sel_idx] = get_bits_long(&s->gb, sps->initial_cpb_removal_delay_length); skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset } } if (sps->vcl_hrd_parameters_present_flag) { for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) { - h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length); + h->initial_cpb_removal_delay[sched_sel_idx] = get_bits_long(&s->gb, sps->initial_cpb_removal_delay_length); skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset } } @@ -169,14 +171,21 @@ int ff_h264_decode_sei(H264Context *h){ type=0; do{ + if (get_bits_left(&s->gb) < 8) + return -1; type+= show_bits(&s->gb, 8); }while(get_bits(&s->gb, 8) == 255); size=0; do{ + if (get_bits_left(&s->gb) < 8) + return -1; size+= show_bits(&s->gb, 8); }while(get_bits(&s->gb, 8) == 255); + if(s->avctx->debug&FF_DEBUG_STARTCODE) + av_log(h->s.avctx, AV_LOG_DEBUG, "SEI %d len:%d\n", type, size); + switch(type){ case SEI_TYPE_PIC_TIMING: // Picture timing SEI if(decode_picture_timing(h) < 0) |