rtmp2: Add gst_rtmp_chunk_stream_serialize_all

Serializes an RTMP message into a series of chunks, all in one buffer.

Similar to what gst_rtmp_connection_queue_message does to serialize
into a GByteArray.
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-02-12 16:47:30 +01:00 committed by GStreamer Merge Bot
parent cb7f0c4be7
commit b03780233e
2 changed files with 19 additions and 0 deletions

View file

@ -666,6 +666,23 @@ gst_rtmp_chunk_stream_serialize_next (GstRtmpChunkStream * cstream,
return serialize_next (cstream, chunk_size, CHUNK_TYPE_3);
}
GstBuffer *
gst_rtmp_chunk_stream_serialize_all (GstRtmpChunkStream * cstream,
GstBuffer * buffer, guint32 chunk_size)
{
GstBuffer *outbuf, *nextbuf;
outbuf = gst_rtmp_chunk_stream_serialize_start (cstream, buffer, chunk_size);
nextbuf = gst_rtmp_chunk_stream_serialize_next (cstream, chunk_size);
while (nextbuf) {
outbuf = gst_buffer_append (outbuf, nextbuf);
nextbuf = gst_rtmp_chunk_stream_serialize_next (cstream, chunk_size);
}
return outbuf;
}
GstRtmpChunkStreams *
gst_rtmp_chunk_streams_new (void)
{

View file

@ -45,6 +45,8 @@ GstBuffer * gst_rtmp_chunk_stream_serialize_start (GstRtmpChunkStream * cstream,
GstBuffer * buffer, guint32 chunk_size);
GstBuffer * gst_rtmp_chunk_stream_serialize_next (GstRtmpChunkStream * cstream,
guint32 chunk_size);
GstBuffer * gst_rtmp_chunk_stream_serialize_all (GstRtmpChunkStream * cstream,
GstBuffer * buffer, guint32 chunk_size);
GstRtmpChunkStreams * gst_rtmp_chunk_streams_new (void);
void gst_rtmp_chunk_streams_free (gpointer ptr);