libavformat/rtpenc.h
Go to the documentation of this file.
00001 /*
00002  * RTP muxer definitions
00003  * Copyright (c) 2002 Fabrice Bellard
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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     /* rtcp sender statistics receive */
00041     int64_t last_rtcp_ntp_time;    // TODO: move into statistics
00042     int64_t first_rtcp_ntp_time;   // TODO: move into statistics
00043 
00044     /* rtcp sender statistics */
00045     unsigned int packet_count;     // TODO: move into statistics (outgoing)
00046     unsigned int octet_count;      // TODO: move into statistics (outgoing)
00047     unsigned int last_octet_count; // TODO: move into statistics (outgoing)
00048     int first_packet;
00049     /* buffer for output */
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 
00068 #define FF_RTP_FLAG_OPTS(ctx, fieldname) \
00069     { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
00070     { "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" } \
00071 
00072 void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
00073 
00074 void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
00075 void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size);
00076 void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size);
00077 void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size);
00078 void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size);
00079 void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size);
00080 void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size);
00081 void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size);
00082 
00083 #endif /* AVFORMAT_RTPENC_H */