~ubuntu-branches/ubuntu/precise/libav/precise-updates

« back to all changes in this revision

Viewing changes to libavformat/oggdec.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-07-21 21:12:27 UTC
  • mfrom: (1.1.9 experimental)
  • Revision ID: james.westby@ubuntu.com-20110721211227-i7f0fi12n1t9vd8e
Tags: 4:0.7.1-1ubuntu1
* Merge from debian/unstable
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - Extra conflicts on libswscale-extra-1 (can be dropped after natty release)

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
 
239
239
            for (n = 0; n < ogg->nstreams; n++) {
240
240
                av_freep(&ogg->streams[n].buf);
241
 
                av_freep(&ogg->streams[n].private);
 
241
                if (!ogg->state || ogg->state->streams[n].private != ogg->streams[n].private)
 
242
                    av_freep(&ogg->streams[n].private);
242
243
            }
243
244
            ogg->curidx   = -1;
244
245
            ogg->nstreams = 0;
372
373
 
373
374
            // We have reached the first non-header packet in this stream.
374
375
            // Unfortunately more header packets may still follow for others,
375
 
            // so we reset this later unless we are done with the headers
376
 
            // for all streams.
 
376
            // but if we continue with header parsing we may lose data packets.
377
377
            ogg->headers = 1;
378
378
 
379
379
            // Update the header state for all streams and
382
382
                s->data_offset = os->sync_pos;
383
383
            for (i = 0; i < ogg->nstreams; i++) {
384
384
                struct ogg_stream *cur_os = ogg->streams + i;
385
 
                if (cur_os->header > 0)
386
 
                    ogg->headers = 0;
387
385
 
388
386
                // if we have a partial non-header packet, its start is
389
387
                // obviously at or after the data start
585
583
                                  int64_t *pos_arg, int64_t pos_limit)
586
584
{
587
585
    struct ogg *ogg = s->priv_data;
588
 
    struct ogg_stream *os = ogg->streams + stream_index;
589
586
    AVIOContext *bc = s->pb;
590
587
    int64_t pts = AV_NOPTS_VALUE;
591
 
    int i;
 
588
    int i = -1;
592
589
    avio_seek(bc, *pos_arg, SEEK_SET);
593
590
    ogg_reset(ogg);
594
591
 
595
592
    while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
596
593
        if (i == stream_index) {
 
594
            struct ogg_stream *os = ogg->streams + stream_index;
597
595
            pts = ogg_calc_pts(s, i, NULL);
598
596
            if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
599
597
                pts = AV_NOPTS_VALUE;
619
617
        os->keyframe_seek = 1;
620
618
 
621
619
    ret = av_seek_frame_binary(s, stream_index, timestamp, flags);
 
620
    os = ogg->streams + stream_index;
622
621
    if (ret < 0)
623
622
        os->keyframe_seek = 0;
624
623
    return ret;