Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Steven Liu <lq@chinaffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Steven Liu <lq@chinaffmpeg.org>
Subject: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
Date: Sun, 20 Aug 2023 12:10:10 +0800
Message-ID: <20230820041010.34334-1-lq@chinaffmpeg.org> (raw)

As the enhanced rtmp Extending NetConnection connect Command section
said, the rtmp should add a property named fourCcLive, but there should
only one codec can be set for the video stream in rtmp+flv, so user can
use the option rtmp_enhanced_flags to set the enhanced rtmp with av1,
hevc or vp9.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 doc/protocols.texi      | 17 +++++++++++++++++
 libavformat/rtmpproto.c | 22 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index b3fad55591..b5ab023066 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -896,6 +896,23 @@ be named, by prefixing the type with 'N' and specifying the name before
 the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
 times to construct arbitrary AMF sequences.
 
+@item rtmp_enhanced_flags @var{flags}
+Specify that the media is an enhanced rtmp live stream. This option have
+three flags, set one of them into fourCcLive property into Connect Command Message,
+The default is @{none}.
+
+@table @samp
+@item av1
+If the rtmp_enhanced_flags set av1, the video stream in enhanced rtmp is av1.
+
+@item hevc
+If the rtmp_enhanced_flags set hevc, the video stream in enhanced rtmp is hevc.
+
+@item vp9
+If the rtmp_enhanced_flags set vp9, the video stream in enhanced rtmp is vp9.
+
+@end table
+
 @item rtmp_flashver
 Version of the Flash plugin used to run the SWF player. The default
 is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index f0ef223f05..9dcc4bdc3a 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -69,6 +69,13 @@ typedef enum {
     STATE_STOPPED,    ///< the broadcast has been stopped
 } ClientState;
 
+typedef enum {
+    ENHANCED_NONE,
+    ENHANCED_AV1,
+    ENHANCED_HEVC,
+    ENHANCED_VP9,
+} EnhancedFlags;
+
 typedef struct TrackedMethod {
     char *name;
     int id;
@@ -123,6 +130,7 @@ typedef struct RTMPContext {
     int           nb_tracked_methods;         ///< number of tracked methods
     int           tracked_methods_size;       ///< size of the tracked methods buffer
     int           listen;                     ///< listen mode flag
+    int           enhanced_flags;             ///< 0: none, 1: av1, 2: hevc, 3: vp9
     int           listen_timeout;             ///< listen timeout to wait for new connections
     int           nb_streamid;                ///< The next stream id to return on createStream calls
     double        duration;                   ///< Duration of the stream in seconds as returned by the server (only valid if non-zero)
@@ -336,6 +344,16 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
     ff_amf_write_field_name(&p, "app");
     ff_amf_write_string2(&p, rt->app, rt->auth_params);
 
+    if (rt->enhanced_flags > 0)
+        ff_amf_write_field_name(&p, "fourCcList");
+
+    if (rt->enhanced_flags == ENHANCED_AV1)
+        ff_amf_write_string(&p, "av01");
+    else if (rt->enhanced_flags == ENHANCED_HEVC)
+        ff_amf_write_string(&p, "hevc");
+    else if (rt->enhanced_flags == ENHANCED_VP9)
+        ff_amf_write_string(&p, "vp9");
+
     if (!rt->is_input) {
         ff_amf_write_field_name(&p, "type");
         ff_amf_write_string(&p, "nonprivate");
@@ -3104,6 +3122,10 @@ static const AVOption rtmp_options[] = {
     {"rtmp_conn", "Append arbitrary AMF data to the Connect message", OFFSET(conn), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
     {"rtmp_flashver", "Version of the Flash plugin used to run the SWF player.", OFFSET(flashver), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
     {"rtmp_flush_interval", "Number of packets flushed in the same request (RTMPT only).", OFFSET(flush_interval), AV_OPT_TYPE_INT, {.i64 = 10}, 0, INT_MAX, ENC},
+    {"rtmp_enhanced_flags", "Specify that the media is an enhanced rtmp live stream", OFFSET(enhanced_flags), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 3, ENC, "rtmp_enhanced_flags"},
+    {"av1", "enhanced rtmp with av1 codec", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, ENC, "rtmp_enhanced_flags"},
+    {"hevc", "enhanced rtmp with hevc codec", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, ENC, "rtmp_enhanced_flags"},
+    {"vp9", "enhanced rtmp with vp9 codec", 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, ENC, "rtmp_enhanced_flags"},
     {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {.i64 = -2}, INT_MIN, INT_MAX, DEC, "rtmp_live"},
     {"any", "both", 0, AV_OPT_TYPE_CONST, {.i64 = -2}, 0, 0, DEC, "rtmp_live"},
     {"live", "live stream", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, DEC, "rtmp_live"},
-- 
2.39.2 (Apple Git-143)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2023-08-20  4:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-20  4:10 Steven Liu [this message]
2023-08-20  8:28 ` Jean-Baptiste Kempf
2023-08-21  1:35   ` Steven Liu
2023-08-23 15:39     ` Jean-Baptiste Kempf
2023-08-23 16:17       ` Martin Storsjö
2023-08-23 17:40         ` Marton Balint
2023-08-24  5:33           ` Steven Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230820041010.34334-1-lq@chinaffmpeg.org \
    --to=lq@chinaffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git