Revision 01f4895c libavformat/raw.c

View differences:

libavformat/raw.c
50 50
    if (ap) {
51 51
        id = s->iformat->value;
52 52
        if (id == CODEC_ID_RAWVIDEO) {
53
            st->codec.codec_type = CODEC_TYPE_VIDEO;
53
            st->codec->codec_type = CODEC_TYPE_VIDEO;
54 54
        } else {
55
            st->codec.codec_type = CODEC_TYPE_AUDIO;
55
            st->codec->codec_type = CODEC_TYPE_AUDIO;
56 56
        }
57
        st->codec.codec_id = id;
57
        st->codec->codec_id = id;
58 58

  
59
        switch(st->codec.codec_type) {
59
        switch(st->codec->codec_type) {
60 60
        case CODEC_TYPE_AUDIO:
61
            st->codec.sample_rate = ap->sample_rate;
62
            st->codec.channels = ap->channels;
63
            av_set_pts_info(st, 64, 1, st->codec.sample_rate);
61
            st->codec->sample_rate = ap->sample_rate;
62
            st->codec->channels = ap->channels;
63
            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
64 64
            break;
65 65
        case CODEC_TYPE_VIDEO:
66 66
            av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
67
            st->codec.width = ap->width;
68
            st->codec.height = ap->height;
69
            st->codec.pix_fmt = ap->pix_fmt;
70
            if(st->codec.pix_fmt == PIX_FMT_NONE)
71
                st->codec.pix_fmt= PIX_FMT_YUV420P;
67
            st->codec->width = ap->width;
68
            st->codec->height = ap->height;
69
            st->codec->pix_fmt = ap->pix_fmt;
70
            if(st->codec->pix_fmt == PIX_FMT_NONE)
71
                st->codec->pix_fmt= PIX_FMT_YUV420P;
72 72
            break;
73 73
        default:
74 74
            return -1;
......
133 133
    int64_t pos;
134 134

  
135 135
    st = s->streams[0];
136
    switch(st->codec.codec_id) {
136
    switch(st->codec->codec_id) {
137 137
    case CODEC_ID_PCM_S16LE:
138 138
    case CODEC_ID_PCM_S16BE:
139 139
    case CODEC_ID_PCM_U16LE:
140 140
    case CODEC_ID_PCM_U16BE:
141
        block_align = 2 * st->codec.channels;
142
        byte_rate = block_align * st->codec.sample_rate;
141
        block_align = 2 * st->codec->channels;
142
        byte_rate = block_align * st->codec->sample_rate;
143 143
        break;
144 144
    case CODEC_ID_PCM_S8:
145 145
    case CODEC_ID_PCM_U8:
146 146
    case CODEC_ID_PCM_MULAW:
147 147
    case CODEC_ID_PCM_ALAW:
148
        block_align = st->codec.channels;
149
        byte_rate = block_align * st->codec.sample_rate;
148
        block_align = st->codec->channels;
149
        byte_rate = block_align * st->codec->sample_rate;
150 150
        break;
151 151
    default:
152
        block_align = st->codec.block_align;
153
        byte_rate = st->codec.bit_rate / 8;
152
        block_align = st->codec->block_align;
153
        byte_rate = st->codec->bit_rate / 8;
154 154
        break;
155 155
    }
156 156
    
......
180 180
    if (!st)
181 181
        return AVERROR_NOMEM;
182 182

  
183
    st->codec.codec_type = CODEC_TYPE_AUDIO;
184
    st->codec.codec_id = CODEC_ID_AC3;
183
    st->codec->codec_type = CODEC_TYPE_AUDIO;
184
    st->codec->codec_id = CODEC_ID_AC3;
185 185
    st->need_parsing = 1;
186 186
    /* the parameters will be extracted from the compressed bitstream */
187 187
    return 0;
......
195 195
    st = av_new_stream(s, 0);
196 196
    if (!st)
197 197
        return AVERROR_NOMEM;
198
    st->codec.codec_type = CODEC_TYPE_AUDIO;
199
    st->codec.codec_id = CODEC_ID_SHORTEN;
198
    st->codec->codec_type = CODEC_TYPE_AUDIO;
199
    st->codec->codec_id = CODEC_ID_SHORTEN;
200 200
    st->need_parsing = 1;
201 201
    /* the parameters will be extracted from the compressed bitstream */
202 202
    return 0;
......
212 212
    if (!st)
213 213
        return AVERROR_NOMEM;
214 214

  
215
    st->codec.codec_type = CODEC_TYPE_AUDIO;
216
    st->codec.codec_id = CODEC_ID_DTS;
215
    st->codec->codec_type = CODEC_TYPE_AUDIO;
216
    st->codec->codec_id = CODEC_ID_DTS;
217 217
    st->need_parsing = 1;
218 218
    /* the parameters will be extracted from the compressed bitstream */
219 219
    return 0;
......
229 229
    if (!st)
230 230
        return AVERROR_NOMEM;
231 231

  
232
    st->codec.codec_type = CODEC_TYPE_VIDEO;
233
    st->codec.codec_id = s->iformat->value;
232
    st->codec->codec_type = CODEC_TYPE_VIDEO;
233
    st->codec->codec_id = s->iformat->value;
234 234
    st->need_parsing = 1;
235 235

  
236 236
    /* for mjpeg, specify frame rate */
237 237
    /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
238 238
    if (ap && ap->time_base.num) {
239 239
        av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
240
    } else if ( st->codec.codec_id == CODEC_ID_MJPEG || 
241
                st->codec.codec_id == CODEC_ID_MPEG4 ||
242
                st->codec.codec_id == CODEC_ID_H264) {
240
    } else if ( st->codec->codec_id == CODEC_ID_MJPEG || 
241
                st->codec->codec_id == CODEC_ID_MPEG4 ||
242
                st->codec->codec_id == CODEC_ID_H264) {
243 243
        av_set_pts_info(st, 64, 1, 25);
244 244
    }
245 245

  
......
609 609
    int packet_size, ret, width, height;
610 610
    AVStream *st = s->streams[0];
611 611

  
612
    width = st->codec.width;
613
    height = st->codec.height;
612
    width = st->codec->width;
613
    height = st->codec->height;
614 614

  
615
    packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
615
    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
616 616
    if (packet_size < 0)
617 617
        return -1;
618 618

  

Also available in: Unified diff