comparison libmpdemux/demux_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 83c3afeab35d
children ccb42ce33c23
comparison
equal deleted inserted replaced
19072:e6f5f7c26166 19073:8b52dad54b1d
176 // if(avfc->track ) demux_info_add(demuxer, "track" , avfc->track ); 176 // if(avfc->track ) demux_info_add(demuxer, "track" , avfc->track );
177 if(avfc->genre [0]) demux_info_add(demuxer, "genre" , avfc->genre ); 177 if(avfc->genre [0]) demux_info_add(demuxer, "genre" , avfc->genre );
178 178
179 for(i=0; i<avfc->nb_streams; i++){ 179 for(i=0; i<avfc->nb_streams; i++){
180 AVStream *st= avfc->streams[i]; 180 AVStream *st= avfc->streams[i];
181 #if LIBAVFORMAT_BUILD >= 4629
182 AVCodecContext *codec= st->codec; 181 AVCodecContext *codec= st->codec;
183 #else 182
184 AVCodecContext *codec= &st->codec;
185 #endif
186
187 switch(codec->codec_type){ 183 switch(codec->codec_type){
188 case CODEC_TYPE_AUDIO:{ 184 case CODEC_TYPE_AUDIO:{
189 WAVEFORMATEX *wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); 185 WAVEFORMATEX *wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1);
190 sh_audio_t* sh_audio; 186 sh_audio_t* sh_audio;
191 if(priv->audio_streams >= MAX_A_STREAMS) 187 if(priv->audio_streams >= MAX_A_STREAMS)
274 sh_video->disp_h= codec->height; 270 sh_video->disp_h= codec->height;
275 if (st->time_base.den) { /* if container has time_base, use that */ 271 if (st->time_base.den) { /* if container has time_base, use that */
276 sh_video->video.dwRate= st->time_base.den; 272 sh_video->video.dwRate= st->time_base.den;
277 sh_video->video.dwScale= st->time_base.num; 273 sh_video->video.dwScale= st->time_base.num;
278 } else { 274 } else {
279 #if LIBAVFORMAT_BUILD >= 4624
280 sh_video->video.dwRate= codec->time_base.den; 275 sh_video->video.dwRate= codec->time_base.den;
281 sh_video->video.dwScale= codec->time_base.num; 276 sh_video->video.dwScale= codec->time_base.num;
282 #else
283 sh_video->video.dwRate= codec->frame_rate;
284 sh_video->video.dwScale= codec->frame_rate_base;
285 #endif
286 } 277 }
287 sh_video->fps=av_q2d(st->r_frame_rate); 278 sh_video->fps=av_q2d(st->r_frame_rate);
288 sh_video->frametime=1/av_q2d(st->r_frame_rate); 279 sh_video->frametime=1/av_q2d(st->r_frame_rate);
289 sh_video->format = bih->biCompression; 280 sh_video->format = bih->biCompression;
290 sh_video->aspect= codec->width * codec->sample_aspect_ratio.num 281 sh_video->aspect= codec->width * codec->sample_aspect_ratio.num
378 memcpy(dp->buffer, pkt.data, pkt.size); 369 memcpy(dp->buffer, pkt.data, pkt.size);
379 av_free_packet(&pkt); 370 av_free_packet(&pkt);
380 } 371 }
381 372
382 if(pkt.pts != AV_NOPTS_VALUE){ 373 if(pkt.pts != AV_NOPTS_VALUE){
383 #if LIBAVFORMAT_BUILD >= 4624
384 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); 374 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base);
385 priv->last_pts= dp->pts * AV_TIME_BASE; 375 priv->last_pts= dp->pts * AV_TIME_BASE;
386 #else
387 priv->last_pts= pkt.pts;
388 dp->pts=pkt.pts / (float)AV_TIME_BASE;
389 #endif
390 } 376 }
391 dp->pos=demux->filepos; 377 dp->pos=demux->filepos;
392 dp->flags= !!(pkt.flags&PKT_FLAG_KEY); 378 dp->flags= !!(pkt.flags&PKT_FLAG_KEY);
393 // append packet to DS stream: 379 // append packet to DS stream:
394 ds_add_packet(ds,dp); 380 ds_add_packet(ds,dp);
396 } 382 }
397 383
398 static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags){ 384 static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags){
399 lavf_priv_t *priv = demuxer->priv; 385 lavf_priv_t *priv = demuxer->priv;
400 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags); 386 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags);
401 387
402 #if LIBAVFORMAT_BUILD < 4619
403 av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE);
404 #else
405 av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE, rel_seek_secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); 388 av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE, rel_seek_secs < 0 ? AVSEEK_FLAG_BACKWARD : 0);
406 #endif
407 } 389 }
408 390
409 static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg) 391 static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
410 { 392 {
411 lavf_priv_t *priv = demuxer->priv; 393 lavf_priv_t *priv = demuxer->priv;