~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavcodec/h264_parser.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * H.26L/H.264/AVC/JVT/14496-10/... parser
3
3
 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4
4
 *
5
 
 * This file is part of FFmpeg.
 
5
 * This file is part of Libav.
6
6
 *
7
 
 * FFmpeg is free software; you can redistribute it and/or
 
7
 * Libav is free software; you can redistribute it and/or
8
8
 * modify it under the terms of the GNU Lesser General Public
9
9
 * License as published by the Free Software Foundation; either
10
10
 * version 2.1 of the License, or (at your option) any later version.
11
11
 *
12
 
 * FFmpeg is distributed in the hope that it will be useful,
 
12
 * Libav is distributed in the hope that it will be useful,
13
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
15
 * Lesser General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU Lesser General Public
18
 
 * License along with FFmpeg; if not, write to the Free Software
 
18
 * License along with Libav; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
26
26
 */
27
27
 
28
28
#include "parser.h"
29
 
#include "h264_parser.h"
30
29
#include "h264data.h"
31
30
#include "golomb.h"
32
31
 
33
32
#include <assert.h>
34
33
 
35
34
 
36
 
int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
 
35
static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
37
36
{
38
37
    int i;
39
38
    uint32_t state;
127
126
    h->sei_cpb_removal_delay        = -1;
128
127
    h->sei_buffering_period_present =  0;
129
128
 
 
129
    if (!buf_size)
 
130
        return 0;
 
131
 
130
132
    for(;;) {
131
133
        int src_length, dst_length, consumed;
132
134
        buf = ff_find_start_code(buf, buf_end, &state);
185
187
            h->sps = *h->sps_buffers[h->pps.sps_id];
186
188
            h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num);
187
189
 
188
 
            avctx->profile = h->sps.profile_idc;
 
190
            avctx->profile = ff_h264_get_profile(&h->sps);
189
191
            avctx->level   = h->sps.level_idc;
190
192
 
191
193
            if(h->sps.frame_mbs_only_flag){
245
247
    ParseContext *pc = &h->s.parse_context;
246
248
    int next;
247
249
 
 
250
    if (!h->got_first) {
 
251
        h->got_first = 1;
 
252
        if (avctx->extradata_size) {
 
253
            h->s.avctx = avctx;
 
254
            ff_h264_decode_extradata(h);
 
255
        }
 
256
    }
 
257
 
248
258
    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
249
259
        next= buf_size;
250
260
    }else{
272
282
            s->dts_ref_dts_delta = INT_MIN;
273
283
            s->pts_dts_delta     = INT_MIN;
274
284
        }
 
285
        if (s->flags & PARSER_FLAG_ONCE) {
 
286
            s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
 
287
        }
275
288
    }
276
289
 
277
290
    *poutbuf = buf;
319
332
    return 0;
320
333
}
321
334
 
322
 
AVCodecParser h264_parser = {
 
335
AVCodecParser ff_h264_parser = {
323
336
    { CODEC_ID_H264 },
324
337
    sizeof(H264Context),
325
338
    init,