Lines Matching refs:cstream
78 chunk_stream_is_open (GstRtmpChunkStream * cstream) in chunk_stream_is_open() argument
80 return cstream->map.data != NULL; in chunk_stream_is_open()
84 chunk_stream_take_buffer (GstRtmpChunkStream * cstream, GstBuffer * buffer) in chunk_stream_take_buffer() argument
88 g_assert (cstream->buffer == NULL); in chunk_stream_take_buffer()
89 cstream->buffer = buffer; in chunk_stream_take_buffer()
90 cstream->meta = meta; in chunk_stream_take_buffer()
94 chunk_stream_clear (GstRtmpChunkStream * cstream) in chunk_stream_clear() argument
96 if (chunk_stream_is_open (cstream)) { in chunk_stream_clear()
97 gst_buffer_unmap (cstream->buffer, &cstream->map); in chunk_stream_clear()
98 cstream->map.data = NULL; in chunk_stream_clear()
101 gst_buffer_replace (&cstream->buffer, NULL); in chunk_stream_clear()
102 cstream->meta = NULL; in chunk_stream_clear()
103 cstream->offset = 0; in chunk_stream_clear()
107 chunk_stream_next_size (GstRtmpChunkStream * cstream, guint32 chunk_size) in chunk_stream_next_size() argument
111 size = cstream->meta->size; in chunk_stream_next_size()
112 offset = cstream->offset; in chunk_stream_next_size()
177 select_chunk_type (GstRtmpChunkStream * cstream, GstBuffer * buffer) in select_chunk_type() argument
179 GstBuffer *old_buffer = cstream->buffer; in select_chunk_type()
190 meta->cstream = cstream->id; in select_chunk_type()
248 serialize_next (GstRtmpChunkStream * cstream, guint32 chunk_size, in serialize_next() argument
251 GstRtmpMeta *meta = cstream->meta; in serialize_next()
259 type, cstream->offset); in serialize_next()
261 if (cstream->id < CHUNK_STREAM_MIN_TWOBYTE) { in serialize_next()
262 small_stream_id = cstream->id; in serialize_next()
264 } else if (cstream->id < CHUNK_STREAM_MIN_THREEBYTE) { in serialize_next()
297 GST_WRITE_UINT8 (map.data + 1, cstream->id - CHUNK_STREAM_MIN_TWOBYTE); in serialize_next()
303 cstream->id - CHUNK_STREAM_MIN_TWOBYTE); in serialize_next()
335 GST_BUFFER_OFFSET (ret) = GST_BUFFER_OFFSET_IS_VALID (cstream->buffer) ? in serialize_next()
336 GST_BUFFER_OFFSET (cstream->buffer) + cstream->offset : cstream->bytes; in serialize_next()
340 guint32 payload_size = chunk_stream_next_size (cstream, chunk_size); in serialize_next()
345 gst_buffer_copy_into (ret, cstream->buffer, GST_BUFFER_COPY_MEMORY, in serialize_next()
346 cstream->offset, payload_size); in serialize_next()
349 cstream->offset += payload_size; in serialize_next()
350 cstream->bytes += payload_size; in serialize_next()
361 gst_rtmp_chunk_stream_clear (GstRtmpChunkStream * cstream) in gst_rtmp_chunk_stream_clear() argument
363 g_return_if_fail (cstream); in gst_rtmp_chunk_stream_clear()
364 GST_LOG ("Clearing chunk stream %" G_GUINT32_FORMAT, cstream->id); in gst_rtmp_chunk_stream_clear()
365 chunk_stream_clear (cstream); in gst_rtmp_chunk_stream_clear()
405 gst_rtmp_chunk_stream_parse_header (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_parse_header() argument
415 g_return_val_if_fail (cstream, 0); in gst_rtmp_chunk_stream_parse_header()
416 g_return_val_if_fail (cstream->id == gst_rtmp_chunk_stream_parse_id (data, in gst_rtmp_chunk_stream_parse_header()
421 cstream->id, type); in gst_rtmp_chunk_stream_parse_header()
438 if (cstream->buffer) { in gst_rtmp_chunk_stream_parse_header()
439 buffer = cstream->buffer; in gst_rtmp_chunk_stream_parse_header()
440 meta = cstream->meta; in gst_rtmp_chunk_stream_parse_header()
441 g_assert (meta->cstream == cstream->id); in gst_rtmp_chunk_stream_parse_header()
445 GST_BUFFER_OFFSET (buffer) = cstream->bytes; in gst_rtmp_chunk_stream_parse_header()
449 meta->cstream = cstream->id; in gst_rtmp_chunk_stream_parse_header()
451 chunk_stream_take_buffer (cstream, buffer); in gst_rtmp_chunk_stream_parse_header()
498 if (!chunk_stream_is_open (cstream)) { in gst_rtmp_chunk_stream_parse_header()
549 gst_rtmp_chunk_stream_parse_payload (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_parse_payload() argument
554 g_return_val_if_fail (cstream, 0); in gst_rtmp_chunk_stream_parse_payload()
555 g_return_val_if_fail (cstream->buffer, 0); in gst_rtmp_chunk_stream_parse_payload()
557 if (!chunk_stream_is_open (cstream)) { in gst_rtmp_chunk_stream_parse_payload()
558 guint32 size = cstream->meta->size; in gst_rtmp_chunk_stream_parse_payload()
569 gst_buffer_append_memory (cstream->buffer, mem); in gst_rtmp_chunk_stream_parse_payload()
570 gst_buffer_map (cstream->buffer, &cstream->map, GST_MAP_WRITE); in gst_rtmp_chunk_stream_parse_payload()
573 g_return_val_if_fail (cstream->map.size == cstream->meta->size, 0); in gst_rtmp_chunk_stream_parse_payload()
576 *data = cstream->map.data + cstream->offset; in gst_rtmp_chunk_stream_parse_payload()
579 return chunk_stream_next_size (cstream, chunk_size); in gst_rtmp_chunk_stream_parse_payload()
583 gst_rtmp_chunk_stream_wrote_payload (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_wrote_payload() argument
588 g_return_val_if_fail (cstream, FALSE); in gst_rtmp_chunk_stream_wrote_payload()
589 g_return_val_if_fail (chunk_stream_is_open (cstream), FALSE); in gst_rtmp_chunk_stream_wrote_payload()
591 size = chunk_stream_next_size (cstream, chunk_size); in gst_rtmp_chunk_stream_wrote_payload()
592 cstream->offset += size; in gst_rtmp_chunk_stream_wrote_payload()
593 cstream->bytes += size; in gst_rtmp_chunk_stream_wrote_payload()
595 return chunk_stream_next_size (cstream, chunk_size); in gst_rtmp_chunk_stream_wrote_payload()
599 gst_rtmp_chunk_stream_parse_finish (GstRtmpChunkStream * cstream) in gst_rtmp_chunk_stream_parse_finish() argument
603 g_return_val_if_fail (cstream, NULL); in gst_rtmp_chunk_stream_parse_finish()
604 g_return_val_if_fail (cstream->buffer, NULL); in gst_rtmp_chunk_stream_parse_finish()
606 buffer = gst_buffer_ref (cstream->buffer); in gst_rtmp_chunk_stream_parse_finish()
607 GST_BUFFER_OFFSET_END (buffer) = cstream->bytes; in gst_rtmp_chunk_stream_parse_finish()
611 chunk_stream_clear (cstream); in gst_rtmp_chunk_stream_parse_finish()
623 chunk_stream_take_buffer (cstream, empty); in gst_rtmp_chunk_stream_parse_finish()
629 gst_rtmp_chunk_stream_serialize_start (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_serialize_start() argument
634 g_return_val_if_fail (cstream, NULL); in gst_rtmp_chunk_stream_serialize_start()
637 type = select_chunk_type (cstream, buffer); in gst_rtmp_chunk_stream_serialize_start()
641 " into stream %" G_GUINT32_FORMAT, buffer, cstream->id); in gst_rtmp_chunk_stream_serialize_start()
645 chunk_stream_clear (cstream); in gst_rtmp_chunk_stream_serialize_start()
646 chunk_stream_take_buffer (cstream, gst_buffer_ref (buffer)); in gst_rtmp_chunk_stream_serialize_start()
648 return serialize_next (cstream, chunk_size, type); in gst_rtmp_chunk_stream_serialize_start()
652 gst_rtmp_chunk_stream_serialize_next (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_serialize_next() argument
655 g_return_val_if_fail (cstream, NULL); in gst_rtmp_chunk_stream_serialize_next()
656 g_return_val_if_fail (cstream->buffer, NULL); in gst_rtmp_chunk_stream_serialize_next()
658 if (chunk_stream_next_size (cstream, chunk_size) == 0) { in gst_rtmp_chunk_stream_serialize_next()
664 " into stream %" G_GUINT32_FORMAT, cstream->buffer, cstream->id); in gst_rtmp_chunk_stream_serialize_next()
666 return serialize_next (cstream, chunk_size, CHUNK_TYPE_3); in gst_rtmp_chunk_stream_serialize_next()
670 gst_rtmp_chunk_stream_serialize_all (GstRtmpChunkStream * cstream, in gst_rtmp_chunk_stream_serialize_all() argument
675 outbuf = gst_rtmp_chunk_stream_serialize_start (cstream, buffer, chunk_size); in gst_rtmp_chunk_stream_serialize_all()
676 nextbuf = gst_rtmp_chunk_stream_serialize_next (cstream, chunk_size); in gst_rtmp_chunk_stream_serialize_all()
680 nextbuf = gst_rtmp_chunk_stream_serialize_next (cstream, chunk_size); in gst_rtmp_chunk_stream_serialize_all()