summaryrefslogtreecommitdiff
path: root/rtmp/amf.h
blob: 0ace7d3e3374600df5e6e651cb8e2d2bdb105022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* GStreamer RTMP Library
 * Copyright (C) 2014 David Schleef <ds@schleef.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef _GST_RTMP_AMF_H_
#define _GST_RTMP_AMF_H_

#include <glib.h>

G_BEGIN_DECLS

typedef enum {
  GST_AMF_TYPE_NUMBER = 0,
  GST_AMF_TYPE_BOOLEAN = 1,
  GST_AMF_TYPE_STRING = 2,
  GST_AMF_TYPE_OBJECT = 3,
  GST_AMF_TYPE_MOVIECLIP = 4,
  GST_AMF_TYPE_NULL = 5,
  GST_AMF_TYPE_UNDEFINED = 6,
  GST_AMF_TYPE_REFERENCE = 7,
  GST_AMF_TYPE_ECMA_ARRAY = 8,
  GST_AMF_TYPE_OBJECT_END = 9,
  GST_AMF_TYPE_STRICT_ARRAY = 10,
  GST_AMF_TYPE_DATE = 11,
  GST_AMF_TYPE_LONG_STRING = 12,
  GST_AMF_TYPE_UNSUPPORTED = 13,
  GST_AMF_TYPE_RECORDSET = 14,
  GST_AMF_TYPE_XML_DOCUMENT = 15,
  GST_AMF_TYPE_TYPED_OBJECT = 16,
  GST_AMF_TYPE_AVMPLUS_OBJECT = 17
} GstAmfType;


struct _GstAmfNode {
  GstAmfType type;
  int int_val;
  double double_val;
  char *string_val;
  GPtrArray *array_val;
};
typedef struct _GstAmfNode GstAmfNode;

GstAmfNode * gst_amf_node_new (GstAmfType type);
void gst_amf_node_free (GstAmfNode *node);
void gst_amf_node_dump (GstAmfNode *node);

GstAmfNode * gst_amf_node_new_parse (const guint8 *data, gsize size,
    gsize *n_bytes);

void gst_amf_node_set_boolean (GstAmfNode *node, gboolean val);
void gst_amf_node_set_number (GstAmfNode *node, double val);
void gst_amf_node_set_string (GstAmfNode *node, const char *s);
void gst_amf_node_set_string_take (GstAmfNode *node, char *s);
void gst_amf_node_set_ecma_array (GstAmfNode *node, guint8 *data, int size);
void gst_amf_object_append_take (GstAmfNode *node, const char *s,
    GstAmfNode *child_node);

void gst_amf_object_set_number (GstAmfNode *node, const char *field_name,
    double val);
void gst_amf_object_set_string (GstAmfNode *node, const char *field_name,
    const char *s);

GBytes * gst_amf_serialize_command (const char *command_name,
    int transaction_id, GstAmfNode *command_object, GstAmfNode *optional_args);

G_END_DECLS

#endif