Commit c1a2ec1f authored by bcoudurier's avatar bcoudurier

ensure first pts is set, according to specs

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18781 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 1aca47af
...@@ -173,6 +173,7 @@ typedef struct MpegTSWriteStream { ...@@ -173,6 +173,7 @@ typedef struct MpegTSWriteStream {
int pid; /* stream associated pid */ int pid; /* stream associated pid */
int cc; int cc;
int payload_index; int payload_index;
int first_pts_check; ///< first pts check needed
int64_t payload_pts; int64_t payload_pts;
int64_t payload_dts; int64_t payload_dts;
uint8_t payload[DEFAULT_PES_PAYLOAD_SIZE]; uint8_t payload[DEFAULT_PES_PAYLOAD_SIZE];
...@@ -419,6 +420,7 @@ static int mpegts_write_header(AVFormatContext *s) ...@@ -419,6 +420,7 @@ static int mpegts_write_header(AVFormatContext *s)
ts_st->pid = DEFAULT_START_PID + i; ts_st->pid = DEFAULT_START_PID + i;
ts_st->payload_pts = AV_NOPTS_VALUE; ts_st->payload_pts = AV_NOPTS_VALUE;
ts_st->payload_dts = AV_NOPTS_VALUE; ts_st->payload_dts = AV_NOPTS_VALUE;
ts_st->first_pts_check = 1;
/* update PCR pid by using the first video stream */ /* update PCR pid by using the first video stream */
if (st->codec->codec_type == CODEC_TYPE_VIDEO && if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
service->pcr_pid == 0x1fff) service->pcr_pid == 0x1fff)
...@@ -701,6 +703,12 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -701,6 +703,12 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (pkt->dts != AV_NOPTS_VALUE) if (pkt->dts != AV_NOPTS_VALUE)
dts = pkt->dts + delay; dts = pkt->dts + delay;
if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_ERROR, "first pts value must set\n");
return -1;
}
ts_st->first_pts_check = 0;
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) { if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
/* for subtitle, a single PES packet must be generated */ /* for subtitle, a single PES packet must be generated */
mpegts_write_pes(s, st, buf, size, pts, AV_NOPTS_VALUE); mpegts_write_pes(s, st, buf, size, pts, AV_NOPTS_VALUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment