mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
mpegpsmux: remember whether an incoming buffer is a keyunit or not
This commit is contained in:
parent
f40ccb3811
commit
1f45eb7950
3 changed files with 11 additions and 3 deletions
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue