Debian Codegraph @

Xpjproject/pjmedia/include/pjmedia-codec/h263_packetizer.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program 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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef __PJMEDIA_H263_PACKETIZER_H__
19 #define __PJMEDIA_H263_PACKETIZER_H__
20
21
22 /**
23 * @file h263_packetizer.h
24 * @brief Packetizes/unpacketizes H.263 bitstream into RTP payload.
25 */
26
27 #include <pj/pool.h>
28 #include <pj/types.h>
29
30 PJ_BEGIN_DECL
31
32
33 /**
34 * Opaque declaration for H.263 packetizer.
35 */
36 typedef struct pjmedia_h263_packetizer pjmedia_h263_packetizer;
37
38
39 /**
40 * Enumeration of H.263 packetization modes.
41 */
42 typedef enum
43 {
44 /**
45 * H.263 RTP packetization using RFC 4629.
46 */
47 PJMEDIA_H263_PACKETIZER_MODE_RFC4629,
48
49 /**
50 * H.263 RTP packetization using legacy RFC 2190.
51 * This is currently not supported.
52 */
53 PJMEDIA_H263_PACKETIZER_MODE_RFC2190,
54
55 } pjmedia_h263_packetizer_mode;
56
57
58 /**
59 * H.263 packetizer configuration.
60 */
61 typedef struct pjmedia_h263_packetizer_cfg
62 {
63 /**
64 * Maximum payload length.
65 * Default: PJMEDIA_MAX_MTU
66 */
67 int mtu;
68
69 /**
70 * Packetization mode.
71 * Default: PJMEDIA_H263_PACKETIZER_MODE_RFC4629
72 */
73 pjmedia_h263_packetizer_mode mode;
74
75 } pjmedia_h263_packetizer_cfg;
76
77
78 /**
79 * Create H.263 packetizer.
80 *
81 * @param pool The memory pool.
82 * @param cfg Packetizer settings, if NULL, default setting
83 * will be used.
84 * @param p_pktz Pointer to receive the packetizer.
85 *
86 * @return PJ_SUCCESS on success.
87 */
88 PJ_DECL(pj_status_t) pjmedia_h263_packetizer_create(
89 pj_pool_t *pool,
90 const pjmedia_h263_packetizer_cfg *cfg,
91 pjmedia_h263_packetizer **p_pktz);
92
93
94 /**
95 * Generate an RTP payload from a H.263 picture bitstream. Note that this
96 * function will apply in-place processing, so the bitstream may be modified
97 * during the packetization.
98 *
99 * @param pktz The packetizer.
100 * @param bits The picture bitstream to be packetized.
101 * @param bits_len The length of the bitstream.
102 * @param bits_pos The bitstream offset to be packetized.
103 * @param payload The output payload.
104 * @param payload_len The output payload length.
105 *
106 * @return PJ_SUCCESS on success.
107 */
108 PJ_DECL(pj_status_t) pjmedia_h263_packetize(pjmedia_h263_packetizer *pktz,
109 pj_uint8_t *bits,
110 pj_size_t bits_len,
111 unsigned *bits_pos,
112 pj_uint8_t **payload,
113 pj_size_t *payload_len);
114
115
116 /**
117 * Append an RTP payload to an H.263 picture bitstream. Note that in case of
118 * noticing packet lost, application should keep calling this function with
119 * payload pointer set to NULL, as the packetizer need to update its internal
120 * state.
121 *
122 * @param pktz The packetizer.
123 * @param payload The payload to be unpacketized.
124 * @param payload_len The payload length.
125 * @param bits The bitstream buffer.
126 * @param bits_size The bitstream buffer size.
127 * @param bits_pos The bitstream offset to put the unpacketized payload
128 * in the bitstream, upon return, this will be updated
129 * to the latest offset as a result of the unpacketized
130 * payload.
131 *
132 * @return PJ_SUCCESS on success.
133 */
134 PJ_DECL(pj_status_t) pjmedia_h263_unpacketize(pjmedia_h263_packetizer *pktz,
135 const pj_uint8_t *payload,
136 pj_size_t payload_len,
137 pj_uint8_t *bits,
138 pj_size_t bits_size,
139 unsigned *bits_pos);
140
141
142 PJ_END_DECL
143
144
145 #endif /* __PJMEDIA_H263_PACKETIZER_H__ */