[Ffmpeg-cvslog] r7982 - trunk/libavformat/gxfenc.c
bcoudurier
subversion
Wed Feb 14 15:54:21 CET 2007
Author: bcoudurier
Date: Wed Feb 14 15:54:20 2007
New Revision: 7982
Modified:
trunk/libavformat/gxfenc.c
Log:
fix dts adjusting
Modified: trunk/libavformat/gxfenc.c
==============================================================================
--- trunk/libavformat/gxfenc.c (original)
+++ trunk/libavformat/gxfenc.c Wed Feb 14 15:54:20 2007
@@ -572,6 +572,8 @@
return updatePacketSize(pb, pos);
}
+#define GXF_NODELAY -5000
+
static int gxf_write_header(AVFormatContext *s)
{
ByteIOContext *pb = &s->pb;
@@ -623,7 +625,8 @@
gxf->flags |= 0x00000040;
}
gxf->sample_rate = sc->sample_rate;
- av_set_pts_info(st, 64, 1, sc->sample_rate);
+ av_set_pts_info(st, 64, 1, st->codec->time_base.den);
+ sc->dts_delay = GXF_NODELAY;
if (gxf_find_lines_index(sc) < 0)
sc->lines_index = -1;
sc->sample_size = st->codec->bit_rate;
@@ -707,7 +710,7 @@
static int gxf_write_media_preamble(ByteIOContext *pb, GXFContext *ctx, AVPacket *pkt, int size)
{
GXFStreamContext *sc = &ctx->streams[pkt->stream_index];
- int64_t dts = av_rescale(pkt->dts, ctx->sample_rate, sc->sample_rate);
+ int64_t dts = av_rescale(pkt->dts, ctx->sample_rate, sc->codec->time_base.den);
put_byte(pb, sc->media_type);
put_byte(pb, sc->index);
@@ -799,13 +802,9 @@
break; /* add pkt right now into list */
}
}
- } else if (pkt) {
- /* adjust dts if negative */
- if (pkt->dts < 0 && !sc->dts_delay) {
- /* XXX: rescale if codec time base is different from stream time base */
- sc->dts_delay = av_rescale_q(pkt->dts, st->codec->time_base, st->time_base);
- pkt->dts = sc->dts_delay; /* set to 0 */
- }
+ } else if (pkt && pkt->stream_index == i) {
+ if (sc->dts_delay == GXF_NODELAY) /* adjust dts if needed */
+ sc->dts_delay = pkt->dts;
pkt->dts -= sc->dts_delay;
}
}
More information about the ffmpeg-cvslog
mailing list