summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-06-05 18:03:10 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-06-06 10:32:05 +0200
commit4cc905409e0b76e19fefe316c386597e393cfaad (patch)
tree35280ad21306fe5d62a89993ac96857cedae9eab
parent38bb55c472233174f6c1beb5e4977f06f78d0a17 (diff)
mpegtsmux: more header clarifications and remove some redundant fields
-rw-r--r--gst/mpegtsmux/tsmux/tsmux.c6
-rw-r--r--gst/mpegtsmux/tsmux/tsmux.h38
-rw-r--r--gst/mpegtsmux/tsmux/tsmuxcommon.h20
-rw-r--r--gst/mpegtsmux/tsmux/tsmuxstream.c6
-rw-r--r--gst/mpegtsmux/tsmux/tsmuxstream.h28
5 files changed, 67 insertions, 31 deletions
diff --git a/gst/mpegtsmux/tsmux/tsmux.c b/gst/mpegtsmux/tsmux/tsmux.c
index 838c48a0c..a3d8af404 100644
--- a/gst/mpegtsmux/tsmux/tsmux.c
+++ b/gst/mpegtsmux/tsmux/tsmux.c
@@ -253,7 +253,6 @@ tsmux_program_new (TsMux * mux)
program->pgm_number = mux->next_pgm_no++;
program->pmt_pid = mux->next_pmt_pid++;
program->pcr_stream = NULL;
- program->last_pcr = -1;
program->streams = g_array_sized_new (FALSE, TRUE, sizeof (TsMuxStream *), 1);
@@ -312,7 +311,6 @@ tsmux_program_add_stream (TsMuxProgram * program, TsMuxStream * stream)
g_return_if_fail (program != NULL);
g_return_if_fail (stream != NULL);
- program->nb_streams++;
g_array_append_val (program->streams, stream);
program->pmt_changed = TRUE;
}
@@ -1005,7 +1003,7 @@ tsmux_write_pmt (TsMux * mux, TsMuxProgram * program)
tsmux_put16 (&pos, 0xFCFC);
/* Write out the entries */
- for (i = 0; i < program->nb_streams; i++) {
+ for (i = 0; i < program->streams->len; i++) {
TsMuxStream *stream = g_array_index (program->streams, TsMuxStream *, i);
guint16 es_info_len;
@@ -1043,7 +1041,7 @@ tsmux_write_pmt (TsMux * mux, TsMuxProgram * program)
tsmux_put32 (&pos, crc);
TS_DEBUG ("PMT for program %d has %d streams, is %u bytes",
- program->pgm_number, program->nb_streams, pmt->pi.stream_avail);
+ program->pgm_number, program->streams->len, pmt->pi.stream_avail);
pmt->pi.pid = program->pmt_pid;
program->pmt_changed = FALSE;
diff --git a/gst/mpegtsmux/tsmux/tsmux.h b/gst/mpegtsmux/tsmux/tsmux.h
index 6c24ecc91..175e173ad 100644
--- a/gst/mpegtsmux/tsmux/tsmux.h
+++ b/gst/mpegtsmux/tsmux/tsmux.h
@@ -111,47 +111,61 @@ struct TsMuxSection {
/* Information for the streams associated with one program */
struct TsMuxProgram {
TsMuxSection pmt;
+ /* PMT version */
guint8 pmt_version;
+ /* trigger for writing PMT */
gboolean pmt_changed;
+ /* interval between PMT in MPEG PTS clock time */
guint pmt_interval;
+ /* last time PMT written in MPEG PTS clock time */
gint64 last_pmt_ts;
- guint16 pgm_number; /* program ID for the PAT */
- guint16 pmt_pid; /* PID to write the PMT */
+ /* program ID for the PAT */
+ guint16 pgm_number;
+ /* PID to write the PMT */
+ guint16 pmt_pid;
- TsMuxStream *pcr_stream; /* Stream which carries the PCR */
- gint64 last_pcr;
+ /* stream which carries the PCR */
+ TsMuxStream *pcr_stream;
- GArray *streams; /* Array of TsMuxStream pointers */
- guint nb_streams;
+ /* programs TsMuxStream's */
+ GArray *streams;
};
struct TsMux {
+ /* TsMuxStream* array of all streams */
guint nb_streams;
- GList *streams; /* TsMuxStream* array of all streams */
+ GList *streams;
+ /* TsMuxProgram* array of all programs */
guint nb_programs;
- GList *programs; /* TsMuxProgram* array of all programs */
-
- guint16 transport_id;
+ GList *programs;
+ /* next auto-generated misc id */
guint16 next_pgm_no;
guint16 next_pmt_pid;
guint16 next_stream_pid;
TsMuxSection pat;
+ /* PAT transport_stream_id */
+ guint16 transport_id;
+ /* PAT version */
guint8 pat_version;
+ /* trigger writing PAT */
gboolean pat_changed;
-
+ /* interval between PAT in MPEG PTS clock time */
guint pat_interval;
+ /* last time PAT written in MPEG PTS clock time */
gint64 last_pat_ts;
+ /* temp packet buffer */
guint8 packet_buf[TSMUX_PACKET_LENGTH];
+ /* callback to write finished packet */
TsMuxWriteFunc write_func;
void *write_func_data;
- /* Scratch space for writing ES_info descriptors */
+ /* scratch space for writing ES_info descriptors */
guint8 es_info_buf[TSMUX_MAX_ES_INFO_LENGTH];
gint64 new_pcr;
};
diff --git a/gst/mpegtsmux/tsmux/tsmuxcommon.h b/gst/mpegtsmux/tsmux/tsmuxcommon.h
index 9657b30c8..88d3a49b7 100644
--- a/gst/mpegtsmux/tsmux/tsmuxcommon.h
+++ b/gst/mpegtsmux/tsmux/tsmuxcommon.h
@@ -127,18 +127,26 @@ struct TsMuxPacketInfo {
guint16 pid;
guint32 flags;
+ gboolean packet_start_unit_indicator;
+
+ /* continuity counter */
+ guint8 packet_count;
+
+ /* payload bytes available
+ * (including PES header if applicable) */
+ guint stream_avail;
+
+ /* optional PCR */
guint64 pcr;
+
+ /* following not really actively used */
+
guint64 opcr;
guint8 splice_countdown;
guint8 private_data_len;
- guint8 private_data [256];
-
- guint8 packet_count; /* continuity counter */
-
- guint stream_avail; /* Number of payload bytes available */
- gboolean packet_start_unit_indicator;
+ guint8 private_data[256];
};
static inline void
diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.c b/gst/mpegtsmux/tsmux/tsmuxstream.c
index 77a6133ae..ac2b7b9cf 100644
--- a/gst/mpegtsmux/tsmux/tsmuxstream.c
+++ b/gst/mpegtsmux/tsmux/tsmuxstream.c
@@ -102,8 +102,10 @@ struct TsMuxStreamBuffer
gint64 pts;
gint64 dts;
+ /* data represents random access point */
gboolean random_access;
+ /* user_data for release function */
void *user_data;
};
@@ -178,8 +180,8 @@ tsmux_stream_new (guint16 pid, TsMuxStreamType stream_type)
break;
}
- stream->last_pts = -1;
- stream->last_dts = -1;
+// stream->last_pts = -1;
+// stream->last_dts = -1;
stream->pcr_ref = 0;
stream->last_pcr = -1;
diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.h b/gst/mpegtsmux/tsmux/tsmuxstream.h
index 47ad842e9..fb87a1349 100644
--- a/gst/mpegtsmux/tsmux/tsmuxstream.h
+++ b/gst/mpegtsmux/tsmux/tsmuxstream.h
@@ -149,41 +149,55 @@ enum TsMuxStreamState {
TSMUX_STREAM_STATE_PACKET
};
-/* TsMuxStream receives elementary streams for parsing.
- * Via the write_bytes() method, it can output a PES stream piecemeal */
+/* TsMuxStream receives elementary streams for parsing */
struct TsMuxStream {
TsMuxStreamState state;
TsMuxPacketInfo pi;
TsMuxStreamType stream_type;
- guint8 id; /* stream id */
- guint8 id_extended; /* extended stream id (13818-1 Amdt 2) */
+
+ /* stream_id (13818-1) */
+ guint8 id;
+ /* extended stream id (13818-1 Amdt 2) */
+ guint8 id_extended;
gboolean is_video_stream;
- /* List of data buffers available for writing out */
+ /* data available for writing out
+ * and total sum of sizes */
GList *buffers;
guint32 bytes_avail;
- /* Current data buffer being consumed */
+ /* current data buffer being consumed
+ * and amount already consumed */
TsMuxStreamBuffer *cur_buffer;
guint32 cur_buffer_consumed;
+ /* helper to release collected buffers */
TsMuxStreamBufferReleaseFunc buffer_release;
+ /* optional fixed PES size for stream type */
guint16 pes_payload_size;
+ /* current PES payload size being written */
guint16 cur_pes_payload_size;
+ /* ... of which already this much written */
guint16 pes_bytes_written;
/* PTS/DTS to write if the flags in the packet info are set */
+ /* in MPEG PTS clock time */
gint64 pts;
gint64 dts;
- gint64 last_pts;
+ /* last ts written, or maybe next one ... ?! */
gint64 last_dts;
+ gint64 last_pts;
+ /* count of programs using this as PCR */
gint pcr_ref;
+ /* last time PCR written */
gint64 last_pcr;
+ /* audio parameters for stream
+ * (used in stream descriptor) */
gint audio_sampling;
gint audio_channels;
gint audio_bitrate;