From: Tristan Matthews <tmatth@videolan.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Steven Liu <lq@chinaffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v1 2/2] avformat/rtmpproto: support enhanced rtmp
Date: Thu, 24 Aug 2023 16:10:59 -0400
Message-ID: <CAN8HRD==Ecn3kZHs-YM=D04uj55hZrduYwmgCUWLJ15+=pqcbg@mail.gmail.com> (raw)
In-Reply-To: <20230824053213.982-2-lq@chinaffmpeg.org>
Hi,
On Thu, Aug 24, 2023 at 1:32 AM Steven Liu <lq@chinaffmpeg.org> wrote:
>
> add option named rtmp_enhanced_codec,
> it would support hvc1,av01,vp09 now,
> the fourcc is using Array of strings.
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
> doc/protocols.texi | 6 ++++++
> libavformat/rtmpproto.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 44 insertions(+)
>
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index b3fad55591..f2930fb3a2 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -896,6 +896,12 @@ 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_codec
> +Specify that the media is an enhanced rtmp live stream. This option should
> +set a sting like @code{hvc1,av01,vp09} for multiple codecs, or @code{hvc1}
I think this should be more like "Specify the codecs to use in an
enhanced rtmp live stream", the wording here makes it sound more like
a boolean flag.
Also nit: "set a string"
> +for only one codec, set codec fourcc into fourCcLive property into
> +Connect Command Message,
> +
> @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..f7ce04244f 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -127,6 +127,7 @@ typedef struct RTMPContext {
> 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)
> int tcp_nodelay; ///< Use TCP_NODELAY to disable Nagle's algorithm if set to 1
> + char *enhanced; ///< codecs list in enhanced rtmp
nit: "codec list"
> char username[50];
> char password[50];
> char auth_params[500];
> @@ -336,6 +337,42 @@ 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) {
> + uint32_t list_len = 0;
> + char *fourcc_data = rt->enhanced;
> + int fourcc_str_len = fourcc_data ? strlen(fourcc_data) : 0;
> +
> + // check the string, fourcc + ',' + ... + end fourcc correct length should be (4+1)*n+4
> + if ((fourcc_str_len + 1) % 5 != 0)
> + return AVERROR(EINVAL);
> +
> + list_len = (fourcc_str_len + 1) / 5;
> + // write the fourCcList field name
> + ff_amf_write_field_name(&p, "fourCcList");
> +
> + // write the fourcc array length
> + ff_amf_write_array(&p, list_len);
> +
> + while(fourcc_data) {
> + unsigned char fourcc[5];
> + switch (*(uint32_t *)fourcc_data) {
> + case MKTAG('h', 'v', 'c', '1'):
> + case MKTAG('a', 'v', '0', '1'):
> + case MKTAG('v', 'p', '0', '9'):
> + strncpy(fourcc, fourcc_data, 4);
> + fourcc[4] = '\0';
> + ff_amf_write_string(&p, fourcc);
> + break;
> + default:
> + return AVERROR(EINVAL);
> + }
> +
> + fourcc_data += (fourcc_str_len - (fourcc_data - rt->enhanced)) > 4 ? 5 : 4;
> + if (fourcc_data - rt->enhanced >= fourcc_str_len)
> + break;
> + }
> + }
> +
> if (!rt->is_input) {
> ff_amf_write_field_name(&p, "type");
> ff_amf_write_string(&p, "nonprivate");
> @@ -3104,6 +3141,7 @@ 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_codec", "Specify that the codec in enhanced rtmp live stream", OFFSET(enhanced), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, ENC},
I think this should be more like "Specify the codec(s) to use in an
enhanced rtmp live stream" ?
> {"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.40.0
>
> _______________________________________________
> 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".
_______________________________________________
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".
next prev parent reply other threads:[~2023-08-24 20:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 5:32 [FFmpeg-devel] [PATCH v1 1/2] avformat/rtmppkt: add ff_amf_write_array for write array strings Steven Liu
2023-08-24 5:32 ` [FFmpeg-devel] [PATCH v1 2/2] avformat/rtmpproto: support enhanced rtmp Steven Liu
2023-08-24 20:10 ` Tristan Matthews [this message]
2023-08-24 21:45 ` Marton Balint
2023-08-25 5:30 ` [FFmpeg-devel] [PATCH v2 1/2] avformat/rtmppkt: add ff_amf_write_array for write array strings Steven Liu
2023-08-25 5:30 ` [FFmpeg-devel] [PATCH v2 2/2] avformat/rtmpproto: support enhanced rtmp Steven Liu
2023-08-25 9:04 ` Martin Storsjö
2023-08-25 9:11 ` Steven Liu
2023-08-25 9:38 ` Martin Storsjö
2023-08-25 10:00 ` Steven Liu
2023-08-25 10:06 ` Martin Storsjö
2023-08-25 10:05 ` [FFmpeg-devel] [PATCH v3 1/2] avformat/rtmppkt: add ff_amf_write_array for write Steven Liu
2023-08-25 10:05 ` [FFmpeg-devel] [PATCH v3 2/2] avformat/rtmpproto: support enhanced rtmp Steven Liu
2023-08-25 10:09 ` Steven Liu
2023-08-26 7:49 ` Marton Balint
2023-08-26 8:28 ` Steven Liu
2023-08-26 9:25 ` Marton Balint
2023-08-28 2:00 ` [FFmpeg-devel] [PATCH v4 1/2] avformat/rtmppkt: add ff_amf_write_array for write Steven Liu
2023-08-28 2:00 ` [FFmpeg-devel] [PATCH v4 2/2] avformat/rtmpproto: support enhanced rtmp Steven Liu
2023-08-28 19:33 ` Marton Balint
2023-08-29 1:06 ` Steven Liu
2023-08-25 5:33 ` [FFmpeg-devel] [PATCH v1 " Steven Liu
2023-08-25 5:32 ` Steven Liu
2023-08-24 20:47 ` [FFmpeg-devel] [PATCH v1 1/2] avformat/rtmppkt: add ff_amf_write_array for write array strings Marton Balint
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='CAN8HRD==Ecn3kZHs-YM=D04uj55hZrduYwmgCUWLJ15+=pqcbg@mail.gmail.com' \
--to=tmatth@videolan.org \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=lq@chinaffmpeg.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