Re: [FFmpeg-devel] [PATCH v5] avformat/hls: Add option to retry failed segments for hls

2023-02-09 Thread Gyan Doshi



On 2023-02-08 01:25 pm, Gyan Doshi wrote:



On 2022-10-21 02:49 pm, Steven Liu wrote:

gnattu  于2022年10月20日周四 20:12写道:

Current HLS implementation simply skip a failed segment to catch up
the stream, but this is not optimal for some use cases like livestream
recording.
Add an option to retry a failed segment to ensure the output file is
a complete stream.

Signed-off-by: gnattu 
---
v5 changed coding style as requested
v4 added documentation for the new seg_max_try option

  doc/demuxers.texi |  4 
  libavformat/hls.c | 15 ++-
  2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 2b6dd86c2a..3e09a0f14e 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -401,6 +401,10 @@ Use HTTP partial requests for downloading HTTP 
segments.


  @item seg_format_options
  Set options for the demuxer of media segments using a list of 
key=value pairs separated by @code{:}.

+
+@item seg_max_retry
+Maximum number of times to reload a segment on error, useful when 
segment skip on network error is not desired.

+Default value is 0.
  @end table

  @section image2
diff --git a/libavformat/hls.c b/libavformat/hls.c
index e622425e80..2a5ffb927f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -225,6 +225,7 @@ typedef struct HLSContext {
  int http_persistent;
  int http_multiple;
  int http_seekable;
+    int seg_max_retry;
  AVIOContext *playlist_pb;
  HLSCryptoContext  crypto_ctx;
  } HLSContext;
@@ -1472,6 +1473,7 @@ static int read_data(void *opaque, uint8_t 
*buf, int buf_size)

  int ret;
  int just_opened = 0;
  int reload_count = 0;
+    int segment_retries = 0;
  struct segment *seg;

  restart:
@@ -1563,9 +1565,18 @@ reload:
  av_log(v->parent, AV_LOG_WARNING, "Failed to open 
segment %"PRId64" of playlist %d\n",

 v->cur_seq_no,
 v->index);
-    v->cur_seq_no += 1;
+    if (segment_retries >= c->seg_max_retry) {
+    av_log(v->parent, AV_LOG_WARNING, "Segment 
%"PRId64" of playlist %d failed too many times, skipping\n",

+   v->cur_seq_no,
+   v->index);
+    v->cur_seq_no++;
+    segment_retries = 0;
+    } else {
+    segment_retries++;
+    }
  goto reload;
  }
+    segment_retries = 0;
  just_opened = 1;
  }

@@ -2549,6 +2560,8 @@ static const AVOption hls_options[] = {
  OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 
1, FLAGS},

  {"seg_format_options", "Set options for segment demuxer",
  OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 
0, 0, FLAGS},
+    {"seg_max_retry", "Maximum number of times to reload a segment 
on error.",
+ OFFSET(seg_max_retry), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 
INT_MAX, FLAGS},

  {NULL}
  };

--
2.37.0 (Apple Git-136)

___
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".

LGTM

Thanks
Steven


This doesn't appear to have been pushed.
Plan to push tomorrow.


Pushed as d09254a658365b89fc4430e88e18fef04de432be

Regards,
Gyan
___
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] avcodec/h264_metadata_bsf: remove AUDs at any position

2023-02-09 Thread Gyan Doshi



On 2023-02-08 12:03 pm, Gyan Doshi wrote:



On 2023-02-04 03:36 pm, Gyan Doshi wrote:

Some files, likely due to faulty packetization or muxing, can have AUDs
at other positions besides the head unit of a packet. Remove these too.

Plan to push in 24h if no more comments.


Pushed as 159b028df58f480605b678109088e1b2ba8fdc71

Regards,
Gyan




---
  libavcodec/h264_metadata_bsf.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_metadata_bsf.c 
b/libavcodec/h264_metadata_bsf.c

index d318bf0cee..b9cfeaba94 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -469,12 +469,13 @@ static int 
h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt,

  H264MetadataContext *ctx = bsf->priv_data;
  int err, i, has_sps, seek_point;
  -    // If an AUD is present, it must be the first NAL unit.
-    if (au->nb_units && au->units[0].type == H264_NAL_AUD) {
-    if (ctx->aud == BSF_ELEMENT_REMOVE)
-    ff_cbs_delete_unit(au, 0);
-    } else {
-    if (pkt && ctx->aud == BSF_ELEMENT_INSERT) {
+    if (ctx->aud == BSF_ELEMENT_REMOVE) {
+    for (i = au->nb_units - 1; i >= 0; i--) {
+    if (au->units[i].type == H264_NAL_AUD)
+    ff_cbs_delete_unit(au, i);
+    }
+    } else if (ctx->aud == BSF_ELEMENT_INSERT) {
+    if (pkt) {
  err = h264_metadata_insert_aud(bsf, au);
  if (err < 0)
  return err;


___
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 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] avformat/movenc: allow writing out channel count in MP4 and 3GP

2023-02-09 Thread Martin Storsjö

On Tue, 7 Feb 2023, Jan Ekström wrote:


ISOBMFF (14496-12) made this field ('channelcount') in the
AudioSampleEntry structure non-template¹ somewhere before the
release of the 2022 edition. As for ETSI TS 126 244 AKA 3GPP
file format (V16.1.0, 2020-10), it does not seem contain any
references limiting the channelcount entry in AudioSampleEntry
or in its own definition of EVSSampleEntry.

fate-mov-mp4-chapters test had to be adjusted as it output a
mono vorbis stream, which would now be properly marked as such
in the container.

1: As per 14496-12:
  Fields shown as “template” in the box descriptions are fields
  which are coded with a default value unless a derived
  specification defines their use and permits writers to use
  other values than the default.
---
libavformat/movenc.c| 8 +---
tests/ref/fate/mov-mp4-chapters | 2 +-
2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8d31317838..f0e218e7b7 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1241,13 +1241,7 @@ static int mov_write_audio_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
avio_wb16(pb, 16);
avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */
} else { /* reserved for mp4/3gp */
-if (track->par->codec_id == AV_CODEC_ID_FLAC ||
-track->par->codec_id == AV_CODEC_ID_ALAC ||
-track->par->codec_id == AV_CODEC_ID_OPUS) {
-avio_wb16(pb, track->par->ch_layout.nb_channels);
-} else {
-avio_wb16(pb, 2);
-}
+avio_wb16(pb, track->par->ch_layout.nb_channels);
if (track->par->codec_id == AV_CODEC_ID_FLAC ||
track->par->codec_id == AV_CODEC_ID_ALAC) {
avio_wb16(pb, track->par->bits_per_raw_sample);


This looks reasonable to me. I didn't follow the references in the commit 
message, but it sounds plausible and probably correct to me.


// Martin
___
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/4] avformat: add av_program_copy()

2023-02-09 Thread Gyan Doshi
Helper to transfer programs from one muxing context to another.
---
 doc/APIchanges |  3 ++
 libavformat/avformat.c | 70 ++
 libavformat/avformat.h | 14 +
 libavformat/version.h  |  2 +-
 4 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6baf914760..4916d1abe8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2023-02-xx - xx - lavf 59.39.100 - avformat.h
+  Add av_program_copy()
+
 2023-0x-xx - xx - lavc 59.63.100
   Allow AV_CODEC_FLAG_COPY_OPAQUE to be used with decoders.
 
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 19c7219471..d3c8def170 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -359,6 +359,76 @@ void av_program_add_stream_index(AVFormatContext *ac, int 
progid, unsigned idx)
 }
 }
 
+int av_program_copy(AVFormatContext *dst, AVFormatContext *src, int progid, 
int overwrite)
+{
+AVProgram *src_prog = NULL;
+AVProgram *dst_prog = NULL;
+int i, j, ret;
+int idx = -1;
+
+for (i = 0; i < src->nb_programs; i++)
+if (src->programs[i]->id == progid)
+src_prog = src->programs[i];
+
+if (!src_prog) {
+av_log(src, AV_LOG_ERROR, "source program not found: id=0x%04x\n", 
progid);
+return AVERROR(EINVAL);
+}
+
+for (i = 0; i < dst->nb_programs; i++) {
+if (dst->programs[i]->id == progid)
+idx = i;
+}
+
+if (idx >= 0 && !overwrite) {
+av_log(src, AV_LOG_ERROR, "target muxer already has program with 
id=0x%04x; not overwriting\n", progid);
+return AVERROR(EINVAL);
+}
+
+av_log(src, AV_LOG_TRACE, "%s program: id=0x%04x\n", idx >= 0 ? 
"overwriting" : "copying", progid);
+
+if (idx >= 0) {
+dst_prog = dst->programs[idx];
+av_dict_free(&dst_prog->metadata);
+av_freep(&dst_prog->stream_index);
+dst_prog->nb_stream_indexes = 0;
+} else {
+dst_prog = av_mallocz(sizeof(*dst_prog));
+if (!dst_prog)
+return AVERROR(ENOMEM);
+ret = av_dynarray_add_nofree(&dst->programs, &dst->nb_programs, 
dst_prog);
+if (ret < 0) {
+av_free(dst_prog);
+return AVERROR(ENOMEM);
+}
+}
+
+/* public fields */
+dst_prog->id  = src_prog->id;
+dst_prog->flags   = src_prog->flags;
+dst_prog->discard = src_prog->discard;
+dst_prog->program_num = src_prog->program_num;
+dst_prog->pmt_pid = src_prog->pmt_pid;
+dst_prog->pcr_pid = src_prog->pcr_pid;
+dst_prog->pmt_version = src_prog->pmt_version;
+
+for (i = 0; i < dst->nb_streams; i++) {
+for (j = 0; j < src_prog->nb_stream_indexes; j++)
+if (dst->streams[i]->id == 
src->streams[src_prog->stream_index[j]]->id)
+av_program_add_stream_index(dst, dst_prog->id, i);
+}
+
+av_dict_copy(&dst_prog->metadata, src_prog->metadata, 0);
+
+/* private fields */
+dst_prog->start_time = src_prog->start_time;
+dst_prog->end_time   = src_prog->end_time;
+dst_prog->pts_wrap_reference = src_prog->pts_wrap_reference;
+dst_prog->pts_wrap_behavior  = src_prog->pts_wrap_behavior;
+
+return 0;
+}
+
 AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, 
int s)
 {
 for (unsigned i = 0; i < ic->nb_programs; i++) {
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1d97d56ac5..2b7ed3abd8 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1996,6 +1996,20 @@ uint8_t *av_stream_get_side_data(const AVStream *stream,
 
 AVProgram *av_new_program(AVFormatContext *s, int id);
 
+/**
+ * Copy an AVProgram from one AVFormatContext to another.
+ *
+ * @param dst   pointer to the target muxer context
+ * @param src   pointer to the source muxer context
+ * @param progidID of the program to be copied
+ * @param overwrite whether to overwrite if target muxer already
+ *  contains a program with the same ID
+ *
+ * @return  0 in case of success, a negative AVERROR code in case of
+ *  failure
+ */
+int av_program_copy(AVFormatContext *dst, AVFormatContext *src, int progid, 
int overwrite);
+
 /**
  * @}
  */
diff --git a/libavformat/version.h b/libavformat/version.h
index 134cdb2b89..9aba356e09 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR  38
+#define LIBAVFORMAT_VERSION_MINOR  39
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.39.1

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

To unsubscribe, visit link above, or email
ffmpe

[FFmpeg-devel] [PATCH v2 2/4] avformat/hls: relay programs to child muxers

2023-02-09 Thread Gyan Doshi
---
 libavformat/hlsenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 39df9becc7..0b66efad3e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -907,6 +907,12 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 st->id = vs->streams[i]->id;
 }
 
+for (i = 0; i < s->nb_programs; i++) {
+ret = av_program_copy(oc, s, s->programs[i]->id, 0);
+if (ret < 0)
+av_log(s, AV_LOG_WARNING, "unable to transfer program %d to child 
muxer\n", s->programs[i]->id);
+}
+
 vs->start_pos = 0;
 vs->new_start = 1;
 
-- 
2.39.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".


[FFmpeg-devel] [PATCH v2 3/4] avformat/segment: relay programs to child muxers

2023-02-09 Thread Gyan Doshi
---
 libavformat/segment.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 80e4bf851c..2d9f24e194 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -182,6 +182,12 @@ static int segment_mux_init(AVFormatContext *s)
 }
 }
 
+for (i = 0; i < s->nb_programs; i++) {
+ret = av_program_copy(oc, s, s->programs[i]->id, 0);
+if (ret < 0)
+av_log(s, AV_LOG_WARNING, "unable to transfer program %d to child 
muxer\n", s->programs[i]->id);
+}
+
 return 0;
 }
 
-- 
2.39.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".


[FFmpeg-devel] [PATCH v2 4/4] avformat/tee: relay programs to child muxers

2023-02-09 Thread Gyan Doshi
---
 libavformat/tee.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index dd408dd096..2fde8a3828 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -291,6 +291,12 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 }
 }
 
+for (i = 0; i < avf->nb_programs; i++) {
+ret = av_program_copy(avf2, avf, avf->programs[i]->id, 0);
+if (ret < 0)
+av_log(avf, AV_LOG_WARNING, "unable to transfer program %d to 
child muxer\n", avf->programs[i]->id);
+}
+
 ret = ff_format_output_open(avf2, filename, &options);
 if (ret < 0) {
 av_log(avf, AV_LOG_ERROR, "Slave '%s': error opening: %s\n", slave,
-- 
2.39.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".


Re: [FFmpeg-devel] [PATCH] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-09 Thread Martin Storsjö

Hi,

On Sat, 4 Feb 2023, Ziemowit Laski wrote:

I've been bringing up FFMPEG using Visual Studio 2022 and the MINGW64 
environment, and came across sundry things that absolutely needed fixes, 
so I thought I'd submit them as a series of small patches for you to 
consider.  Here is the first patch.


FWIW, this setup is definitely being used by lots of others already - so 
whenever there's such an issue, the main question to ask is why others 
haven't run into the issue before. But improvements are definitely 
welcome!


For this patch, the answer to that question is that configure has a test, 
which checks if "$windres --version" works, and if not, it doesn't try to 
use the tool. So in many cases, the mswindres hasn't been used at all.


When building FFMPEG from the MINGW/MSYS shell under Windows, one must 
not use forward slashes ('/') for command-line options.  MINGW/MSYS 
interprets these as absolute paths and then automatically rewrites them 
into equivalent Windows paths.  For example, the '/logo' switch below 
gets rewritten to something like 'C:/Program Files/Git/logo', and this


You should probably talk about the option '/nologo' here, there's no 
'/logo' option afaik.


obviously breaks the build.  Thankfully, most M$ tools accept dashes 
('-') as well.


Signed-off-by: Ziemowit Łąski <15880281+zla...@users.noreply.github.com>
---
compat/windows/mswindres | 8 
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/compat/windows/mswindres b/compat/windows/mswindres
index 450525a33e..ed32796230 100755
--- a/compat/windows/mswindres
+++ b/compat/windows/mswindres
@@ -10,12 +10,12 @@ if [ $# -lt 2 ]; then
exit 0
fi

-EXTRA_OPTS="/nologo"
+EXTRA_OPTS="-nologo"


These changes seem fine, but you're apparently not touching the case at 
the top, used for --version, where it is calling 'rc.exe /?'. For me, this 
causes configure to decide to not use the tool at all. (It seems like 
current msys2 rewrites "rc.exe /?" so that it fails, while git bash 
doesn't rewrite it in that way, so that "rc.exe /?" works there.)


So I guess that's the explanation for the issue you're seeing - you're 
running in an environment where the "rc.exe /?" check succeeds (so the 
tool is taken into use, unlike it is for me), but then failed at actual 
use. While it for me, building in msys2, didn't try to use the tool at 
all. (And in cross-msvc builds, it enabled and used the tool just fine.)


Anyway, with the commit message fixed, and the case of /? changed into -?, 
this patch would seem fine to me - thanks for your contribution!


// Martin
___
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] lavfi/metal: fix build for iOS with deployment target lower than 13

2023-02-09 Thread Rechi

supportsFamily: is only available on iOS 13.0 or newer
Signed-off-by: Rechi 
---
 libavfilter/metal/utils.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m
index f365d3cee..bb1825ae3 100644
--- a/libavfilter/metal/utils.m
+++ b/libavfilter/metal/utils.m
@@ -31,7 +31,7 @@ void ff_metal_compute_encoder_dispatch(id 
device,

 BOOL fallback = YES;
 // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to 
include its functionality (including iOS, tvOS, etc)

 #ifdef MAC_OS_X_VERSION_10_15
-if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) {
+if (@available(macOS 10.15, iOS 13, tvOS 14.5, *)) {
 if ([device supportsFamily:MTLGPUFamilyCommon3]) {
 MTLSize threadsPerGrid = MTLSizeMake(width, height, 1);
 [encoder dispatchThreads:threadsPerGrid 
threadsPerThreadgroup:threadsPerThreadgroup];

--
2.39.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".


[FFmpeg-devel] [PATCH] avdevice: add dxgigrab

2023-02-09 Thread aline . gondimsantos
From: Aline Gondim Santos 

A dxgi grab device may be either a display or a window.
Differently from the existing gdigrab, this new device does
not make the mouse to flick and also allows proper grabbing of
accelerated windows, such as chrome or visual studio code.

Signed-off-by: Aline Gondim Santos 
---
 configure|   1 +
 libavdevice/Makefile |   4 +
 libavdevice/alldevices.c |   1 +
 libavdevice/d3dHelpers.h |  59 
 libavdevice/direct3d11.interop.h |  51 +++
 libavdevice/dxgigrab.cpp | 225 +++
 libavdevice/dxgigrab.h   |  83 
 libavdevice/dxgigrab_c.c |  59 
 libavdevice/dxgigrab_c.h |  98 ++
 libavdevice/windows_capture.cpp  | 184 +
 libavdevice/windows_capture.h|  82 +++
 11 files changed, 847 insertions(+)
 create mode 100644 libavdevice/d3dHelpers.h
 create mode 100644 libavdevice/direct3d11.interop.h
 create mode 100644 libavdevice/dxgigrab.cpp
 create mode 100644 libavdevice/dxgigrab.h
 create mode 100644 libavdevice/dxgigrab_c.c
 create mode 100644 libavdevice/dxgigrab_c.h
 create mode 100644 libavdevice/windows_capture.cpp
 create mode 100644 libavdevice/windows_capture.h

diff --git a/configure b/configure
index 12184c7f26..c9cbee0c09 100755
--- a/configure
+++ b/configure
@@ -3529,6 +3529,7 @@ fbdev_outdev_deps="linux_fb_h"
 gdigrab_indev_deps="CreateDIBSection"
 gdigrab_indev_extralibs="-lgdi32"
 gdigrab_indev_select="bmp_decoder"
+dxgigrab_indev_extralibs="-ldxgi -ld3d11"
 iec61883_indev_deps="libiec61883"
 iec61883_indev_select="dv_demuxer"
 jack_indev_deps="libjack"
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 8a62822b69..6740012000 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -30,6 +30,7 @@ OBJS-$(CONFIG_FBDEV_INDEV)   += fbdev_dec.o \
 OBJS-$(CONFIG_FBDEV_OUTDEV)  += fbdev_enc.o \
 fbdev_common.o
 OBJS-$(CONFIG_GDIGRAB_INDEV) += gdigrab.o
+OBJS-$(CONFIG_DXGIGRAB_INDEV)+= windows_capture.o dxgigrab.o 
dxgigrab_c.o
 OBJS-$(CONFIG_IEC61883_INDEV)+= iec61883.o
 OBJS-$(CONFIG_JACK_INDEV)+= jack.o timefilter.o
 OBJS-$(CONFIG_KMSGRAB_INDEV) += kmsgrab.o
@@ -72,5 +73,8 @@ SKIPHEADERS-$(CONFIG_V4L2_INDEV) += v4l2-common.h
 SKIPHEADERS-$(CONFIG_V4L2_OUTDEV)+= v4l2-common.h
 SKIPHEADERS-$(CONFIG_ALSA)   += alsa.h
 SKIPHEADERS-$(CONFIG_SNDIO)  += sndio.h
+SKIPHEADERS-$(CONFIG_DXGIGRAB_INDEV) += dxgigrab.h \
+windows_capture.h \
+dxgigrab_c.h
 
 TESTPROGS-$(CONFIG_JACK_INDEV)   += timefilter
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 22323a0a44..fb0a37513b 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -35,6 +35,7 @@ extern const AVInputFormat  ff_dshow_demuxer;
 extern const AVInputFormat  ff_fbdev_demuxer;
 extern const AVOutputFormat ff_fbdev_muxer;
 extern const AVInputFormat  ff_gdigrab_demuxer;
+extern const AVInputFormat  ff_dxgigrab_demuxer;
 extern const AVInputFormat  ff_iec61883_demuxer;
 extern const AVInputFormat  ff_jack_demuxer;
 extern const AVInputFormat  ff_kmsgrab_demuxer;
diff --git a/libavdevice/d3dHelpers.h b/libavdevice/d3dHelpers.h
new file mode 100644
index 00..d8d2c003ec
--- /dev/null
+++ b/libavdevice/d3dHelpers.h
@@ -0,0 +1,59 @@
+/*
+ * 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
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+
+inline auto
+CreateD3DDevice(
+D3D_DRIVER_TYPE const type,
+winrt::com_ptr& device)
+{
+WINRT_ASSERT(!device);
+
+UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
+
+return D3D11CreateDevice(
+nullptr,
+type,
+nullptr,
+flags,
+nullptr, 0,
+D3D11_SDK_VERSION,
+device.put(),
+nullptr,
+nullptr);
+}
+
+inline auto
+CreateD3DDevice()
+{
+winrt::com_ptr device;
+HRESULT hr = CreateD3DDevice(D3D_DRIVER_TYPE_HARDWARE, device);
+
+if (DXGI_ERROR_UNSUPPORTED == hr)
+{
+hr = 

[FFmpeg-devel] [PATCH] avdevice/xcbgrab: enable window resizing

2023-02-09 Thread aline . gondimsantos
From: Aline Gondim Santos 

Signed-off-by: Aline Gondim Santos 
---
 libavdevice/xcbgrab.c | 180 +-
 1 file changed, 39 insertions(+), 141 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 64a68ba497..05282911a9 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -29,11 +29,6 @@
 #include 
 #endif
 
-#if CONFIG_LIBXCB_SHM
-#include 
-#include 
-#endif
-
 #if CONFIG_LIBXCB_SHAPE
 #include 
 #endif
@@ -53,9 +48,6 @@ typedef struct XCBGrabContext {
 xcb_connection_t *conn;
 xcb_screen_t *screen;
 xcb_window_t window;
-#if CONFIG_LIBXCB_SHM
-AVBufferPool *shm_pool;
-#endif
 int64_t time_frame;
 AVRational time_base;
 int64_t frame_duration;
@@ -72,10 +64,9 @@ typedef struct XCBGrabContext {
 int region_border;
 int centered;
 int select_region;
+int is_area;
 
 const char *framerate;
-
-int has_shm;
 } XCBGrabContext;
 
 #define FOLLOW_CENTER -1
@@ -97,6 +88,7 @@ static const AVOption options[] = {
 { "show_region", "Show the grabbing region.", OFFSET(show_region), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
 { "region_border", "Set the region border thickness.", 
OFFSET(region_border), AV_OPT_TYPE_INT, { .i64 = 3 }, 1, 128, D },
 { "select_region", "Select the grabbing region graphically using the 
pointer.", OFFSET(select_region), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D },
+{ "is_area", "Define if we are grabing a region of the display/window.", 
OFFSET(is_area), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D },
 { NULL },
 };
 
@@ -216,99 +208,6 @@ static int64_t wait_frame(AVFormatContext *s, AVPacket 
*pkt)
 return curtime;
 }
 
-#if CONFIG_LIBXCB_SHM
-static int check_shm(xcb_connection_t *conn)
-{
-xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(conn);
-xcb_shm_query_version_reply_t *reply;
-
-reply = xcb_shm_query_version_reply(conn, cookie, NULL);
-if (reply) {
-free(reply);
-return 1;
-}
-
-return 0;
-}
-
-static void free_shm_buffer(void *opaque, uint8_t *data)
-{
-shmdt(data);
-}
-
-static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
-{
-xcb_connection_t *conn = opaque;
-xcb_shm_seg_t segment;
-AVBufferRef *ref;
-uint8_t *data;
-int id;
-
-id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
-if (id == -1)
-return NULL;
-
-segment = xcb_generate_id(conn);
-xcb_shm_attach(conn, segment, id, 0);
-data = shmat(id, NULL, 0);
-shmctl(id, IPC_RMID, 0);
-if ((intptr_t)data == -1 || !data)
-return NULL;
-
-ref = av_buffer_create(data, size, free_shm_buffer, (void 
*)(ptrdiff_t)segment, 0);
-if (!ref)
-shmdt(data);
-
-return ref;
-}
-
-static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt)
-{
-XCBGrabContext *c = s->priv_data;
-xcb_shm_get_image_cookie_t iq;
-xcb_shm_get_image_reply_t *img;
-xcb_drawable_t drawable = c->window_id;
-xcb_generic_error_t *e = NULL;
-AVBufferRef *buf;
-xcb_shm_seg_t segment;
-
-buf = av_buffer_pool_get(c->shm_pool);
-if (!buf) {
-av_log(s, AV_LOG_ERROR, "Could not get shared memory buffer.\n");
-return AVERROR(ENOMEM);
-}
-segment = (xcb_shm_seg_t)(uintptr_t)av_buffer_pool_buffer_get_opaque(buf);
-
-iq = xcb_shm_get_image(c->conn, drawable,
-   c->x, c->y, c->width, c->height, ~0,
-   XCB_IMAGE_FORMAT_Z_PIXMAP, segment, 0);
-img = xcb_shm_get_image_reply(c->conn, iq, &e);
-
-xcb_flush(c->conn);
-
-if (e) {
-av_log(s, AV_LOG_ERROR,
-   "Cannot get the image data "
-   "event_error: response_type:%u error_code:%u "
-   "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
-   e->response_type, e->error_code,
-   e->sequence, e->resource_id, e->minor_code, e->major_code);
-
-free(e);
-av_buffer_unref(&buf);
-return AVERROR(EACCES);
-}
-
-free(img);
-
-pkt->buf = buf;
-pkt->data = buf->data;
-pkt->size = c->frame_size;
-
-return 0;
-}
-#endif /* CONFIG_LIBXCB_SHM */
-
 #if CONFIG_LIBXCB_XFIXES
 static int check_xfixes(xcb_connection_t *conn)
 {
@@ -462,14 +361,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (c->show_region)
 xcbgrab_update_region(s, win_x, win_y);
 
-#if CONFIG_LIBXCB_SHM
-if (c->has_shm && xcbgrab_frame_shm(s, pkt) < 0) {
-av_log(s, AV_LOG_WARNING, "Continuing without shared memory.\n");
-c->has_shm = 0;
-}
-#endif
-if (!c->has_shm)
-ret = xcbgrab_frame(s, pkt);
+ret = xcbgrab_frame(s, pkt);
 pkt->dts = pkt->pts = pts;
 pkt->duration = c->frame_duration;
 
@@ -488,11 +380,8 @@ static av_cold int xcbgrab_read_close(AVFormatContext *s)
 {
 XCBGrabContext *ctx = s->priv_data;
 
-#if CONFIG_LIBXCB_SHM
-av_buffer_pool_uninit(

[FFmpeg-devel] [PATCH] fftools/ffmpeg: rename -enc_stats* to -stats_enc*

2023-02-09 Thread Anton Khirnov
This is consistent with -stats_mux*

As the options were added very recently, this should not break any
users.
---
 Changelog|  2 +-
 doc/ffmpeg.texi  | 20 ++--
 fftools/ffmpeg_opt.c | 12 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Changelog b/Changelog
index bd9fe9922d..11dfd7ef73 100644
--- a/Changelog
+++ b/Changelog
@@ -32,7 +32,7 @@ version :
 - WADY DPCM decoder and demuxer
 - CBD2 DPCM decoder
 - ssim360 video filter
-- ffmpeg CLI new options: -enc_stats_pre[_fmt], -enc_stats_post[_fmt],
+- ffmpeg CLI new options: -stats_enc_pre[_fmt], -stats_enc_post[_fmt],
   -stats_mux_pre[_fmt]
 - hstack_vaapi, vstack_vaapi and xstack_vaapi filters
 - XMD ADPCM decoder and demuxer
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 076956d128..d9d4b75567 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -2061,30 +2061,30 @@ encoder/muxer, it does not change the stream to conform 
to this value. Setting
 values that do not match the stream properties may result in encoding failures
 or invalid output files.
 
-@item -enc_stats_pre[:@var{stream_specifier}] @var{path} 
(@emph{output,per-stream})
-@item -enc_stats_post[:@var{stream_specifier}] @var{path} 
(@emph{output,per-stream})
+@item -stats_enc_pre[:@var{stream_specifier}] @var{path} 
(@emph{output,per-stream})
+@item -stats_enc_post[:@var{stream_specifier}] @var{path} 
(@emph{output,per-stream})
 @item -stats_mux_pre[:@var{stream_specifier}] @var{path} 
(@emph{output,per-stream})
 Write per-frame encoding information about the matching streams into the file
 given by @var{path}.
 
-@option{-enc_stats_pre} writes information about raw video or audio frames 
right
-before they are sent for encoding, while @option{-enc_stats_post} writes
+@option{-stats_enc_pre} writes information about raw video or audio frames 
right
+before they are sent for encoding, while @option{-stats_enc_post} writes
 information about encoded packets as they are received from the encoder.
 @option{-stats_mux_pre} writes information about packets just as they are 
about to
 be sent to the muxer. Every frame or packet produces one line in the specified
-file. The format of this line is controlled by @option{-enc_stats_pre_fmt} /
-@option{-enc_stats_post_fmt} / @option{-stats_mux_pre_fmt}.
+file. The format of this line is controlled by @option{-stats_enc_pre_fmt} /
+@option{-stats_enc_post_fmt} / @option{-stats_mux_pre_fmt}.
 
 When stats for multiple streams are written into a single file, the lines
 corresponding to different streams will be interleaved. The precise order of
 this interleaving is not specified and not guaranteed to remain stable between
 different invocations of the program, even with the same options.
 
-@item -enc_stats_pre_fmt[:@var{stream_specifier}] @var{format_spec} 
(@emph{output,per-stream})
-@item -enc_stats_post_fmt[:@var{stream_specifier}] @var{format_spec} 
(@emph{output,per-stream})
+@item -stats_enc_pre_fmt[:@var{stream_specifier}] @var{format_spec} 
(@emph{output,per-stream})
+@item -stats_enc_post_fmt[:@var{stream_specifier}] @var{format_spec} 
(@emph{output,per-stream})
 @item -stats_mux_pre_fmt[:@var{stream_specifier}] @var{format_spec} 
(@emph{output,per-stream})
-Specify the format for the lines written with @option{-enc_stats_pre} /
-@option{-enc_stats_post} / @option{-stats_mux_pre}.
+Specify the format for the lines written with @option{-stats_enc_pre} /
+@option{-stats_enc_post} / @option{-stats_mux_pre}.
 
 @var{format_spec} is a string that may contain directives of the form
 @var{@{fmt@}}. @var{format_spec} is backslash-escaped --- use \@{, \@}, and \\
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index ed7ee6ab7d..055275d813 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1544,16 +1544,16 @@ const OptionDef options[] = {
 { .off = OFFSET(bits_per_raw_sample) },
 "set the number of bits per raw sample", "number" },
 
-{ "enc_stats_pre",  HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(enc_stats_pre)  },
+{ "stats_enc_pre",  HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(enc_stats_pre)  },
 "write encoding stats before encoding" },
-{ "enc_stats_post", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(enc_stats_post) },
+{ "stats_enc_post", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(enc_stats_post) },
 "write encoding stats after encoding" },
 { "stats_mux_pre",  HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(mux_stats)  },
 "write packets stats before muxing" },
-{ "enc_stats_pre_fmt",  HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | 
OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt)  },
-"format of the stats written with -enc_stats_pre" },
-{ "enc_stats_post_fmt", HAS_ARG | OPT_SPEC | OPT_

Re: [FFmpeg-devel] [PATCH] avdevice/xcbgrab: enable window resizing

2023-02-09 Thread Nicolas George
aline.gondimsan...@savoirfairelinux.com (12023-02-09):
> From: Aline Gondim Santos 
> 
> Signed-off-by: Aline Gondim Santos 
> ---
>  libavdevice/xcbgrab.c | 180 +-
>  1 file changed, 39 insertions(+), 141 deletions(-)

Hi. Thanks for the patch. Are you removing support for using shared
memory entirely to implement this feature? If so, can we see some
benchmarks comparisons?

Regards,

-- 
  Nicolas George
___
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] libavcodec/amfenc: Add mapping for AV_PIX_FMT_BGRA

2023-02-09 Thread Romain Roffé
DXGI Desktop duplication outputs BGRA frames.

Signed-off-by: Romain Roffé 
---
 libavcodec/amfenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index c487fc48aa..06bd2a45db 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -73,6 +73,7 @@ static const FormatMap format_map[] =
 { AV_PIX_FMT_NONE,   AMF_SURFACE_UNKNOWN },
 { AV_PIX_FMT_NV12,   AMF_SURFACE_NV12 },
 { AV_PIX_FMT_BGR0,   AMF_SURFACE_BGRA },
+{ AV_PIX_FMT_BGRA,   AMF_SURFACE_BGRA },
 { AV_PIX_FMT_RGB0,   AMF_SURFACE_RGBA },
 { AV_PIX_FMT_GRAY8,  AMF_SURFACE_GRAY8 },
 { AV_PIX_FMT_YUV420P,AMF_SURFACE_YUV420P },
-- 
2.30.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 2/2] avformat/flvenc: add option to read metadata from file

2023-02-09 Thread Anton Khirnov
Quoting Gyan Doshi (2023-02-05 12:05:19)
> 
> 
> On 2023-02-05 04:07 pm, Anton Khirnov wrote:
> > Quoting Gyan Doshi (2023-02-04 11:11:12)
> >> On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:
> >>> What does this achieve that can't be achieved by other means (namely by
> >>> an API-user updating the relevant metadata dictionaries)?
> >> This option together with meta_period is for CLI users.
> > Options for CLI users should be in the CLI, not the libraries.
> 
> Do I then add and use a AVFMT flag to avoid recurring metadata updates 
> for all other muxers?

I don't follow, why should there be a lavf flag for an ffmpeg CLI
option?

-- 
Anton Khirnov
___
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] fftools/ffmpeg_mux: distinguish between sync queue and muxer EOF

2023-02-09 Thread Anton Khirnov
---
How about something like this?
---
 fftools/ffmpeg_mux.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index dffc1410c8..cf58051949 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -159,14 +159,18 @@ fail:
 return ret;
 }
 
-static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt)
+static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, 
int *stream_eof)
 {
 OutputFile *of = &mux->of;
 
 if (ost->sq_idx_mux >= 0) {
 int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
-if (ret < 0)
+if (ret < 0) {
+if (ret == AVERROR_EOF)
+*stream_eof = 1;
+
 return ret;
+}
 
 while (1) {
 ret = sq_receive(mux->sq_mux, -1, SQPKT(mux->sq_pkt));
@@ -208,7 +212,7 @@ static void *muxer_thread(void *arg)
 
 while (1) {
 OutputStream *ost;
-int stream_idx;
+int stream_idx, stream_eof = 0;
 
 ret = tq_receive(mux->tq, &stream_idx, pkt);
 if (stream_idx < 0) {
@@ -218,9 +222,9 @@ static void *muxer_thread(void *arg)
 }
 
 ost = of->streams[stream_idx];
-ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt);
+ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt, &stream_eof);
 av_packet_unref(pkt);
-if (ret == AVERROR_EOF)
+if (ret == AVERROR_EOF && stream_eof)
 tq_receive_finish(mux->tq, stream_idx);
 else if (ret < 0) {
 av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");
-- 
2.35.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".


Re: [FFmpeg-devel] [PATCH] avdevice: add dxgigrab

2023-02-09 Thread Timo Rothenpieler

On 09.02.2023 15:22, aline.gondimsan...@savoirfairelinux.com wrote:

From: Aline Gondim Santos 

A dxgi grab device may be either a display or a window.
Differently from the existing gdigrab, this new device does
not make the mouse to flick and also allows proper grabbing of
accelerated windows, such as chrome or visual studio code.


How do you get access to the d3d hwdevice, given this lives in lavd, 
which has no provisions for that?
This looks much more like it'd fit in with the desktop duplication 
capture, which ended up being a vsrc filter for that reason.



Signed-off-by: Aline Gondim Santos 
---
  configure|   1 +
  libavdevice/Makefile |   4 +
  libavdevice/alldevices.c |   1 +
  libavdevice/d3dHelpers.h |  59 
  libavdevice/direct3d11.interop.h |  51 +++
  libavdevice/dxgigrab.cpp | 225 +++
  libavdevice/dxgigrab.h   |  83 
  libavdevice/dxgigrab_c.c |  59 
  libavdevice/dxgigrab_c.h |  98 ++
  libavdevice/windows_capture.cpp  | 184 +
  libavdevice/windows_capture.h|  82 +++


The name of these files seem way too generic to just sit there like this 
in the top level.



  11 files changed, 847 insertions(+)
  create mode 100644 libavdevice/d3dHelpers.h
  create mode 100644 libavdevice/direct3d11.interop.h
  create mode 100644 libavdevice/dxgigrab.cpp
  create mode 100644 libavdevice/dxgigrab.h
  create mode 100644 libavdevice/dxgigrab_c.c
  create mode 100644 libavdevice/dxgigrab_c.h
  create mode 100644 libavdevice/windows_capture.cpp
  create mode 100644 libavdevice/windows_capture.h

diff --git a/configure b/configure
index 12184c7f26..c9cbee0c09 100755
--- a/configure
+++ b/configure
@@ -3529,6 +3529,7 @@ fbdev_outdev_deps="linux_fb_h"
  gdigrab_indev_deps="CreateDIBSection"
  gdigrab_indev_extralibs="-lgdi32"
  gdigrab_indev_select="bmp_decoder"
+dxgigrab_indev_extralibs="-ldxgi -ld3d11"
  iec61883_indev_deps="libiec61883"
  iec61883_indev_select="dv_demuxer"
  jack_indev_deps="libjack"
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 8a62822b69..6740012000 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -30,6 +30,7 @@ OBJS-$(CONFIG_FBDEV_INDEV)   += fbdev_dec.o \
  OBJS-$(CONFIG_FBDEV_OUTDEV)  += fbdev_enc.o \
  fbdev_common.o
  OBJS-$(CONFIG_GDIGRAB_INDEV) += gdigrab.o
+OBJS-$(CONFIG_DXGIGRAB_INDEV)+= windows_capture.o dxgigrab.o 
dxgigrab_c.o
  OBJS-$(CONFIG_IEC61883_INDEV)+= iec61883.o
  OBJS-$(CONFIG_JACK_INDEV)+= jack.o timefilter.o
  OBJS-$(CONFIG_KMSGRAB_INDEV) += kmsgrab.o
@@ -72,5 +73,8 @@ SKIPHEADERS-$(CONFIG_V4L2_INDEV) += v4l2-common.h
  SKIPHEADERS-$(CONFIG_V4L2_OUTDEV)+= v4l2-common.h
  SKIPHEADERS-$(CONFIG_ALSA)   += alsa.h
  SKIPHEADERS-$(CONFIG_SNDIO)  += sndio.h
+SKIPHEADERS-$(CONFIG_DXGIGRAB_INDEV) += dxgigrab.h \
+windows_capture.h \
+dxgigrab_c.h
  
  TESTPROGS-$(CONFIG_JACK_INDEV)   += timefilter

diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 22323a0a44..fb0a37513b 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -35,6 +35,7 @@ extern const AVInputFormat  ff_dshow_demuxer;
  extern const AVInputFormat  ff_fbdev_demuxer;
  extern const AVOutputFormat ff_fbdev_muxer;
  extern const AVInputFormat  ff_gdigrab_demuxer;
+extern const AVInputFormat  ff_dxgigrab_demuxer;
  extern const AVInputFormat  ff_iec61883_demuxer;
  extern const AVInputFormat  ff_jack_demuxer;
  extern const AVInputFormat  ff_kmsgrab_demuxer;
diff --git a/libavdevice/d3dHelpers.h b/libavdevice/d3dHelpers.h
new file mode 100644
index 00..d8d2c003ec
--- /dev/null
+++ b/libavdevice/d3dHelpers.h
@@ -0,0 +1,59 @@
+/*
+ * 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
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 


Are these headers parts of any normal windows SDK?
I don't see them in anything mingw has.
Does this break cross compiling from Linux, or 

Re: [FFmpeg-devel] [PATCH] avdevice: add dxgigrab

2023-02-09 Thread Nicolas George
Timo Rothenpieler (12023-02-09):
> How do you get access to the d3d hwdevice, given this lives in lavd, which
> has no provisions for that?

Would it work better if it was in the same library?

Regards,

-- 
  Nicolas George
___
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] avformat/flvenc: add option to read metadata from file

2023-02-09 Thread Gyan Doshi




On 2023-02-09 09:15 pm, Anton Khirnov wrote:

Quoting Gyan Doshi (2023-02-05 12:05:19)


On 2023-02-05 04:07 pm, Anton Khirnov wrote:

Quoting Gyan Doshi (2023-02-04 11:11:12)

On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:

What does this achieve that can't be achieved by other means (namely by
an API-user updating the relevant metadata dictionaries)?

This option together with meta_period is for CLI users.

Options for CLI users should be in the CLI, not the libraries.

Do I then add and use a AVFMT flag to avoid recurring metadata updates
for all other muxers?

I don't follow, why should there be a lavf flag for an ffmpeg CLI
option?


The meta period option will control how frequently the metadata file is 
read and the muxer ctx dict updated in ffttools write_packet.
Only one muxer - flvenc - can be triggered to recheck the dict in its 
.write_packet, so it seems wasteful to carry out those ops generally.

The AVFMT flag can guard that.

Regards,
Gyan

___
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] fftools/ffmpeg_mux: distinguish between sync queue and muxer EOF

2023-02-09 Thread Gyan Doshi




On 2023-02-09 09:27 pm, Anton Khirnov wrote:

---
How about something like this?


Yes, this works.

Regards,
Gyan


---
  fftools/ffmpeg_mux.c | 14 +-
  1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index dffc1410c8..cf58051949 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -159,14 +159,18 @@ fail:
  return ret;
  }
  
-static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt)

+static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, 
int *stream_eof)
  {
  OutputFile *of = &mux->of;
  
  if (ost->sq_idx_mux >= 0) {

  int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
-if (ret < 0)
+if (ret < 0) {
+if (ret == AVERROR_EOF)
+*stream_eof = 1;
+
  return ret;
+}
  
  while (1) {

  ret = sq_receive(mux->sq_mux, -1, SQPKT(mux->sq_pkt));
@@ -208,7 +212,7 @@ static void *muxer_thread(void *arg)
  
  while (1) {

  OutputStream *ost;
-int stream_idx;
+int stream_idx, stream_eof = 0;
  
  ret = tq_receive(mux->tq, &stream_idx, pkt);

  if (stream_idx < 0) {
@@ -218,9 +222,9 @@ static void *muxer_thread(void *arg)
  }
  
  ost = of->streams[stream_idx];

-ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt);
+ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt, &stream_eof);
  av_packet_unref(pkt);
-if (ret == AVERROR_EOF)
+if (ret == AVERROR_EOF && stream_eof)
  tq_receive_finish(mux->tq, stream_idx);
  else if (ret < 0) {
  av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");


___
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 1/2] doc/dev_community: add the addresses of the committees

2023-02-09 Thread Nicolas George
Thilo Borgman (12023-02-08):
> From: Nicolas George 
> 
> Omitting the .org from the address should be protection enough
> against spam spiders.
> 
> Signed-off-by: Nicolas George 
> ---
>  doc/dev_community/community.md | 4 
>  1 file changed, 4 insertions(+)

Thanks for picking this up.

Regards,

-- 
  Nicolas George
___
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] avdevice: add dxgigrab

2023-02-09 Thread Timo Rothenpieler

On 09.02.2023 17:10, Nicolas George wrote:

Timo Rothenpieler (12023-02-09):

How do you get access to the d3d hwdevice, given this lives in lavd, which
has no provisions for that?


Would it work better if it was in the same library?


It's not so much about in which library it is, but that there is 
absolutely no API for hwdecide stuff in lavd.
While lavfi is all prepared for it, and ffmpeg.c has tons of options to 
control it.

___
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] (no subject)

2023-02-09 Thread Aline Gondim Santos



Hello Nicolas,
Bellow you can find the bechmarks using `ffmpeg -benchmark` option.

1 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: 
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x564d03e165c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675963927.428661, bitrate: 3379200 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1master.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  251 fps= 25 q=31.0 Lsize=5720kB time=00:00:10.00 
bitrate=4686.0kbits/s speed=0.996x
video:5718kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034719%
bench: utime=13.142s stime=0.307s rtime=10.039s
bench: maxrss=207576kB

2 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -window_id 0x568 -i 
":1+0,0 1920x1080"  output2master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: 
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675963986.581500, bitrate: 472305 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 841x702, 472305 kb/s, 
25 fps, 25 tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output2master.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
841x702, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=1274kB time=00:00:09.96 
bitrate=1047.9kbits/s speed=   1x
video:1272kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.151768%
bench: utime=0.628s stime=1.465s rtime=9.920s
bench: maxrss=52268kB   


3 - patch applied

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1.mp4
ffmpeg version N-109783-g2352934f8b Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: 
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x55e86905b5c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675964519.431271, bitrate: 3379200 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=5723kB time=00:00:09.96 
bitrate=4706.8kbits/s speed=0.996x
video:5721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034227%
bench: utime=14.005s stime=0.168s rtime=9.998s
bench: maxrss=207828kB


4 - patch applied


./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -window_id 0x568 -i 
":1+0,0 1920x1080"  output2.mp4
ffmpeg version N-109783-g2352934f8b Copyright (c) 20

[FFmpeg-devel] [PATCH] avdevice/xcbgrab: enable window resizing

2023-02-09 Thread Aline Gondim Santos
Signed-off-by: Aline Gondim Santos 
---
 libavdevice/xcbgrab.c | 180 +-
 1 file changed, 39 insertions(+), 141 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 64a68ba497..05282911a9 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -29,11 +29,6 @@
 #include 
 #endif
 
-#if CONFIG_LIBXCB_SHM
-#include 
-#include 
-#endif
-
 #if CONFIG_LIBXCB_SHAPE
 #include 
 #endif
@@ -53,9 +48,6 @@ typedef struct XCBGrabContext {
 xcb_connection_t *conn;
 xcb_screen_t *screen;
 xcb_window_t window;
-#if CONFIG_LIBXCB_SHM
-AVBufferPool *shm_pool;
-#endif
 int64_t time_frame;
 AVRational time_base;
 int64_t frame_duration;
@@ -72,10 +64,9 @@ typedef struct XCBGrabContext {
 int region_border;
 int centered;
 int select_region;
+int is_area;
 
 const char *framerate;
-
-int has_shm;
 } XCBGrabContext;
 
 #define FOLLOW_CENTER -1
@@ -97,6 +88,7 @@ static const AVOption options[] = {
 { "show_region", "Show the grabbing region.", OFFSET(show_region), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
 { "region_border", "Set the region border thickness.", 
OFFSET(region_border), AV_OPT_TYPE_INT, { .i64 = 3 }, 1, 128, D },
 { "select_region", "Select the grabbing region graphically using the 
pointer.", OFFSET(select_region), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D },
+{ "is_area", "Define if we are grabing a region of the display/window.", 
OFFSET(is_area), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D },
 { NULL },
 };
 
@@ -216,99 +208,6 @@ static int64_t wait_frame(AVFormatContext *s, AVPacket 
*pkt)
 return curtime;
 }
 
-#if CONFIG_LIBXCB_SHM
-static int check_shm(xcb_connection_t *conn)
-{
-xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(conn);
-xcb_shm_query_version_reply_t *reply;
-
-reply = xcb_shm_query_version_reply(conn, cookie, NULL);
-if (reply) {
-free(reply);
-return 1;
-}
-
-return 0;
-}
-
-static void free_shm_buffer(void *opaque, uint8_t *data)
-{
-shmdt(data);
-}
-
-static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
-{
-xcb_connection_t *conn = opaque;
-xcb_shm_seg_t segment;
-AVBufferRef *ref;
-uint8_t *data;
-int id;
-
-id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
-if (id == -1)
-return NULL;
-
-segment = xcb_generate_id(conn);
-xcb_shm_attach(conn, segment, id, 0);
-data = shmat(id, NULL, 0);
-shmctl(id, IPC_RMID, 0);
-if ((intptr_t)data == -1 || !data)
-return NULL;
-
-ref = av_buffer_create(data, size, free_shm_buffer, (void 
*)(ptrdiff_t)segment, 0);
-if (!ref)
-shmdt(data);
-
-return ref;
-}
-
-static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt)
-{
-XCBGrabContext *c = s->priv_data;
-xcb_shm_get_image_cookie_t iq;
-xcb_shm_get_image_reply_t *img;
-xcb_drawable_t drawable = c->window_id;
-xcb_generic_error_t *e = NULL;
-AVBufferRef *buf;
-xcb_shm_seg_t segment;
-
-buf = av_buffer_pool_get(c->shm_pool);
-if (!buf) {
-av_log(s, AV_LOG_ERROR, "Could not get shared memory buffer.\n");
-return AVERROR(ENOMEM);
-}
-segment = (xcb_shm_seg_t)(uintptr_t)av_buffer_pool_buffer_get_opaque(buf);
-
-iq = xcb_shm_get_image(c->conn, drawable,
-   c->x, c->y, c->width, c->height, ~0,
-   XCB_IMAGE_FORMAT_Z_PIXMAP, segment, 0);
-img = xcb_shm_get_image_reply(c->conn, iq, &e);
-
-xcb_flush(c->conn);
-
-if (e) {
-av_log(s, AV_LOG_ERROR,
-   "Cannot get the image data "
-   "event_error: response_type:%u error_code:%u "
-   "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
-   e->response_type, e->error_code,
-   e->sequence, e->resource_id, e->minor_code, e->major_code);
-
-free(e);
-av_buffer_unref(&buf);
-return AVERROR(EACCES);
-}
-
-free(img);
-
-pkt->buf = buf;
-pkt->data = buf->data;
-pkt->size = c->frame_size;
-
-return 0;
-}
-#endif /* CONFIG_LIBXCB_SHM */
-
 #if CONFIG_LIBXCB_XFIXES
 static int check_xfixes(xcb_connection_t *conn)
 {
@@ -462,14 +361,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (c->show_region)
 xcbgrab_update_region(s, win_x, win_y);
 
-#if CONFIG_LIBXCB_SHM
-if (c->has_shm && xcbgrab_frame_shm(s, pkt) < 0) {
-av_log(s, AV_LOG_WARNING, "Continuing without shared memory.\n");
-c->has_shm = 0;
-}
-#endif
-if (!c->has_shm)
-ret = xcbgrab_frame(s, pkt);
+ret = xcbgrab_frame(s, pkt);
 pkt->dts = pkt->pts = pts;
 pkt->duration = c->frame_duration;
 
@@ -488,11 +380,8 @@ static av_cold int xcbgrab_read_close(AVFormatContext *s)
 {
 XCBGrabContext *ctx = s->priv_data;
 
-#if CONFIG_LIBXCB_SHM
-av_buffer_pool_uninit(&ctx->shm_pool);
-#endif
-
 

Re: [FFmpeg-devel] [PATCH] avdevice/xcbgrab: enable window resizing

2023-02-09 Thread Aline Gondim Santos Gondim Santos
Hello Nicolas,
Bellow you can find the bechmarks using `ffmpeg -benchmark` option.

1 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration:
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x564d03e165c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675963927.428661, bitrate: 3379200 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1master.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  251 fps= 25 q=31.0 Lsize=5720kB time=00:00:10.00 
bitrate=4686.0kbits/s speed=0.996x
video:5718kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034719%
bench: utime=13.142s stime=0.307s rtime=10.039s
bench: maxrss=207576kB

2 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -window_id 0x568 -i 
":1+0,0 1920x1080"  output2master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration:
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675963986.581500, bitrate: 472305 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 841x702, 472305 kb/s, 
25 fps, 25 tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output2master.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
841x702, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=1274kB time=00:00:09.96 
bitrate=1047.9kbits/s speed=   1x
video:1272kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.151768%
bench: utime=0.628s stime=1.465s rtime=9.920s
bench: maxrss=52268kB  


3 - patch applied

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1.mp4
ffmpeg version N-109783-g2352934f8b Copyright (c) 2000-2023 the FFmpeg 
developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration:
  libavutil  57. 44.100 / 57. 44.100
  libavcodec 59. 63.100 / 59. 63.100
  libavformat59. 38.100 / 59. 38.100
  libavdevice59.  8.101 / 59.  8.101
  libavfilter 8. 56.100 /  8. 56.100
  libswscale  6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x55e86905b5c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
  Duration: N/A, start: 1675964519.431271, bitrate: 3379200 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1.mp4':
  Metadata:
encoder : Lavf59.38.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
Metadata:
  encoder : Lavc59.63.100 mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=5723kB time=00:00:09.96 
bitrate=4706.8kbits/s speed=0.996x
video:5721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034227%
bench: utime=14.005s stime=0.168s rtime=9.998s
bench: maxrss=207828kB


4 - patch applied


./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -window_id 0x568 -i 
":1+0,0 1920x1080"  output2.mp4
ffmpeg version N-109783-g2352934f8b Copyright (c) 2000-2023

Re: [FFmpeg-devel] [PATCH] avdevice: add dxgigrab

2023-02-09 Thread Aline Gondim Santos Gondim Santos
> How do you get access to the d3d hwdevice, given this lives in lavd,
> which has no provisions for that?
> This looks much more like it'd fit in with the desktop duplication
> capture, which ended up being a vsrc filter for that reason.

Upon developing the device i did notice the d3dhwdevice but I do not use it to 
get the frames.
When it was written that we could access accelerated windows, I did not mean to 
say that the
output from dxgigrab is an accelerated format. The access to such window frames 
is due to the
API that allows us to map the frames for CPU access.


> The name of these files seem way too generic to just sit there like this
> in the top level.

I can either rename or rearrange the files to a sub-folder is the patch is to 
be accepted.

> Are these headers parts of any normal windows SDK?
> I don't see them in anything mingw has.
> Does this break cross compiling from Linux, or with anything that's not
> MSVC?
> And given it's winrt... does this work on normal Desktop Windows?

Build was tested from a normal Windows 10 Desktop with both VisualStudio 2019 
and 2022, the required SDK is 10.0.18632.0.
lower SDK do not have required includes and SDK 10.019XXX is bugged. Other SDKs 
were not tested.
In the following link you can find the configuration used to build. 
https://git.jami.net/savoirfairelinux/jami-daemon/-/blob/master/contrib/src/ffmpeg/windows-configure-make.sh
please consider $1 = win32 and $2 = x64 .


For note, the current Jami beta release 
(https://jami.net/download-jami-windows/) uses the patch for window sharing in 
calls.
___
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] avformat/movenc: allow writing out channel count in MP4 and 3GP

2023-02-09 Thread Jan Ekström
On Thu, Feb 9, 2023 at 12:08 PM Martin Storsjö  wrote:
>
> This looks reasonable to me. I didn't follow the references in the commit
> message, but it sounds plausible and probably correct to me.
>

For the record, due to dumb ISO/IEC rule changes regarding how
specifications need to be authorized to be free after 2015, it's
relatively hard to verify the 14496-12 part.

The last version of 14496-12 that was freely available (2015) defined
channelcount in AudioSampleEntry as follows:

template unsigned int(16) channelcount = 2;

Meanwhile the latest 2022 edition defines the related structure(s) as follows:

class AudioSampleEntry(codingname) extends SampleEntry (codingname) {
   const unsigned int(32)[2] reserved = 0;
   unsigned int(16) channelcount;
   template unsigned int(16) samplesize = 16;
   unsigned int(16) pre_defined = 0;
   const unsigned int(16) reserved = 0 ;
   template unsigned int(32) samplerate = { default samplerate of media} << 16;
   // optional boxes follow
   Box ();  // further boxes as needed
   ChannelLayout();
   DownMixInstructions() [];
   DRCCoefficientsBasic() [];
   DRCInstructionsBasic() [];
   DRCCoefficientsUniDRC() [];
   DRCInstructionsUniDRC() [];
   // we permit only one DRC Extension box:
   UniDrcConfigExtension();
   // optional boxes follow
   SamplingRateBox();
   ChannelLayout();
}

aligned(8) class SamplingRateBox extends FullBox('srat') {
   unsigned int(32) sampling_rate;
}

class AudioSampleEntryV1(codingname) extends SampleEntry (codingname) {
   unsigned int(16) entry_version;   // shall be 1,
 // and shall be in an stsd with version ==1
   const unsigned int(16)[3] reserved = 0;
   template unsigned int(16) channelcount;   // shall be correct
   template unsigned int(16) samplesize = 16;
   unsigned int(16) pre_defined = 0;
   const unsigned int(16) reserved = 0 ;
   template unsigned int(32) samplerate = 1<<16;
   // optional boxes follow
   SamplingRateBox();
   Box ();  // further boxes as needed
   ChannelLayout();
   DownMixInstructions() [];
   DRCCoefficientsBasic() [];
   DRCInstructionsBasic() [];
   DRCCoefficientsUniDRC() [];
   DRCInstructionsUniDRC() [];
   // we permit only one DRC Extension box:
   UniDrcConfigExtension();
   // optional boxes follow
   ChannelLayout();
}
___
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] avdevice/xcbgrab: enable window resizing

2023-02-09 Thread Marton Balint




On Thu, 9 Feb 2023, Aline Gondim Santos Gondim Santos wrote:


Hello Nicolas,
Bellow you can find the bechmarks using `ffmpeg -benchmark` option.


Utime change seems significant - as expected.

In general I don't like the idea of removing shared memory support, and I 
don't quite see why window resizing cannot be supported with shm.


Regards,
Marton



1 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
 built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
 configuration:
 libavutil  57. 44.100 / 57. 44.100
 libavcodec 59. 63.100 / 59. 63.100
 libavformat59. 38.100 / 59. 38.100
 libavdevice59.  8.101 / 59.  8.101
 libavfilter 8. 56.100 /  8. 56.100
 libswscale  6.  8.112 /  6.  8.112
 libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x564d03e165c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
 Duration: N/A, start: 1675963927.428661, bitrate: 3379200 kb/s
 Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1master.mp4':
 Metadata:
   encoder : Lavf59.38.100
 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
   Metadata:
 encoder : Lavc59.63.100 mpeg4
   Side data:
 cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  251 fps= 25 q=31.0 Lsize=5720kB time=00:00:10.00 
bitrate=4686.0kbits/s speed=0.996x
video:5718kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034719%
bench: utime=13.142s stime=0.307s rtime=10.039s
bench: maxrss=207576kB

2 - master

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -window_id 0x568 -i ":1+0,0 
1920x1080"  output2master.mp4
ffmpeg version N-109782-g458ae405ef Copyright (c) 2000-2023 the FFmpeg 
developers
 built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
 configuration:
 libavutil  57. 44.100 / 57. 44.100
 libavcodec 59. 63.100 / 59. 63.100
 libavformat59. 38.100 / 59. 38.100
 libavdevice59.  8.101 / 59.  8.101
 libavfilter 8. 56.100 /  8. 56.100
 libswscale  6.  8.112 /  6.  8.112
 libswresample   4.  9.100 /  4.  9.100
Input #0, x11grab, from ':1+0,0 1920x1080':
 Duration: N/A, start: 1675963986.581500, bitrate: 472305 kb/s
 Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 841x702, 472305 kb/s, 
25 fps, 25 tbr, 1000k tbn
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output2master.mp4':
 Metadata:
   encoder : Lavf59.38.100
 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
841x702, q=2-31, 200 kb/s, 25 fps, 12800 tbn
   Metadata:
 encoder : Lavc59.63.100 mpeg4
   Side data:
 cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=1274kB time=00:00:09.96 
bitrate=1047.9kbits/s speed=   1x
video:1272kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.151768%
bench: utime=0.628s stime=1.465s rtime=9.920s
bench: maxrss=52268kB


3 - patch applied

./ffmpeg -benchmark -t 10 -framerate 25 -f x11grab -i ":1+0,0 1920x1080"  
output1.mp4
ffmpeg version N-109783-g2352934f8b Copyright (c) 2000-2023 the FFmpeg 
developers
 built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
 configuration:
 libavutil  57. 44.100 / 57. 44.100
 libavcodec 59. 63.100 / 59. 63.100
 libavformat59. 38.100 / 59. 38.100
 libavdevice59.  8.101 / 59.  8.101
 libavfilter 8. 56.100 /  8. 56.100
 libswscale  6.  8.112 /  6.  8.112
 libswresample   4.  9.100 /  4.  9.100
[x11grab @ 0x55e86905b5c0] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':1+0,0 1920x1080':
 Duration: N/A, start: 1675964519.431271, bitrate: 3379200 kb/s
 Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3520x1200, 3379200 
kb/s, 25 fps, 1000k tbr, 1000k tbn
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output1.mp4':
 Metadata:
   encoder : Lavf59.38.100
 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 
3520x1200, q=2-31, 200 kb/s, 25 fps, 12800 tbn
   Metadata:
 encoder : Lavc59.63.100 mpeg4
   Side data:
 cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
frame=  250 fps= 25 q=31.0 Lsize=5723kB time=00:00:09.96 
bitrate=4706.8kbits/s speed=0.996x
video:5721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.034227%
bench: utime=14.005s stime=0.168s rtime=9.998s
bench:

Re: [FFmpeg-devel] [PATCH] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions

2023-02-09 Thread Hendrik Leppkes
On Thu, Feb 9, 2023 at 5:42 AM Marth64  wrote:
>
> Signed-off-by: Marth64 
> ---
> Adds detection of spatial/object-based audio extensions in E-AC-3,
> TrueHD, and DCA XLL (DTS). This includes Atmos, DTS:X, and IMAX formats.
> Please let me know what I could improve, I'm learning still.
> Thank you.
>

The detection itself seems fine to me, however we should talk about
how the presence is communicated back to the user.

A new flag in AVCodecContext goes against a variety of designs we try
to avoid - namely having codec-specific things in a global struct, as
well as having only one value, rather then per-frame values.

So options that present themself to me:
(a) Use "profile". At least for DTS that would fit quite nicely, as it
already has profiles, and it seems like a logical extension. TrueHD
and eac3 do not have profiles, but it might still be sensible to put
it there. The advantage here is that it also automatically is conveyed
in AVCodecParameters after avformat opens a stream, so the information
is available early and lets players decide how to handle the stream.
(b) Use per-frame side data. The early-availability advantage is not
present here, so its not my favorite. side-data could be used in the
future to transport the actual object metadata, if needed.

So from where I'm standing we should maybe define profiles to use for
these. In the past profiles were at least suggested for TrueHD Atmos
before, but there were some objections, so maybe a good time to
revisit and see where we go from here.

- Hendrik
___
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] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-09 Thread Ziemowit Laski
> FWIW, this setup is definitely being used by lots of others already - so
> whenever there's such an issue, the main question to ask is why others
> haven't run into the issue before. But improvements are definitely
> welcome!

You have to have PATH set up so that rc.exe is found inside the Windows SDK.
This is NOT the default behavior.  Usually, you would have to invoke the
'Developer Command Prompt' from the start menu to get the correct environment.

But I have my system set up so that the Microsoft tools are ALWAYS found,
regardless of which shell you are running.  That could explain the different
behavior that I'm seeing.

> You should probably talk about the option '/nologo' here, there's no
> '/logo' option afaik.

Yes, good catch, thanks.

> These changes seem fine, but you're apparently not touching the case at
> the top, used for --version, where it is calling 'rc.exe /?'. For me, this

That's an interesting point.  I guess MinGW is "smart enough" not to rewrite
"/?" because it doesn't represent a valid path to begin with.  I will change
it to "-?" as you suggest.

> Anyway, with the commit message fixed, and the case of /? changed into -?,
> this patch would seem fine to me - thanks for your contribution!

Will do.  Thanks for your review. 😊

--Zem
___
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] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-09 Thread Hendrik Leppkes
On Thu, Feb 9, 2023 at 10:02 PM Ziemowit Laski  wrote:
>
> > FWIW, this setup is definitely being used by lots of others already - so
> > whenever there's such an issue, the main question to ask is why others
> > haven't run into the issue before. But improvements are definitely
> > welcome!
>
> You have to have PATH set up so that rc.exe is found inside the Windows SDK.
> This is NOT the default behavior.  Usually, you would have to invoke the
> 'Developer Command Prompt' from the start menu to get the correct environment.
>
> But I have my system set up so that the Microsoft tools are ALWAYS found,
> regardless of which shell you are running.  That could explain the different
> behavior that I'm seeing.
>
> > You should probably talk about the option '/nologo' here, there's no
> > '/logo' option afaik.
>
> Yes, good catch, thanks.
>
> > These changes seem fine, but you're apparently not touching the case at
> > the top, used for --version, where it is calling 'rc.exe /?'. For me, this
>
> That's an interesting point.  I guess MinGW is "smart enough" not to rewrite
> "/?" because it doesn't represent a valid path to begin with.  I will change
> it to "-?" as you suggest.
>

You would think so, but attempting to run rc.exe /? straight from a
msys bash prompt over here does come up with an invalid file error, so
definitely better to fix it.

- Hendrik
___
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] avdevice: add dxgigrab

2023-02-09 Thread Michael Niedermayer
On Thu, Feb 09, 2023 at 04:58:46PM +0100, Timo Rothenpieler wrote:
> On 09.02.2023 15:22, aline.gondimsan...@savoirfairelinux.com wrote:
> > From: Aline Gondim Santos 
> > 
> > A dxgi grab device may be either a display or a window.
> > Differently from the existing gdigrab, this new device does
> > not make the mouse to flick and also allows proper grabbing of
> > accelerated windows, such as chrome or visual studio code.
> 
> How do you get access to the d3d hwdevice, given this lives in lavd, which
> has no provisions for that?
> This looks much more like it'd fit in with the desktop duplication capture,
> which ended up being a vsrc filter for that reason.
> 
> > Signed-off-by: Aline Gondim Santos 
> > ---
> >   configure|   1 +
> >   libavdevice/Makefile |   4 +
> >   libavdevice/alldevices.c |   1 +
> >   libavdevice/d3dHelpers.h |  59 
> >   libavdevice/direct3d11.interop.h |  51 +++
> >   libavdevice/dxgigrab.cpp | 225 +++
> >   libavdevice/dxgigrab.h   |  83 
> >   libavdevice/dxgigrab_c.c |  59 
> >   libavdevice/dxgigrab_c.h |  98 ++
> >   libavdevice/windows_capture.cpp  | 184 +
> >   libavdevice/windows_capture.h|  82 +++
> 
> The name of these files seem way too generic to just sit there like this in
> the top level.
> 
> >   11 files changed, 847 insertions(+)
> >   create mode 100644 libavdevice/d3dHelpers.h
> >   create mode 100644 libavdevice/direct3d11.interop.h
> >   create mode 100644 libavdevice/dxgigrab.cpp
> >   create mode 100644 libavdevice/dxgigrab.h
> >   create mode 100644 libavdevice/dxgigrab_c.c
> >   create mode 100644 libavdevice/dxgigrab_c.h
> >   create mode 100644 libavdevice/windows_capture.cpp
> >   create mode 100644 libavdevice/windows_capture.h
> > 
> > diff --git a/configure b/configure
> > index 12184c7f26..c9cbee0c09 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3529,6 +3529,7 @@ fbdev_outdev_deps="linux_fb_h"
> >   gdigrab_indev_deps="CreateDIBSection"
> >   gdigrab_indev_extralibs="-lgdi32"
> >   gdigrab_indev_select="bmp_decoder"
> > +dxgigrab_indev_extralibs="-ldxgi -ld3d11"
> >   iec61883_indev_deps="libiec61883"
> >   iec61883_indev_select="dv_demuxer"
> >   jack_indev_deps="libjack"
> > diff --git a/libavdevice/Makefile b/libavdevice/Makefile
> > index 8a62822b69..6740012000 100644
> > --- a/libavdevice/Makefile
> > +++ b/libavdevice/Makefile
> > @@ -30,6 +30,7 @@ OBJS-$(CONFIG_FBDEV_INDEV)   += fbdev_dec.o \
> >   OBJS-$(CONFIG_FBDEV_OUTDEV)  += fbdev_enc.o \
> >   fbdev_common.o
> >   OBJS-$(CONFIG_GDIGRAB_INDEV) += gdigrab.o
> > +OBJS-$(CONFIG_DXGIGRAB_INDEV)+= windows_capture.o dxgigrab.o 
> > dxgigrab_c.o
> >   OBJS-$(CONFIG_IEC61883_INDEV)+= iec61883.o
> >   OBJS-$(CONFIG_JACK_INDEV)+= jack.o timefilter.o
> >   OBJS-$(CONFIG_KMSGRAB_INDEV) += kmsgrab.o
> > @@ -72,5 +73,8 @@ SKIPHEADERS-$(CONFIG_V4L2_INDEV) += v4l2-common.h
> >   SKIPHEADERS-$(CONFIG_V4L2_OUTDEV)+= v4l2-common.h
> >   SKIPHEADERS-$(CONFIG_ALSA)   += alsa.h
> >   SKIPHEADERS-$(CONFIG_SNDIO)  += sndio.h
> > +SKIPHEADERS-$(CONFIG_DXGIGRAB_INDEV) += dxgigrab.h \
> > +windows_capture.h \
> > +dxgigrab_c.h
> >   TESTPROGS-$(CONFIG_JACK_INDEV)   += timefilter
> > diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
> > index 22323a0a44..fb0a37513b 100644
> > --- a/libavdevice/alldevices.c
> > +++ b/libavdevice/alldevices.c
> > @@ -35,6 +35,7 @@ extern const AVInputFormat  ff_dshow_demuxer;
> >   extern const AVInputFormat  ff_fbdev_demuxer;
> >   extern const AVOutputFormat ff_fbdev_muxer;
> >   extern const AVInputFormat  ff_gdigrab_demuxer;
> > +extern const AVInputFormat  ff_dxgigrab_demuxer;
> >   extern const AVInputFormat  ff_iec61883_demuxer;
> >   extern const AVInputFormat  ff_jack_demuxer;
> >   extern const AVInputFormat  ff_kmsgrab_demuxer;
> > diff --git a/libavdevice/d3dHelpers.h b/libavdevice/d3dHelpers.h
> > new file mode 100644
> > index 00..d8d2c003ec
> > --- /dev/null
> > +++ b/libavdevice/d3dHelpers.h
> > @@ -0,0 +1,59 @@
> > +/*
> > + * 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 

Re: [FFmpeg-devel] [PATCH] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-09 Thread Martin Storsjö

On Thu, 9 Feb 2023, Ziemowit Laski wrote:


These changes seem fine, but you're apparently not touching the case at
the top, used for --version, where it is calling 'rc.exe /?'. For me, this


That's an interesting point.  I guess MinGW is "smart enough" not to rewrite
"/?" because it doesn't represent a valid path to begin with.  I will change
it to "-?" as you suggest.


Just to clarify some details here - mingw doesn't do any such path 
rewriting - that's all msys's doing. Mingw processes themselves are 
entirely regular win32 processes which know nothing about unix style 
paths; it's msys2 which does the whole unix-style paths and which 
automatically tries to rewrite command line arguments as if they were 
paths, with some level of heuristics.


Git bash also uses the msys2 layer, but apparently it uses a different 
version of the msys2 runtime, since it didn't seem to fail when executing 
"rc.exe /?", while the current msys2 version fails.


None of that has anything to do with mingw.

// Martin

___
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] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions

2023-02-09 Thread Michael Niedermayer
On Wed, Feb 08, 2023 at 10:41:00PM -0600, Marth64 wrote:
> Signed-off-by: Marth64 
> ---
> Adds detection of spatial/object-based audio extensions in E-AC-3,
> TrueHD, and DCA XLL (DTS). This includes Atmos, DTS:X, and IMAX formats.
> Please let me know what I could improve, I'm learning still.
> Thank you.
[...]
> @@ -1054,10 +1055,23 @@ static int parse_frame(DCAXllDecoder *s, const 
> uint8_t *data, int size, DCAExssA
>  return ret;
>  if ((ret = parse_band_data(s)) < 0)
>  return ret;
> +
> +extradata_peek_pos = (get_bits_count(&s->gb) + 31) & ~31;
> +if (s->frame_size * 8 > extradata_peek_pos) {
> +unsigned int extradata_syncword = show_bits(&s->gb, 32);

show_bits_long()


[..]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


signature.asc
Description: PGP signature
___
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] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions

2023-02-09 Thread Marth64
Hi,

Thank you for your time and thoughts. Some of this I had wondered about the
same.

Re: Hendrik, Using profile >
This was an original intention of mine but I changed course. I'm happy to
do it, but felt too unsure for a first pass.
My reasoning being that I'm not sure if the presence of extension metadata
itself qualifies as a discrete profile. For DCA in particular, I was
worried since DCA already expands to profiles (ES, XLL, etc.). I did not
want to clutter those distinctions with a "somewhat profile of a profile,
based on an educated guess without the reference docs" and break any
existing integrations. Likewise, EAC3 and TrueHD didn't have profiles, so
it felt tacked on for this case. So I settled with "extension" as the
marker. That said, I wasn't too thrilled about adding to AVCodecContext
either. I discovered and considered priv_data but then realized that this
is a pattern across 3 codecs, maybe more in the future. So definitely open
to guidance here. Profile is probably the next best bet.

I had gone down the frame-level inspection road at some point, but came to
a similar conclusion as you, it makes this less useful as a feature.

I am open to other's interpretation. Will ponder this a little more.

Re: Michael, show_bits_long >
Will fix. I am trying to procure another IMAX DTS material to test the
syncword better, so will push any of those changes together in the next 2
days.

Thank you!



On Thu, Feb 9, 2023 at 2:12 PM Hendrik Leppkes  wrote:

> On Thu, Feb 9, 2023 at 5:42 AM Marth64  wrote:
> >
> > Signed-off-by: Marth64 
> > ---
> > Adds detection of spatial/object-based audio extensions in E-AC-3,
> > TrueHD, and DCA XLL (DTS). This includes Atmos, DTS:X, and IMAX formats.
> > Please let me know what I could improve, I'm learning still.
> > Thank you.
> >
>
> The detection itself seems fine to me, however we should talk about
> how the presence is communicated back to the user.
>
> A new flag in AVCodecContext goes against a variety of designs we try
> to avoid - namely having codec-specific things in a global struct, as
> well as having only one value, rather then per-frame values.
>
> So options that present themself to me:
> (a) Use "profile". At least for DTS that would fit quite nicely, as it
> already has profiles, and it seems like a logical extension. TrueHD
> and eac3 do not have profiles, but it might still be sensible to put
> it there. The advantage here is that it also automatically is conveyed
> in AVCodecParameters after avformat opens a stream, so the information
> is available early and lets players decide how to handle the stream.
> (b) Use per-frame side data. The early-availability advantage is not
> present here, so its not my favorite. side-data could be used in the
> future to transport the actual object metadata, if needed.
>
> So from where I'm standing we should maybe define profiles to use for
> these. In the past profiles were at least suggested for TrueHD Atmos
> before, but there were some objections, so maybe a good time to
> revisit and see where we go from here.
>
> - Hendrik
> ___
> 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 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] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions

2023-02-09 Thread Marth64
Ack'd. Nice catch. Thank you!

On Thu, Feb 9, 2023 at 4:35 PM Michael Niedermayer 
wrote:

> On Wed, Feb 08, 2023 at 10:41:00PM -0600, Marth64 wrote:
> > Signed-off-by: Marth64 
> > ---
> > Adds detection of spatial/object-based audio extensions in E-AC-3,
> > TrueHD, and DCA XLL (DTS). This includes Atmos, DTS:X, and IMAX formats.
> > Please let me know what I could improve, I'm learning still.
> > Thank you.
> [...]
> > @@ -1054,10 +1055,23 @@ static int parse_frame(DCAXllDecoder *s, const
> uint8_t *data, int size, DCAExssA
> >  return ret;
> >  if ((ret = parse_band_data(s)) < 0)
> >  return ret;
> > +
> > +extradata_peek_pos = (get_bits_count(&s->gb) + 31) & ~31;
> > +if (s->frame_size * 8 > extradata_peek_pos) {
> > +unsigned int extradata_syncword = show_bits(&s->gb, 32);
>
> show_bits_long()
>
>
> [..]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The misfortune of the wise is better than the prosperity of the fool.
> -- Epicurus
> ___
> 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 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] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-09 Thread Ziemowit Laski
> paths; it's msys2 which does the whole unix-style paths and which
> automatically tries to rewrite command line arguments as if they were
> paths, with some level of heuristics.

Yes, this makes sense.  The build uses /bin/bash, which is configured as 
x86_64-pc-msys, and that's where the rewriting happens.  I always assumed that
MinGW was basically built on top of MSYS.
 
--Zem

___
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] Use '-' instead of '/' for rc.exe options (take 2)

2023-02-09 Thread Ziemowit Laski
Second version of my patch.  Please let me know if I forgot something.

--Zem
===
When building FFMPEG in the MSYS environment under Windows, one must not use 
forward slashes ('/') for command-line options.  It appears that the MSYS shell 
interprets these as absolute paths and then automatically rewrites them into 
equivalent Windows paths.  For example, the '/nologo' switch below gets 
rewritten to something like 'C:/Program Files/Git/nologo', and this obviously 
breaks the build.  Thankfully, most M$ tools accept dashes ('-') as well.

Signed-off-by: Ziemowit Łąski <15880281+zla...@users.noreply.github.com>
---
 compat/windows/mswindres | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/compat/windows/mswindres b/compat/windows/mswindres index 
450525a33e..8c14c96bae 100755
--- a/compat/windows/mswindres
+++ b/compat/windows/mswindres
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if [ "$1" = "--version" ]; then
-rc.exe /?
+rc.exe -?
 exit $?
 fi
 
@@ -10,12 +10,12 @@ if [ $# -lt 2 ]; then
 exit 0
 fi
 
-EXTRA_OPTS="/nologo"
+EXTRA_OPTS="-nologo"
 
 while [ $# -gt 2 ]; do
 case $1 in
--D*) EXTRA_OPTS="$EXTRA_OPTS /d$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
--I*) EXTRA_OPTS="$EXTRA_OPTS /i$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
+-D*) EXTRA_OPTS="$EXTRA_OPTS -d$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
+-I*) EXTRA_OPTS="$EXTRA_OPTS -i$(echo $1 | sed -e "s/^..//" -e "s/ 
+ / /g")" ;;
 -o)  OPT_OUT="$2"; shift ;;
 esac
 shift
@@ -29,4 +29,4 @@ else
 fi
 
 eval set -- $EXTRA_OPTS
-rc.exe "$@" /fo "$OUT" "$IN"
+rc.exe "$@" -fo "$OUT" "$IN"
--
2.39.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".