mpegtsmux: Set random_access_indicator for keyframes

This commit is contained in:
David Schleef 2010-11-17 17:49:17 -08:00
parent 73923c4a6e
commit ea113a79aa
3 changed files with 15 additions and 3 deletions

View file

@ -712,7 +712,7 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux)
} }
tsmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf), tsmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf), buf, pts, -1); GST_BUFFER_SIZE (buf), buf, pts, -1, !delta);
best->queued_buf = NULL; best->queued_buf = NULL;
mux->is_delta = delta; mux->is_delta = delta;

View file

@ -100,6 +100,8 @@ struct TsMuxStreamBuffer
gint64 pts; gint64 pts;
gint64 dts; gint64 dts;
gboolean random_access;
void *user_data; void *user_data;
}; };
@ -372,6 +374,13 @@ tsmux_stream_initialize_pes_packet (TsMuxStream * stream)
stream->pi.flags |= TSMUX_PACKET_FLAG_PES_WRITE_PTS; stream->pi.flags |= TSMUX_PACKET_FLAG_PES_WRITE_PTS;
} }
if (stream->buffers) {
TsMuxStreamBuffer *buf = (TsMuxStreamBuffer *) (stream->buffers->data);
if (buf->random_access) {
stream->pi.flags |= TSMUX_PACKET_FLAG_RANDOM_ACCESS;
}
}
return TRUE; return TRUE;
} }
@ -589,6 +598,7 @@ tsmux_stream_write_pes_header (TsMuxStream * stream, guint8 * data)
* @user_data: user data to pass to release func * @user_data: user data to pass to release func
* @pts: PTS of access unit in @data * @pts: PTS of access unit in @data
* @dts: DTS of access unit in @data * @dts: DTS of access unit in @data
* @random_access: TRUE if random access point (keyframe)
* *
* Submit @len bytes of @data into @stream. @pts and @dts can be set to the * Submit @len bytes of @data into @stream. @pts and @dts can be set to the
* timestamp (against a 90Hz clock) of the first access unit in @data. A * timestamp (against a 90Hz clock) of the first access unit in @data. A
@ -599,7 +609,7 @@ tsmux_stream_write_pes_header (TsMuxStream * stream, guint8 * data)
*/ */
void void
tsmux_stream_add_data (TsMuxStream * stream, guint8 * data, guint len, tsmux_stream_add_data (TsMuxStream * stream, guint8 * data, guint len,
void *user_data, gint64 pts, gint64 dts) void *user_data, gint64 pts, gint64 dts, gboolean random_access)
{ {
TsMuxStreamBuffer *packet; TsMuxStreamBuffer *packet;
@ -609,6 +619,7 @@ tsmux_stream_add_data (TsMuxStream * stream, guint8 * data, guint len,
packet->data = data; packet->data = data;
packet->size = len; packet->size = len;
packet->user_data = user_data; packet->user_data = user_data;
packet->random_access = random_access;
packet->pts = pts; packet->pts = pts;
packet->dts = dts; packet->dts = dts;

View file

@ -201,7 +201,8 @@ void tsmux_stream_set_buffer_release_func (TsMuxStream *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 tsmux_stream_add_data (TsMuxStream *stream, guint8 *data, guint len, void tsmux_stream_add_data (TsMuxStream *stream, guint8 *data, guint len,
void *user_data, gint64 pts, gint64 dts); void *user_data, gint64 pts, gint64 dts,
gboolean random_access);
void tsmux_stream_pcr_ref (TsMuxStream *stream); void tsmux_stream_pcr_ref (TsMuxStream *stream);
void tsmux_stream_pcr_unref (TsMuxStream *stream); void tsmux_stream_pcr_unref (TsMuxStream *stream);