1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

mpegts: rename payload_index to payload_size

It holds the size of the current payload.
This commit is contained in:
Luca Barbato 2011-12-17 14:08:11 +01:00
parent 02e8f03296
commit 1c66862472

View File

@ -201,7 +201,7 @@ typedef struct MpegTSWriteStream {
struct MpegTSService *service; struct MpegTSService *service;
int pid; /* stream associated pid */ int pid; /* stream associated pid */
int cc; int cc;
int payload_index; int payload_size;
int first_pts_check; ///< first pts check needed int first_pts_check; ///< first pts check needed
int64_t payload_pts; int64_t payload_pts;
int64_t payload_dts; int64_t payload_dts;
@ -1006,21 +1006,21 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
} }
if (ts_st->payload_index + size > DEFAULT_PES_PAYLOAD_SIZE) { if (ts_st->payload_size + size > DEFAULT_PES_PAYLOAD_SIZE) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
ts_st->payload_pts, ts_st->payload_dts, ts_st->payload_pts, ts_st->payload_dts,
ts_st->payload_flags & AV_PKT_FLAG_KEY); ts_st->payload_flags & AV_PKT_FLAG_KEY);
ts_st->payload_index = 0; ts_st->payload_size = 0;
} }
if (!ts_st->payload_index) { if (!ts_st->payload_size) {
ts_st->payload_pts = pts; ts_st->payload_pts = pts;
ts_st->payload_dts = dts; ts_st->payload_dts = dts;
ts_st->payload_flags = pkt->flags; ts_st->payload_flags = pkt->flags;
} }
memcpy(ts_st->payload + ts_st->payload_index, buf, size); memcpy(ts_st->payload + ts_st->payload_size, buf, size);
ts_st->payload_index += size; ts_st->payload_size += size;
av_free(data); av_free(data);
@ -1039,8 +1039,8 @@ static int mpegts_write_end(AVFormatContext *s)
for(i = 0; i < s->nb_streams; i++) { for(i = 0; i < s->nb_streams; i++) {
st = s->streams[i]; st = s->streams[i];
ts_st = st->priv_data; ts_st = st->priv_data;
if (ts_st->payload_index > 0) { if (ts_st->payload_size > 0) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
ts_st->payload_pts, ts_st->payload_dts, ts_st->payload_pts, ts_st->payload_dts,
ts_st->payload_flags & AV_PKT_FLAG_KEY); ts_st->payload_flags & AV_PKT_FLAG_KEY);
} }