Skip to content

Commit 9587390

Browse files
committed
WHIP: Add WebRTC WHIP muxer.
1 parent feeeefc commit 9587390

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@
4141
/src
4242
/mapfile
4343
/tools/python/__pycache__/
44+
.idea

libavformat/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ OBJS-$(CONFIG_RSD_DEMUXER) += rsd.o
492492
OBJS-$(CONFIG_RPL_DEMUXER) += rpl.o
493493
OBJS-$(CONFIG_RSO_DEMUXER) += rsodec.o rso.o pcm.o
494494
OBJS-$(CONFIG_RSO_MUXER) += rsoenc.o rso.o rawenc.o
495+
OBJS-$(CONFIG_RTC_MUXER) += rtcenc.o avc.o
495496
OBJS-$(CONFIG_RTP_MPEGTS_MUXER) += rtpenc_mpegts.o
496497
OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
497498
rtpenc_aac.o \

libavformat/allformats.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ extern const AVInputFormat ff_rpl_demuxer;
391391
extern const AVInputFormat ff_rsd_demuxer;
392392
extern const AVInputFormat ff_rso_demuxer;
393393
extern const FFOutputFormat ff_rso_muxer;
394+
extern const FFOutputFormat ff_rtc_muxer;
394395
extern const AVInputFormat ff_rtp_demuxer;
395396
extern const FFOutputFormat ff_rtp_muxer;
396397
extern const FFOutputFormat ff_rtp_mpegts_muxer;

libavformat/rtcenc.c

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* FLV muxer
3+
* Copyright (c) 2003 The FFmpeg Project
4+
*
5+
* This file is part of FFmpeg.
6+
*
7+
* FFmpeg is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* FFmpeg is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with FFmpeg; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
22+
#include "libavutil/dict.h"
23+
#include "libavutil/avassert.h"
24+
#include "libavutil/mathematics.h"
25+
#include "libavcodec/codec_desc.h"
26+
#include "libavcodec/mpeg4audio.h"
27+
#include "avformat.h"
28+
#include "internal.h"
29+
#include "mux.h"
30+
#include "libavutil/opt.h"
31+
32+
typedef struct RTCContext {
33+
AVClass *av_class;
34+
} RTCContext;
35+
36+
static int rtc_init(struct AVFormatContext *s)
37+
{
38+
return 0;
39+
}
40+
41+
static int rtc_write_header(struct AVFormatContext *s)
42+
{
43+
return 0;
44+
}
45+
46+
static int rtc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
47+
{
48+
return 0;
49+
}
50+
51+
static int rtc_write_trailer(struct AVFormatContext *s)
52+
{
53+
return 0;
54+
}
55+
56+
static void rtc_deinit(struct AVFormatContext *s)
57+
{
58+
}
59+
60+
static const AVOption options[] = {
61+
{ NULL },
62+
};
63+
64+
static const AVClass rtc_muxer_class = {
65+
.class_name = "RTC WHIP muxer",
66+
.item_name = av_default_item_name,
67+
.option = NULL,
68+
.version = LIBAVUTIL_VERSION_INT,
69+
};
70+
71+
const FFOutputFormat ff_rtc_muxer = {
72+
.p.name = "rtc",
73+
.p.long_name = NULL_IF_CONFIG_SMALL("WebRTC WHIP muxer"),
74+
.p.audio_codec = AV_CODEC_ID_OPUS,
75+
.p.video_codec = AV_CODEC_ID_H264,
76+
.p.flags = AVFMT_NOFILE,
77+
.p.priv_class = &rtc_muxer_class,
78+
.priv_data_size = sizeof(RTCContext),
79+
.init = rtc_init,
80+
.write_header = rtc_write_header,
81+
.write_packet = rtc_write_packet,
82+
.write_trailer = rtc_write_trailer,
83+
.deinit = rtc_deinit,
84+
};

0 commit comments

Comments
 (0)