Revision 01f4895c libavformat/sierravmd.c

View differences:

libavformat/sierravmd.c
131 131
        return AVERROR_NOMEM;
132 132
    av_set_pts_info(st, 33, 1, 90000);
133 133
    vmd->video_stream_index = st->index;
134
    st->codec.codec_type = CODEC_TYPE_VIDEO;
135
    st->codec.codec_id = CODEC_ID_VMDVIDEO;
136
    st->codec.codec_tag = 0;  /* no fourcc */
137
    st->codec.width = LE_16(&vmd->vmd_header[12]);
138
    st->codec.height = LE_16(&vmd->vmd_header[14]);
139
    st->codec.extradata_size = VMD_HEADER_SIZE;
140
    st->codec.extradata = av_malloc(VMD_HEADER_SIZE);
141
    memcpy(st->codec.extradata, vmd->vmd_header, VMD_HEADER_SIZE);
134
    st->codec->codec_type = CODEC_TYPE_VIDEO;
135
    st->codec->codec_id = CODEC_ID_VMDVIDEO;
136
    st->codec->codec_tag = 0;  /* no fourcc */
137
    st->codec->width = LE_16(&vmd->vmd_header[12]);
138
    st->codec->height = LE_16(&vmd->vmd_header[14]);
139
    st->codec->extradata_size = VMD_HEADER_SIZE;
140
    st->codec->extradata = av_malloc(VMD_HEADER_SIZE);
141
    memcpy(st->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE);
142 142

  
143 143
    /* if sample rate is 0, assume no audio */
144 144
    vmd->sample_rate = LE_16(&vmd->vmd_header[804]);
......
148 148
            return AVERROR_NOMEM;
149 149
        av_set_pts_info(st, 33, 1, 90000);
150 150
        vmd->audio_stream_index = st->index;
151
        st->codec.codec_type = CODEC_TYPE_AUDIO;
152
        st->codec.codec_id = CODEC_ID_VMDAUDIO;
153
        st->codec.codec_tag = 0;  /* no codec tag */
154
        st->codec.channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
155
        st->codec.sample_rate = vmd->sample_rate;
156
        st->codec.block_align = vmd->audio_block_align = 
151
        st->codec->codec_type = CODEC_TYPE_AUDIO;
152
        st->codec->codec_id = CODEC_ID_VMDAUDIO;
153
        st->codec->codec_tag = 0;  /* no codec tag */
154
        st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
155
        st->codec->sample_rate = vmd->sample_rate;
156
        st->codec->block_align = vmd->audio_block_align = 
157 157
            LE_16(&vmd->vmd_header[806]);
158
        if (st->codec.block_align & 0x8000) {
159
            st->codec.bits_per_sample = 16;
160
            st->codec.block_align = -(st->codec.block_align - 0x10000);
158
        if (st->codec->block_align & 0x8000) {
159
            st->codec->bits_per_sample = 16;
160
            st->codec->block_align = -(st->codec->block_align - 0x10000);
161 161
        } else
162
            st->codec.bits_per_sample = 16;
163
//            st->codec.bits_per_sample = 8;
164
        st->codec.bit_rate = st->codec.sample_rate * 
165
            st->codec.bits_per_sample * st->codec.channels;
162
            st->codec->bits_per_sample = 16;
163
//            st->codec->bits_per_sample = 8;
164
        st->codec->bit_rate = st->codec->sample_rate * 
165
            st->codec->bits_per_sample * st->codec->channels;
166 166

  
167 167
        /* for calculating pts */
168
        vmd->audio_frame_divisor = st->codec.bits_per_sample / 8 / 
169
            st->codec.channels;
168
        vmd->audio_frame_divisor = st->codec->bits_per_sample / 8 / 
169
            st->codec->channels;
170 170

  
171 171
        video_pts_inc = 90000;
172
        video_pts_inc *= st->codec.block_align;
173
        video_pts_inc /= st->codec.sample_rate;
172
        video_pts_inc *= st->codec->block_align;
173
        video_pts_inc /= st->codec->sample_rate;
174 174
    } else {
175 175
        /* if no audio, assume 10 frames/second */
176 176
        video_pts_inc = 90000 / 10;

Also available in: Unified diff