47 #define RTCP_SR_SIZE 28
181 "Packetizing VC-2 is experimental and does not use all values "
182 "of the specification "
183 "(even though most receivers may handle it just fine). "
184 "Please set -strict experimental in order to enable it.\n");
192 "Packetizing H.261 is experimental and produces incorrect "
193 "packetization for cases where GOBs don't fit into packets "
194 "(even though most receivers may handle it just fine). "
195 "Please set -f_strict experimental in order to enable it.\n");
218 "Packetizing VP9 is experimental and its specification is "
219 "still in draft state. "
220 "Please set -strict experimental in order to enable it.\n");
292 s1->streams[0]->time_base) +
s->base_timestamp;
298 avio_wb32(
s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
314 for (len = (7 + len) % 4; len % 4; len++)
346 s->
seq = (s->
seq + 1) & 0xffff;
354 const uint8_t *buf1,
int size,
int sample_size_bits)
357 int len, max_packet_size,
n;
359 int aligned_samples_size = sample_size_bits/
av_gcd(sample_size_bits, 8);
361 max_packet_size = (s->
max_payload_size / aligned_samples_size) * aligned_samples_size;
363 if ((sample_size_bits % 8) == 0 && ((8 *
size) % sample_size_bits) != 0)
368 len =
FFMIN(max_packet_size, size);
392 if ((len + size) > max_packet_size) {
403 if (size > max_packet_size) {
407 len = max_packet_size - 4;
413 s->
buf[2] = count >> 8;
415 memcpy(s->
buf + 4, buf1, len);
429 memcpy(s->
buf_ptr, buf1, size);
438 int len, max_packet_size;
443 len = max_packet_size;
500 memcpy(s->
buf_ptr, buf, frame_size);
587 int mb_info_size = 0;
620 "Packet size %d too large for max RTP payload size %d\n",
655 .priv_class = &rtp_muxer_class,
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
enum AVFieldOrder field_order
Video only.
int64_t start_time_realtime
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January ...
#define LIBAVUTIL_VERSION_INT
static int rtp_send_samples(AVFormatContext *s1, const uint8_t *buf1, int size, int sample_size_bits)
static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
int64_t last_rtcp_ntp_time
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
#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
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
int strict_std_compliance
Allow non-standard and experimental extension.
void ff_rtp_send_vc2hq(AVFormatContext *s1, const uint8_t *buf, int size, int interlaced)
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
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static const AVClass rtp_muxer_class
int id
Format-specific stream ID.
int max_frames_per_packet
void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size)
Packetize H.263 frames into RTP packets according to RFC 4629.
void ff_rtp_send_vp9(AVFormatContext *s1, const uint8_t *buff, int size)
AVStream ** streams
A list of all streams in the file.
static int rtp_write_header(AVFormatContext *s1)
int flags
Flags modifying the (de)muxer behaviour.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
#define FF_RTP_FLAG_RFC2190
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
void ff_rtp_send_jpeg(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. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3
enum AVMediaType codec_type
General type of the encoded data.
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)
Compute the greatest common divisor of a and b.
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters in...
#define FF_RTP_FLAG_SKIP_RTCP
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare 2 timestamps each in its own timebases.
static void rtp_send_mpegts_raw(AVFormatContext *s1, const uint8_t *buf1, int size)
int extradata_size
Size of the extradata content in bytes.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int block_align
Audio only.
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)
Force flushing of buffered data.
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
void ff_rtp_send_h261(AVFormatContext *s1, const uint8_t *buf1, int size)
static int write_trailer(AVFormatContext *s1)
void ff_rtp_send_h264_hevc(AVFormatContext *s1, const uint8_t *buf1, int size)
static int rtp_send_ilbc(AVFormatContext *s1, const uint8_t *buf, int size)
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)
preferred ID for MPEG-1/2 video decoding
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it...
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
int64_t first_rtcp_ntp_time
AVOutputFormat ff_rtp_muxer
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
AVIOContext * pb
I/O context.
#define FF_RTP_FLAG_OPTS(ctx, fieldname)
void avio_w8(AVIOContext *s, int b)
static int is_supported(enum AVCodecID id)
Describe the class of an AVClass context structure.
rational number numerator/denominator
void avio_wb16(AVIOContext *s, unsigned int val)
int sample_rate
Audio only.
static void rtp_send_raw(AVFormatContext *s1, const uint8_t *buf1, int size)
static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye)
unsigned int packet_count
FAKE codec to indicate a raw MPEG-2 TS stream (only used by libavformat)
int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecParameters *par, int idx)
Return the payload type for a given stream used in the given format context.
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
static int rtp_write_trailer(AVFormatContext *s1)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
void ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf1, int size, const uint8_t *mb_info, int mb_info_size)
void avio_wb32(AVIOContext *s, unsigned int val)
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
AVCodecParameters * codecpar
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
#define FF_RTP_FLAG_SEND_BYE
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.