comparison libmpdemux/demux_lavf.c @ 37194:d773c8901dd8

demux_lavf: set stream_pts if possible.
author reimar
date Sun, 28 Sep 2014 12:21:42 +0000
parents 917a3c4c2d39
children
comparison
equal deleted inserted replaced
37193:82a15e343f94 37194:d773c8901dd8
638 lavf_priv_t *priv= demux->priv; 638 lavf_priv_t *priv= demux->priv;
639 AVPacket pkt; 639 AVPacket pkt;
640 demux_packet_t *dp; 640 demux_packet_t *dp;
641 demux_stream_t *ds; 641 demux_stream_t *ds;
642 int id; 642 int id;
643 double stream_pts = MP_NOPTS_VALUE;
643 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_lavf_fill_buffer()\n"); 644 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_lavf_fill_buffer()\n");
644 645
645 demux->filepos=stream_tell(demux->stream); 646 demux->filepos=stream_tell(demux->stream);
646 647
647 if(av_read_frame(priv->avfc, &pkt) < 0) 648 if(av_read_frame(priv->avfc, &pkt) < 0)
697 if(ds == demux->sub && pkt.convergence_duration > 0) 698 if(ds == demux->sub && pkt.convergence_duration > 0)
698 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); 699 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base);
699 } 700 }
700 dp->pos=demux->filepos; 701 dp->pos=demux->filepos;
701 dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY); 702 dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY);
703 if (ds == demux->video &&
704 stream_control(demux->stream, STREAM_CTRL_GET_CURRENT_TIME, (void *)&stream_pts) != STREAM_UNSUPPORTED)
705 dp->stream_pts = stream_pts;
702 // append packet to DS stream: 706 // append packet to DS stream:
703 ds_add_packet(ds,dp); 707 ds_add_packet(ds,dp);
704 return 1; 708 return 1;
705 } 709 }
706 710