Re: [FFmpeg-devel] [PATCH v2 1/1] libavdevice/decklink: extend available actions on signal loss

2024-05-21 Thread Michael Riedl
On 5/14/24 21:39, Marton Balint wrote:
>
>
> On Tue, 14 May 2024, Michael Riedl wrote:
>
>>>
>>>> Deprecate the option 'draw_bars' in favor of the new option 
>>>> 'signal_loss_action',
>>>> which controls the behavior when the input signal is not available
>>>> (including the behavior previously available through draw_bars).
>>>> The default behavior remains unchanged to be backwards compatible.
>>>> The new option is more flexible for extending now and in the future.
>>>>
>>>> The new value 'repeat' repeats the last video frame.
>>>> This is useful for very short dropouts and was not available before.
>>>
>>> As far as I see, you are overriding frameBytes for a repeated frame, that 
>>> seems wrong. pkt.data (frameBytes) must be associated with the videoFrame 
>>> which is passed to av_buffer_create() later on.
>>>
>>> Every AVFrame returned by the decklink device has an AVBuffer set up which
>>> keeps a reference to the original DeckLink frame. This allows the use of 
>>> the DeckLink frame's raw buffer directly. But you cannot use the raw buffer 
>>> of another DeckLink frame for which the AVBuffer of the AVFrame does not 
>>> keep a reference.
>>
>> Thank you for your feedback!
>>
>> I took another look at the code and revisited the DeckLink documentation to 
>> ensure my understanding was correct. It seems that frameBytes is a pointer 
>> to the buffer of an IDeckLinkVideoFrame, and it remains valid as long as the 
>> videoFrame is not released.
>
> That is just it. You are releasing the repeated frame as soon as a valid 
> frame comes in. The AVPacket data you previously returned will still point to 
> the now released frameBytes. As I wrote above, the decklink frame 
> corresponding to the returned frameBytes must be released in the destructor 
> of the AVPacket buffer.

Took me a while to understand the issue, thank you for pointing that out. If I 
understand it correctly, the issue is fixed when the AVBuffer references the 
corresponding video frame that manages frameBytes. Does the change below look 
good to you?


diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index e10fd5d6569..a6f9c4e0b3c 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -734,6 +734,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 BMDTimeValue frameDuration;
 int64_t wallclock = 0, abs_wallclock = 0;
 struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
+    IDeckLinkVideoInputFrame *currentVideoFrame = videoFrame; // video frame 
that holds frameBytes
 
 if (ctx->autodetect) {
 if (videoFrame && !(videoFrame->GetFlags() & bmdFrameHasNoInputSource) 
&&
@@ -790,7 +791,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 *p++ = bars[(x * 8) / width];
 }
 } else if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
-    last_video_frame->GetBytes();
+    currentVideoFrame = last_video_frame;
+    currentVideoFrame->GetBytes();
 }
 
 if (!no_video) {
@@ -866,8 +868,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 pkt.flags   |= AV_PKT_FLAG_KEY;
 pkt.stream_index = ctx->video_st->index;
 pkt.data = (uint8_t *)frameBytes;
-    pkt.size = videoFrame->GetRowBytes() *
-   videoFrame->GetHeight();
+    pkt.size = currentVideoFrame->GetRowBytes() *
+   currentVideoFrame->GetHeight();
 //fprintf(stderr,"Video Frame size %d ts %d\n", pkt.size, pkt.pts);
 
 if (!no_video) {
@@ -943,9 +945,9 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 }
 }
 
-    pkt.buf = av_buffer_create(pkt.data, pkt.size, decklink_object_free, 
videoFrame, 0);
+    pkt.buf = av_buffer_create(pkt.data, pkt.size, decklink_object_free, 
currentVideoFrame, 0);
 if (pkt.buf)
-    videoFrame->AddRef();
+    currentVideoFrame->AddRef();
 
 if (ff_decklink_packet_queue_put(>queue, ) < 0) {
 ++ctx->dropped;

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

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


[FFmpeg-devel] [PATCH v3 1/1] libavdevice/decklink: extend available actions on signal loss

2024-05-14 Thread Michael Riedl
Deprecate the option 'draw_bars' in favor of the new option 
'signal_loss_action',
which controls the behavior when the input signal is not available
(including the behavior previously available through draw_bars).
The default behavior remains unchanged to be backwards compatible.
The new option is more flexible for extending now and in the future.

The new value 'repeat' repeats the last video frame.
This is useful for very short dropouts and was not available before.

Signed-off-by: Michael Riedl 
---
 doc/indevs.texi | 16 
 libavdevice/decklink_common.h   |  1 +
 libavdevice/decklink_common_c.h |  7 +++
 libavdevice/decklink_dec.cpp| 24 +++-
 libavdevice/decklink_dec_c.c|  6 +-
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 734fc657523..cdf44a66382 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -396,6 +396,22 @@ Defaults to @samp{audio}.
 @item draw_bars
 If set to @samp{true}, color bars are drawn in the event of a signal loss.
 Defaults to @samp{true}.
+This option is deprecated, please use the @code{signal_loss_action} option.
+
+@item signal_loss_action
+Sets the action to take in the event of a signal loss. Accepts one of the
+following values:
+
+@table @option
+@item 1, none
+Do nothing on signal loss. This usually results in black frames.
+@item 2, bars
+Draw color bars on signal loss. Only supported for 8-bit input signals.
+@item 3, repeat
+Repeat the last video frame on signal loss.
+@end table
+
+Defaults to @samp{bars}.
 
 @item queue_size
 Sets maximum input buffer size in bytes. If the buffering reaches this value,
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index c54a635876c..6b32dc2d09c 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -147,6 +147,7 @@ struct decklink_ctx {
 DecklinkPtsSource video_pts_source;
 int draw_bars;
 BMDPixelFormat raw_format;
+DecklinkSignalLossAction signal_loss_action;
 
 int frames_preroll;
 int frames_buffer;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 9c55d891494..53d2c583e7e 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -37,6 +37,12 @@ typedef enum DecklinkPtsSource {
 PTS_SRC_NB
 } DecklinkPtsSource;
 
+typedef enum DecklinkSignalLossAction {
+SIGNAL_LOSS_NONE= 1,
+SIGNAL_LOSS_REPEAT  = 2,
+SIGNAL_LOSS_BARS= 3
+} DecklinkSignalLossAction;
+
 struct decklink_cctx {
 const AVClass *cclass;
 
@@ -68,6 +74,7 @@ struct decklink_cctx {
 int64_t timestamp_align;
 int timing_offset;
 int wait_for_tc;
+DecklinkSignalLossAction signal_loss_action;
 };
 
 #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 671573853ba..e10fd5d6569 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -593,6 +593,7 @@ private:
 int no_video;
 int64_t initial_video_pts;
 int64_t initial_audio_pts;
+IDeckLinkVideoInputFrame* last_video_frame;
 };
 
 decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : 
_refs(1)
@@ -602,10 +603,13 @@ 
decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : _ref
 ctx = (struct decklink_ctx *)cctx->ctx;
 no_video = 0;
 initial_audio_pts = initial_video_pts = AV_NOPTS_VALUE;
+last_video_frame = nullptr;
 }
 
 decklink_input_callback::~decklink_input_callback()
 {
+if (last_video_frame)
+last_video_frame->Release();
 }
 
 ULONG decklink_input_callback::AddRef(void)
@@ -773,7 +777,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
   ctx->video_st->time_base.den);
 
 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
-if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
bmdFormat8BitYUV) {
+if (ctx->signal_loss_action == SIGNAL_LOSS_BARS && 
videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
 unsigned bars[8] = {
 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
@@ -785,6 +789,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 for (int x = 0; x < width; x += 2)
 *p++ = bars[(x * 8) / width];
 }
+} else if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+last_video_frame->GetBytes();
 }
 
 if (!no_video) {
@@ -793,6 +799,12 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 }
 no_video = 1;
 } else {
+if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+if (last_

[FFmpeg-devel] [PATCH v3 0/1] Updated decklink patch

2024-05-14 Thread Michael Riedl
Hi,

This patch adds the possibility to specify an action to be taken when a signal 
loss is detected on a decklink device.
Version 3 of this patch fixes a memory leak present in v2. Thanks to Marton 
Balint for reviewing the patch.

Kind regards,
Michael


Michael Riedl (1):
  libavdevice/decklink: extend available actions on signal loss

 doc/indevs.texi | 16 
 libavdevice/decklink_common.h   |  1 +
 libavdevice/decklink_common_c.h |  7 +++
 libavdevice/decklink_dec.cpp| 24 +++-
 libavdevice/decklink_dec_c.c|  6 +-
 5 files changed, 52 insertions(+), 2 deletions(-)

--
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 1/1] libavdevice/decklink: extend available actions on signal loss

2024-05-14 Thread Michael Riedl
>
>> Deprecate the option 'draw_bars' in favor of the new option 
>> 'signal_loss_action',
>> which controls the behavior when the input signal is not available
>> (including the behavior previously available through draw_bars).
>> The default behavior remains unchanged to be backwards compatible.
>> The new option is more flexible for extending now and in the future.
>>
>> The new value 'repeat' repeats the last video frame.
>> This is useful for very short dropouts and was not available before.
>
> As far as I see, you are overriding frameBytes for a repeated frame, that 
> seems wrong. pkt.data (frameBytes) must be associated with the videoFrame 
> which is passed to av_buffer_create() later on.
>
> Every AVFrame returned by the decklink device has an AVBuffer set up which
> keeps a reference to the original DeckLink frame. This allows the use of the 
> DeckLink frame's raw buffer directly. But you cannot use the raw buffer of 
> another DeckLink frame for which the AVBuffer of the AVFrame does not keep a 
> reference.

Thank you for your feedback!

I took another look at the code and revisited the DeckLink documentation to 
ensure my understanding was correct. It seems that frameBytes is a pointer to 
the buffer of an IDeckLinkVideoFrame, and it remains valid as long as the 
videoFrame is not released. To handle this, I add a reference to the DeckLink 
videoFrame to keep it valid and then release it (decreasing the reference 
counter) when it's no longer needed. Updating frameBytes multiple times should 
be okay since it just points to the raw frame buffer.

I ran some tests using Valgrind with and without the repeat option. I found a 
memory leak introduced by the patch because the destructor of 
decklink_input_callback is never called, which leaves one last video frame 
unreleased.

I'll work on fixing this memory leak and send an update soon. If you have any 
more comments or concerns, please let me know.

Best regards,
Michael Riedl

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

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


[FFmpeg-devel] [PATCH v2 1/1] libavdevice/decklink: extend available actions on signal loss

2024-04-23 Thread Michael Riedl
Deprecate the option 'draw_bars' in favor of the new option 
'signal_loss_action',
which controls the behavior when the input signal is not available
(including the behavior previously available through draw_bars).
The default behavior remains unchanged to be backwards compatible.
The new option is more flexible for extending now and in the future.

The new value 'repeat' repeats the last video frame.
This is useful for very short dropouts and was not available before.

Signed-off-by: Michael Riedl 
---
 doc/indevs.texi | 16 
 libavdevice/decklink_common.h   |  1 +
 libavdevice/decklink_common_c.h |  7 +++
 libavdevice/decklink_dec.cpp| 23 ++-
 libavdevice/decklink_dec_c.c|  6 +-
 5 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 734fc657523..cdf44a66382 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -396,6 +396,22 @@ Defaults to @samp{audio}.
 @item draw_bars
 If set to @samp{true}, color bars are drawn in the event of a signal loss.
 Defaults to @samp{true}.
+This option is deprecated, please use the @code{signal_loss_action} option.
+
+@item signal_loss_action
+Sets the action to take in the event of a signal loss. Accepts one of the
+following values:
+
+@table @option
+@item 1, none
+Do nothing on signal loss. This usually results in black frames.
+@item 2, bars
+Draw color bars on signal loss. Only supported for 8-bit input signals.
+@item 3, repeat
+Repeat the last video frame on signal loss.
+@end table
+
+Defaults to @samp{bars}.
 
 @item queue_size
 Sets maximum input buffer size in bytes. If the buffering reaches this value,
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index c54a635876c..6b32dc2d09c 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -147,6 +147,7 @@ struct decklink_ctx {
 DecklinkPtsSource video_pts_source;
 int draw_bars;
 BMDPixelFormat raw_format;
+DecklinkSignalLossAction signal_loss_action;
 
 int frames_preroll;
 int frames_buffer;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 9c55d891494..53d2c583e7e 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -37,6 +37,12 @@ typedef enum DecklinkPtsSource {
 PTS_SRC_NB
 } DecklinkPtsSource;
 
+typedef enum DecklinkSignalLossAction {
+SIGNAL_LOSS_NONE= 1,
+SIGNAL_LOSS_REPEAT  = 2,
+SIGNAL_LOSS_BARS= 3
+} DecklinkSignalLossAction;
+
 struct decklink_cctx {
 const AVClass *cclass;
 
@@ -68,6 +74,7 @@ struct decklink_cctx {
 int64_t timestamp_align;
 int timing_offset;
 int wait_for_tc;
+DecklinkSignalLossAction signal_loss_action;
 };
 
 #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 671573853ba..1c2d08ea9fc 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -593,6 +593,7 @@ private:
 int no_video;
 int64_t initial_video_pts;
 int64_t initial_audio_pts;
+IDeckLinkVideoInputFrame* last_video_frame;
 };
 
 decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : 
_refs(1)
@@ -602,10 +603,13 @@ 
decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : _ref
 ctx = (struct decklink_ctx *)cctx->ctx;
 no_video = 0;
 initial_audio_pts = initial_video_pts = AV_NOPTS_VALUE;
+last_video_frame = nullptr;
 }
 
 decklink_input_callback::~decklink_input_callback()
 {
+if (last_video_frame)
+last_video_frame->Release();
 }
 
 ULONG decklink_input_callback::AddRef(void)
@@ -773,7 +777,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
   ctx->video_st->time_base.den);
 
 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
-if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
bmdFormat8BitYUV) {
+if (ctx->signal_loss_action == SIGNAL_LOSS_BARS && 
videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
 unsigned bars[8] = {
 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
@@ -785,6 +789,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 for (int x = 0; x < width; x += 2)
 *p++ = bars[(x * 8) / width];
 }
+} else if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+last_video_frame->GetBytes();
 }
 
 if (!no_video) {
@@ -793,6 +799,12 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 }
 no_video = 1;
 } else {
+if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+if (last_

[FFmpeg-devel] [PATCH v2 0/1] Updated decklink patch

2024-04-23 Thread Michael Riedl
Hi,

This patch adds the possibility to specify an action to be taken when a signal 
loss is detected on a decklink device.
I have updated the patch from September 2023 to latest master branch (as of 
today).
I would be grateful if this patch could be reviewed and merged.

Kind regards,
Michael


Michael Riedl (1):
  libavdevice/decklink: extend available actions on signal loss

 doc/indevs.texi | 16 
 libavdevice/decklink_common.h   |  1 +
 libavdevice/decklink_common_c.h |  7 +++
 libavdevice/decklink_dec.cpp| 23 ++-
 libavdevice/decklink_dec_c.c|  6 +-
 5 files changed, 51 insertions(+), 2 deletions(-)

--
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2024-03-05 Thread Michael Riedl
Ping. 

Anything missing or wrong with this patch?


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

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


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2024-01-09 Thread Michael Riedl
On 11/28/23 16:48, Devin Heitmueller wrote:
> My apologies, I saw your remarks that this didn't change backward
> compatibility but failed to reply.  I have no further issues with this
> patch.
>
> Thanks,
>
> Devin

Ping.

Can this please be merged? Thanks.

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

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


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2023-11-28 Thread Michael Riedl
Ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 0/6] WebRTC sub-second live streaming support

2023-11-27 Thread Michael Riedl
On 11/15/23 22:45, Michael Niedermayer wrote:
> On Tue, Nov 14, 2023 at 01:59:48PM +0100, Michael Riedl wrote:
>> On 11/14/23 11:05, Tomas Härdin wrote:
>>> This patchset is missing tests. I know that we for some reason don't
>>> really have tests for protocols, but I feel the issue is worthwhile to
>>> bring up. I've worked a bit with WebRTC recently and it's fiddly, so
>>> it'd be nice to have some automated thing that keeps track of which
>>> WebRTC implementations this works with. Or maybe this is better handled
>>> with an external project, testing which implementations interoperate?
>>
>> I agree that having automated tests would be useful for stability in the 
>> future.
>> I tested the patchset with both SRS and Millicast, and it worked well.
>>
>> For automated testing, we could use FATE, but it needs an extra server with
>> protection and someone to keep it updated. Testing with paid services like
>> Millicast is tricky.
>>
>> Another option is an external project for WebRTC testing, but the challenge 
>> is
>> keeping it maintained and compatible with changes in implementations.
>>
>> External services might update their software, causing issues with tests. We
>> would need a plan for dealing with that.
>>
>> For paid services like Millicast, we need to figure out who pays for the 
>> tests.
>> Understanding the costs is essential if we want to use paid services for
>> testing.
>>
>> I'd like to hear your thoughts on these points and how you would propose to
>> proceed with adding tests for protocols like WebRTC.
> simple, add server support for this to FFmpeg.
>
> FATE is run in cases without network access (for example googles ossfuzz setup
> i belives does not permit the fuzzed code to access external things IIRC)
>
> The practice of implementing only one end of a protocol is honestly wrong.
> And if there is no usable free server, then even more so.
>
> thx

Server support was planned for later, but maybe it's better to do it now.
Multiple solutions are possible, but one solution requires adding 2 more
(de)muxers for server support to this patch series. It would also be possible to
split the patch series into 2 parts, one for WHIP client and server support and
one for WHEP client and server support. But I'm not sure which solution is
better.

My idea is to add 2 more (de)muxers for server support. This would allow us to
test the following:
- WHIP muxer (client) --> WHIP demuxer (server)
- WHEP muxer (server) --> WHEP demuxer (client)

Regardless, this will only test the implementation against itself. If that makes
sense and sounds reasonable, I will add the server support to this patch series.

Please let me know what you think.

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

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


[FFmpeg-devel] [PATCH] configure: fix linker error due to missing dependency

2023-11-15 Thread Michael Riedl
Add av1_parser to av1_decoder to fix undefined reference to 'ff_av1_framerate'.

To reproduce: ./configure --disable-everything --disable-autodetect 
--enable-encoder=av1

Signed-off-by: Michael Riedl 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 055d558c5a8..a2d19dbd578 100755
--- a/configure
+++ b/configure
@@ -2816,7 +2816,7 @@ asv1_encoder_select="aandcttables bswapdsp fdctdsp 
pixblockdsp"
 asv2_decoder_select="blockdsp bswapdsp idctdsp"
 asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
 atrac1_decoder_select="sinewin"
-av1_decoder_select="cbs_av1 atsc_a53"
+av1_decoder_select="cbs_av1 atsc_a53 av1_parser"
 bink_decoder_select="blockdsp hpeldsp"
 binkaudio_dct_decoder_select="wma_freqs"
 binkaudio_rdft_decoder_select="wma_freqs"
-- 
2.39.2

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

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


Re: [FFmpeg-devel] [PATCH v2 0/6] WebRTC sub-second live streaming support

2023-11-14 Thread Michael Riedl
On 11/14/23 11:05, Tomas Härdin wrote:
> This patchset is missing tests. I know that we for some reason don't
> really have tests for protocols, but I feel the issue is worthwhile to
> bring up. I've worked a bit with WebRTC recently and it's fiddly, so
> it'd be nice to have some automated thing that keeps track of which
> WebRTC implementations this works with. Or maybe this is better handled
> with an external project, testing which implementations interoperate?


I agree that having automated tests would be useful for stability in the future.
I tested the patchset with both SRS and Millicast, and it worked well.

For automated testing, we could use FATE, but it needs an extra server with
protection and someone to keep it updated. Testing with paid services like
Millicast is tricky.

Another option is an external project for WebRTC testing, but the challenge is
keeping it maintained and compatible with changes in implementations.

External services might update their software, causing issues with tests. We
would need a plan for dealing with that.

For paid services like Millicast, we need to figure out who pays for the tests.
Understanding the costs is essential if we want to use paid services for
testing.

I'd like to hear your thoughts on these points and how you would propose to
proceed with adding tests for protocols like WebRTC.


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

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


[FFmpeg-devel] [PATCH v2 6/6] libavformat/webrtc_mux: add WebRTC-HTTP ingestion protocol (WHIP) muxer

2023-11-07 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 Changelog  |   1 +
 configure  |   2 +
 doc/muxers.texi|  21 +++
 libavformat/Makefile   |   1 +
 libavformat/allformats.c   |   1 +
 libavformat/webrtc_mux.c (new) | 273 +
 6 files changed, 299 insertions(+)

diff --git a/Changelog b/Changelog
index 45c6c752a06..2604a2925bb 100644
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
 
 version :
 - WHEP demuxer
+- WHIP muxer
 
 
 version 6.1:
diff --git a/configure b/configure
index 02c6f7f2c5d..05cfbbb2376 100755
--- a/configure
+++ b/configure
@@ -3557,6 +3557,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel rtp_muxer"
+whip_muxer_select="http_protocol rtpenc_chain"
 whep_demuxer_deps="libdatachannel sdp_demuxer"
 whep_demuxer_select="http_protocol"
 wtv_demuxer_select="mpegts_demuxer riffdec"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index f6071484ff6..144b0638571 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2846,4 +2846,25 @@ ffmpeg -f webm_dash_manifest -i video1.webm \
manifest.xml
 @end example
 
+@section whip
+
+WebRTC-HTTP ingestion protocol (WHIP) muxer.
+
+This muxer allows sending audio and video streams to a remote media server
+using the WebRTC-HTTP ingestion protocol (WHIP) as defined in
+@url{https://datatracker.ietf.org/doc/draft-ietf-wish-whip/}.
+
+This muxer supports the following options:
+@table @option
+@item bearer_token
+Optional bearer token for authentication and authorization to the HTTP server.
+Default is @code{NULL}.
+@item connection_timeout
+Timeout for establishing a connection to the media server.
+Default is 10 seconds.
+@item rw_timeout
+Timeout for receiving/writing data from/to the media server.
+Default is 1 second.
+@end table
+
 @c man end MUXERS
diff --git a/libavformat/Makefile b/libavformat/Makefile
index f790fa8cae4..000fd308be2 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= webrtc.o webrtc_mux.o
 OBJS-$(CONFIG_WHEP_DEMUXER)  += webrtc.o webrtc_demux.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 7acb05634c8..2ad2a6dcba2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_whep_demuxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
diff --git a/libavformat/webrtc_mux.c b/libavformat/webrtc_mux.c
new file mode 100644
index 000..2a659ffa41b
--- /dev/null
+++ b/libavformat/webrtc_mux.c
@@ -0,0 +1,273 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/avstring.h"
+#include "libavutil/time.h"
+#include "mux.h"
+#include "rtpenc.h"
+#include "rtpenc_chain.h"
+#include "rtsp.h"
+#include "webrtc.h"
+#include "version.h"
+
+typedef struct WHIPContext {
+AVClass *av_class;
+WebRTCContext webrtc_ctx;
+} WHIPContext;
+
+
+static void whip_deinit(AVFormatContext* avctx);
+static int whip_init(AVFormatContext* a

[FFmpeg-devel] [PATCH v2 4/6] libavformat/webrtc: add common code for WebRTC streaming

2023-11-07 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 MAINTAINERS|   1 +
 libavformat/webrtc.c (new) | 410 +
 libavformat/webrtc.h (new) |  70 +++
 3 files changed, 481 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b66c3d09a68..840290c4514 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -505,6 +505,7 @@ Muxers/Demuxers:
   wav.c Michael Niedermayer
   wc3movie.cMike Melanson
   webm dash (matroskaenc.c) Vignesh Venkatasubramanian
+  webrtc*   Michael Riedl
   webvtt*   Matthew J Heaney
   westwood.cMike Melanson
   wtv.c Peter Ross
diff --git a/libavformat/webrtc.c b/libavformat/webrtc.c
new file mode 100644
index 000..c5a0ce8f5de
--- /dev/null
+++ b/libavformat/webrtc.c
@@ -0,0 +1,410 @@
+/*
+ * WebRTC-HTTP ingestion/egress protocol (WHIP/WHEP) common code
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/uuid.h"
+#include "libavutil/random_seed.h"
+#include "rtpenc_chain.h"
+#include "rtsp.h"
+#include "webrtc.h"
+
+static const char* webrtc_get_state_name(const rtcState state)
+{
+switch (state)
+{
+case RTC_NEW:
+return "RTC_NEW";
+case RTC_CONNECTING:
+return "RTC_CONNECTING";
+case RTC_CONNECTED:
+return "RTC_CONNECTED";
+case RTC_DISCONNECTED:
+return "RTC_DISCONNECTED";
+case RTC_FAILED:
+return "RTC_FAILED";
+case RTC_CLOSED:
+return "RTC_CLOSED";
+default:
+return "UNKNOWN";
+}
+}
+
+static void webrtc_log(const rtcLogLevel rtcLevel, const char *const message)
+{
+int level = AV_LOG_VERBOSE;
+switch (rtcLevel)
+{
+case RTC_LOG_NONE:
+level = AV_LOG_QUIET;
+break;
+case RTC_LOG_DEBUG:
+case RTC_LOG_VERBOSE:
+level = AV_LOG_DEBUG;
+break;
+case RTC_LOG_INFO:
+level = AV_LOG_VERBOSE;
+break;
+case RTC_LOG_WARNING:
+level = AV_LOG_WARNING;
+break;
+case RTC_LOG_ERROR:
+level = AV_LOG_ERROR;
+break;
+case RTC_LOG_FATAL:
+level = AV_LOG_FATAL;
+break;
+}
+
+av_log(NULL, level, "[libdatachannel] %s\n", message);
+}
+
+void ff_webrtc_init_logger(void)
+{
+rtcLogLevel level = RTC_LOG_VERBOSE;
+switch (av_log_get_level())
+{
+case AV_LOG_QUIET:
+level = RTC_LOG_NONE;
+break;
+case AV_LOG_DEBUG:
+level = RTC_LOG_DEBUG;
+break;
+case AV_LOG_VERBOSE:
+level = RTC_LOG_VERBOSE;
+break;
+case AV_LOG_WARNING:
+level = RTC_LOG_WARNING;
+break;
+case AV_LOG_ERROR:
+level = RTC_LOG_ERROR;
+break;
+case AV_LOG_FATAL:
+level = RTC_LOG_FATAL;
+break;
+}
+
+rtcInitLogger(level, webrtc_log);
+}
+
+int ff_webrtc_generate_media_stream_id(char media_stream_id[37])
+{
+int ret;
+AVUUID uuid;
+
+ret = av_random_bytes(uuid, sizeof(uuid));
+if (ret < 0) {
+goto fail;
+}
+av_uuid_unparse(uuid, media_stream_id);
+return 0;
+
+fail:
+return ret;
+}
+
+int ff_webrtc_create_resource(WebRTCContext*const ctx)
+{
+int ret;
+URLContext* h = NULL;
+char* headers = NULL;
+char offer_sdp[SDP_MAX_SIZE] = { 0 };
+char response_sdp[SDP_MAX_SIZE] = { 0 };
+
+/* set local description */
+if (rtcSetLocalDescription(ctx->peer_connection, "offer") != 
RTC_ERR_SUCCESS) {
+av_log(ctx->avctx, AV_LOG_ERROR, "Failed to set local description\n");
+ret = AVERROR_EXTERNAL;
+   

[FFmpeg-devel] [PATCH v2 5/6] libavformat/webrtc_demux: add WebRTC-HTTP egress protocol (WHEP) demuxer

2023-11-07 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 Changelog|   4 +
 configure|   2 +
 doc/demuxers.texi|  22 +++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/webrtc_demux.c (new) | 246 +++
 6 files changed, 276 insertions(+)

diff --git a/Changelog b/Changelog
index 8f0606fc267..45c6c752a06 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version :
+- WHEP demuxer
+
+
 version 6.1:
 - libaribcaption decoder
 - Playdate video decoder and demuxer
diff --git a/configure b/configure
index 187f16b425d..02c6f7f2c5d 100755
--- a/configure
+++ b/configure
@@ -3557,6 +3557,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whep_demuxer_deps="libdatachannel sdp_demuxer"
+whep_demuxer_select="http_protocol"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index ca1563abb03..81940b8ece7 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -943,4 +943,26 @@ which in turn, acts as a ceiling for the size of scripts 
that can be read.
 Default is 1 MiB.
 @end table
 
+@section whep
+
+WebRTC-HTTP egress protocol (WHEP) demuxer.
+
+This demuxers allows reading media from a remote media server using the
+WebRTC-HTTP egress protocol (WHEP) as defined in
+@url{https://datatracker.ietf.org/doc/draft-murillo-whep/02}. Currently, only a
+single video (H.264) and a single audio stream (OPUS) are supported.
+
+This demuxer accepts the following options:
+@table @option
+@item bearer_token
+Optional bearer token for authentication and authorization to the HTTP server.
+Default is @code{NULL}.
+@item connection_timeout
+Timeout for establishing a connection to the media server.
+Default is 10 seconds.
+@item rw_timeout
+Timeout for receiving/writing data from/to the media server.
+Default is 1 second.
+@end table
+
 @c man end DEMUXERS
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..f790fa8cae4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHEP_DEMUXER)  += webrtc.o webrtc_demux.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..7acb05634c8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const AVInputFormat  ff_whep_demuxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/webrtc_demux.c b/libavformat/webrtc_demux.c
new file mode 100644
index 000..391eea6d654
--- /dev/null
+++ b/libavformat/webrtc_demux.c
@@ -0,0 +1,246 @@
+/*
+ * WebRTC-HTTP egress protocol (WHEP) demuxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "libavutil/avstring.h"
+#include "libavutil/time.h"
+#include "libavutil/random_seed.h"
+#include "version.h"
+#include "rtsp.h"
+#include "webrtc.h"
+
+typedef struct WHEPContext {
+const AVClass *av_class

[FFmpeg-devel] [PATCH v2 3/6] configure: add libdatachannel as external library

2023-11-07 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 8ab658f7303..187f16b425d 100755
--- a/configure
+++ b/configure
@@ -223,6 +223,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1849,6 +1850,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -6708,6 +6710,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.5.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h rtcPreload 
-ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH v2 2/6] libavformat/sdp: remove whitespaces in fmtp

2023-11-07 Thread Michael Riedl
Whitespaces after semicolon breaks some servers

Signed-off-by: Michael Riedl 
---
 libavformat/sdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 68889362906..5ab017b1ba5 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -159,8 +159,8 @@ static int extradata2psets(AVFormatContext *s, const 
AVCodecParameters *par,
 {
 char *psets, *p;
 const uint8_t *r;
-static const char pset_string[] = "; sprop-parameter-sets=";
-static const char profile_string[] = "; profile-level-id=";
+static const char pset_string[] = ";sprop-parameter-sets=";
+static const char profile_string[] = ";profile-level-id=";
 uint8_t *extradata = par->extradata;
 int extradata_size = par->extradata_size;
 uint8_t *tmpbuf = NULL;
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH v2 1/6] libavformat/http: expose actual Location header value

2023-11-07 Thread Michael Riedl
This is needed for (de)muxers which need to access the Location header as 
transmitted when no redirection happend.

Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = 
HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header for 
POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH v2 0/6] WebRTC sub-second live streaming support

2023-11-07 Thread Michael Riedl
This patch series adds support for WHIP and WHEP (WebRTC-HTTP ingestion protocol
and WebRTC-HTTP egress protocol). It supersedes the previous patch series. Thank
you all for your feedback and suggestions!

The WHIP and WHEP are defined in the following draft RFCs:
- WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip
- WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

The implementation builds on FFmpeg's existing RTP, HTTP and SDP support as well
as libdatachannel for the rest. This library is much more lightweight than other
libraries (e.g. libwebrtc). At the same time, using this library avoids
reimplementing parts of WebRTC in FFmpeg.

This patch series was tested with WebRTC servers Dolby.io (formerly Millicast)
and SRS (https://github.com/ossrs/srs). Using a local server, an end-to-end
latency of 3 frames (50 ms at 60 fps) was measured with video-only output, and
12 frames (200 ms at 60 fps) with audio and video output. Using a DeckLink input
device, an end-to-end latency of about 4 frames (70 ms at 60 fps) was measured
with both, video-only and audio and video output.

Using a remote server, only the RTT is added to the end-to-end latency. For
example, using a server in Amsterdam (The Netherlands) from a location in
Salzburg (Austria), with RTT=18ms, an end-to-end latency of 50+18=68 ms was
measured for video-only output.


Michael Riedl (6):
  libavformat/http: expose actual Location header value
  libavformat/sdp: remove whitespaces in fmtp
  configure: add libdatachannel as external library
  libavformat/webrtc: add common code for WebRTC streaming
  libavformat/webrtc_demux: add WebRTC-HTTP egress protocol (WHEP)
demuxer
  libavformat/webrtc_mux: add WebRTC-HTTP ingestion protocol (WHIP)
muxer

 Changelog|   5 +
 MAINTAINERS  |   1 +
 configure|   7 +
 doc/demuxers.texi|  22 ++
 doc/muxers.texi  |  21 ++
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/http.c   |   1 +
 libavformat/sdp.c|   4 +-
 libavformat/webrtc.c (new)   | 410 +++
 libavformat/webrtc.h (new)   |  70 ++
 libavformat/webrtc_demux.c (new) | 246 +++
 libavformat/webrtc_mux.c (new)   | 273 
 13 files changed, 1062 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/webrtc.c
 create mode 100644 libavformat/webrtc.h
 create mode 100644 libavformat/webrtc_demux.c
 create mode 100644 libavformat/webrtc_mux.c

--
2.39.2

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

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


[FFmpeg-devel] [PATCH 6/6] libavformat/webrtc_mux: add WebRTC-HTTP ingestion protocol (WHIP) muxer

2023-11-06 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 configure|   2 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/webrtc_mux.c | 273 +++
 4 files changed, 277 insertions(+)
 create mode 100644 libavformat/webrtc_mux.c

diff --git a/configure b/configure
index 02c6f7f2c5d..05cfbbb2376 100755
--- a/configure
+++ b/configure
@@ -3557,6 +3557,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel rtp_muxer"
+whip_muxer_select="http_protocol rtpenc_chain"
 whep_demuxer_deps="libdatachannel sdp_demuxer"
 whep_demuxer_select="http_protocol"
 wtv_demuxer_select="mpegts_demuxer riffdec"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index f790fa8cae4..000fd308be2 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= webrtc.o webrtc_mux.o
 OBJS-$(CONFIG_WHEP_DEMUXER)  += webrtc.o webrtc_demux.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 7acb05634c8..2ad2a6dcba2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_whep_demuxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
diff --git a/libavformat/webrtc_mux.c b/libavformat/webrtc_mux.c
new file mode 100644
index 000..1fe30ecb278
--- /dev/null
+++ b/libavformat/webrtc_mux.c
@@ -0,0 +1,273 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/avstring.h"
+#include "libavutil/time.h"
+#include "mux.h"
+#include "rtpenc.h"
+#include "rtpenc_chain.h"
+#include "rtsp.h"
+#include "webrtc.h"
+#include "version.h"
+
+typedef struct WHIPContext {
+AVClass *av_class;
+DataChannelContext data_channel;
+} WHIPContext;
+
+
+static void whip_deinit(AVFormatContext* avctx);
+static int whip_init(AVFormatContext* avctx)
+{
+WHIPContext*const ctx = (WHIPContext*const)avctx->priv_data;
+AVStream* stream;
+const AVCodecParameters* codecpar;
+int i, ret;
+char media_stream_id[37] = { 0 };
+rtcTrackInit track_init;
+const AVChannelLayout supported_layout = AV_CHANNEL_LAYOUT_STEREO;
+const RTPMuxContext* rtp_mux_ctx;
+DataChannelTrack* track;
+char sdp_stream[SDP_MAX_SIZE] = { 0 };
+char* fmtp;
+
+ctx->data_channel.avctx = avctx;
+webrtc_init_logger();
+ret = webrtc_init_connection(>data_channel);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to initialize connection\n");
+goto fail;
+}
+
+if (!(ctx->data_channel.tracks = av_mallocz(sizeof(DataChannelTrack) * 
avctx->nb_streams))) {
+av_log(avctx, AV_LOG_ERROR, "Failed to allocate tracks\n");
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
+/* configure tracks */
+ret = webrtc_generate_media_stream_id(media_stream_id);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to generate media stream id\n");
+goto fail;
+}
+
+for (i = 0; i < avctx->nb_streams; ++

[FFmpeg-devel] [PATCH 5/6] libavformat/webrtc_demux: add WebRTC-HTTP egress protocol (WHEP) demuxer

2023-11-06 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 configure  |   2 +
 libavformat/Makefile   |   1 +
 libavformat/allformats.c   |   1 +
 libavformat/webrtc_demux.c | 231 +
 4 files changed, 235 insertions(+)
 create mode 100644 libavformat/webrtc_demux.c

diff --git a/configure b/configure
index 187f16b425d..02c6f7f2c5d 100755
--- a/configure
+++ b/configure
@@ -3557,6 +3557,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whep_demuxer_deps="libdatachannel sdp_demuxer"
+whep_demuxer_select="http_protocol"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..f790fa8cae4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHEP_DEMUXER)  += webrtc.o webrtc_demux.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..7acb05634c8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const AVInputFormat  ff_whep_demuxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/webrtc_demux.c b/libavformat/webrtc_demux.c
new file mode 100644
index 000..7ef4e3d3ce3
--- /dev/null
+++ b/libavformat/webrtc_demux.c
@@ -0,0 +1,231 @@
+/*
+ * WebRTC-HTTP egress protocol (WHEP) demuxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "libavutil/avstring.h"
+#include "libavutil/random_seed.h"
+#include "version.h"
+#include "rtsp.h"
+#include "webrtc.h"
+
+typedef struct WHEPContext {
+const AVClass *av_class;
+DataChannelContext data_channel;
+} WHEPContext;
+
+static int whep_read_header(AVFormatContext* avctx)
+{
+WHEPContext*const ctx = (WHEPContext*const)avctx->priv_data;
+int ret, i;
+char media_stream_id[37] = { 0 };
+rtcTrackInit track_init;
+AVDictionary* options = NULL;
+const AVInputFormat* infmt;
+AVStream* stream;
+FFIOContext sdp_pb;
+
+webrtc_init_logger();
+ret = webrtc_init_connection(>data_channel);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to initialize connection\n");
+goto fail;
+}
+
+/* configure audio and video track */
+ret = webrtc_generate_media_stream_id(media_stream_id);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to generate media stream id\n");
+goto fail;
+}
+ctx->data_channel.tracks = av_mallocz(2 * sizeof(DataChannelTrack));
+ctx->data_channel.nb_tracks = 2;
+ctx->data_channel.avctx = avctx;
+if (!ctx->data_channel.tracks) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+for (i=0; i < ctx->data_channel.nb_tracks; i++) {
+ctx->data_channel.tracks[i].avctx = avctx;
+}
+
+/* configure video track */
+memset(_init, 0, sizeof(rtcTrackInit));
+track_init.direction = RTC_DIRECTION_RECVONLY;
+track_init.codec = RTC_CODEC_H264; // TODO: support more codecs once 
libdatachannel C api supports them
+track_init.payloadType = 96

[FFmpeg-devel] [PATCH 4/6] libavformat/webrtc: add common code for WebRTC streaming

2023-11-06 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 libavformat/webrtc.c | 398 +++
 libavformat/webrtc.h |  70 
 2 files changed, 468 insertions(+)
 create mode 100644 libavformat/webrtc.c
 create mode 100644 libavformat/webrtc.h

diff --git a/libavformat/webrtc.c b/libavformat/webrtc.c
new file mode 100644
index 000..75884eac46f
--- /dev/null
+++ b/libavformat/webrtc.c
@@ -0,0 +1,398 @@
+/*
+ * WebRTC-HTTP ingestion/egress protocol (WHIP/WHEP) common code
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/uuid.h"
+#include "libavutil/random_seed.h"
+#include "rtpenc_chain.h"
+#include "rtsp.h"
+#include "webrtc.h"
+
+static const char* webrtc_get_state_name(const rtcState state)
+{
+switch (state)
+{
+case RTC_NEW:
+return "RTC_NEW";
+case RTC_CONNECTING:
+return "RTC_CONNECTING";
+case RTC_CONNECTED:
+return "RTC_CONNECTED";
+case RTC_DISCONNECTED:
+return "RTC_DISCONNECTED";
+case RTC_FAILED:
+return "RTC_FAILED";
+case RTC_CLOSED:
+return "RTC_CLOSED";
+default:
+return "UNKNOWN";
+}
+}
+
+static void webrtc_log(const rtcLogLevel rtcLevel, const char *const message)
+{
+int level = AV_LOG_VERBOSE;
+switch (rtcLevel)
+{
+case RTC_LOG_NONE:
+level = AV_LOG_QUIET;
+break;
+case RTC_LOG_DEBUG:
+case RTC_LOG_VERBOSE:
+level = AV_LOG_DEBUG;
+break;
+case RTC_LOG_INFO:
+level = AV_LOG_VERBOSE;
+break;
+case RTC_LOG_WARNING:
+level = AV_LOG_WARNING;
+break;
+case RTC_LOG_ERROR:
+level = AV_LOG_ERROR;
+break;
+case RTC_LOG_FATAL:
+level = AV_LOG_FATAL;
+break;
+}
+
+av_log(NULL, level, "[libdatachannel] %s\n", message);
+}
+
+void webrtc_init_logger(void)
+{
+rtcLogLevel level = RTC_LOG_VERBOSE;
+switch (av_log_get_level())
+{
+case AV_LOG_QUIET:
+level = RTC_LOG_NONE;
+break;
+case AV_LOG_DEBUG:
+level = RTC_LOG_DEBUG;
+break;
+case AV_LOG_VERBOSE:
+level = RTC_LOG_VERBOSE;
+break;
+case AV_LOG_WARNING:
+level = RTC_LOG_WARNING;
+break;
+case AV_LOG_ERROR:
+level = RTC_LOG_ERROR;
+break;
+case AV_LOG_FATAL:
+level = RTC_LOG_FATAL;
+break;
+}
+
+rtcInitLogger(level, webrtc_log);
+}
+
+int webrtc_generate_media_stream_id(char media_stream_id[37])
+{
+int ret;
+AVUUID uuid;
+
+ret = av_random_bytes(uuid, sizeof(uuid));
+if (ret < 0) {
+goto fail;
+}
+av_uuid_unparse(uuid, media_stream_id);
+return 0;
+
+fail:
+return ret;
+}
+
+int webrtc_create_resource(DataChannelContext*const ctx)
+{
+int ret;
+URLContext* h = NULL;
+char* headers;
+char offer_sdp[SDP_MAX_SIZE] = { 0 };
+char response_sdp[SDP_MAX_SIZE] = { 0 };
+
+/* set local description */
+if (rtcSetLocalDescription(ctx->peer_connection, "offer") != 
RTC_ERR_SUCCESS) {
+av_log(ctx->avctx, AV_LOG_ERROR, "Failed to set local description\n");
+ret = AVERROR_EXTERNAL;
+goto fail;
+}
+
+/* create offer */
+ret = rtcGetLocalDescription(ctx->peer_connection, offer_sdp, 
sizeof(offer_sdp));
+if (ret < 0) {
+av_log(ctx->avctx, AV_LOG_ERROR, "Failed to get local description\n");
+ret = AVERROR_EXTERNAL;
+goto fail;
+}
+av_log(ctx->avctx, AV_LOG_VERBOSE, "offer_sdp: %s\n", offer_sdp);
+
+/* alloc the http context */
+if ((ret = ffurl_alloc(, ctx->avctx->url, AVIO_FLAG_READ_WRITE, NULL)) &

[FFmpeg-devel] [PATCH 3/6] configure: add libdatachannel as external library

2023-11-06 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 8ab658f7303..187f16b425d 100755
--- a/configure
+++ b/configure
@@ -223,6 +223,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1849,6 +1850,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -6708,6 +6710,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.5.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h rtcPreload 
-ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 2/6] libavformat/sdp: remove whitespaces in fmtp

2023-11-06 Thread Michael Riedl
Whitespaces after semicolon breaks some servers

Signed-off-by: Michael Riedl 
---
 libavformat/sdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 68889362906..5ab017b1ba5 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -159,8 +159,8 @@ static int extradata2psets(AVFormatContext *s, const 
AVCodecParameters *par,
 {
 char *psets, *p;
 const uint8_t *r;
-static const char pset_string[] = "; sprop-parameter-sets=";
-static const char profile_string[] = "; profile-level-id=";
+static const char pset_string[] = ";sprop-parameter-sets=";
+static const char profile_string[] = ";profile-level-id=";
 uint8_t *extradata = par->extradata;
 int extradata_size = par->extradata_size;
 uint8_t *tmpbuf = NULL;
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 1/6] libavformat/http: expose actual Location header value

2023-11-06 Thread Michael Riedl
This is needed for (de)muxers which need to access the Location header as 
transmitted when no redirection happend.

Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = 
HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header for 
POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 0/6] WebRTC sub-second live streaming support

2023-11-06 Thread Michael Riedl
This patch series adds support for WHIP and WHEP (WebRTC-HTTP ingestion protocol
and WebRTC-HTTP egress protocol). It supersedes the previous patch series for
WHIP.

The WHIP and WHEP are defined in the following draft RFCs:
- WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip
- WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

The implementation builds on FFmpeg's existing RTP, HTTP and SDP support as well
as libdatachannel for the rest. This library is much more lightweight than other
libraries (e.g. libwebrtc). At the same time, using this library avoids
reimplementing parts of WebRTC in FFmpeg.

This patch series was tested with WebRTC servers Dolby.io (formerly Millicast)
and SRS (https://github.com/ossrs/srs). Using a local server, an end-to-end
latency of 3 frames (50 ms at 60 fps) was measured with video-only output, and
12 frames (200 ms at 60 fps) with audio and video output. Using a DeckLink input
device, an end-to-end latency of about 4 frames (70 ms at 60 fps) was measured
with both, video-only and audio and video output.

Using a remote server, only the RTT is added to the end-to-end latency. For
example, using a server in Amsterdam (The Netherlands) from a location in
Salzburg (Austria), with RTT=18ms, an end-to-end latency of 50+18=68 ms was
measured for video-only output.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 2/2] libavformat/whip: add WebRTC-HTTP ingestion protocol (WHIP)

2023-11-06 Thread Michael Riedl
This patch is obsolete and will be superseded by today's patch for both WHIP 
and WHEP.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2023-11-02 Thread Michael Riedl
> Hi Michael,
>
> I haven't tried your patch, but a quick review suggests that while
> you've declared the option as deprecated that it no longer works.
> Presumably somewhere in there should be a line of code that says
> something like "if (ctx->draw_bars == 0) then ctx->signal_loss_action
> = SIGNAL_LOSS_NONE"
>
> Even though the option is deprecated, it should still continue to work
> until it is completely removed.
>
> Devin


Hi Devin,

thank you for reviewing.

I just tested the code again and can confirm that the old option draw_bars still
works as intended (as describe in the table below). If the users explicitly uses
"-draw_bars false" then we set signal_loss_action to SIGNAL_LOSS_NONE (if the
option was not set by the user) and emit a deprecation warning to the user. If
the users leaves draw_bars to the default value, the option signal_loss_action
has priority.

I think this is the best solution for now that keeps the old behavior and allows
us to remove the option in the future.

| draw_bars      | signal_loss_action | new action     |
| -- | -- | -- |
| true (default) | bars (default) | bars           |
| true (default) | none               | none       |
| true (default) | repeat             | repeat     |
| false  | bars (default) | none       |
| false  | none   | none   |
| false  | repeat             | conflict error |


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

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


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2023-11-02 Thread Michael Riedl
On 9/25/23 13:58, Michael Riedl wrote:
> Deprecate the option 'draw_bars' in favor of the new option 
> 'signal_loss_action',
> which controls the behavior when the input signal is not available
> (including the behavior previously available through draw_bars).
> The default behavior remains unchanged to be backwards compatible.
> The new option is more flexible for extending now and in the future.
>
> The new value 'repeat' repeats the last video frame.
> This is useful for very short dropouts and was not available before.
>
> Signed-off-by: Michael Riedl 
> ---
>  doc/indevs.texi | 16 
>  libavdevice/decklink_common.h   |  1 +
>  libavdevice/decklink_common_c.h |  7 +++
>  libavdevice/decklink_dec.cpp| 23 ++-
>  libavdevice/decklink_dec_c.c|  6 +-
>  5 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/doc/indevs.texi b/doc/indevs.texi
> index 863536a34d5..a985d58ce7f 100644
> --- a/doc/indevs.texi
> +++ b/doc/indevs.texi
> @@ -395,6 +395,22 @@ Defaults to @samp{audio}.
>  @item draw_bars
>  If set to @samp{true}, color bars are drawn in the event of a signal loss.
>  Defaults to @samp{true}.
> +This option is deprecated, please use the @code{signal_loss_action} option.
> +
> +@item signal_loss_action
> +Sets the action to take in the event of a signal loss. Accepts one of the
> +following values:
> +
> +@table @option
> +@item 1, none
> +Do nothing on signal loss. This usually results in black frames.
> +@item 2, bars
> +Draw color bars on signal loss. Only supported for 8-bit input signals.
> +@item 3, repeat
> +Repeat the last video frame on signal loss.
> +@end table
> +
> +Defaults to @samp{bars}.
>  
>  @item queue_size
>  Sets maximum input buffer size in bytes. If the buffering reaches this value,
> diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
> index 34ab1b96700..be666212e6c 100644
> --- a/libavdevice/decklink_common.h
> +++ b/libavdevice/decklink_common.h
> @@ -146,6 +146,7 @@ struct decklink_ctx {
>  DecklinkPtsSource video_pts_source;
>  int draw_bars;
>  BMDPixelFormat raw_format;
> +DecklinkSignalLossAction signal_loss_action;
>  
>  int frames_preroll;
>  int frames_buffer;
> diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
> index 9c55d891494..53d2c583e7e 100644
> --- a/libavdevice/decklink_common_c.h
> +++ b/libavdevice/decklink_common_c.h
> @@ -37,6 +37,12 @@ typedef enum DecklinkPtsSource {
>  PTS_SRC_NB
>  } DecklinkPtsSource;
>  
> +typedef enum DecklinkSignalLossAction {
> +SIGNAL_LOSS_NONE= 1,
> +SIGNAL_LOSS_REPEAT  = 2,
> +SIGNAL_LOSS_BARS= 3
> +} DecklinkSignalLossAction;
> +
>  struct decklink_cctx {
>  const AVClass *cclass;
>  
> @@ -68,6 +74,7 @@ struct decklink_cctx {
>  int64_t timestamp_align;
>  int timing_offset;
>  int wait_for_tc;
> +DecklinkSignalLossAction signal_loss_action;
>  };
>  
>  #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> index 11640f72caa..f6095c72359 100644
> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -593,6 +593,7 @@ private:
>  int no_video;
>  int64_t initial_video_pts;
>  int64_t initial_audio_pts;
> +IDeckLinkVideoInputFrame* last_video_frame;
>  };
>  
>  decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : 
> _refs(1)
> @@ -602,10 +603,13 @@ 
> decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : 
> _ref
>  ctx = (struct decklink_ctx *)cctx->ctx;
>  no_video = 0;
>  initial_audio_pts = initial_video_pts = AV_NOPTS_VALUE;
> +last_video_frame = nullptr;
>  }
>  
>  decklink_input_callback::~decklink_input_callback()
>  {
> +if (last_video_frame)
> +last_video_frame->Release();
>  }
>  
>  ULONG decklink_input_callback::AddRef(void)
> @@ -773,7 +777,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
>ctx->video_st->time_base.den);
>  
>  if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
> -if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
> bmdFormat8BitYUV) {
> +if (ctx->signal_loss_action == SIGNAL_LOSS_BARS && 
> videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
>  unsigned bars[8] = {
>  0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
>  0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0

Re: [FFmpeg-devel] [PATCH] avformat/mxfenc: fix static building

2023-10-09 Thread Michael Riedl
On 9/19/23 17:12, Michael Riedl wrote:
> MXF muxer requires rangecoder otherwise static linking fails.
>
> Signed-off-by: Michael Riedl 
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 3bb68d3f20c..9d4297ea68f 100755
> --- a/configure
> +++ b/configure
> @@ -3532,7 +3532,7 @@ mp4_muxer_select="mov_muxer"
>  mpegts_demuxer_select="iso_media"
>  mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf 
> hevc_mp4toannexb_bsf"
>  mpegtsraw_demuxer_select="mpegts_demuxer"
> -mxf_muxer_select="pcm_rechunk_bsf"
> +mxf_muxer_select="pcm_rechunk_bsf rangecoder"
>  mxf_d10_muxer_select="mxf_muxer"
>  mxf_opatom_muxer_select="mxf_muxer"
>  nut_muxer_select="riffenc"

Ping. Without this patch master fails to build when ffv1 is not enabled.


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

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


[FFmpeg-devel] [PATCH] libavdevice/decklink: extend available actions on signal loss

2023-09-25 Thread Michael Riedl
Deprecate the option 'draw_bars' in favor of the new option 
'signal_loss_action',
which controls the behavior when the input signal is not available
(including the behavior previously available through draw_bars).
The default behavior remains unchanged to be backwards compatible.
The new option is more flexible for extending now and in the future.

The new value 'repeat' repeats the last video frame.
This is useful for very short dropouts and was not available before.

Signed-off-by: Michael Riedl 
---
 doc/indevs.texi | 16 
 libavdevice/decklink_common.h   |  1 +
 libavdevice/decklink_common_c.h |  7 +++
 libavdevice/decklink_dec.cpp| 23 ++-
 libavdevice/decklink_dec_c.c|  6 +-
 5 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 863536a34d5..a985d58ce7f 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -395,6 +395,22 @@ Defaults to @samp{audio}.
 @item draw_bars
 If set to @samp{true}, color bars are drawn in the event of a signal loss.
 Defaults to @samp{true}.
+This option is deprecated, please use the @code{signal_loss_action} option.
+
+@item signal_loss_action
+Sets the action to take in the event of a signal loss. Accepts one of the
+following values:
+
+@table @option
+@item 1, none
+Do nothing on signal loss. This usually results in black frames.
+@item 2, bars
+Draw color bars on signal loss. Only supported for 8-bit input signals.
+@item 3, repeat
+Repeat the last video frame on signal loss.
+@end table
+
+Defaults to @samp{bars}.
 
 @item queue_size
 Sets maximum input buffer size in bytes. If the buffering reaches this value,
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index 34ab1b96700..be666212e6c 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -146,6 +146,7 @@ struct decklink_ctx {
 DecklinkPtsSource video_pts_source;
 int draw_bars;
 BMDPixelFormat raw_format;
+DecklinkSignalLossAction signal_loss_action;
 
 int frames_preroll;
 int frames_buffer;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 9c55d891494..53d2c583e7e 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -37,6 +37,12 @@ typedef enum DecklinkPtsSource {
 PTS_SRC_NB
 } DecklinkPtsSource;
 
+typedef enum DecklinkSignalLossAction {
+SIGNAL_LOSS_NONE= 1,
+SIGNAL_LOSS_REPEAT  = 2,
+SIGNAL_LOSS_BARS= 3
+} DecklinkSignalLossAction;
+
 struct decklink_cctx {
 const AVClass *cclass;
 
@@ -68,6 +74,7 @@ struct decklink_cctx {
 int64_t timestamp_align;
 int timing_offset;
 int wait_for_tc;
+DecklinkSignalLossAction signal_loss_action;
 };
 
 #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 11640f72caa..f6095c72359 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -593,6 +593,7 @@ private:
 int no_video;
 int64_t initial_video_pts;
 int64_t initial_audio_pts;
+IDeckLinkVideoInputFrame* last_video_frame;
 };
 
 decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : 
_refs(1)
@@ -602,10 +603,13 @@ 
decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : _ref
 ctx = (struct decklink_ctx *)cctx->ctx;
 no_video = 0;
 initial_audio_pts = initial_video_pts = AV_NOPTS_VALUE;
+last_video_frame = nullptr;
 }
 
 decklink_input_callback::~decklink_input_callback()
 {
+if (last_video_frame)
+last_video_frame->Release();
 }
 
 ULONG decklink_input_callback::AddRef(void)
@@ -773,7 +777,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
   ctx->video_st->time_base.den);
 
 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
-if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
bmdFormat8BitYUV) {
+if (ctx->signal_loss_action == SIGNAL_LOSS_BARS && 
videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
 unsigned bars[8] = {
 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
@@ -785,6 +789,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 for (int x = 0; x < width; x += 2)
 *p++ = bars[(x * 8) / width];
 }
+} else if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+last_video_frame->GetBytes();
 }
 
 if (!no_video) {
@@ -793,6 +799,12 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 }
 no_video = 1;
 } else {
+if (ctx->signal_loss_action == SIGNAL_LOSS_REPEAT) {
+if (last_

[FFmpeg-devel] [PATCH v2 2/2] libavformat/whip: add WebRTC-HTTP ingestion protocol (WHIP)

2023-09-25 Thread Michael Riedl
This is based on the library libdatachannel,
which is much more lightweight than other libraries like libwebrtc.
At the same time, using this library avoids reimplementing parts of WebRTC in 
FFmpeg.

Signed-off-by: Michael Riedl 
---
 configure|   5 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/whip.c   | 538 +++
 4 files changed, 545 insertions(+)
 create mode 100644 libavformat/whip.c

diff --git a/configure b/configure
index 48fee07f817..3bb68d3f20c 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1853,6 +1854,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -3566,6 +3568,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel"
+whip_muxer_select="http_protocol rtpenc_chain"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
@@ -6691,6 +6695,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.5.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h rtcPreload 
-ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..db9d8ec5d47 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= whip.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..e8825a92b54 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/whip.c b/libavformat/whip.c
new file mode 100644
index 000..8ed593a9b5c
--- /dev/null
+++ b/libavformat/whip.c
@@ -0,0 +1,538 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "mux.h"
+#include "

[FFmpeg-devel] [PATCH v2 1/2] libavformat/http: expose actual Location header value

2023-09-25 Thread Michael Riedl
This is needed for muxers which need to access the Location header as 
transmitted when no redirection happen.

Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = 
HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header for 
POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH] avformat/mxfenc: fix static building

2023-09-19 Thread Michael Riedl
MXF muxer requires rangecoder otherwise static linking fails.

Signed-off-by: Michael Riedl 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 3bb68d3f20c..9d4297ea68f 100755
--- a/configure
+++ b/configure
@@ -3532,7 +3532,7 @@ mp4_muxer_select="mov_muxer"
 mpegts_demuxer_select="iso_media"
 mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf 
hevc_mp4toannexb_bsf"
 mpegtsraw_demuxer_select="mpegts_demuxer"
-mxf_muxer_select="pcm_rechunk_bsf"
+mxf_muxer_select="pcm_rechunk_bsf rangecoder"
 mxf_d10_muxer_select="mxf_muxer"
 mxf_opatom_muxer_select="mxf_muxer"
 nut_muxer_select="riffenc"
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 2/2] libavformat/whip: add WebRTC-HTTP ingestion protocol (WHIP)

2023-09-19 Thread Michael Riedl
This is based on the library libdatachannel,
which is much more lightweight than other libraries like libwebrtc.
At the same time, using this library avoids reimplementing parts of WebRTC in 
FFmpeg.

Signed-off-by: Michael Riedl 
---
 configure|   5 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/whip.c   | 521 +++
 4 files changed, 528 insertions(+)
 create mode 100644 libavformat/whip.c

diff --git a/configure b/configure
index 48fee07f817..3bb68d3f20c 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1853,6 +1854,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -3566,6 +3568,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel"
+whip_muxer_select="http_protocol rtpenc_chain"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
@@ -6691,6 +6695,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.5.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h rtcPreload 
-ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..db9d8ec5d47 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= whip.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..e8825a92b54 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/whip.c b/libavformat/whip.c
new file mode 100644
index 000..0bf162c51a1
--- /dev/null
+++ b/libavformat/whip.c
@@ -0,0 +1,521 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "mux.h"
+#include "version.h"
+#include "

[FFmpeg-devel] [PATCH 1/2] libavformat/http: expose actual Location header value

2023-09-19 Thread Michael Riedl
This is needed for muxers which need to access the Location header as 
transmitted when no redirection happen.

Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = 
HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header for 
POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 2/2] libavformat/whip: add WebRTC-HTTP ingestion protocol (WHIP)

2023-09-19 Thread Michael Riedl

This is based on the library libdatachannel,
which is much more lightweight than other libraries like libwebrtc.
At the same time, using this library avoids reimplementing parts of WebRTC in 
FFmpeg.

Signed-off-by: Michael Riedl 
---
 configure|   5 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/whip.c   | 521 +++
 4 files changed, 528 insertions(+)
 create mode 100644 libavformat/whip.c

diff --git a/configure b/configure
index 48fee07f817..3bb68d3f20c 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1853,6 +1854,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -3566,6 +3568,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel"
+whip_muxer_select="http_protocol rtpenc_chain"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
@@ -6691,6 +6695,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.5.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h rtcPreload 
-ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..db9d8ec5d47 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= whip.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..e8825a92b54 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/whip.c b/libavformat/whip.c
new file mode 100644
index 000..0bf162c51a1
--- /dev/null
+++ b/libavformat/whip.c
@@ -0,0 +1,521 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "mux.h"
+#include "version.h"
+#include "

[FFmpeg-devel] [PATCH 1/2] libavformat/http: expose actual Location header value

2023-09-19 Thread Michael Riedl

This is needed for muxers which need to access the Location header as 
transmitted when no redirection happen.

Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = 
HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header for 
POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from a 
client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
--
2.39.2

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

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


[FFmpeg-devel] [PATCH 2/2] libavformat/whip: add WebRTC-HTTP ingestion protocol (WHIP)

2023-09-19 Thread Michael Riedl

This is based on the library libdatachannel,
which is much more lightweight than other libraries like libwebrtc.
At the same time, using this library avoids reimplementing parts of 
WebRTC in FFmpeg.


Signed-off-by: Michael Riedl 
---
 configure|   5 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/whip.c   | 521 +++
 4 files changed, 528 insertions(+)
 create mode 100644 libavformat/whip.c

diff --git a/configure b/configure
index 48fee07f817..3bb68d3f20c 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdatachannel  enable WHIP muxing via libdatachannel [no]
   --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
@@ -1853,6 +1854,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdatachannel
 libdav1d
 libdc1394
 libdrm
@@ -3566,6 +3568,8 @@ wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_chunk_muxer_select="webm_muxer"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
+whip_muxer_deps="libdatachannel"
+whip_muxer_select="http_protocol rtpenc_chain"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 wtv_muxer_select="mpegts_muxer riffenc"
 xmv_demuxer_select="riffdec"
@@ -6691,6 +6695,7 @@ enabled libcelt   && require libcelt 
celt/celt.h celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h 
codec2_create -lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 
0.5.0" "dav1d/dav1d.h" dav1d_version
+enabled libdatachannel&& require libdatachannel rtc/rtc.h 
rtcPreload -ldatachannel
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 
1.6.0" davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm 
xf86drm.h drmGetVersion

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 329055ccfd9..db9d8ec5d47 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -621,6 +621,7 @@ OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
+OBJS-$(CONFIG_WHIP_MUXER)+= whip.o
 OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
 OBJS-$(CONFIG_WSAUD_MUXER)   += westwood_audenc.o
 OBJS-$(CONFIG_WSD_DEMUXER)   += wsddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d4b505a5a32..e8825a92b54 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -504,6 +504,7 @@ extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
 extern const AVInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
+extern const FFOutputFormat ff_whip_muxer;
 extern const AVInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
 extern const AVInputFormat  ff_wsd_demuxer;
diff --git a/libavformat/whip.c b/libavformat/whip.c
new file mode 100644
index 000..0bf162c51a1
--- /dev/null
+++ b/libavformat/whip.c
@@ -0,0 +1,521 @@
+/*
+ * WebRTC-HTTP ingestion protocol (WHIP) muxer using libdatachannel
+ *
+ * Copyright (C) 2023 NativeWaves GmbH 
+ * This work is supported by FFG project 47168763.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software 
Foundation,

+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "mux.h"
+#include "version.h"
+#include 

[FFmpeg-devel] [PATCH 1/2] libavformat/http: expose actual Location header value

2023-09-19 Thread Michael Riedl
This is needed for muxers which need to access the Location header as 
transmitted when no redirection happen.


Signed-off-by: Michael Riedl 
---
 libavformat/http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index c0fe7c36d91..27f9c8e3000 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -166,6 +166,7 @@ static const AVOption options[] = {
 { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { 
.i64 = HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"},
 { "send_expect_100", "Force sending an Expect: 100-continue header 
for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 
1, E },
 { "location", "The actual location of the data received", 
OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "new_location", "The location header value of the data received", 
OFFSET(new_location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, 
{ .i64 = 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this 
offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, 
D },
 { "method", "Override the HTTP method or set the expected HTTP 
method from a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL 
}, 0, 0, D | E },

--
2.39.2

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

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


Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_showinfo: add wallclock option

2022-08-25 Thread Michael Riedl

The patchset allows to control whether to print date, time or both.
In practical use, I ended up printing a line with the date on startup
and print only time information, e.g. like this:

01:40:42.467 ffmpeg version 5.1...
01:40:42.467   built with ...
01:40:42.468 Execution Date: 2022-08-16 01:40:42
01:40:42.499 Input #0, matroska,webm, ...



If there is interest, I can submit my latest version of this.


From my side this would be interesting and helpful for me.

Thanks,
Michael
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] API documentation

2022-08-24 Thread Michael Riedl

Hi,

I saw on the FFmpeg website that for some stable versions there is no
API documentation. The latest stable documentation (for version 4.1) is
four years old.

We managed to build the API documentation for 5.1
(https://ffmpeg-docs.tools.nativewaves.com/5.1/index.html) and other
stable versions (https://ffmpeg-docs.tools.nativewaves.com/). We happily
offer to host the documentation (updated regularly) free of charge.
Maybe our page can be linked on FFmpeg's documentation page
(https://ffmpeg.org/documentation.html) to complete it with respect to
recent releases.

Please let me know what you think.

Best,
Michael
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_showinfo: add wallclock option

2022-08-17 Thread Michael Riedl

On 17.08.2022 10:43, Nicolas George wrote:

Michael Riedl (12022-08-17):

Signed-off-by: Michael Riedl 
---
  libavfilter/vf_showinfo.c | 11 +++
  1 file changed, 11 insertions(+)


What is the intended use case? It seems to me very ad-hoc. A fftools
option to add a timestamp to each log line seems a more generic and
cleaner approach.


This is a good idea, I will look into that. Regarding vf_showinfo, I am 
working on options to limit the output to certain frames (first N, last 
N, only I-frames). I think this will be useful, what do you think?


Regards,
--
Michael Riedl
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2] avfilter/vf_showinfo: add wallclock option

2022-08-17 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 libavfilter/vf_showinfo.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 2c8514fc80..1953f777c7 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -43,6 +43,7 @@
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
 #include "libavutil/uuid.h"
+#include "libavutil/time.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -51,6 +52,7 @@
 typedef struct ShowInfoContext {
 const AVClass *class;
 int calculate_checksums;
+int print_wallclock;
 } ShowInfoContext;
 
 #define OFFSET(x) offsetof(ShowInfoContext, x)
@@ -58,6 +60,7 @@ typedef struct ShowInfoContext {
 
 static const AVOption showinfo_options[] = {
 { "checksum", "calculate checksums", OFFSET(calculate_checksums), 
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, VF },
+{ "wallclock", "print wallclock", OFFSET(print_wallclock), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
 { NULL }
 };
 
@@ -740,6 +743,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
sqrt((sum2[plane] - 
sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
 av_log(ctx, AV_LOG_INFO, "\b]");
 }
+
+if (s->print_wallclock) {
+av_log(ctx, AV_LOG_INFO,
+   " wallclock:%"PRId64" ",
+   av_gettime()
+);
+}
+
 av_log(ctx, AV_LOG_INFO, "\n");
 
 for (i = 0; i < frame->nb_side_data; i++) {
-- 
2.37.2.windows.2

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

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


[FFmpeg-devel] [PATCH] avfilter/vf_showinfo: add wallclock option

2022-08-10 Thread Michael Riedl
Signed-off-by: Michael Riedl 
---
 libavfilter/vf_showinfo.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 2c8514fc80..1953f777c7 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -43,6 +43,7 @@
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
 #include "libavutil/uuid.h"
+#include "libavutil/time.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -51,6 +52,7 @@
 typedef struct ShowInfoContext {
 const AVClass *class;
 int calculate_checksums;
+int print_wallclock;
 } ShowInfoContext;
 
 #define OFFSET(x) offsetof(ShowInfoContext, x)
@@ -58,6 +60,7 @@ typedef struct ShowInfoContext {
 
 static const AVOption showinfo_options[] = {
 { "checksum", "calculate checksums", OFFSET(calculate_checksums), 
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, VF },
+{ "wallclock", "print wallclock", OFFSET(print_wallclock), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
 { NULL }
 };
 
@@ -740,6 +743,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
sqrt((sum2[plane] - 
sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
 av_log(ctx, AV_LOG_INFO, "\b]");
 }
+
+if (s->print_wallclock) {
+av_log(ctx, AV_LOG_INFO,
+   " wallclock:%"PRId64" ",
+   av_gettime()
+);
+}
+
 av_log(ctx, AV_LOG_INFO, "\n");
 
 for (i = 0; i < frame->nb_side_data; i++) {
-- 
2.37.1.windows.1

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

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