~ubuntu-branches/ubuntu/trusty/gst-libav1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavformat/oggparsetheora.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-09-24 17:07:00 UTC
  • mfrom: (1.1.17) (7.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20130924170700-4dg62s3pwl0pdakz
Tags: 1.2.0-1
* New upstream stable release:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
        os->private = thp;
54
54
    }
55
55
 
56
 
    if (os->buf[os->pstart] == 0x80) {
 
56
    switch (os->buf[os->pstart]) {
 
57
    case 0x80: {
57
58
        GetBitContext gb;
58
59
        int width, height;
 
60
        AVRational timebase;
59
61
 
60
62
        init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
61
63
 
85
87
 
86
88
            skip_bits(&gb, 16);
87
89
        }
88
 
        st->codec->time_base.den = get_bits_long(&gb, 32);
89
 
        st->codec->time_base.num = get_bits_long(&gb, 32);
90
 
        if (!(st->codec->time_base.num > 0 && st->codec->time_base.den > 0)) {
 
90
        timebase.den = get_bits_long(&gb, 32);
 
91
        timebase.num = get_bits_long(&gb, 32);
 
92
        if (!(timebase.num > 0 && timebase.den > 0)) {
91
93
            av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n");
92
 
            st->codec->time_base.num = 1;
93
 
            st->codec->time_base.den = 25;
 
94
            timebase.num = 1;
 
95
            timebase.den = 25;
94
96
        }
95
 
        avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
 
97
        avpriv_set_pts_info(st, 64, timebase.num, timebase.den);
96
98
 
97
99
        st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
98
100
        st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
106
108
        thp->gpmask = (1 << thp->gpshift) - 1;
107
109
 
108
110
        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
109
 
        st->codec->codec_id = CODEC_ID_THEORA;
 
111
        st->codec->codec_id = AV_CODEC_ID_THEORA;
110
112
        st->need_parsing = AVSTREAM_PARSE_HEADERS;
111
113
 
112
 
    } else if (os->buf[os->pstart] == 0x83) {
113
 
        ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
 
114
    }
 
115
    break;
 
116
    case 0x81:
 
117
        ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
 
118
    case 0x82:
 
119
        if (!thp->version)
 
120
            return -1;
 
121
        break;
 
122
    default:
 
123
        return -1;
114
124
    }
115
125
 
116
126
    st->codec->extradata = av_realloc (st->codec->extradata,
130
140
    struct ogg *ogg = ctx->priv_data;
131
141
    struct ogg_stream *os = ogg->streams + idx;
132
142
    struct theora_params *thp = os->private;
133
 
    uint64_t iframe = gp >> thp->gpshift;
134
 
    uint64_t pframe = gp & thp->gpmask;
 
143
    uint64_t iframe, pframe;
 
144
 
 
145
    if (!thp)
 
146
        return AV_NOPTS_VALUE;
 
147
 
 
148
    iframe = gp >> thp->gpshift;
 
149
    pframe = gp & thp->gpmask;
135
150
 
136
151
    if (thp->version < 0x030201)
137
152
        iframe++;
149
164
    .magic = "\200theora",
150
165
    .magicsize = 7,
151
166
    .header = theora_header,
152
 
    .gptopts = theora_gptopts
 
167
    .gptopts = theora_gptopts,
 
168
    .nb_header = 3,
153
169
};