46 #define RTCP_SR_SIZE 28
85 int max_packet_size, n;
111 if (max_packet_size <= 12)
165 "incompatible with the latest spec drafts.\n");
219 avio_wb32(s1->
pb, ((ntp_time % 1000000) << 32) / 1000000);
232 av_dlog(s1,
"rtp_send_data size=%d\n", len);
252 const uint8_t *buf1,
int size,
int sample_size_bits)
255 int len, max_packet_size, n;
257 int aligned_samples_size = sample_size_bits/
av_gcd(sample_size_bits, 8);
259 max_packet_size = (s->
max_payload_size / aligned_samples_size) * aligned_samples_size;
261 if ((sample_size_bits % 8) == 0 && ((8 *
size) % sample_size_bits) != 0)
266 len =
FFMIN(max_packet_size, size);
280 const uint8_t *buf1,
int size)
283 int len, count, max_packet_size;
289 if ((len + size) > max_packet_size) {
300 if (size > max_packet_size) {
304 len = max_packet_size - 4;
310 s->
buf[2] = count >> 8;
312 memcpy(s->
buf + 4, buf1, len);
326 memcpy(s->
buf_ptr, buf1, size);
332 const uint8_t *buf1,
int size)
335 int len, max_packet_size;
340 len = max_packet_size;
354 const uint8_t *buf1,
int size)
480 .priv_class = &rtp_muxer_class,
int64_t start_time_realtime
Start time of the stream in real world time, in microseconds since the unix epoch (00:00 1st January ...
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
int64_t last_rtcp_ntp_time
#define RTCP_TX_RATIO_NUM
unsigned int last_octet_count
static const AVOption options[]
void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size)
Packetize AMR frames into RTP packets according to RFC 3267, in octet-aligned mode.
#define RTCP_TX_RATIO_DEN
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int nal_length_size
Number of bytes used for H.264 NAL length, if the MP4 syntax is used (1, 2 or 4)
#define FF_RTP_FLAG_MP4A_LATM
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static const AVClass rtp_muxer_class
int max_frames_per_packet
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size)
Packetize H.263 frames into RTP packets according to RFC 4629.
static int rtp_write_header(AVFormatContext *s1)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
preferred ID for MPEG-1/2 video decoding
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int is_supported(enum CodecID id)
void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size)
void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size)
int64_t av_gcd(int64_t a, int64_t b)
Return the greatest common divisor of a and b.
void av_log(void *avcl, int level, const char *fmt,...)
static void rtp_send_mpegts_raw(AVFormatContext *s1, const uint8_t *buf1, int size)
AVCodecContext * codec
codec context
unsigned int nb_streams
A list of all streams in the file.
void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size)
Packetize Xiph frames into RTP according to RFC 5215 (Vorbis) and the Theora RFC draft.
int void avio_flush(AVIOContext *s)
#define AV_TIME_BASE
Internal time base represented as integer.
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size)
static void rtp_send_mpegaudio(AVFormatContext *s1, const uint8_t *buf1, int size)
#define av_dlog(pctx,...)
av_dlog macros Useful to print debug messages that shouldn't get compiled in normally.
static void rtp_send_samples(AVFormatContext *s1, const uint8_t *buf1, int size, int sample_size_bits)
int frame_size
Samples per packet, initialized when calling 'init'.
int64_t first_rtcp_ntp_time
AVOutputFormat ff_rtp_muxer
enum AVMediaType codec_type
int sample_rate
samples per second
#define FF_RTP_FLAG_OPTS(ctx, fieldname)
void avio_w8(AVIOContext *s, int b)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Describe the class of an AVClass context structure.
rational number numerator/denominator
FAKE codec to indicate a raw MPEG-2 TS stream (only used by libavformat)
static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
void avio_wb16(AVIOContext *s, unsigned int val)
struct RTPMuxContext RTPMuxContext
void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size)
static void rtp_send_raw(AVFormatContext *s1, const uint8_t *buf1, int size)
CodecID
Identify the syntax and semantics of the bitstream.
unsigned int packet_count
int channels
number of audio channels
void * priv_data
Format private data.
static int rtp_write_trailer(AVFormatContext *s1)
void avio_wb32(AVIOContext *s, unsigned int val)
int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
Return the payload type for a given codec used in the given format context.
uint32_t av_get_random_seed(void)
Get random data.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
preferred ID for decoding MPEG audio layer 1, 2 or 3