|
static struct ast_frame * | create_video_frame (uint8_t *start, uint8_t *end, int format, int head, struct ast_frame *prev) |
|
static struct video_dec_desc * | dec_init (uint32_t the_ast_format) |
|
static struct video_dec_desc * | dec_uninit (struct video_dec_desc *v) |
| uninitialize the descriptor for remote video stream More...
|
|
static int | fbuf_append (struct fbuf_t *b, uint8_t *src, int len, int sbit, int ebit) |
|
static int | ffmpeg_decode (struct video_dec_desc *v, struct fbuf_t *b) |
|
static int | ffmpeg_encode (struct video_out_desc *v) |
|
static int | h261_decap (struct fbuf_t *b, uint8_t *data, int len) |
|
static int | h261_enc_init (AVCodecContext *enc_ctx) |
|
static struct ast_frame * | h261_encap (struct fbuf_t *b, int mtu, struct ast_frame **tail) |
|
static int | h263_decap (struct fbuf_t *b, uint8_t *data, int len) |
|
static int | h263_enc_init (AVCodecContext *enc_ctx) |
|
static struct ast_frame * | h263_encap (struct fbuf_t *b, int mtu, struct ast_frame **tail) |
|
static int | h263p_decap (struct fbuf_t *b, uint8_t *data, int len) |
| extract the bitstreem from the RTP payload. This is format dependent. For h263+, the format is defined in RFC 2429 and basically has a fixed 2-byte header as follows: 5 bits RR reserved, shall be 0 1 bit P indicate a start/end condition, in which case the payload should be prepended by two zero-valued bytes. 1 bit V there is an additional VRC header after this header 6 bits PLEN length in bytes of extra picture header 3 bits PEBIT how many bits to be ignored in the last byte More...
|
|
static int | h263p_enc_init (AVCodecContext *enc_ctx) |
| initialization of h263p More...
|
|
static struct ast_frame * | h263p_encap (struct fbuf_t *b, int mtu, struct ast_frame **tail) |
|
static int | h264_dec_init (AVCodecContext *dec_ctx) |
|
static int | h264_decap (struct fbuf_t *b, uint8_t *data, int len) |
|
static int | h264_enc_init (AVCodecContext *enc_ctx) |
|
static struct ast_frame * | h264_encap (struct fbuf_t *b, int mtu, struct ast_frame **tail) |
|
static struct video_codec_desc * | map_video_codec (int fmt) |
|
static enum CodecID | map_video_format (uint32_t ast_format, int rw) |
| map an asterisk format into an ffmpeg one More...
|
|
static int | mpeg4_decap (struct fbuf_t *b, uint8_t *data, int len) |
|
static int | mpeg4_decode (struct video_dec_desc *v, struct fbuf_t *b) |
|
static int | mpeg4_enc_init (AVCodecContext *enc_ctx) |
|
static struct ast_frame * | mpeg4_encap (struct fbuf_t *b, int mtu, struct ast_frame **tail) |
|
static struct ast_frame* create_video_frame |
( |
uint8_t * |
start, |
|
|
uint8_t * |
end, |
|
|
int |
format, |
|
|
int |
head, |
|
|
struct ast_frame * |
prev |
|
) |
| |
|
static |
Build an ast_frame for a given chunk of data, and link it into the queue, with possibly 'head' bytes at the beginning to fill in some fields later.
Definition at line 228 of file vcodecs.c.
References ast_calloc, AST_FRAME_VIDEO, ast_free, AST_LIST_NEXT, ast_log, AST_MALLOCD_DATA, AST_MALLOCD_HDR, ast_frame::data, ast_frame::datalen, ast_frame::delivery, video_codec_desc::format, ast_frame::frametype, len(), LOG_WARNING, ast_frame::mallocd, NULL, ast_frame::offset, ast_frame::ptr, ast_frame::samples, ast_frame::seqno, ast_frame::src, and ast_frame::subclass.
Referenced by h261_encap(), h263_encap(), h263p_encap(), h264_encap(), and mpeg4_encap().
246 memcpy(data+head, start, len);
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
struct ast_frame_subclass subclass
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_calloc(num, len)
A wrapper for calloc()
Data structure associated with a single frame of data.
union ast_frame::@263 data
enum ast_frame_type frametype
static snd_pcm_format_t format
Definition at line 1204 of file vcodecs.c.
References ast_calloc, ast_log, video_dec_desc::codec, video_dec_desc::d_callbacks, video_dec_desc::d_frame, video_dec_desc::dec_ctx, video_dec_desc::dec_in, video_dec_desc::dec_in_cur, video_dec_desc::dec_in_dpy, dec_uninit(), video_dec_desc::discard, video_codec_desc::format, LOG_WARNING, map_video_codec(), map_video_format(), NULL, and video_dec_desc::parser.
1221 v->
codec = avcodec_find_decoder(codec);
1229 v->
dec_ctx = avcodec_alloc_context();
1242 v->
parser = av_parser_init(codec);
1248 v->
d_frame = avcodec_alloc_frame();
struct fbuf_t dec_in[N_DEC_IN]
struct video_codec_desc * d_callbacks
AVCodecParserContext * parser
static enum CodecID map_video_format(uint32_t ast_format, int rw)
map an asterisk format into an ffmpeg one
struct fbuf_t * dec_in_dpy
struct fbuf_t * dec_in_cur
static struct video_codec_desc * map_video_codec(int fmt)
#define ast_calloc(num, len)
A wrapper for calloc()
static struct video_dec_desc * dec_uninit(struct video_dec_desc *v)
uninitialize the descriptor for remote video stream
static int fbuf_append |
( |
struct fbuf_t * |
b, |
|
|
uint8_t * |
src, |
|
|
int |
len, |
|
|
int |
sbit, |
|
|
int |
ebit |
|
) |
| |
|
static |
Definition at line 273 of file vcodecs.c.
References ast_calloc, ast_log, ast_realloc, fbuf_t::data, fbuf_t::ebit, len(), LOG_WARNING, NULL, fbuf_t::size, and fbuf_t::used.
Referenced by h261_decap(), h263_decap(), h263p_decap(), h264_decap(), and mpeg4_decap().
280 int need =
len + FF_INPUT_BUFFER_PADDING_SIZE;
289 }
else if (b->
used + need > b->
size) {
307 mask = (1 << b->
ebit) - 1;
310 dst[-1] |= (*src & mask);
318 memcpy(dst, src,
len);
#define ast_realloc(p, len)
A wrapper for realloc()
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_calloc(num, len)
A wrapper for calloc()
Definition at line 729 of file vcodecs.c.
References AST_FORMAT_H261, create_video_frame(), fbuf_t::data, ast_frame::data, first, H261_MIN_LEN, len(), NULL, ast_frame::ptr, ast_frame::subclass, and fbuf_t::used.
732 uint8_t *
d = b->
data;
733 int start = 0, i,
len = b->
used;
735 const int pheader_len = 4;
737 uint8_t *h = h261_hdr;
738 int sbit = 0, ebit = 0;
740 #define H261_MIN_LEN 10 744 memset(h261_hdr,
'\0',
sizeof(h261_hdr));
751 for (i =
H261_MIN_LEN, start = 0; start < len - 1; start = i, i += 4) {
755 int found = 0, found_ebit = 0;
756 for (; i <
len ; i++) {
757 uint8_t x, rpos, lpos;
768 for (rpos = 0x80, ebit = 7; rpos; ebit--, rpos >>= 1)
772 for (lpos = (rpos >> 1); lpos ; lpos >>= 1)
790 if (i - start > mtu && found) {
807 h[0] = ( (sbit & 7) << 5 ) | ( (ebit & 7) << 2 ) | 1;
811 sbit = (8 - ebit) & 7;
static struct ast_frame * create_video_frame(uint8_t *start, uint8_t *end, int format, int head, struct ast_frame *prev)
struct ast_frame_subclass subclass
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct sla_ringing_trunk * first
Data structure associated with a single frame of data.
union ast_frame::@263 data
Definition at line 575 of file vcodecs.c.
References AST_FORMAT_H263, ast_log, create_video_frame(), fbuf_t::data, ast_frame::data, first, H263_MIN_LEN, len(), LOG_WARNING, NULL, ast_frame::ptr, ast_frame::subclass, and fbuf_t::used.
578 uint8_t *
d = b->
data;
579 int start = 0, i,
len = b->
used;
581 const int pheader_len = 4;
582 uint8_t h263_hdr[12];
583 uint8_t *h = h263_hdr;
585 #define H263_MIN_LEN 6 589 memset(h263_hdr,
'\0',
sizeof(h263_hdr));
602 h[1] = ( (d[4] & 0x1f) << 3 ) |
603 ( (d[5] & 0xc0) >> 5 );
611 for (; i <
len ; i++) {
612 uint8_t x, rpos, lpos;
626 for (rpos = 0x80, rpos_i = 8; rpos; rpos >>= 1, rpos_i--)
630 for (lpos = rpos; lpos ; lpos >>= 1)
static struct ast_frame * create_video_frame(uint8_t *start, uint8_t *end, int format, int head, struct ast_frame *prev)
struct ast_frame_subclass subclass
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct sla_ringing_trunk * first
Data structure associated with a single frame of data.
union ast_frame::@263 data
static int h263p_decap |
( |
struct fbuf_t * |
b, |
|
|
uint8_t * |
data, |
|
|
int |
len |
|
) |
| |
|
static |
extract the bitstreem from the RTP payload. This is format dependent. For h263+, the format is defined in RFC 2429 and basically has a fixed 2-byte header as follows: 5 bits RR reserved, shall be 0 1 bit P indicate a start/end condition, in which case the payload should be prepended by two zero-valued bytes. 1 bit V there is an additional VRC header after this header 6 bits PLEN length in bytes of extra picture header 3 bits PEBIT how many bits to be ignored in the last byte
XXX the code below is not complete.
Definition at line 433 of file vcodecs.c.
References ast_log, fbuf_append(), and LOG_WARNING.
441 PLEN = ( (
data[0] & 1) << 5 ) | ( (
data[1] & 0xf8) >> 3);
static int fbuf_append(struct fbuf_t *b, uint8_t *src, int len, int sbit, int ebit)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
union ast_frame::@263 data
Definition at line 959 of file vcodecs.c.
References AST_FORMAT_H264, ast_log, create_video_frame(), d, fbuf_t::data, ast_frame::data, end, first, HAVE_NAL, LOG_WARNING, MIN, NULL, ast_frame::ptr, ast_frame::subclass, and fbuf_t::used.
963 uint8_t *
d, *start = b->
data;
964 uint8_t *
end = start + b->
used;
969 #define HAVE_NAL(x) (x[-4] == 0 && x[-3] == 0 && x[-2] == 0 && x[-1] == 1) 970 for (start += 4; start <
end; start++) {
971 int ty = start[0] & 0x1f;
972 if (
HAVE_NAL(start) && ty != 0 && ty != 31)
980 for (;start < end - 4; start =
d) {
986 for (d = start + 4; d <
end; d++) {
994 }
else if (ty == 0 || ty == 31) {
996 ty, d - (uint8_t *)b->
data, b->
used);
1000 size = d - start - 4;
1015 hdr[0] = (*start & 0xe0) | 28;
1016 hdr[1] = (*start++ & 0x1f) | 0x80 ;
1020 int frag_size =
MIN(size, mtu);
1030 data[1] = hdr[1] | (size == 0 ? 0x40 : 0);
static struct ast_frame * create_video_frame(uint8_t *start, uint8_t *end, int format, int head, struct ast_frame *prev)
struct ast_frame_subclass subclass
struct sla_ringing_trunk * first
Data structure associated with a single frame of data.
union ast_frame::@263 data