summaryrefslogtreecommitdiff
path: root/gst/mpegpsmux
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-08-31 19:40:05 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-12-11 00:10:12 +0000
commit1f45eb7950215d890fd6919a2013f16fb7c27238 (patch)
tree1a67c2b7fe598f6d38a497a7eaf7e5aa9ab1baa8 /gst/mpegpsmux
parentf40ccb381166fc86eec1fe8003992b41a814a16c (diff)
downloadgstreamer-plugins-bad-1f45eb7950215d890fd6919a2013f16fb7c27238.tar.gz
mpegpsmux: remember whether an incoming buffer is a keyunit or not
Diffstat (limited to 'gst/mpegpsmux')
-rw-r--r--gst/mpegpsmux/mpegpsmux.c6
-rw-r--r--gst/mpegpsmux/psmuxstream.c3
-rw-r--r--gst/mpegpsmux/psmuxstream.h5
3 files changed, 11 insertions, 3 deletions
diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c
index be8e3da77..d0e31bb86 100644
--- a/gst/mpegpsmux/mpegpsmux.c
+++ b/gst/mpegpsmux/mpegpsmux.c
@@ -454,6 +454,7 @@ mpegpsmux_collected (GstCollectPads * pads, MpegPsMux * mux)
GstFlowReturn ret = GST_FLOW_OK;
MpegPsPadData *best = NULL;
+ gboolean keyunit;
GST_DEBUG_OBJECT (mux, "Pads collected");
@@ -496,9 +497,12 @@ mpegpsmux_collected (GstCollectPads * pads, MpegPsMux * mux)
G_GINT64_FORMAT, GST_TIME_ARGS (best->cur_ts), pts);
}
+ keyunit = !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
+
/* give the buffer to libpsmux for processing */
psmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf), buf, pts, -1);
+ GST_BUFFER_SIZE (buf), buf, pts, -1, keyunit);
+
best->queued_buf = NULL;
/* write the data from libpsmux to stream */
diff --git a/gst/mpegpsmux/psmuxstream.c b/gst/mpegpsmux/psmuxstream.c
index e91cc006b..a0bd38ee6 100644
--- a/gst/mpegpsmux/psmuxstream.c
+++ b/gst/mpegpsmux/psmuxstream.c
@@ -513,7 +513,7 @@ psmux_stream_write_pes_header (PsMuxStream * stream, guint8 * data)
*/
void
psmux_stream_add_data (PsMuxStream * stream, guint8 * data, guint len,
- void *user_data, gint64 pts, gint64 dts)
+ void *user_data, gint64 pts, gint64 dts, gboolean keyunit)
{
PsMuxStreamBuffer *packet;
@@ -524,6 +524,7 @@ psmux_stream_add_data (PsMuxStream * stream, guint8 * data, guint len,
packet->size = len;
packet->user_data = user_data;
+ packet->keyunit = keyunit;
packet->pts = pts;
packet->dts = dts;
diff --git a/gst/mpegpsmux/psmuxstream.h b/gst/mpegpsmux/psmuxstream.h
index 9860e6230..ff4c2892b 100644
--- a/gst/mpegpsmux/psmuxstream.h
+++ b/gst/mpegpsmux/psmuxstream.h
@@ -86,6 +86,8 @@ struct PsMuxStreamBuffer
guint8 *data;
guint32 size;
+ gboolean keyunit;
+
/* PTS & DTS associated with the contents of this buffer */
GstClockTime pts;
GstClockTime dts;
@@ -146,7 +148,8 @@ void psmux_stream_set_buffer_release_func (PsMuxStream *stream,
/* Add a new buffer to the pool of available bytes. If pts or dts are not -1, they
* indicate the PTS or DTS of the first access unit within this packet */
void psmux_stream_add_data (PsMuxStream *stream, guint8 *data, guint len,
- void *user_data, gint64 pts, gint64 dts);
+ void *user_data, gint64 pts, gint64 dts,
+ gboolean keyunit);
/* total bytes in buffer */
gint psmux_stream_bytes_in_buffer (PsMuxStream *stream);