FFmpeg
prompeg.c
Go to the documentation of this file.
1 /*
2  * Pro-MPEG Code of Practice #3 Release 2 FEC
3  * Copyright (c) 2016 Mobibase, France (http://www.mobibase.com)
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * Pro-MPEG Code of Practice #3 Release 2 FEC protocol
25  * @author Vlad Tarca <vlad.tarca@gmail.com>
26  */
27 
28 /*
29  * Reminder:
30 
31  [RFC 2733] FEC Packet Structure
32 
33  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34  | RTP Header |
35  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36  | FEC Header |
37  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38  | FEC Payload |
39  | |
40  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 
42 
43  [RFC 3550] RTP header
44 
45  0 1 2 3
46  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
47  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48  |V=2|P|X| CC |M| PT | sequence number |
49  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50  | timestamp |
51  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52  | synchronization source (SSRC) identifier |
53  +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
54  | contributing source (CSRC) identifiers |
55  | .... |
56  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 
58  [RFC 3550] RTP header extension (after CSRC)
59 
60  0 1 2 3
61  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
62  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63  | defined by profile | length |
64  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
65  | header extension |
66  | .... |
67  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
68 
69  [Pro-MPEG COP3] FEC Header
70 
71  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
72  | SNBase low bits | length recovery |
73  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74  |E| PT recovery | mask |
75  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
76  | TS recovery |
77  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
78  |X|D|type |index| offset | NA |SNBase ext bits|
79  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
80 
81  */
82 
83 #include "libavutil/intreadwrite.h"
84 #include "libavutil/mem.h"
85 #include "libavutil/opt.h"
86 #include "libavutil/random_seed.h"
87 #include "avformat.h"
88 #include "config.h"
89 #include "url.h"
90 
91 #define PROMPEG_RTP_PT 0x60
92 #define PROMPEG_FEC_COL 0x0
93 #define PROMPEG_FEC_ROW 0x1
94 
95 typedef struct PrompegFec {
96  uint16_t sn;
97  uint32_t ts;
98  uint8_t *bitstring;
99 } PrompegFec;
100 
101 typedef struct PrompegContext {
102  const AVClass *class;
105  int ttl;
106  uint8_t l, d;
107  uint8_t *rtp_buf;
109  uint16_t length_recovery;
115  int init;
116  int first;
118 
119 #define OFFSET(x) offsetof(PrompegContext, x)
120 #define E AV_OPT_FLAG_ENCODING_PARAM
121 
122 static const AVOption options[] = {
123  { "ttl", "Time to live (in milliseconds, multicast only)", OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = E },
124  { "l", "FEC L", OFFSET(l), AV_OPT_TYPE_INT, { .i64 = 5 }, 4, 20, .flags = E },
125  { "d", "FEC D", OFFSET(d), AV_OPT_TYPE_INT, { .i64 = 5 }, 4, 20, .flags = E },
126  { NULL }
127 };
128 
129 static const AVClass prompeg_class = {
130  .class_name = "prompeg",
131  .item_name = av_default_item_name,
132  .option = options,
133  .version = LIBAVUTIL_VERSION_INT,
134 };
135 
136 static void xor_fast(const uint8_t *in1, const uint8_t *in2, uint8_t *out, int size) {
137  int i, n, s;
138 
139 #if HAVE_FAST_64BIT
140  uint64_t v1, v2;
141 
142  n = size / sizeof (uint64_t);
143  s = n * sizeof (uint64_t);
144 
145  for (i = 0; i < n; i++) {
146  v1 = AV_RN64A(in1);
147  v2 = AV_RN64A(in2);
148  AV_WN64A(out, v1 ^ v2);
149  in1 += 8;
150  in2 += 8;
151  out += 8;
152  }
153 #else
154  uint32_t v1, v2;
155 
156  n = size / sizeof (uint32_t);
157  s = n * sizeof (uint32_t);
158 
159  for (i = 0; i < n; i++) {
160  v1 = AV_RN32A(in1);
161  v2 = AV_RN32A(in2);
162  AV_WN32A(out, v1 ^ v2);
163  in1 += 4;
164  in2 += 4;
165  out += 4;
166  }
167 #endif
168 
169  n = size - s;
170 
171  for (i = 0; i < n; i++) {
172  out[i] = in1[i] ^ in2[i];
173  }
174 }
175 
176 static int prompeg_create_bitstring(URLContext *h, const uint8_t *buf, int size,
177  uint8_t **bitstring) {
178  PrompegContext *s = h->priv_data;
179  uint8_t *b;
180 
181  if (size < 12 || (buf[0] & 0xc0) != 0x80 || (buf[1] & 0x7f) != 0x21) {
182  av_log(h, AV_LOG_ERROR, "Unsupported stream format (expected MPEG-TS over RTP)\n");
183  return AVERROR(EINVAL);
184  }
185  if (size != s->packet_size) {
186  av_log(h, AV_LOG_ERROR, "The RTP packet size must be constant (set pkt_size)\n");
187  return AVERROR(EINVAL);
188  }
189 
190  *bitstring = av_malloc(s->bitstring_size);
191  if (!*bitstring) {
192  av_log(h, AV_LOG_ERROR, "Failed to allocate the bitstring buffer\n");
193  return AVERROR(ENOMEM);
194  }
195  b = *bitstring;
196 
197  // P, X, CC
198  b[0] = buf[0] & 0x3f;
199  // M, PT
200  b[1] = buf[1];
201  // Timestamp
202  b[2] = buf[4];
203  b[3] = buf[5];
204  b[4] = buf[6];
205  b[5] = buf[7];
206  /*
207  * length_recovery: the unsigned network-ordered sum of lengths of CSRC,
208  * padding, extension and media payload
209  */
210  AV_WB16(b + 6, s->length_recovery);
211  // Payload
212  memcpy(b + 8, buf + 12, s->length_recovery);
213 
214  return 0;
215 }
216 
217 static int prompeg_write_fec(URLContext *h, PrompegFec *fec, uint8_t type) {
218  PrompegContext *s = h->priv_data;
219  URLContext *hd;
220  uint8_t *buf = s->rtp_buf; // zero-filled
221  uint8_t *b = fec->bitstring;
222  uint16_t sn;
223  int ret;
224 
225  sn = type == PROMPEG_FEC_COL ? ++s->rtp_col_sn : ++s->rtp_row_sn;
226 
227  // V, P, X, CC
228  buf[0] = 0x80 | (b[0] & 0x3f);
229  // M, PT
230  buf[1] = (b[1] & 0x80) | PROMPEG_RTP_PT;
231  // SN
232  AV_WB16(buf + 2, sn);
233  // TS
234  AV_WB32(buf + 4, fec->ts);
235  // CSRC=0
236  //AV_WB32(buf + 8, 0);
237  // SNBase low bits
238  AV_WB16(buf + 12, fec->sn);
239  // Length recovery
240  buf[14] = b[6];
241  buf[15] = b[7];
242  // E=1, PT recovery
243  buf[16] = 0x80 | b[1];
244  // Mask=0
245  //buf[17] = 0x0;
246  //buf[18] = 0x0;
247  //buf[19] = 0x0;
248  // TS recovery
249  buf[20] = b[2];
250  buf[21] = b[3];
251  buf[22] = b[4];
252  buf[23] = b[5];
253  // X=0, D, type=0, index=0
254  buf[24] = type == PROMPEG_FEC_COL ? 0x0 : 0x40;
255  // offset
256  buf[25] = type == PROMPEG_FEC_COL ? s->l : 0x1;
257  // NA
258  buf[26] = type == PROMPEG_FEC_COL ? s->d : s->l;
259  // SNBase ext bits=0
260  //buf[27] = 0x0;
261  // Payload
262  memcpy(buf + 28, b + 8, s->length_recovery);
263 
264  hd = type == PROMPEG_FEC_COL ? s->fec_col_hd : s->fec_row_hd;
265  ret = ffurl_write(hd, buf, s->rtp_buf_size);
266  return ret;
267 }
268 
269 static int prompeg_open(URLContext *h, const char *uri, int flags) {
270  PrompegContext *s = h->priv_data;
271  AVDictionary *udp_opts = NULL;
272  int rtp_port;
273  char hostname[256];
274  char buf[1024];
275 
276  s->fec_col_hd = NULL;
277  s->fec_row_hd = NULL;
278 
279  if (s->l * s->d > 100) {
280  av_log(h, AV_LOG_ERROR, "L * D must be <= 100\n");
281  return AVERROR(EINVAL);
282  }
283 
284  av_url_split(NULL, 0, NULL, 0, hostname, sizeof (hostname), &rtp_port,
285  NULL, 0, uri);
286 
287  if (rtp_port < 1 || rtp_port > UINT16_MAX - 4) {
288  av_log(h, AV_LOG_ERROR, "Invalid RTP base port %d\n", rtp_port);
289  return AVERROR(EINVAL);
290  }
291 
292  if (s->ttl > 0) {
293  av_dict_set_int(&udp_opts, "ttl", s->ttl, 0);
294  }
295 
296  ff_url_join(buf, sizeof (buf), "udp", NULL, hostname, rtp_port + 2, NULL);
297  if (ffurl_open_whitelist(&s->fec_col_hd, buf, flags, &h->interrupt_callback,
298  &udp_opts, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
299  goto fail;
300  ff_url_join(buf, sizeof (buf), "udp", NULL, hostname, rtp_port + 4, NULL);
301  if (ffurl_open_whitelist(&s->fec_row_hd, buf, flags, &h->interrupt_callback,
302  &udp_opts, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
303  goto fail;
304 
305  h->max_packet_size = s->fec_col_hd->max_packet_size;
306  s->init = 1;
307 
308  av_dict_free(&udp_opts);
309  av_log(h, AV_LOG_INFO, "ProMPEG CoP#3-R2 FEC L=%d D=%d\n", s->l, s->d);
310  return 0;
311 
312 fail:
313  ffurl_closep(&s->fec_col_hd);
314  ffurl_closep(&s->fec_row_hd);
315  av_dict_free(&udp_opts);
316  return AVERROR(EIO);
317 }
318 
319 static int prompeg_init(URLContext *h, const uint8_t *buf, int size) {
320  PrompegContext *s = h->priv_data;
321  uint32_t seed;
322  int i;
323 
324  s->fec_arr = NULL;
325  s->rtp_buf = NULL;
326 
327  if (size < 12 || size > UINT16_MAX + 12) {
328  av_log(h, AV_LOG_ERROR, "Invalid RTP packet size\n");
329  return AVERROR_INVALIDDATA;
330  }
331 
332  s->packet_idx = 0;
333  s->packet_idx_max = s->l * s->d;
334  s->packet_size = size;
335  s->length_recovery = size - 12;
336  s->rtp_buf_size = 28 + s->length_recovery; // 12 + 16: RTP + FEC headers
337  s->bitstring_size = 8 + s->length_recovery; // 8: P, X, CC, M, PT, SN, TS
338  s->fec_arr_len = 1 + 2 * s->l; // row + column tmp + column out
339 
340  if (h->flags & AVFMT_FLAG_BITEXACT) {
341  s->rtp_col_sn = 0;
342  s->rtp_row_sn = 0;
343  } else {
345  s->rtp_col_sn = seed & 0x0fff;
346  s->rtp_row_sn = (seed >> 16) & 0x0fff;
347  }
348 
349  s->fec_arr = av_malloc_array(s->fec_arr_len, sizeof (PrompegFec*));
350  if (!s->fec_arr) {
351  goto fail;
352  }
353  for (i = 0; i < s->fec_arr_len; i++) {
354  s->fec_arr[i] = av_malloc(sizeof (PrompegFec));
355  if (!s->fec_arr[i]) {
356  goto fail;
357  }
358  s->fec_arr[i]->bitstring = av_malloc_array(s->bitstring_size, sizeof (uint8_t));
359  if (!s->fec_arr[i]->bitstring) {
360  av_freep(&s->fec_arr[i]);
361  goto fail;
362  }
363  }
364  s->fec_row = *s->fec_arr;
365  s->fec_col = s->fec_arr + 1;
366  s->fec_col_tmp = s->fec_arr + 1 + s->l;
367 
368  s->rtp_buf = av_malloc_array(s->rtp_buf_size, sizeof (uint8_t));
369  if (!s->rtp_buf) {
370  goto fail;
371  }
372  memset(s->rtp_buf, 0, s->rtp_buf_size);
373 
374  s->init = 0;
375  s->first = 1;
376 
377  return 0;
378 
379 fail:
380  av_log(h, AV_LOG_ERROR, "Failed to allocate the FEC buffer\n");
381  return AVERROR(ENOMEM);
382 }
383 
384 static int prompeg_write(URLContext *h, const uint8_t *buf, int size) {
385  PrompegContext *s = h->priv_data;
386  PrompegFec *fec_tmp;
387  uint8_t *bitstring = NULL;
388  int col_idx, col_out_idx, row_idx;
389  int ret = 0;
390 
391  if (s->init && ((ret = prompeg_init(h, buf, size)) < 0))
392  goto end;
393 
394  if ((ret = prompeg_create_bitstring(h, buf, size, &bitstring)) < 0)
395  goto end;
396 
397  col_idx = s->packet_idx % s->l;
398  row_idx = s->packet_idx / s->l % s->d;
399 
400  // FEC' (row) send block-aligned, xor
401  if (col_idx == 0) {
402  if (!s->first || s->packet_idx > 0) {
403  if ((ret = prompeg_write_fec(h, s->fec_row, PROMPEG_FEC_ROW)) < 0)
404  goto end;
405  }
406  memcpy(s->fec_row->bitstring, bitstring, s->bitstring_size);
407  s->fec_row->sn = AV_RB16(buf + 2);
408  s->fec_row->ts = AV_RB32(buf + 4);
409  } else {
410  xor_fast(s->fec_row->bitstring, bitstring, s->fec_row->bitstring,
411  s->bitstring_size);
412  }
413 
414  // FEC (column) xor
415  if (row_idx == 0) {
416  if (!s->first) {
417  // swap fec_col and fec_col_tmp
418  fec_tmp = s->fec_col[col_idx];
419  s->fec_col[col_idx] = s->fec_col_tmp[col_idx];
420  s->fec_col_tmp[col_idx] = fec_tmp;
421  }
422  memcpy(s->fec_col_tmp[col_idx]->bitstring, bitstring, s->bitstring_size);
423  s->fec_col_tmp[col_idx]->sn = AV_RB16(buf + 2);
424  s->fec_col_tmp[col_idx]->ts = AV_RB32(buf + 4);
425  } else {
426  xor_fast(s->fec_col_tmp[col_idx]->bitstring, bitstring,
427  s->fec_col_tmp[col_idx]->bitstring, s->bitstring_size);
428  }
429 
430  // FEC (column) send block-aligned
431  if (!s->first && s->packet_idx % s->d == 0) {
432  col_out_idx = s->packet_idx / s->d;
433  if ((ret = prompeg_write_fec(h, s->fec_col[col_out_idx], PROMPEG_FEC_COL)) < 0)
434  goto end;
435  }
436 
437  if (++s->packet_idx >= s->packet_idx_max) {
438  s->packet_idx = 0;
439  if (s->first)
440  s->first = 0;
441  }
442 
443  ret = size;
444 
445 end:
446  av_free(bitstring);
447  return ret;
448 }
449 
450 static int prompeg_close(URLContext *h) {
451  PrompegContext *s = h->priv_data;
452  int i;
453 
454  ffurl_closep(&s->fec_col_hd);
455  ffurl_closep(&s->fec_row_hd);
456 
457  if (s->fec_arr) {
458  for (i = 0; i < s->fec_arr_len; i++) {
459  av_free(s->fec_arr[i]->bitstring);
460  av_freep(&s->fec_arr[i]);
461  }
462  av_freep(&s->fec_arr);
463  }
464  av_freep(&s->rtp_buf);
465 
466  return 0;
467 }
468 
470  .name = "prompeg",
471  .url_open = prompeg_open,
472  .url_write = prompeg_write,
473  .url_close = prompeg_close,
474  .priv_data_size = sizeof(PrompegContext),
476  .priv_data_class = &prompeg_class,
477 };
PrompegContext::init
int init
Definition: prompeg.c:115
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:33
out
FILE * out
Definition: movenc.c:55
PrompegContext::packet_size
int packet_size
Definition: prompeg.c:110
PrompegFec::ts
uint32_t ts
Definition: prompeg.c:97
prompeg_open
static int prompeg_open(URLContext *h, const char *uri, int flags)
Definition: prompeg.c:269
PrompegContext::rtp_row_sn
uint16_t rtp_row_sn
Definition: prompeg.c:108
ffurl_write
static int ffurl_write(URLContext *h, const uint8_t *buf, int size)
Write size bytes from buf to the resource accessed by h.
Definition: url.h:202
prompeg_class
static const AVClass prompeg_class
Definition: prompeg.c:129
AVOption
AVOption.
Definition: opt.h:429
PrompegContext
Definition: prompeg.c:101
b
#define b
Definition: input.c:41
PrompegContext::fec_row_hd
URLContext * fec_row_hd
Definition: prompeg.c:103
AV_WN32A
#define AV_WN32A(p, v)
Definition: intreadwrite.h:534
AVDictionary
Definition: dict.c:34
URLProtocol
Definition: url.h:51
PrompegFec
Definition: prompeg.c:95
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
av_get_random_seed
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
Definition: random_seed.c:167
PROMPEG_FEC_COL
#define PROMPEG_FEC_COL
Definition: prompeg.c:92
fail
#define fail()
Definition: checkasm.h:193
OFFSET
#define OFFSET(x)
Definition: prompeg.c:119
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
PrompegContext::packet_idx_max
int packet_idx_max
Definition: prompeg.c:111
PrompegContext::ttl
int ttl
Definition: prompeg.c:105
ffurl_open_whitelist
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it.
Definition: avio.c:362
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
prompeg_init
static int prompeg_init(URLContext *h, const uint8_t *buf, int size)
Definition: prompeg.c:319
ff_url_join
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
Definition: url.c:40
ff_prompeg_protocol
const URLProtocol ff_prompeg_protocol
Definition: prompeg.c:469
options
static const AVOption options[]
Definition: prompeg.c:122
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
AV_WB16
#define AV_WB16(p, v)
Definition: intreadwrite.h:401
PrompegContext::fec_col
PrompegFec ** fec_col
Definition: prompeg.c:104
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
options
Definition: swscale.c:42
seed
static unsigned int seed
Definition: videogen.c:78
PrompegContext::rtp_buf_size
int rtp_buf_size
Definition: prompeg.c:114
PrompegContext::l
uint8_t l
Definition: prompeg.c:106
AV_WB32
#define AV_WB32(p, v)
Definition: intreadwrite.h:415
PrompegContext::d
uint8_t d
Definition: prompeg.c:106
size
int size
Definition: twinvq_data.h:10344
URLProtocol::name
const char * name
Definition: url.h:52
AV_RB32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:96
AV_RN64A
#define AV_RN64A(p)
Definition: intreadwrite.h:526
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:223
prompeg_create_bitstring
static int prompeg_create_bitstring(URLContext *h, const uint8_t *buf, int size, uint8_t **bitstring)
Definition: prompeg.c:176
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
prompeg_close
static int prompeg_close(URLContext *h)
Definition: prompeg.c:450
PrompegContext::fec_col_hd
URLContext * fec_col_hd
Definition: prompeg.c:103
URLContext
Definition: url.h:35
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
PrompegContext::length_recovery
uint16_t length_recovery
Definition: prompeg.c:109
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
av_url_split
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
Definition: utils.c:351
url.h
PrompegContext::rtp_col_sn
uint16_t rtp_col_sn
Definition: prompeg.c:108
prompeg_write_fec
static int prompeg_write_fec(URLContext *h, PrompegFec *fec, uint8_t type)
Definition: prompeg.c:217
AV_RN32A
#define AV_RN32A(p)
Definition: intreadwrite.h:522
ffurl_closep
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
Definition: avio.c:588
AVFMT_FLAG_BITEXACT
#define AVFMT_FLAG_BITEXACT
When muxing, try to avoid writing any random/volatile data to the output.
Definition: avformat.h:1468
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:80
PrompegContext::packet_idx
int packet_idx
Definition: prompeg.c:111
PrompegContext::bitstring_size
int bitstring_size
Definition: prompeg.c:113
avformat.h
PrompegContext::first
int first
Definition: prompeg.c:116
AV_WN64A
#define AV_WN64A(p, v)
Definition: intreadwrite.h:538
xor_fast
static void xor_fast(const uint8_t *in1, const uint8_t *in2, uint8_t *out, int size)
Definition: prompeg.c:136
random_seed.h
PrompegContext::fec_col_tmp
PrompegFec ** fec_col_tmp
Definition: prompeg.c:104
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
PrompegContext::fec_arr
PrompegFec ** fec_arr
Definition: prompeg.c:104
PrompegFec::bitstring
uint8_t * bitstring
Definition: prompeg.c:98
PrompegFec::sn
uint16_t sn
Definition: prompeg.c:96
av_dict_set_int
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
Definition: dict.c:167
E
#define E
Definition: prompeg.c:120
mem.h
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
prompeg_write
static int prompeg_write(URLContext *h, const uint8_t *buf, int size)
Definition: prompeg.c:384
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
PrompegContext::fec_row
PrompegFec * fec_row
Definition: prompeg.c:104
h
h
Definition: vp9dsp_template.c:2070
PrompegContext::rtp_buf
uint8_t * rtp_buf
Definition: prompeg.c:107
PrompegContext::fec_arr_len
int fec_arr_len
Definition: prompeg.c:112
PROMPEG_FEC_ROW
#define PROMPEG_FEC_ROW
Definition: prompeg.c:93
AV_RB16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98
PROMPEG_RTP_PT
#define PROMPEG_RTP_PT
Definition: prompeg.c:91