00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AVFORMAT_RTPENC_H
00022 #define AVFORMAT_RTPENC_H
00023
00024 #include "avformat.h"
00025 #include "rtp.h"
00026
00027 struct RTPMuxContext {
00028 const AVClass *av_class;
00029 AVFormatContext *ic;
00030 AVStream *st;
00031 int payload_type;
00032 uint32_t ssrc;
00033 uint16_t seq;
00034 uint32_t timestamp;
00035 uint32_t base_timestamp;
00036 uint32_t cur_timestamp;
00037 int max_payload_size;
00038 int num_frames;
00039
00040
00041 int64_t last_rtcp_ntp_time;
00042 int64_t first_rtcp_ntp_time;
00043
00044
00045 unsigned int packet_count;
00046 unsigned int octet_count;
00047 unsigned int last_octet_count;
00048 int first_packet;
00049
00050 uint8_t *buf;
00051 uint8_t *buf_ptr;
00052
00053 int max_frames_per_packet;
00054
00059 int nal_length_size;
00060
00061 int flags;
00062 };
00063
00064 typedef struct RTPMuxContext RTPMuxContext;
00065
00066 #define FF_RTP_FLAG_MP4A_LATM 1
00067 #define FF_RTP_FLAG_RFC2190 2
00068 #define FF_RTP_FLAG_SKIP_RTCP 4
00069
00070 #define FF_RTP_FLAG_OPTS(ctx, fieldname) \
00071 { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
00072 { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
00073 { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
00074 { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
00075
00076 void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
00077
00078 void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
00079 void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size);
00080 void ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf1, int size,
00081 const uint8_t *mb_info, int mb_info_size);
00082 void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size);
00083 void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size);
00084 void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size);
00085 void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size);
00086 void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size);
00087 void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size);
00088
00089 const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *restrict start,
00090 const uint8_t *restrict end);
00091
00092 #endif