From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 712F045F3A for ; Sun, 20 Aug 2023 04:10:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E2A9968C5FC; Sun, 20 Aug 2023 07:10:37 +0300 (EEST) Received: from bg2.exmail.qq.com (bg2.exmail.qq.com [114.132.123.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B8CB368C3CB for ; Sun, 20 Aug 2023 07:10:29 +0300 (EEST) X-QQ-mid: bizesmtp76t1692504613t0e5hfei Received: from localhost ( [221.216.148.250]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 20 Aug 2023 12:10:11 +0800 (CST) X-QQ-SSF: 01100000000000Z0Z000000A0000000 X-QQ-FEAT: v2TBAhtyi5GZw45GEC1cILUq0VuMlSabqJQAnI2Kv+V7MVq9MA8HT8PncqCGn 6lbGehP0pw1j8O3ml6ZvPI6LQojBQV6UKWl61fksxVvKBILNv/EgFz3GBv/JAZ3oUfXEfru q+YejvMh/2EyDpHILvHEMx3xJroX/ruvB6808TH+10w7ovp5WD0uhMoHPmuF2FngGzPa5lp kX27E3lc5V8Sm2HwKY46gKriVZqVgfavLE/hgn2oryvHdMu+i+zv3ujLbOJkF2vaLzDJ+j/ /+Fvm16b45zbQnTEXZ/BbrjCnzf72RQLiv5YIA8uV8bYQDPi6nJvJUsQuRVk/ASCDIeKmno YcowvNEt3LHGzP6uxiR+HM+Flnb2w== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 3521603281204034661 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Aug 2023 12:10:10 +0800 Message-Id: <20230820041010.34334-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-0 Subject: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 --- 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".