summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-05-29 18:50:31 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-05-29 18:50:31 +0000
commit3c895fc098f7637f6d5ec3a9d6766e724a8b9e41 (patch)
tree712ed6644fa0f4e5d9b6201048c320d5208eabe8 /libavformat/mpeg.c
parent575181556259ca3a69a17a544a0ab3b45c4fec61 (diff)
correctly interleave packets during encoding
dts/pts fixed for streamcopy dont use coded_frame->key_frame hack in muxers, use AVPacket.flags instead Originally committed as revision 3171 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r--libavformat/mpeg.c50
1 files changed, 1 insertions, 49 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index ffe19ea6ec..03505af2f3 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -803,51 +803,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
s->packet_number++;
}
-/* XXX: move that to upper layer */
-/* XXX: we assume that there are always 'max_b_frames' between
- reference frames. A better solution would be to use the AVFrame pts
- field */
-static void compute_pts_dts(AVStream *st, int64_t *ppts, int64_t *pdts,
- int64_t timestamp)
-{
- int frame_delay;
- int64_t pts, dts;
-
- if (st->codec.codec_type == CODEC_TYPE_VIDEO &&
- st->codec.max_b_frames != 0) {
- frame_delay = (st->codec.frame_rate_base * 90000LL) /
- st->codec.frame_rate;
- if (timestamp == 0) {
- /* specific case for first frame : DTS just before */
- pts = timestamp;
- dts = timestamp - frame_delay;
- } else {
- timestamp -= frame_delay;
- if (st->codec.coded_frame->pict_type == FF_B_TYPE) {
- /* B frames has identical pts/dts */
- pts = timestamp;
- dts = timestamp;
- } else {
- /* a reference frame has a pts equal to the dts of the
- _next_ one */
- dts = timestamp;
- pts = timestamp + (st->codec.max_b_frames + 1) * frame_delay;
- }
- }
-#if 1
- av_log(&st->codec, AV_LOG_DEBUG, "pts=%0.3f dts=%0.3f pict_type=%c\n",
- pts / 90000.0, dts / 90000.0,
- av_get_pict_type_char(st->codec.coded_frame->pict_type));
-#endif
- } else {
- pts = timestamp;
- dts = timestamp;
- }
-
- *ppts = pts & ((1LL << 33) - 1);
- *pdts = dts & ((1LL << 33) - 1);
-}
-
static int64_t update_scr(AVFormatContext *ctx,int stream_index,int64_t pts)
{
MpegMuxContext *s = ctx->priv_data;
@@ -923,9 +878,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
int64_t pts, dts, new_start_pts, new_start_dts;
int len, avail_size;
- //XXX/FIXME this is and always was broken
-// compute_pts_dts(st, &pts, &dts, pkt->pts);
-
pts= pkt->pts;
dts= pkt->dts;
@@ -1395,7 +1347,7 @@ static int mpegps_read_packet(AVFormatContext *s,
pkt->dts = dts;
pkt->stream_index = st->index;
#if 0
- printf("%d: pts=%0.3f dts=%0.3f\n",
+ av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f\n",
pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0);
#endif
return 0;