[FFmpeg-devel] [PATCH] Rename SRT's streamid to srt_streamid to avoid a conflict with standard streamid option
Default streamid is some numeric value and not used by SRT code. Instead SRT has its own string streamid. Current code has the same option name for both and this causes a conflict when ffmpeg is started from a terminal. The attached patch fixes it by renaming SRT's "streamid" to "srt_streamid" Best Regards, Sergey From 46d75e066ec828545ebf242ab0530ecb66d7fc6d Mon Sep 17 00:00:00 2001 From: Sergey Ilinykh Date: Thu, 3 Jun 2021 13:13:32 +0300 Subject: [PATCH] Rename SRT's streamid to srt_streamid to avoid a conflict with standard streamid option --- libavformat/libsrt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index c1e96f700e..10dfc9e9c9 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -133,7 +133,7 @@ static const AVOption libsrt_options[] = { { "rcvbuf", "Receive buffer size (in bytes)", OFFSET(rcvbuf), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "lossmaxttl", "Maximum possible packet reorder tolerance",OFFSET(lossmaxttl), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "minversion", "The minimum SRT version that is required from the peer", OFFSET(minversion), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, -{ "streamid", "A string of up to 512 characters that an Initiator can pass to a Responder", OFFSET(streamid), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, +{ "srt_streamid", "A string of up to 512 characters that an Initiator can pass to a Responder", OFFSET(streamid), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { "smoother", "The type of Smoother used for the transmission for that socket", OFFSET(smoother), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { "messageapi", "Enable message API", OFFSET(messageapi), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E }, { "transtype", "The transmission type for the socket", OFFSET(transtype),AV_OPT_TYPE_INT, { .i64 = SRTT_INVALID }, SRTT_LIVE, SRTT_INVALID, .flags = D|E, "transtype" }, @@ -608,7 +608,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) if (av_find_info_tag(buf, sizeof(buf), "minversion", p)) { s->minversion = strtol(buf, NULL, 0); } -if (av_find_info_tag(buf, sizeof(buf), "streamid", p)) { +if (av_find_info_tag(buf, sizeof(buf), "srt_streamid", p)) { av_freep(&s->streamid); s->streamid = av_strdup(buf); if (!s->streamid) { -- 2.31.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] avformat/flvdec: Ignore the first two data/subtitle streams.
Hi, On Fri, 14 May 2021, Josh Allmann wrote: On Thu, 13 May 2021 at 16:38, Josh Allmann wrote: Previously, one or the other would have been ignored, but not both. Since the probe terminates at three streams, it could exit prematurely if both data and subtitles are present along with slightly trailing media, usually video trailing audio. Trailing media is common in RTMP, and encoders write strange metadata. --- Here's a trac ticket with some more context: https://trac.ffmpeg.org/ticket/9241 And a sample that exhibits the problem: https://trac.ffmpeg.org/attachment/ticket/9241/flv-probe-missing-streams.flv Just FYI and sorry, I'm planning on looking at this patch and have it pinned to look at later, but I haven't yet had time to actually take a look. Hoping to get to it soon... // 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] avformat/nut: add support for P010 pixel format
On Wed, Jun 02, 2021 at 07:08:24PM +0300, Valerii Zapodovnikov wrote: > I don't really care about your nut container, FATE just complains that > something in raw.c is not in nut.c. If you care about the discrepancy then you have to fix it. your patch just moves the discrepancy to be between the nut spec and nut.c Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus 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".
[FFmpeg-devel] [PATCH] ffmpeg: add -fpsmin to clamp output framerate
Add -fpsmin analogously to -fpsmax for setting a lower bound to the auto-set frame rate. Signed-off-by: Matthias Neugebauer --- doc/ffmpeg.texi | 7 +++ fftools/ffmpeg.c | 7 ++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 26 +++--- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9feabe6517..5576508347 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -862,6 +862,13 @@ Clamps output frame rate when output framerate is auto-set and is higher than th Useful in batch processing or when input framerate is wrongly detected as very high. It cannot be set together with @code{-r}. It is ignored during streamcopy. +@item -fpsmin[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream}) +Set minimum frame rate (Hz value, fraction or abbreviation). + +Clamps output frame rate when output framerate is auto-set and is lower than this value. +Useful in batch processing or when input framerate is wrongly detected as very low. +It cannot be set together with @code{-r}. It is ignored during streamcopy. + @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b3658d8f65..fd9747a8ac 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3390,7 +3390,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; -if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { +if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num && !ost->min_frame_rate.num) { ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " @@ -3400,6 +3400,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->file_index, ost->index); } +if (ost->min_frame_rate.num && +(av_q2d(ost->frame_rate) < av_q2d(ost->min_frame_rate) || +!ost->frame_rate.den)) +ost->frame_rate = ost->min_frame_rate; + if (ost->max_frame_rate.num && (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) || !ost->frame_rate.den)) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 606f2afe0c..515d0c7a46 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -110,6 +110,8 @@ typedef struct OptionsContext { intnb_frame_rates; SpecifierOpt *max_frame_rates; intnb_max_frame_rates; +SpecifierOpt *min_frame_rates; +intnb_min_frame_rates; SpecifierOpt *frame_sizes; intnb_frame_sizes; SpecifierOpt *frame_pix_fmts; @@ -486,6 +488,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; +AVRational min_frame_rate; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 849d24b16d..b0d7550ce6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -56,6 +56,7 @@ static const char *const opt_name_audio_channels[] = {"ac", NULL}; static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; static const char *const opt_name_frame_rates[] = {"r", NULL}; static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; +static const char *const opt_name_min_frame_rates[] = {"fpsmin", NULL}; static const char *const opt_name_frame_sizes[] = {"s", NULL}; static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", NULL}; static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; @@ -1694,7 +1695,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; -char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; +char *frame_rate = NULL, *max_frame_rate = NULL, *min_frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; @@ -1712,14 +1713,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } +MATCH_PER_STREAM_OPT(min_frame_rates, str, min_frame_rate, oc, st); +if (min_frame_rate && av_parse_video_rate(&ost->min_frame_rate, min_frame_rate) < 0) { +av_log(NULL, AV_LOG_FATAL, "Invalid minimum framerate value: %s\n", min_frame_rate); +exit_program(1); +} + if (frame_rate && max_frame_rate) { av_log(NULL, AV_LOG_ERROR, "Only one of -fpsmax and -r can be set for a stream.\n"); exit_program(1); } -if ((frame_rate || max_frame_rate)
Re: [FFmpeg-devel] [PATCH v2] ffmpeg: add -fpsmin to clamp output framerate
> Can you send this again? Patchwork hasn't appeared to pick it up earlier? Sent again to a new thread. ___ 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] ffmpeg: add -fpsmin to clamp output framerate
On 2021-06-03 14:08, Matthias Neugebauer wrote: Add -fpsmin analogously to -fpsmax for setting a lower bound to the auto-set frame rate. Still not picked up. Should be sent same as your patch from December. https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=&submitter=1113&state=*&q=&archive=both&delegate= Signed-off-by: Matthias Neugebauer --- doc/ffmpeg.texi | 7 +++ fftools/ffmpeg.c | 7 ++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 26 +++--- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9feabe6517..5576508347 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -862,6 +862,13 @@ Clamps output frame rate when output framerate is auto-set and is higher than th Useful in batch processing or when input framerate is wrongly detected as very high. It cannot be set together with @code{-r}. It is ignored during streamcopy. +@item -fpsmin[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream}) +Set minimum frame rate (Hz value, fraction or abbreviation). + +Clamps output frame rate when output framerate is auto-set and is lower than this value. +Useful in batch processing or when input framerate is wrongly detected as very low. +It cannot be set together with @code{-r}. It is ignored during streamcopy. + @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b3658d8f65..fd9747a8ac 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3390,7 +3390,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; -if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { +if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num && !ost->min_frame_rate.num) { ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " @@ -3400,6 +3400,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->file_index, ost->index); } +if (ost->min_frame_rate.num && +(av_q2d(ost->frame_rate) < av_q2d(ost->min_frame_rate) || +!ost->frame_rate.den)) +ost->frame_rate = ost->min_frame_rate; + if (ost->max_frame_rate.num && (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) || !ost->frame_rate.den)) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 606f2afe0c..515d0c7a46 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -110,6 +110,8 @@ typedef struct OptionsContext { intnb_frame_rates; SpecifierOpt *max_frame_rates; intnb_max_frame_rates; +SpecifierOpt *min_frame_rates; +intnb_min_frame_rates; SpecifierOpt *frame_sizes; intnb_frame_sizes; SpecifierOpt *frame_pix_fmts; @@ -486,6 +488,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; +AVRational min_frame_rate; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 849d24b16d..b0d7550ce6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -56,6 +56,7 @@ static const char *const opt_name_audio_channels[]= {"ac", NULL}; static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; static const char *const opt_name_frame_rates[] = {"r", NULL}; static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; +static const char *const opt_name_min_frame_rates[] = {"fpsmin", NULL}; static const char *const opt_name_frame_sizes[] = {"s", NULL}; static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", NULL}; static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; @@ -1694,7 +1695,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; -char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; +char *frame_rate = NULL, *max_frame_rate = NULL, *min_frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; @@ -1712,14 +1713,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } +MATCH_PER_STREAM_OPT(min_frame_rates, str, min_frame_rate, oc, st); +if (min_frame_rate && av_parse_video_rate(&ost->min_frame_rate, min_frame_rate) < 0) { +av_log(NULL, AV_LOG_FATAL, "Invalid minimum framerate value: %s\n
Re: [FFmpeg-devel] [PATCH] avcodec/ccaption_dec: Make real-time latency configurable v2
On Sat, May 29, 2021, 08:51 Pavel Koshevoy wrote: > Un-hardcode the 200ms minimum latency between emitting subtitle events > so that those that wish to receive a subtitle event for every screen > change could do so. > > The problem with delaying realtime output by any amount is that it is > unknown when the next byte pair that would trigger output will happen. > It may be within 200ms, or it may be several seconds later -- that's > not realtime at all. > --- > libavcodec/ccaption_dec.c | 4 +++- > libavcodec/version.h | 2 +- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c > index de05d037a8..27c61527f6 100644 > --- a/libavcodec/ccaption_dec.c > +++ b/libavcodec/ccaption_dec.c > @@ -238,6 +238,7 @@ struct Screen { > typedef struct CCaptionSubContext { > AVClass *class; > int real_time; > +int real_time_latency_msec; > int data_field; > struct Screen screen[2]; > int active_screen; > @@ -906,7 +907,7 @@ static int decode(AVCodecContext *avctx, void *data, > int *got_sub, AVPacket *avp > } > > if (ctx->real_time && ctx->screen_touched && > -sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, > AV_TIME_BASE_Q)) { > +sub->pts >= ctx->last_real_time + > av_rescale_q(ctx->real_time_latency_msec, ms_tb, AV_TIME_BASE_Q)) { > ctx->last_real_time = sub->pts; > ctx->screen_touched = 0; > > @@ -927,6 +928,7 @@ static int decode(AVCodecContext *avctx, void *data, > int *got_sub, AVPacket *avp > #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM > static const AVOption options[] = { > { "real_time", "emit subtitle events as they are decoded for > real-time display", OFFSET(real_time), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, > 1, SD }, > +{ "real_time_latency_msec", "minimum elapsed time between emitting > real-time subtitle events", OFFSET(real_time_latency_msec), > AV_OPT_TYPE_INT, { .i64 = 200 }, 0, 500, SD }, > { "data_field", "select data field", OFFSET(data_field), > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, SD, "data_field" }, > { "auto", "pick first one that appears", 0, AV_OPT_TYPE_CONST, { > .i64 =-1 }, 0, 0, SD, "data_field" }, > { "first", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, SD, > "data_field" }, > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 48165b9ac4..5b1e9e77f3 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -29,7 +29,7 @@ > > #define LIBAVCODEC_VERSION_MAJOR 59 > #define LIBAVCODEC_VERSION_MINOR 1 > -#define LIBAVCODEC_VERSION_MICRO 100 > +#define LIBAVCODEC_VERSION_MICRO 101 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > LIBAVCODEC_VERSION_MINOR, \ > -- > 2.26.2 > Are there any objections to this? Thank you, Pavel > ___ 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] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder
On Tue, Jun 01, 2021 at 06:22:24PM -0700, Mohammad Izadi wrote: > HDR10+ metadata is stored in the bit stream for HEVC. The story is different > for VP9 and cannot store the metadata in the bit stream. HDR10+ should be > passed to packet side data an stored in the container (mkv) for VP9. > > This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing > it to the AVPacket side data. > --- > doc/APIchanges | 2 + > libavcodec/avpacket.c | 1 + > libavcodec/decode.c| 1 + > libavcodec/libvpxenc.c | 94 ++ > libavcodec/packet.h| 8 > libavcodec/version.h | 2 +- > 6 files changed, 107 insertions(+), 1 deletion(-) crashes gdb --args ./ffmpeg_g -i ~/tickets/3562/issue3562_cut.avi -t 0.1 -bitexact -filter_complex '[0:0]format=yuv420p;[0:1]aresample=osr=22050' -y 3562.webm Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault. 0x5666c73e in av_fifo_size (f=0x0) at libavutil/fifo.c:79 79 return (uint32_t)(f->wndx - f->rndx); (gdb) bt #0 0x5666c73e in av_fifo_size (f=0x0) at libavutil/fifo.c:79 #1 0x55e42726 in free_hdr10_plus_fifo (fifo=0x575dbb30) at libavcodec/libvpxenc.c:346 #2 0x55e42bfe in vpx_free (avctx=0x575db480) at libavcodec/libvpxenc.c:443 #3 0x55bee381 in avcodec_close (avctx=0x575db480) at libavcodec/avcodec.c:472 #4 0x55f31233 in avcodec_free_context (pavctx=0x575d0ad8) at libavcodec/options.c:163 #5 0x55696ba0 in ffmpeg_cleanup (ret=0) at fftools/ffmpeg.c:609 #6 0x5568e51b in exit_program (ret=0) at fftools/cmdutils.c:135 #7 0x556a8540 in main (argc=10, argv=0x7fffe1d8) at fftools/ffmpeg.c:5032 [...] -- 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] swscale: fix chroma width rounding
On Wed, Jun 02, 2021 at 11:02:44PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > fixes vertical line at the right side of video for rgb24toyv12 conversion. > Please reproduce it with below command: > ./ffplay -f lavfi -i > "testsrc=size=529x656,ocv=filter_name=smooth,format=yuv420p" > > Signed-off-by: Limin Wang > --- > libswscale/rgb2rgb_template.c | 2 +- > libswscale/x86/rgb2rgb_template.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c > index 42c6980..e716ba5 100644 > --- a/libswscale/rgb2rgb_template.c > +++ b/libswscale/rgb2rgb_template.c > @@ -654,7 +654,7 @@ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, > uint8_t *udst, > int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; > int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; > int y; > -const int chromWidth = width >> 1; > +const int chromWidth = AV_CEIL_RSHIFT(width, 1); > > for (y = 0; y < height; y += 2) { > int i; > diff --git a/libswscale/x86/rgb2rgb_template.c > b/libswscale/x86/rgb2rgb_template.c > index ae2469e..704b0fa 100644 > --- a/libswscale/x86/rgb2rgb_template.c > +++ b/libswscale/x86/rgb2rgb_template.c > @@ -1578,7 +1578,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t > *src, uint8_t *ydst, uint8_ > #define BGR2U_IDX "16*4+16*33" > #define BGR2V_IDX "16*4+16*34" > int y; > -const x86_reg chromWidth= width>>1; > +const x86_reg chromWidth = AV_CEIL_RSHIFT(width, 1); > > if (height > 2) { > ff_rgb24toyv12_c(src, ydst, udst, vdst, width, 2, lumStride, > chromStride, srcStride, rgb2yuv); the comments above the functions are incorrect if you add support for odd width also the code writes outside the luma array i think with this change thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato 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 v3 2/3] libavcodec/mips: Fix build errors reported by clang
On Tue, Jun 01, 2021 at 09:02:54PM +0800, yinshiyou...@loongson.cn wrote: [...] > > +}; > > + > > #endif /* AVCODEC_MIPS_ASMDEFS_H */ > > -- > > 2.1.0 > > > > LGTM. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus 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 3/3] libavcodec/mips: Fix fate errors reported by clang
On Tue, Jun 01, 2021 at 09:03:24PM +0800, yinshiyou...@loongson.cn wrote: [...] > > "punpcklwd %[filter10], %[ftmp4], %[ftmp4] \n\t" > > "punpckhwd %[filter32], %[ftmp4], %[ftmp4] \n\t" > > -- > > 2.1.0 > > > > LGTM. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. 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] avformat/nut: add support for P010 pixel format
The bigger problem are FATE hashes. I am not able to fill them here. As to send patches against another repo, I can do that, no problem with --subject-prefix="PATCH nut". Also, I do not see a problem with the spec, the spec says that it has priority, not the code. I am not doing this patch for nut.c, but for dshow to support HDR, but HDR signalling is PQ transfer and other patches implement reading that. I still do not know whether endianness is swapped in dshow and what sample location means for P010, BTW. ___ 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] libavcodec: r12b decoder
Hi ffmpeg-devel, I've added a r12b decoder (12bpp RGB packing which packs 8 pixels into 36 bytes, used by Blackmagic Decklink cards). The patch is attached for your consideration. Kind regards, Dennis Fleurbaaij 0001-libavcodec-r12b-decoder-added.patch Description: Binary data ___ 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/4] avdevice/avdevice: Revert "Deprecate AVDevice Capabilities API"
This reverts commit 4f49ca7bbc75a9db4cdf93f27f95a668c751f160. This patch series will implement this capability for avdevice/dshow, enabling configuration discovery of DirectShow devices through the API, which is important for my use case. It enables making proper GUIs presenting users with options, instead of asking them to discover a dshow devices capabilities through the list_options option with an ffmpeg tool, and listing what they want to configure in text boxes. Signed-off-by: Diederick Niehorster --- doc/APIchanges | 4 +++ libavdevice/avdevice.c | 71 ++ libavdevice/avdevice.h | 5 --- libavdevice/version.h | 5 +-- libavformat/avformat.h | 21 + 5 files changed, 91 insertions(+), 15 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index c46f4d5304..30c0e7bf3f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-xx-xx - xx - lavd 58.xx.100 - avdevice.h + Un-deprecated avdevice_capabilities_create() and + avdevice_capabilities_free(). + 2021-04-27 - cb3ac722f4 - lavc 59.0.100 - avcodec.h Constified AVCodecParserContext.parser. diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 22b7595ab1..371ec17d02 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -27,11 +27,39 @@ #include "libavutil/ffversion.h" const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -#if FF_API_DEVICE_CAPABILITIES +#define E AV_OPT_FLAG_ENCODING_PARAM +#define D AV_OPT_FLAG_DECODING_PARAM +#define A AV_OPT_FLAG_AUDIO_PARAM +#define V AV_OPT_FLAG_VIDEO_PARAM +#define OFFSET(x) offsetof(AVDeviceCapabilitiesQuery, x) + const AVOption av_device_capabilities[] = { +{ "codec", "codec", OFFSET(codec), AV_OPT_TYPE_INT, +{.i64 = AV_CODEC_ID_NONE}, AV_CODEC_ID_NONE, INT_MAX, E|D|A|V }, +{ "sample_format", "sample format", OFFSET(sample_format), AV_OPT_TYPE_SAMPLE_FMT, +{.i64 = AV_SAMPLE_FMT_NONE}, AV_SAMPLE_FMT_NONE, INT_MAX, E|D|A }, +{ "sample_rate", "sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "channels", "channels", OFFSET(channels), AV_OPT_TYPE_INT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "channel_layout", "channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "pixel_format", "pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, +{.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX, E|D|V }, +{ "window_size", "window size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, +{.str = NULL}, -1, INT_MAX, E|D|V }, +{ "frame_size", "frame size", OFFSET(frame_width), AV_OPT_TYPE_IMAGE_SIZE, +{.str = NULL}, -1, INT_MAX, E|D|V }, +{ "fps", "fps", OFFSET(fps), AV_OPT_TYPE_RATIONAL, +{.dbl = -1}, -1, INT_MAX, E|D|V }, { NULL } }; -#endif + +#undef E +#undef D +#undef A +#undef V +#undef OFFSET unsigned avdevice_version(void) { @@ -66,18 +94,49 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToA return s->control_message_cb(s, type, data, data_size); } -#if FF_API_DEVICE_CAPABILITIES int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options) { -return AVERROR(ENOSYS); +int ret; +av_assert0(s && caps); +av_assert0(s->iformat || s->oformat); +if ((s->oformat && !s->oformat->create_device_capabilities) || +(s->iformat && !s->iformat->create_device_capabilities)) +return AVERROR(ENOSYS); +*caps = av_mallocz(sizeof(**caps)); +if (!(*caps)) +return AVERROR(ENOMEM); +(*caps)->device_context = s; +if (((ret = av_opt_set_dict(s->priv_data, device_options)) < 0)) +goto fail; +if (s->iformat) { +if ((ret = s->iformat->create_device_capabilities(s, *caps)) < 0) +goto fail; +} else { +if ((ret = s->oformat->create_device_capabilities(s, *caps)) < 0) +goto fail; +} +av_opt_set_defaults(*caps); +return 0; + fail: +av_freep(caps); +return ret; } void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s) { -return; +if (!s || !caps || !(*caps)) +return; +av_assert0(s->iformat || s->oformat); +if (s->iformat) { +if (s->iformat->free_device_capabilities) +s->iformat->free_device_capabilities(s, *caps); +} else { +if (s->oformat->free_device_capabilities) +s->oformat->free_device_capabilities(s, *caps); +} +av_freep(caps); } -#endif int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) { diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index 8370bbc7f2..727ba2a5f3 100644 --- a/libavdevice/avdevice.h +
[FFmpeg-devel] [PATCH 4/4] examples: adding device_get_capabilities example
Signed-off-by: Diederick Niehorster --- configure | 2 + doc/examples/.gitignore| 1 + doc/examples/Makefile | 47 doc/examples/Makefile.example | 1 + doc/examples/device_get_capabilities.c | 151 + 5 files changed, 179 insertions(+), 23 deletions(-) create mode 100644 doc/examples/device_get_capabilities.c diff --git a/configure b/configure index 82367fd30d..5e9666d017 100755 --- a/configure +++ b/configure @@ -1705,6 +1705,7 @@ EXAMPLE_LIST=" decode_audio_example decode_video_example demuxing_decoding_example +device_get_capabilities_example encode_audio_example encode_video_example extract_mvs_example @@ -3712,6 +3713,7 @@ avio_reading_deps="avformat avcodec avutil" decode_audio_example_deps="avcodec avutil" decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +device_get_capabilities_example_deps="avdevice avformat avutil" encode_audio_example_deps="avcodec avutil" encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index 44960e1de7..256f33a600 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -3,6 +3,7 @@ /decode_audio /decode_video /demuxing_decoding +/device_get_capabilities /encode_audio /encode_video /extract_mvs diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 81bfd34d5d..7988ed4226 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -1,26 +1,27 @@ -EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir -EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading -EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio -EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video -EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding -EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio -EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video -EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs -EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio -EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio -EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video -EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient -EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode -EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata -EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing -EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec -EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing -EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio -EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video -EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac -EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding -EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode -EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode +EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir +EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading +EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio +EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video +EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding +EXAMPLES-$(CONFIG_DEVICE_GET_CAPABILITIES_EXAMPLE) += device_get_capabilities +EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video +EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs +EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio +EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio +EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video +EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient +EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode +EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata +EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing +EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec +EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing +EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio +EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video +EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac +EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding +EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode +EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode EXAMPLES := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) diff --git a/doc/examples/Makefile.example b/doc/examples/Makefile.example index a232d97f98
[FFmpeg-devel] [PATCH 2/4] avdevice/avdevice: clean up avdevice_capabilities_create
Draw implementation in line with that of avdevice_list_devices Signed-off-by: Diederick Niehorster --- libavdevice/avdevice.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 371ec17d02..2e64d35cf5 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -98,12 +98,15 @@ int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatConte AVDictionary **device_options) { int ret; -av_assert0(s && caps); +av_assert0(s); +av_assert0(caps); av_assert0(s->iformat || s->oformat); if ((s->oformat && !s->oformat->create_device_capabilities) || -(s->iformat && !s->iformat->create_device_capabilities)) +(s->iformat && !s->iformat->create_device_capabilities)) { +*caps = NULL; return AVERROR(ENOSYS); -*caps = av_mallocz(sizeof(**caps)); +} +*caps = av_mallocz(sizeof(AVDeviceCapabilitiesQuery)); if (!(*caps)) return AVERROR(ENOMEM); (*caps)->device_context = s; -- 2.28.0.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".
[FFmpeg-devel] [PATCH 0/4] avdevice/dshow: implement capabilities API
Undeprecating the avdevice capabilities API and implementing it for the dshow device. Much needed. Together with the other patches i sent, a dshow device can now be properly used programmatically by programs using ffmpeg under the hood. Diederick Niehorster (4): avdevice/avdevice: Revert "Deprecate AVDevice Capabilities API" avdevice/avdevice: clean up avdevice_capabilities_create avdevice/dshow: implement capabilities API examples: adding device_get_capabilities example configure | 2 + doc/APIchanges | 4 + doc/examples/.gitignore| 1 + doc/examples/Makefile | 47 +-- doc/examples/Makefile.example | 1 + doc/examples/device_get_capabilities.c | 151 libavdevice/avdevice.c | 74 +++- libavdevice/avdevice.h | 5 - libavdevice/dshow.c| 498 +++-- libavdevice/version.h | 5 +- libavformat/avformat.h | 21 ++ 11 files changed, 735 insertions(+), 74 deletions(-) create mode 100644 doc/examples/device_get_capabilities.c -- 2.28.0.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".
[FFmpeg-devel] [PATCH 0/4] avdevice/dshow: implement capabilities API
** Resending as it seems they didn't all make it..** Undeprecating the avdevice capabilities API and implementing it for the dshow device. Much needed. Together with the other patches i sent, a dshow device can now be properly used programmatically by programs using ffmpeg under the hood. Diederick Niehorster (4): avdevice/avdevice: Revert "Deprecate AVDevice Capabilities API" avdevice/avdevice: clean up avdevice_capabilities_create avdevice/dshow: implement capabilities API examples: adding device_get_capabilities example configure | 2 + doc/APIchanges | 4 + doc/examples/.gitignore| 1 + doc/examples/Makefile | 47 +-- doc/examples/Makefile.example | 1 + doc/examples/device_get_capabilities.c | 151 libavdevice/avdevice.c | 74 +++- libavdevice/avdevice.h | 5 - libavdevice/dshow.c| 498 +++-- libavdevice/version.h | 5 +- libavformat/avformat.h | 21 ++ 11 files changed, 735 insertions(+), 74 deletions(-) create mode 100644 doc/examples/device_get_capabilities.c -- 2.28.0.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".
[FFmpeg-devel] [PATCH 1/4] avdevice/avdevice: Revert "Deprecate AVDevice Capabilities API"
This reverts commit 4f49ca7bbc75a9db4cdf93f27f95a668c751f160. This patch series will implement this capability for avdevice/dshow, enabling configuration discovery of DirectShow devices through the API, which is important for my use case. It enables making proper GUIs presenting users with options, instead of asking them to discover a dshow devices capabilities through the list_options option with an ffmpeg tool, and listing what they want to configure in text boxes. Signed-off-by: Diederick Niehorster --- doc/APIchanges | 4 +++ libavdevice/avdevice.c | 71 ++ libavdevice/avdevice.h | 5 --- libavdevice/version.h | 5 +-- libavformat/avformat.h | 21 + 5 files changed, 91 insertions(+), 15 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index c46f4d5304..30c0e7bf3f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-xx-xx - xx - lavd 58.xx.100 - avdevice.h + Un-deprecated avdevice_capabilities_create() and + avdevice_capabilities_free(). + 2021-04-27 - cb3ac722f4 - lavc 59.0.100 - avcodec.h Constified AVCodecParserContext.parser. diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 22b7595ab1..371ec17d02 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -27,11 +27,39 @@ #include "libavutil/ffversion.h" const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -#if FF_API_DEVICE_CAPABILITIES +#define E AV_OPT_FLAG_ENCODING_PARAM +#define D AV_OPT_FLAG_DECODING_PARAM +#define A AV_OPT_FLAG_AUDIO_PARAM +#define V AV_OPT_FLAG_VIDEO_PARAM +#define OFFSET(x) offsetof(AVDeviceCapabilitiesQuery, x) + const AVOption av_device_capabilities[] = { +{ "codec", "codec", OFFSET(codec), AV_OPT_TYPE_INT, +{.i64 = AV_CODEC_ID_NONE}, AV_CODEC_ID_NONE, INT_MAX, E|D|A|V }, +{ "sample_format", "sample format", OFFSET(sample_format), AV_OPT_TYPE_SAMPLE_FMT, +{.i64 = AV_SAMPLE_FMT_NONE}, AV_SAMPLE_FMT_NONE, INT_MAX, E|D|A }, +{ "sample_rate", "sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "channels", "channels", OFFSET(channels), AV_OPT_TYPE_INT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "channel_layout", "channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, +{.i64 = -1}, -1, INT_MAX, E|D|A }, +{ "pixel_format", "pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, +{.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX, E|D|V }, +{ "window_size", "window size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, +{.str = NULL}, -1, INT_MAX, E|D|V }, +{ "frame_size", "frame size", OFFSET(frame_width), AV_OPT_TYPE_IMAGE_SIZE, +{.str = NULL}, -1, INT_MAX, E|D|V }, +{ "fps", "fps", OFFSET(fps), AV_OPT_TYPE_RATIONAL, +{.dbl = -1}, -1, INT_MAX, E|D|V }, { NULL } }; -#endif + +#undef E +#undef D +#undef A +#undef V +#undef OFFSET unsigned avdevice_version(void) { @@ -66,18 +94,49 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToA return s->control_message_cb(s, type, data, data_size); } -#if FF_API_DEVICE_CAPABILITIES int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options) { -return AVERROR(ENOSYS); +int ret; +av_assert0(s && caps); +av_assert0(s->iformat || s->oformat); +if ((s->oformat && !s->oformat->create_device_capabilities) || +(s->iformat && !s->iformat->create_device_capabilities)) +return AVERROR(ENOSYS); +*caps = av_mallocz(sizeof(**caps)); +if (!(*caps)) +return AVERROR(ENOMEM); +(*caps)->device_context = s; +if (((ret = av_opt_set_dict(s->priv_data, device_options)) < 0)) +goto fail; +if (s->iformat) { +if ((ret = s->iformat->create_device_capabilities(s, *caps)) < 0) +goto fail; +} else { +if ((ret = s->oformat->create_device_capabilities(s, *caps)) < 0) +goto fail; +} +av_opt_set_defaults(*caps); +return 0; + fail: +av_freep(caps); +return ret; } void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s) { -return; +if (!s || !caps || !(*caps)) +return; +av_assert0(s->iformat || s->oformat); +if (s->iformat) { +if (s->iformat->free_device_capabilities) +s->iformat->free_device_capabilities(s, *caps); +} else { +if (s->oformat->free_device_capabilities) +s->oformat->free_device_capabilities(s, *caps); +} +av_freep(caps); } -#endif int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) { diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index 8370bbc7f2..727ba2a5f3 100644 --- a/libavdevice/avdevice.h +
[FFmpeg-devel] [PATCH 2/4] avdevice/avdevice: clean up avdevice_capabilities_create
Draw implementation in line with that of avdevice_list_devices Signed-off-by: Diederick Niehorster --- libavdevice/avdevice.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 371ec17d02..2e64d35cf5 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -98,12 +98,15 @@ int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatConte AVDictionary **device_options) { int ret; -av_assert0(s && caps); +av_assert0(s); +av_assert0(caps); av_assert0(s->iformat || s->oformat); if ((s->oformat && !s->oformat->create_device_capabilities) || -(s->iformat && !s->iformat->create_device_capabilities)) +(s->iformat && !s->iformat->create_device_capabilities)) { +*caps = NULL; return AVERROR(ENOSYS); -*caps = av_mallocz(sizeof(**caps)); +} +*caps = av_mallocz(sizeof(AVDeviceCapabilitiesQuery)); if (!(*caps)) return AVERROR(ENOMEM); (*caps)->device_context = s; -- 2.28.0.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".
[FFmpeg-devel] [PATCH 3/4] avdevice/dshow: implement capabilities API
This implements avdevice_capabilities_create and avdevice_capabilities_free for the dshow device. Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 498 1 file changed, 462 insertions(+), 36 deletions(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 8d0a6fcc09..c65492119e 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -30,6 +30,48 @@ #include "objidl.h" #include "shlwapi.h" +enum DshowCapQueryType { +CAP_QUERY_NONE = 0, +CAP_QUERY_SAMPLE_FORMAT, +CAP_QUERY_SAMPLE_RATE, +CAP_QUERY_CHANNELS, +CAP_QUERY_CODEC, +CAP_QUERY_PIXEL_FORMAT, +CAP_QUERY_FRAME_SIZE, +CAP_QUERY_FPS +}; +typedef struct DshowCapQueryTypeEntry { +const char* name; +enum DshowCapQueryType query_type; +} DshowCapQueryTypeEntry; + +static const DshowCapQueryTypeEntry query_table[] = { +{ "sample_format", CAP_QUERY_SAMPLE_FORMAT }, +{ "sample_rate",CAP_QUERY_SAMPLE_RATE }, +{ "channels", CAP_QUERY_CHANNELS }, +{ "codec", CAP_QUERY_CODEC }, +{ "pixel_format", CAP_QUERY_PIXEL_FORMAT }, +{ "frame_size", CAP_QUERY_FRAME_SIZE }, +{ "fps",CAP_QUERY_FPS }, +}; + +static enum DshowCapQueryType dshow_get_query_type(const char* option_name) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (!strcmp(query_table[i].name, option_name)) +return query_table[i].query_type; +} +return CAP_QUERY_NONE; +} + +static const char* dshow_get_query_type_string(enum DshowCapQueryType query_type) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (query_table[i].query_type == query_type) +return query_table[i].name; +} +return NULL; +} static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) { @@ -54,6 +96,26 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) return avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), biCompression); // all others } +static enum AVCodecID waveform_codec_id(enum AVSampleFormat sample_fmt) +{ +switch (sample_fmt) { +case AV_SAMPLE_FMT_U8: return AV_CODEC_ID_PCM_U8; +case AV_SAMPLE_FMT_S16: return AV_CODEC_ID_PCM_S16LE; +case AV_SAMPLE_FMT_S32: return AV_CODEC_ID_PCM_S32LE; +default:return AV_CODEC_ID_NONE; /* Should never happen. */ +} +} + +static enum AVSampleFormat sample_fmt_bits_per_sample(int bits) +{ +switch (bits) { +case 8: return AV_SAMPLE_FMT_U8; +case 16: return AV_SAMPLE_FMT_S16; +case 32: return AV_SAMPLE_FMT_S32; +default: return AV_SAMPLE_FMT_NONE; /* Should never happen. */ +} +} + static int dshow_read_close(AVFormatContext *s) { @@ -317,10 +379,13 @@ fail1: * try to set parameters specified through AVOptions and if successful * return 1 in *pformat_set. * If pformat_set is NULL, list all pin capabilities. + * When listing pin capabilities, if ranges is NULL, output to log, + * else store capabilities in ranges. */ static void dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, -IPin *pin, int *pformat_set) +IPin *pin, int *pformat_set, +AVOptionRanges *ranges, enum DshowCapQueryType query_type) { struct dshow_ctx *ctx = avctx->priv_data; IAMStreamConfig *config = NULL; @@ -338,7 +403,11 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, if (!caps) goto end; -for (i = 0; i < n && !format_set; i++) { +for (i = 0; i < n && (!format_set || ranges); i++) { +AVOptionRange *range = NULL; +AVOptionRange **range_list = NULL; +int nb_range = 0; + r = IAMStreamConfig_GetStreamCaps(config, i, &type, (void *) caps); if (r != S_OK) goto next; @@ -365,7 +434,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, } else { goto next; } -if (!pformat_set) { +if (!pformat_set && !ranges) { enum AVPixelFormat pix_fmt = dshow_pixfmt(bih->biCompression, bih->biBitCount); if (pix_fmt == AV_PIX_FMT_NONE) { enum AVCodecID codec_id = av_codec_get_id(tags, bih->biCompression); @@ -410,6 +479,81 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, bih->biWidth = ctx->requested_width; bih->biHeight = ctx->requested_height; } + +if (ranges) { +if (query_type == CAP_QUERY_FRAME_SIZE) { +for (int j = 0; j < 3; j++) { +range = av_mallocz(sizeof(AVOptionRange)); +if (!range) +goto next; +range->str = av_strdup(j == 0 ? "pixel_count" : (j == 1 ? "width" :
[FFmpeg-devel] [PATCH 4/4] examples: adding device_get_capabilities example
Signed-off-by: Diederick Niehorster --- configure | 2 + doc/examples/.gitignore| 1 + doc/examples/Makefile | 47 doc/examples/Makefile.example | 1 + doc/examples/device_get_capabilities.c | 151 + 5 files changed, 179 insertions(+), 23 deletions(-) create mode 100644 doc/examples/device_get_capabilities.c diff --git a/configure b/configure index 82367fd30d..5e9666d017 100755 --- a/configure +++ b/configure @@ -1705,6 +1705,7 @@ EXAMPLE_LIST=" decode_audio_example decode_video_example demuxing_decoding_example +device_get_capabilities_example encode_audio_example encode_video_example extract_mvs_example @@ -3712,6 +3713,7 @@ avio_reading_deps="avformat avcodec avutil" decode_audio_example_deps="avcodec avutil" decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +device_get_capabilities_example_deps="avdevice avformat avutil" encode_audio_example_deps="avcodec avutil" encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index 44960e1de7..256f33a600 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -3,6 +3,7 @@ /decode_audio /decode_video /demuxing_decoding +/device_get_capabilities /encode_audio /encode_video /extract_mvs diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 81bfd34d5d..7988ed4226 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -1,26 +1,27 @@ -EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir -EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading -EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio -EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video -EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding -EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio -EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video -EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs -EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio -EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio -EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video -EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient -EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode -EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata -EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing -EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec -EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing -EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio -EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video -EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac -EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding -EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode -EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode +EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir +EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading +EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio +EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video +EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding +EXAMPLES-$(CONFIG_DEVICE_GET_CAPABILITIES_EXAMPLE) += device_get_capabilities +EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video +EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs +EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio +EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio +EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video +EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient +EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode +EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata +EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing +EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec +EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing +EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio +EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video +EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac +EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding +EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode +EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode EXAMPLES := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) diff --git a/doc/examples/Makefile.example b/doc/examples/Makefile.example index a232d97f98
[FFmpeg-devel] [PATCH 1/2] avdevice/dshow: implement capabilities API
This implements avdevice_capabilities_create and avdevice_capabilities_free for the dshow device. Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 498 1 file changed, 462 insertions(+), 36 deletions(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 8d0a6fcc09..c65492119e 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -30,6 +30,48 @@ #include "objidl.h" #include "shlwapi.h" +enum DshowCapQueryType { +CAP_QUERY_NONE = 0, +CAP_QUERY_SAMPLE_FORMAT, +CAP_QUERY_SAMPLE_RATE, +CAP_QUERY_CHANNELS, +CAP_QUERY_CODEC, +CAP_QUERY_PIXEL_FORMAT, +CAP_QUERY_FRAME_SIZE, +CAP_QUERY_FPS +}; +typedef struct DshowCapQueryTypeEntry { +const char* name; +enum DshowCapQueryType query_type; +} DshowCapQueryTypeEntry; + +static const DshowCapQueryTypeEntry query_table[] = { +{ "sample_format", CAP_QUERY_SAMPLE_FORMAT }, +{ "sample_rate",CAP_QUERY_SAMPLE_RATE }, +{ "channels", CAP_QUERY_CHANNELS }, +{ "codec", CAP_QUERY_CODEC }, +{ "pixel_format", CAP_QUERY_PIXEL_FORMAT }, +{ "frame_size", CAP_QUERY_FRAME_SIZE }, +{ "fps",CAP_QUERY_FPS }, +}; + +static enum DshowCapQueryType dshow_get_query_type(const char* option_name) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (!strcmp(query_table[i].name, option_name)) +return query_table[i].query_type; +} +return CAP_QUERY_NONE; +} + +static const char* dshow_get_query_type_string(enum DshowCapQueryType query_type) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (query_table[i].query_type == query_type) +return query_table[i].name; +} +return NULL; +} static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) { @@ -54,6 +96,26 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) return avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), biCompression); // all others } +static enum AVCodecID waveform_codec_id(enum AVSampleFormat sample_fmt) +{ +switch (sample_fmt) { +case AV_SAMPLE_FMT_U8: return AV_CODEC_ID_PCM_U8; +case AV_SAMPLE_FMT_S16: return AV_CODEC_ID_PCM_S16LE; +case AV_SAMPLE_FMT_S32: return AV_CODEC_ID_PCM_S32LE; +default:return AV_CODEC_ID_NONE; /* Should never happen. */ +} +} + +static enum AVSampleFormat sample_fmt_bits_per_sample(int bits) +{ +switch (bits) { +case 8: return AV_SAMPLE_FMT_U8; +case 16: return AV_SAMPLE_FMT_S16; +case 32: return AV_SAMPLE_FMT_S32; +default: return AV_SAMPLE_FMT_NONE; /* Should never happen. */ +} +} + static int dshow_read_close(AVFormatContext *s) { @@ -317,10 +379,13 @@ fail1: * try to set parameters specified through AVOptions and if successful * return 1 in *pformat_set. * If pformat_set is NULL, list all pin capabilities. + * When listing pin capabilities, if ranges is NULL, output to log, + * else store capabilities in ranges. */ static void dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, -IPin *pin, int *pformat_set) +IPin *pin, int *pformat_set, +AVOptionRanges *ranges, enum DshowCapQueryType query_type) { struct dshow_ctx *ctx = avctx->priv_data; IAMStreamConfig *config = NULL; @@ -338,7 +403,11 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, if (!caps) goto end; -for (i = 0; i < n && !format_set; i++) { +for (i = 0; i < n && (!format_set || ranges); i++) { +AVOptionRange *range = NULL; +AVOptionRange **range_list = NULL; +int nb_range = 0; + r = IAMStreamConfig_GetStreamCaps(config, i, &type, (void *) caps); if (r != S_OK) goto next; @@ -365,7 +434,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, } else { goto next; } -if (!pformat_set) { +if (!pformat_set && !ranges) { enum AVPixelFormat pix_fmt = dshow_pixfmt(bih->biCompression, bih->biBitCount); if (pix_fmt == AV_PIX_FMT_NONE) { enum AVCodecID codec_id = av_codec_get_id(tags, bih->biCompression); @@ -410,6 +479,81 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, bih->biWidth = ctx->requested_width; bih->biHeight = ctx->requested_height; } + +if (ranges) { +if (query_type == CAP_QUERY_FRAME_SIZE) { +for (int j = 0; j < 3; j++) { +range = av_mallocz(sizeof(AVOptionRange)); +if (!range) +goto next; +range->str = av_strdup(j == 0 ? "pixel_count" : (j == 1 ? "width" :
[FFmpeg-devel] [PATCH 3/4] avdevice/dshow: implement capabilities API
This implements avdevice_capabilities_create and avdevice_capabilities_free for the dshow device. Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 498 1 file changed, 462 insertions(+), 36 deletions(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 8d0a6fcc09..c65492119e 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -30,6 +30,48 @@ #include "objidl.h" #include "shlwapi.h" +enum DshowCapQueryType { +CAP_QUERY_NONE = 0, +CAP_QUERY_SAMPLE_FORMAT, +CAP_QUERY_SAMPLE_RATE, +CAP_QUERY_CHANNELS, +CAP_QUERY_CODEC, +CAP_QUERY_PIXEL_FORMAT, +CAP_QUERY_FRAME_SIZE, +CAP_QUERY_FPS +}; +typedef struct DshowCapQueryTypeEntry { +const char* name; +enum DshowCapQueryType query_type; +} DshowCapQueryTypeEntry; + +static const DshowCapQueryTypeEntry query_table[] = { +{ "sample_format", CAP_QUERY_SAMPLE_FORMAT }, +{ "sample_rate",CAP_QUERY_SAMPLE_RATE }, +{ "channels", CAP_QUERY_CHANNELS }, +{ "codec", CAP_QUERY_CODEC }, +{ "pixel_format", CAP_QUERY_PIXEL_FORMAT }, +{ "frame_size", CAP_QUERY_FRAME_SIZE }, +{ "fps",CAP_QUERY_FPS }, +}; + +static enum DshowCapQueryType dshow_get_query_type(const char* option_name) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (!strcmp(query_table[i].name, option_name)) +return query_table[i].query_type; +} +return CAP_QUERY_NONE; +} + +static const char* dshow_get_query_type_string(enum DshowCapQueryType query_type) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(query_table); ++i) { +if (query_table[i].query_type == query_type) +return query_table[i].name; +} +return NULL; +} static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) { @@ -54,6 +96,26 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) return avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), biCompression); // all others } +static enum AVCodecID waveform_codec_id(enum AVSampleFormat sample_fmt) +{ +switch (sample_fmt) { +case AV_SAMPLE_FMT_U8: return AV_CODEC_ID_PCM_U8; +case AV_SAMPLE_FMT_S16: return AV_CODEC_ID_PCM_S16LE; +case AV_SAMPLE_FMT_S32: return AV_CODEC_ID_PCM_S32LE; +default:return AV_CODEC_ID_NONE; /* Should never happen. */ +} +} + +static enum AVSampleFormat sample_fmt_bits_per_sample(int bits) +{ +switch (bits) { +case 8: return AV_SAMPLE_FMT_U8; +case 16: return AV_SAMPLE_FMT_S16; +case 32: return AV_SAMPLE_FMT_S32; +default: return AV_SAMPLE_FMT_NONE; /* Should never happen. */ +} +} + static int dshow_read_close(AVFormatContext *s) { @@ -317,10 +379,13 @@ fail1: * try to set parameters specified through AVOptions and if successful * return 1 in *pformat_set. * If pformat_set is NULL, list all pin capabilities. + * When listing pin capabilities, if ranges is NULL, output to log, + * else store capabilities in ranges. */ static void dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, -IPin *pin, int *pformat_set) +IPin *pin, int *pformat_set, +AVOptionRanges *ranges, enum DshowCapQueryType query_type) { struct dshow_ctx *ctx = avctx->priv_data; IAMStreamConfig *config = NULL; @@ -338,7 +403,11 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, if (!caps) goto end; -for (i = 0; i < n && !format_set; i++) { +for (i = 0; i < n && (!format_set || ranges); i++) { +AVOptionRange *range = NULL; +AVOptionRange **range_list = NULL; +int nb_range = 0; + r = IAMStreamConfig_GetStreamCaps(config, i, &type, (void *) caps); if (r != S_OK) goto next; @@ -365,7 +434,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, } else { goto next; } -if (!pformat_set) { +if (!pformat_set && !ranges) { enum AVPixelFormat pix_fmt = dshow_pixfmt(bih->biCompression, bih->biBitCount); if (pix_fmt == AV_PIX_FMT_NONE) { enum AVCodecID codec_id = av_codec_get_id(tags, bih->biCompression); @@ -410,6 +479,81 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, bih->biWidth = ctx->requested_width; bih->biHeight = ctx->requested_height; } + +if (ranges) { +if (query_type == CAP_QUERY_FRAME_SIZE) { +for (int j = 0; j < 3; j++) { +range = av_mallocz(sizeof(AVOptionRange)); +if (!range) +goto next; +range->str = av_strdup(j == 0 ? "pixel_count" : (j == 1 ? "width" :
[FFmpeg-devel] [PATCH 2/2] examples: adding device_get_capabilities example
Signed-off-by: Diederick Niehorster --- configure | 2 + doc/examples/.gitignore| 1 + doc/examples/Makefile | 47 doc/examples/Makefile.example | 1 + doc/examples/device_get_capabilities.c | 151 + 5 files changed, 179 insertions(+), 23 deletions(-) create mode 100644 doc/examples/device_get_capabilities.c diff --git a/configure b/configure index 82367fd30d..5e9666d017 100755 --- a/configure +++ b/configure @@ -1705,6 +1705,7 @@ EXAMPLE_LIST=" decode_audio_example decode_video_example demuxing_decoding_example +device_get_capabilities_example encode_audio_example encode_video_example extract_mvs_example @@ -3712,6 +3713,7 @@ avio_reading_deps="avformat avcodec avutil" decode_audio_example_deps="avcodec avutil" decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +device_get_capabilities_example_deps="avdevice avformat avutil" encode_audio_example_deps="avcodec avutil" encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index 44960e1de7..256f33a600 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -3,6 +3,7 @@ /decode_audio /decode_video /demuxing_decoding +/device_get_capabilities /encode_audio /encode_video /extract_mvs diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 81bfd34d5d..7988ed4226 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -1,26 +1,27 @@ -EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir -EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading -EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio -EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video -EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding -EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio -EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video -EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs -EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio -EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio -EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video -EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient -EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode -EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata -EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing -EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec -EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing -EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio -EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video -EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac -EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding -EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode -EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode +EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir +EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading +EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio +EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video +EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding +EXAMPLES-$(CONFIG_DEVICE_GET_CAPABILITIES_EXAMPLE) += device_get_capabilities +EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video +EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs +EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio +EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio +EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video +EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient +EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode +EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata +EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing +EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec +EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing +EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio +EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video +EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac +EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding +EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode +EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode EXAMPLES := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) diff --git a/doc/examples/Makefile.example b/doc/examples/Makefile.example index a232d97f98
Re: [FFmpeg-devel] [PATCH] avdevice/avdevice: Deprecate AVDevice Capabilities API
Hi Nicolas, On Wed, Jun 2, 2021 at 2:37 PM Nicolas George wrote: > Excellent. Applications that use the advanced features of libavdevice > and serve as test beds for these features are sorely needed. > > The project has no real system to make engagements about something like > this, but I can say that if you propose a patch series that de-deprecate > the API and implements it in dshow, I would personally support it. Just sent the patch, it completes my push together with my other patches of the last few days to make the dshow device fully programmatically controllable and discoverable. By the way, each of these patch series applies to master, but not on top of each other (there'd be massive conflicts). What is custom? Should i instead send them all as one large patch series? Thanks and all the best, Dee ___ 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] libavcodec: r12b decoder
You patch did not apply on patchwork and thus did not make fate tests. Please use .txt extension on the patch (BTW, what a joke) or use git send-email. It is also very funny that gmail for android recognises patch as video. Wht? ___ 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] ffmpeg: add -fpsmin to clamp output framerate
It is not going to work. His email is marked as spam here in gmail for android, so it looks like it is globally banned in google and because you clever guys use gmail for patchwork, i.e. ffmpegpatchwo...@gmail.com but you did not set to send all spam into main folder, like I always do, see https://webapps.stackexchange.com/questions/1307/ it is not recognising it. I personally use this: instead of "has the words" method that was banned by some nut in google (I still did not found out who did that) I use the opposite with some crazy thing like faewfaefagvfdvfaefeffdvcvfea. And it will send all "spam" to main folder. Yeah. ___ 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/2] lavfi/vf_drawbox.c: fix CID 1485004
CID 1485004: Uninitialized variables (UNINIT) Using uninitialized value "x" when calling "*pixel_belongs_to_region". Signed-off-by: Ting Fu --- libavfilter/vf_drawbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index fff78862e9..1e9e028650 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -126,8 +126,9 @@ static void draw_region(AVFrame *frame, DrawBoxContext *ctx, int left, int top, for (y = top; y < down; y++) { ASSIGN_THREE_CHANNELS if (ctx->invert_color) { -if (pixel_belongs_to_region(ctx, x, y)) -row[0][x] = 0xff - row[0][x]; +for (x = left; x < right; x++) +if (pixel_belongs_to_region(ctx, x, y)) +row[0][x] = 0xff - row[0][x]; } else { for (x = left; x < right; x++) { double alpha = (double)ctx->yuv_color[A] / 255; -- 2.17.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 2/2] lavfi/vf_drawtext.c: fix CID 1485003
CID 1485003: Memory - illegal accesses (UNINIT) Using uninitialized value "sd". Signed-off-by: Ting Fu --- libavfilter/vf_drawtext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 382d589e26..c4c09894e4 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1554,7 +1554,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFrameSideData *sd; int loop = 1; -if (s->text_source == AV_FRAME_DATA_DETECTION_BBOXES && sd) { +if (s->text_source == AV_FRAME_DATA_DETECTION_BBOXES) { sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DETECTION_BBOXES); if (sd) { header = (AVDetectionBBoxHeader *)sd->data; -- 2.17.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] swscale: fix chroma width rounding
On Thu, Jun 03, 2021 at 09:10:13PM +0200, Michael Niedermayer wrote: > On Wed, Jun 02, 2021 at 11:02:44PM +0800, lance.lmw...@gmail.com wrote: > > From: Limin Wang > > > > fixes vertical line at the right side of video for rgb24toyv12 conversion. > > Please reproduce it with below command: > > ./ffplay -f lavfi -i > > "testsrc=size=529x656,ocv=filter_name=smooth,format=yuv420p" > > > > Signed-off-by: Limin Wang > > --- > > libswscale/rgb2rgb_template.c | 2 +- > > libswscale/x86/rgb2rgb_template.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c > > index 42c6980..e716ba5 100644 > > --- a/libswscale/rgb2rgb_template.c > > +++ b/libswscale/rgb2rgb_template.c > > @@ -654,7 +654,7 @@ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t > > *ydst, uint8_t *udst, > > int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = > > rgb2yuv[BU_IDX]; > > int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = > > rgb2yuv[BV_IDX]; > > int y; > > -const int chromWidth = width >> 1; > > +const int chromWidth = AV_CEIL_RSHIFT(width, 1); > > > > for (y = 0; y < height; y += 2) { > > int i; > > diff --git a/libswscale/x86/rgb2rgb_template.c > > b/libswscale/x86/rgb2rgb_template.c > > index ae2469e..704b0fa 100644 > > --- a/libswscale/x86/rgb2rgb_template.c > > +++ b/libswscale/x86/rgb2rgb_template.c > > @@ -1578,7 +1578,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t > > *src, uint8_t *ydst, uint8_ > > #define BGR2U_IDX "16*4+16*33" > > #define BGR2V_IDX "16*4+16*34" > > int y; > > -const x86_reg chromWidth= width>>1; > > +const x86_reg chromWidth = AV_CEIL_RSHIFT(width, 1); > > > > if (height > 2) { > > ff_rgb24toyv12_c(src, ydst, udst, vdst, width, 2, lumStride, > > chromStride, srcStride, rgb2yuv); > > the comments above the functions are incorrect if you add support for odd > width > also the code writes outside the luma array i think with this change Sorry, I haven't notice the comments say about that, then I prefer not to use the optimized bgr24toYV12 unscaled conversion when width%2. Will update the patch. > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Those who are too smart to engage in politics are punished by being > governed by those who are dumber. -- Plato > ___ > 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". -- Thanks, Limin Wang ___ 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] avformat/avio: fixed AVSEEK_FORCE and documentation
Always true expression: we would have returned on line 265, if whence were SEEK_END we would've already returned. Because of short circuiting force will never be checked. Was broken since 7a6fe01f99cb95797ba59134f44bb1a5e792. That is 11 years! Also fixed other commit that did confuse ORing / passing: 41ed7ab45fc693f7d7fc35664c0233f4c32d69bb. --- libavformat/avio.h| 4 ++-- libavformat/aviobuf.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 0b35409787..83e2a71b67 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -505,14 +505,14 @@ int avio_put_str16be(AVIOContext *s, const char *str); void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type); /** - * ORing this as the "whence" parameter to a seek function causes it to + * Passing this as the "whence" parameter to a seek function causes it to * return the filesize without seeking anywhere. Supporting this is optional. * If it is not supported then the seek function will return <0. */ #define AVSEEK_SIZE 0x1 /** - * Passing this flag as the "whence" parameter to a seek function causes it to + * OR'ing this flag into the "whence" parameter to a seek function causes it to * seek by any means (like reopening and linear reading) or other normally unreasonable * means that can be extremely slow. * This may be ignored by the seek code. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index ddfa4ecbf1..d748cda397 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -286,8 +286,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) } else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) || offset1 <= buffer_size + short_seek) && !s->write_flag && offset1 >= 0 && - (!s->direct || !s->seek) && - (whence != SEEK_END || force)) { + (!s->direct || !s->seek) || force) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached) -- 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] lavfi/dnn/dnn_io_proc.c: fix CID 1484955
> -Original Message- > From: Guo, Yejun > Sent: 2021年5月29日 21:24 > To: ffmpeg-devel@ffmpeg.org > Cc: Guo, Yejun > Subject: [PATCH] lavfi/dnn/dnn_io_proc.c: fix CID 1484955 > > CID 1484955: Memory - corruptions (ARRAY_VS_SINGLETON) > --- > libavfilter/dnn/dnn_io_proc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c > index 021d004e1d..f55424d97c 100644 > --- a/libavfilter/dnn/dnn_io_proc.c > +++ b/libavfilter/dnn/dnn_io_proc.c > @@ -128,7 +128,7 @@ DNNReturnType > ff_proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *lo > } > sws_scale(sws_ctx, (const uint8_t **)frame->data, > frame->linesize, 0, frame->height, > - (uint8_t * const*)(&input->data), > + (uint8_t * const [4]){input->data, 0, 0, 0}, > (const int [4]){frame->width * 3 * sizeof(float), > 0, 0, 0}); > sws_freeContext(sws_ctx); > break; will push tomorrow if there's no objection. ___ 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] swscale/swscale_unscaled: don't use the optimized bgr24toYV12 unscaled conversion when width%2
From: Limin Wang Signed-off-by: Limin Wang --- libswscale/swscale_unscaled.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index c4dd8a4..e8e2975 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1978,6 +1978,7 @@ void ff_get_unscaled_swscale(SwsContext *c) const enum AVPixelFormat dstFormat = c->dstFormat; const int flags = c->flags; const int dstH = c->dstH; +const int dstW = c->dstW; int needsDither; needsDither = isAnyRGB(dstFormat) && @@ -2033,7 +2034,7 @@ void ff_get_unscaled_swscale(SwsContext *c) /* bgr24toYV12 */ if (srcFormat == AV_PIX_FMT_BGR24 && (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && -!(flags & SWS_ACCURATE_RND)) +!(flags & SWS_ACCURATE_RND) && !(dstW&1)) c->swscale = bgr24ToYv12Wrapper; /* RGB/BGR -> RGB/BGR (no dither needed forms) */ -- 1.8.3.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] libavformat/movenc: Support encryption of H265 stream in AnnexB format
Ping. This change is quite simple and should be quick to review. Feel free to ask any questions пн, 22 мар. 2021 г. в 11:29, Вадим Бездушный : > Ping. > > чт, 11 мар. 2021 г. в 10:14, Вадим Бездушный : > >> Ping. >> >> вт, 9 мар. 2021 г. в 00:05, Вадим Бездушный : >> >>> Ping. >>> >>> This change is quite simple and should be quick to review. Feel free to >>> ask any questions >>> >>> On Mon, 1 Mar 2021, 14:54 Vadym Bezdushnyi, >>> wrote: >>> Add an ability to accept H265 AnnexB stream at encryption similar to how its done for H264 AnnexB stream. Steps to test: 1. Create h265 test files - mp4 and h265 AnnexB streams: ffmpeg -f lavfi -i testsrc=duration=10:size=640x480:rate=30 -c:v hevc input_h265.mp4 ffmpeg -f lavfi -i testsrc=duration=10:size=640x480:rate=30 -c:v hevc -bsf:v hevc_mp4toannexb input_h265.h265 2. Encrypt and decrypt files. Put appropriate input file name here: input_h265.mp4 or input_h265.h265 ffmpeg -i input_h265.h265 -vcodec copy -acodec copy -encryption_scheme cenc-aes-ctr \ -encryption_key -encryption_kid \ encrypted_h265.mp4 ffplay -i encrypted_h265.mp4 -decryption_key Signed-off-by: Vadym Bezdushnyi --- libavformat/movenc.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 545b0885ae..0433968cd2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5685,7 +5685,15 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) return ret; avio_write(pb, reformatted_data, size); } else { -size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, 0, NULL); +if (trk->cenc.aes_ctr) { +size = ff_mov_cenc_avc_parse_nal_units(&trk->cenc, pb, pkt->data, size); +if (size < 0) { +ret = size; +goto err; +} +} else { +size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, 0, NULL); +} } } else if (par->codec_id == AV_CODEC_ID_AV1) { if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) { @@ -5727,6 +5735,9 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 4) { int nal_size_length = (par->extradata[4] & 0x3) + 1; ret = ff_mov_cenc_avc_write_nal_units(s, &trk->cenc, nal_size_length, pb, pkt->data, size); +} else if(par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 21) { +int nal_size_length = (par->extradata[21] & 0x3) + 1; +ret = ff_mov_cenc_avc_write_nal_units(s, &trk->cenc, nal_size_length, pb, pkt->data, size); } else { ret = ff_mov_cenc_write_packet(&trk->cenc, pb, pkt->data, size); } @@ -6711,7 +6722,8 @@ static int mov_init(AVFormatContext *s) if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ret = ff_mov_cenc_init(&track->cenc, mov->encryption_key, -track->par->codec_id == AV_CODEC_ID_H264, s->flags & AVFMT_FLAG_BITEXACT); +(track->par->codec_id == AV_CODEC_ID_H264 || track->par->codec_id == AV_CODEC_ID_HEVC), +s->flags & AVFMT_FLAG_BITEXACT); if (ret) return ret; } -- 2.30.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".