[FFmpeg-cvslog] r18910 - trunk/libavformat/mpegtsenc.c
bcoudurier
subversion
Sat May 23 08:25:44 CEST 2009
Author: bcoudurier
Date: Sat May 23 08:25:44 2009
New Revision: 18910
Log:
simplify pes timestamps fetching, based on a patch by corp186, chasedouglas at gmail dot com
Modified:
trunk/libavformat/mpegtsenc.c
Modified: trunk/libavformat/mpegtsenc.c
==============================================================================
--- trunk/libavformat/mpegtsenc.c Sat May 23 08:09:16 2009 (r18909)
+++ trunk/libavformat/mpegtsenc.c Sat May 23 08:25:44 2009 (r18910)
@@ -701,7 +701,6 @@ static int mpegts_write_packet(AVFormatC
uint8_t *buf= pkt->data;
uint8_t *data= NULL;
MpegTSWriteStream *ts_st = st->priv_data;
- const uint8_t *access_unit_index = NULL;
const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
@@ -732,14 +731,6 @@ static int mpegts_write_packet(AVFormatC
buf = data;
size = pkt->size+6;
}
- access_unit_index = buf;
- } else {
- access_unit_index = pkt->data;
- }
-
- if (!access_unit_index) {
- av_log(s, AV_LOG_ERROR, "error, could not find access unit start\n");
- return -1;
}
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE ||
@@ -750,6 +741,11 @@ static int mpegts_write_packet(AVFormatC
return 0;
}
+ if (ts_st->payload_pts == AV_NOPTS_VALUE) {
+ ts_st->payload_dts = dts;
+ ts_st->payload_pts = pts;
+ }
+
// audio
while (size > 0) {
len = DEFAULT_PES_PAYLOAD_SIZE - ts_st->payload_index;
@@ -759,19 +755,12 @@ static int mpegts_write_packet(AVFormatC
buf += len;
size -= len;
ts_st->payload_index += len;
- if (access_unit_index && access_unit_index < buf &&
- ts_st->payload_pts == AV_NOPTS_VALUE &&
- ts_st->payload_dts == AV_NOPTS_VALUE) {
- ts_st->payload_dts = dts;
- ts_st->payload_pts = pts;
- }
if (ts_st->payload_index >= DEFAULT_PES_PAYLOAD_SIZE) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,
ts_st->payload_pts, ts_st->payload_dts);
ts_st->payload_pts = AV_NOPTS_VALUE;
ts_st->payload_dts = AV_NOPTS_VALUE;
ts_st->payload_index = 0;
- access_unit_index = NULL; // unset access unit to avoid setting pts/dts again
}
}
More information about the ffmpeg-cvslog
mailing list