1 /* GStreamer RTMP Library 2 * Copyright (C) 2013 David Schleef <ds@schleef.org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef _GST_RTMP_UTILS_H_ 21 #define _GST_RTMP_UTILS_H_ 22 23 #include <gst/gst.h> 24 #include <gio/gio.h> 25 #include "rtmpmessage.h" 26 27 G_BEGIN_DECLS 28 29 void gst_rtmp_byte_array_append_bytes (GByteArray * bytearray, GBytes * bytes); 30 31 void gst_rtmp_input_stream_read_all_bytes_async (GInputStream * stream, 32 gsize count, int io_priority, GCancellable * cancellable, 33 GAsyncReadyCallback callback, gpointer user_data); 34 GBytes * gst_rtmp_input_stream_read_all_bytes_finish (GInputStream * stream, 35 GAsyncResult * result, GError ** error); 36 37 void gst_rtmp_output_stream_write_all_bytes_async (GOutputStream * stream, 38 GBytes * bytes, int io_priority, GCancellable * cancellable, 39 GAsyncReadyCallback callback, gpointer user_data); 40 gboolean gst_rtmp_output_stream_write_all_bytes_finish (GOutputStream * stream, 41 GAsyncResult * result, GError ** error); 42 43 void gst_rtmp_output_stream_write_all_buffer_async (GOutputStream * stream, 44 GstBuffer * buffer, int io_priority, GCancellable * cancellable, 45 GAsyncReadyCallback callback, gpointer user_data); 46 gboolean gst_rtmp_output_stream_write_all_buffer_finish (GOutputStream * stream, 47 GAsyncResult * result, gsize * bytes_written, GError ** error); 48 49 void gst_rtmp_string_print_escaped (GString * string, const gchar * data, 50 gssize size); 51 52 #define GST_RTMP_FLV_TAG_HEADER_SIZE 11 53 54 typedef struct { 55 GstRtmpMessageType type; 56 gsize payload_size, total_size; 57 guint32 timestamp; 58 } GstRtmpFlvTagHeader; 59 60 gboolean gst_rtmp_flv_tag_parse_header (GstRtmpFlvTagHeader *header, 61 const guint8 * data, gsize size); 62 63 G_END_DECLS 64 65 #endif 66