comparison libmpdemux/muxer_lavf.c @ 19073:8b52dad54b1d

Remove #if LIBAVCODEC_BUILD >= XXX and #if LIBAVFORMAT_BUILD >= XXX jungle. It served no apparent purpose anymore.
author diego
date Thu, 13 Jul 2006 23:02:03 +0000
parents ebf5efd78cb6
children d4d72e5eea07
comparison
equal deleted inserted replaced
19072:e6f5f7c26166 19073:8b52dad54b1d
156 mp_msg(MSGT_MUXER, MSGL_ERR, "Could not alloc avstream, EXIT\n"); 156 mp_msg(MSGT_MUXER, MSGL_ERR, "Could not alloc avstream, EXIT\n");
157 return NULL; 157 return NULL;
158 } 158 }
159 spriv->avstream->stream_copy = 1; 159 spriv->avstream->stream_copy = 1;
160 160
161 #if LIBAVFORMAT_BUILD >= 4629
162 ctx = spriv->avstream->codec; 161 ctx = spriv->avstream->codec;
163 #else
164 ctx = &(spriv->avstream->codec);
165 #endif
166 ctx->codec_id = muxer->avih.dwStreams; 162 ctx->codec_id = muxer->avih.dwStreams;
167 switch(type) 163 switch(type)
168 { 164 {
169 case MUXER_TYPE_VIDEO: 165 case MUXER_TYPE_VIDEO:
170 ctx->codec_type = CODEC_TYPE_VIDEO; 166 ctx->codec_type = CODEC_TYPE_VIDEO;
185 static void fix_parameters(muxer_stream_t *stream) 181 static void fix_parameters(muxer_stream_t *stream)
186 { 182 {
187 muxer_stream_priv_t *spriv = (muxer_stream_priv_t *) stream->priv; 183 muxer_stream_priv_t *spriv = (muxer_stream_priv_t *) stream->priv;
188 AVCodecContext *ctx; 184 AVCodecContext *ctx;
189 185
190 #if LIBAVFORMAT_BUILD >= 4629
191 ctx = spriv->avstream->codec; 186 ctx = spriv->avstream->codec;
192 #else 187
193 ctx = &(spriv->avstream->codec);
194 #endif
195
196 if(stream->wf && stream->wf->nAvgBytesPerSec) 188 if(stream->wf && stream->wf->nAvgBytesPerSec)
197 ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8; 189 ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
198 ctx->rc_buffer_size= stream->vbv_size; 190 ctx->rc_buffer_size= stream->vbv_size;
199 ctx->rc_max_rate= stream->max_rate; 191 ctx->rc_max_rate= stream->max_rate;
200 192
234 ctx->codec_tag= stream->bih->biCompression; 226 ctx->codec_tag= stream->bih->biCompression;
235 mp_msg(MSGT_MUXER, MSGL_INFO, "VIDEO CODEC ID: %d\n", ctx->codec_id); 227 mp_msg(MSGT_MUXER, MSGL_INFO, "VIDEO CODEC ID: %d\n", ctx->codec_id);
236 ctx->width = stream->bih->biWidth; 228 ctx->width = stream->bih->biWidth;
237 ctx->height = stream->bih->biHeight; 229 ctx->height = stream->bih->biHeight;
238 ctx->bit_rate = 800000; 230 ctx->bit_rate = 800000;
239 #if (LIBAVFORMAT_BUILD >= 4624)
240 ctx->time_base.den = stream->h.dwRate; 231 ctx->time_base.den = stream->h.dwRate;
241 ctx->time_base.num = stream->h.dwScale; 232 ctx->time_base.num = stream->h.dwScale;
242 #else
243 ctx->frame_rate = stream->h.dwRate;
244 ctx->frame_rate_base = stream->h.dwScale;
245 #endif
246 if(stream->bih+1 && (stream->bih->biSize > sizeof(BITMAPINFOHEADER))) 233 if(stream->bih+1 && (stream->bih->biSize > sizeof(BITMAPINFOHEADER)))
247 { 234 {
248 ctx->extradata = av_malloc(stream->bih->biSize - sizeof(BITMAPINFOHEADER)); 235 ctx->extradata = av_malloc(stream->bih->biSize - sizeof(BITMAPINFOHEADER));
249 if(ctx->extradata != NULL) 236 if(ctx->extradata != NULL)
250 { 237 {
277 else 264 else
278 pkt.flags = 0; 265 pkt.flags = 0;
279 266
280 267
281 //pkt.pts = AV_NOPTS_VALUE; 268 //pkt.pts = AV_NOPTS_VALUE;
282 #if LIBAVFORMAT_BUILD >= 4624
283 pkt.pts = (stream->timer / av_q2d(priv->oc->streams[pkt.stream_index]->time_base) + 0.5); 269 pkt.pts = (stream->timer / av_q2d(priv->oc->streams[pkt.stream_index]->time_base) + 0.5);
284 #else
285 pkt.pts = AV_TIME_BASE * stream->timer;
286 #endif
287 //fprintf(stderr, "%Ld %Ld id:%d tb:%f %f\n", pkt.dts, pkt.pts, pkt.stream_index, av_q2d(priv->oc->streams[pkt.stream_index]->time_base), stream->timer); 270 //fprintf(stderr, "%Ld %Ld id:%d tb:%f %f\n", pkt.dts, pkt.pts, pkt.stream_index, av_q2d(priv->oc->streams[pkt.stream_index]->time_base), stream->timer);
288 271
289 if(av_interleaved_write_frame(priv->oc, &pkt) != 0) //av_write_frame(priv->oc, &pkt) 272 if(av_interleaved_write_frame(priv->oc, &pkt) != 0) //av_write_frame(priv->oc, &pkt)
290 { 273 {
291 mp_msg(MSGT_MUXER, MSGL_ERR, "Error while writing frame\n"); 274 mp_msg(MSGT_MUXER, MSGL_ERR, "Error while writing frame\n");