1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * RTP muxer definitions 3cabdff1aSopenharmony_ci * Copyright (c) 2002 Fabrice Bellard 4cabdff1aSopenharmony_ci * 5cabdff1aSopenharmony_ci * This file is part of FFmpeg. 6cabdff1aSopenharmony_ci * 7cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 8cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 9cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 10cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 11cabdff1aSopenharmony_ci * 12cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 13cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 14cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15cabdff1aSopenharmony_ci * Lesser General Public License for more details. 16cabdff1aSopenharmony_ci * 17cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 18cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 19cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20cabdff1aSopenharmony_ci */ 21cabdff1aSopenharmony_ci#ifndef AVFORMAT_RTPENC_H 22cabdff1aSopenharmony_ci#define AVFORMAT_RTPENC_H 23cabdff1aSopenharmony_ci 24cabdff1aSopenharmony_ci#include "avformat.h" 25cabdff1aSopenharmony_ci#include "rtp.h" 26cabdff1aSopenharmony_ci 27cabdff1aSopenharmony_cistruct RTPMuxContext { 28cabdff1aSopenharmony_ci const AVClass *av_class; 29cabdff1aSopenharmony_ci AVFormatContext *ic; 30cabdff1aSopenharmony_ci AVStream *st; 31cabdff1aSopenharmony_ci int payload_type; 32cabdff1aSopenharmony_ci uint32_t ssrc; 33cabdff1aSopenharmony_ci const char *cname; 34cabdff1aSopenharmony_ci int seq; 35cabdff1aSopenharmony_ci uint32_t timestamp; 36cabdff1aSopenharmony_ci uint32_t base_timestamp; 37cabdff1aSopenharmony_ci uint32_t cur_timestamp; 38cabdff1aSopenharmony_ci int max_payload_size; 39cabdff1aSopenharmony_ci int num_frames; 40cabdff1aSopenharmony_ci 41cabdff1aSopenharmony_ci /* rtcp sender statistics */ 42cabdff1aSopenharmony_ci int64_t last_rtcp_ntp_time; 43cabdff1aSopenharmony_ci int64_t first_rtcp_ntp_time; 44cabdff1aSopenharmony_ci unsigned int packet_count; 45cabdff1aSopenharmony_ci unsigned int octet_count; 46cabdff1aSopenharmony_ci unsigned int last_octet_count; 47cabdff1aSopenharmony_ci int first_packet; 48cabdff1aSopenharmony_ci /* buffer for output */ 49cabdff1aSopenharmony_ci uint8_t *buf; 50cabdff1aSopenharmony_ci uint8_t *buf_ptr; 51cabdff1aSopenharmony_ci 52cabdff1aSopenharmony_ci int max_frames_per_packet; 53cabdff1aSopenharmony_ci 54cabdff1aSopenharmony_ci /** 55cabdff1aSopenharmony_ci * Number of bytes used for H.264 NAL length, if the MP4 syntax is used 56cabdff1aSopenharmony_ci * (1, 2 or 4) 57cabdff1aSopenharmony_ci */ 58cabdff1aSopenharmony_ci int nal_length_size; 59cabdff1aSopenharmony_ci int buffered_nals; 60cabdff1aSopenharmony_ci 61cabdff1aSopenharmony_ci int flags; 62cabdff1aSopenharmony_ci 63cabdff1aSopenharmony_ci unsigned int frame_count; 64cabdff1aSopenharmony_ci}; 65cabdff1aSopenharmony_ci 66cabdff1aSopenharmony_citypedef struct RTPMuxContext RTPMuxContext; 67cabdff1aSopenharmony_ci 68cabdff1aSopenharmony_ci#define FF_RTP_FLAG_MP4A_LATM 1 69cabdff1aSopenharmony_ci#define FF_RTP_FLAG_RFC2190 2 70cabdff1aSopenharmony_ci#define FF_RTP_FLAG_SKIP_RTCP 4 71cabdff1aSopenharmony_ci#define FF_RTP_FLAG_H264_MODE0 8 72cabdff1aSopenharmony_ci#define FF_RTP_FLAG_SEND_BYE 16 73cabdff1aSopenharmony_ci 74cabdff1aSopenharmony_ci#define FF_RTP_FLAG_OPTS(ctx, fieldname) \ 75cabdff1aSopenharmony_ci { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ 76cabdff1aSopenharmony_ci { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ 77cabdff1aSopenharmony_ci { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ 78cabdff1aSopenharmony_ci { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ 79cabdff1aSopenharmony_ci { "h264_mode0", "Use mode 0 for H.264 in RTP", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ 80cabdff1aSopenharmony_ci { "send_bye", "Send RTCP BYE packets when finishing", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_SEND_BYE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \ 81cabdff1aSopenharmony_ci 82cabdff1aSopenharmony_civoid ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); 83cabdff1aSopenharmony_ci 84cabdff1aSopenharmony_civoid ff_rtp_send_h264_hevc(AVFormatContext *s1, const uint8_t *buf1, int size); 85cabdff1aSopenharmony_civoid ff_rtp_send_h261(AVFormatContext *s1, const uint8_t *buf1, int size); 86cabdff1aSopenharmony_civoid ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size); 87cabdff1aSopenharmony_civoid ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf1, int size, 88cabdff1aSopenharmony_ci const uint8_t *mb_info, int mb_info_size); 89cabdff1aSopenharmony_civoid ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size); 90cabdff1aSopenharmony_civoid ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size); 91cabdff1aSopenharmony_civoid ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size); 92cabdff1aSopenharmony_civoid ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size); 93cabdff1aSopenharmony_civoid ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size); 94cabdff1aSopenharmony_civoid ff_rtp_send_vc2hq(AVFormatContext *s1, const uint8_t *buf, int size, int interlaced); 95cabdff1aSopenharmony_civoid ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size); 96cabdff1aSopenharmony_civoid ff_rtp_send_vp9(AVFormatContext *s1, const uint8_t *buff, int size); 97cabdff1aSopenharmony_civoid ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buff, int size); 98cabdff1aSopenharmony_civoid ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size, int interlaced, int field); 99cabdff1aSopenharmony_ci 100cabdff1aSopenharmony_ciconst uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *av_restrict start, 101cabdff1aSopenharmony_ci const uint8_t *av_restrict end); 102cabdff1aSopenharmony_ci 103cabdff1aSopenharmony_ci#endif /* AVFORMAT_RTPENC_H */ 104