mpegpsmux: remember whether an incoming buffer is a keyunit or not

This commit is contained in:
Tim-Philipp Müller 2011-08-31 19:40:05 +01:00
parent f40ccb3811
commit 1f45eb7950
3 changed files with 11 additions and 3 deletions

View file

@ -454,6 +454,7 @@ mpegpsmux_collected (GstCollectPads * pads, MpegPsMux * mux)
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
MpegPsPadData *best = NULL; MpegPsPadData *best = NULL;
gboolean keyunit;
GST_DEBUG_OBJECT (mux, "Pads collected"); 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); 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 */ /* give the buffer to libpsmux for processing */
psmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf), 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; best->queued_buf = NULL;
/* write the data from libpsmux to stream */ /* write the data from libpsmux to stream */

View file

@ -513,7 +513,7 @@ psmux_stream_write_pes_header (PsMuxStream * stream, guint8 * data)
*/ */
void void
psmux_stream_add_data (PsMuxStream * stream, guint8 * data, guint len, 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; PsMuxStreamBuffer *packet;
@ -524,6 +524,7 @@ psmux_stream_add_data (PsMuxStream * stream, guint8 * data, guint len,
packet->size = len; packet->size = len;
packet->user_data = user_data; packet->user_data = user_data;
packet->keyunit = keyunit;
packet->pts = pts; packet->pts = pts;
packet->dts = dts; packet->dts = dts;

View file

@ -86,6 +86,8 @@ struct PsMuxStreamBuffer
guint8 *data; guint8 *data;
guint32 size; guint32 size;
gboolean keyunit;
/* PTS & DTS associated with the contents of this buffer */ /* PTS & DTS associated with the contents of this buffer */
GstClockTime pts; GstClockTime pts;
GstClockTime dts; 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 /* 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 */ * 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 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 */ /* total bytes in buffer */
gint psmux_stream_bytes_in_buffer (PsMuxStream *stream); gint psmux_stream_bytes_in_buffer (PsMuxStream *stream);