Re: [FFmpeg-devel] [PATCH] avformat/url: fix ff_make_absolute_url with Windows file paths

2021-04-05 Thread Marton Balint



On Fri, 2 Apr 2021, Marton Balint wrote:


Ugly, but a lot less broken than it was.

Fixes ticket #9166.


Ping for this, if there is no disapproval of this fix then I plan to 
extend fate and backport this to 4.4/4.3.


Thanks,
Marton



Signed-off-by: Marton Balint 
---
libavformat/url.c | 25 -
1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/libavformat/url.c b/libavformat/url.c
index 77d610d95f..90fd41e810 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -149,6 +149,18 @@ int ff_url_decompose(URLComponents *uc, const char *url, 
const char *end)
return 0;
}

+static int is_fq_dos_path(const char *path)
+{
+if ((path[0] >= 'a' && path[0] <= 'z' || path[0] >= 'A' && path[0] <= 'Z') 
&&
+ path[1] == ':' &&
+(path[2] == '/' || path[2] == '\\'))
+return 1;
+if ((path[0] == '/' || path[0] == '\\') &&
+(path[1] == '/' || path[1] == '\\'))
+return 1;
+return 0;
+}
+
static int append_path(char *root, char *out_end, char **rout,
   const char *in, const char *in_end)
{
@@ -185,6 +197,7 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
char *out, *out_end, *path;
const char *keep, *base_path_end;
int use_base_path, simplify_path = 0, ret;
+const char *base_separators = "/";

/* This is tricky.
   For HTTP, http://server/site/page + ../media/file
@@ -211,6 +224,16 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,

if (!base)
base = "";
+if (HAVE_DOS_PATHS) {
+if ((ret = ff_url_decompose(&ub, base, NULL)) < 0)
+goto error;
+if (is_fq_dos_path(base) || av_strstart(base, "file:", NULL) || 
ub.path == ub.url) {
+if (is_fq_dos_path(rel))
+base = "";
+else
+base_separators = "/\\";
+}
+}
if ((ret = ff_url_decompose(&ub, base, NULL)) < 0 ||
(ret = ff_url_decompose(&uc, rel,  NULL)) < 0)
goto error;
@@ -249,7 +272,7 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
if (use_base_path) {
base_path_end = ub.url_component_end_path;
if (URL_COMPONENT_HAVE(uc, path))
-while (base_path_end > ub.path && base_path_end[-1] != '/')
+while (base_path_end > ub.path && !strchr(base_separators, 
base_path_end[-1]))
base_path_end--;
}
if (keep > ub.path)
--
2.26.2

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

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

___
ffmpeg-devel 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 V6 4/6] lavu: add side data AV_FRAME_DATA_BOUNDING_BOXES

2021-04-05 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Nicolas
> George
> Sent: 2021年4月4日 18:02
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V6 4/6] lavu: add side data
> AV_FRAME_DATA_BOUNDING_BOXES
> 
> Guo, Yejun (12021-04-01):
> > > Is this allowed to be negative? Can/should this be size_t?
> > There was a long discussion about size_t/int/uint32_t when I added
> > struct AVRegionOfInterest in frame.h, and finally size_t is not chosen.
> 
> Then at least unsigned.

yes, 'unsigned int' is another option. but imho, it might be better to use
the same data type of AVFrame.width/height, they are 'int'.

> 
> > yes, we can add a version number (enum AVBBoxHeaderVersion, see below)
> at the
> > beginning of the struct, and the user needs to set it with
> AV_BBOX_HEADER_CURRENT.
> > It is not elegant, is this what we really want?
> 
> A version number does not make the structure compatible. At best,
> applications check the version and detect they do not support this one
> and report an error. At worse, they do not bother to check and it causes
> strange bugs. The version number does not help with compatibility, it
> just makes it detectable.

My idea was to use separate code path for AVBoundingBoxHeaderV1, 
AVBoundingBoxHeaderV2, ... (not union in my previous email) according to
the version number. And yes, it doesn't work if the user does not set or
check the version number correctly.

> 
> To make the structure compatible, we have to ask ourselves: What happens
> if we update it? What breaks compatibility? Once we have an answer, we
> find a workaround.
> 
> In this case, what happens is that the variable array must be at the
> end, and therefore its offset changes. And we cannot have a second
> variable array (like the name! you had to set a constant size), and we
> cannot update the type of the array elements.
> 
> And the solution becomes obvious: let us store the offsets in the
> structure.

Thanks a lot for your nice explanation! thank you.

> 
> So, that would be:
> 
>   typedef struct AVBoundingBoxHeader {
>   ...
>   /**
>* Offset of the array of bounding boxes.
>*/
>   size_t bboxes_offset;
> 
>   /**
>* Offset increment in the array of bounding boxes.
>*/
>   size_t bboxes_step;
>   };
> 
> Note that with that solution, we do not need the empty array, we can do
> this:
> 
> AVBoundingBoxHeader *ff_bounding_box_alloc(size_t nb_bbox)
> {
> struct {
>   AVBoundingBoxHeader header;
>   AVBoundingBox boxes[nb_bbox];
> } *ret;
> ret = av_mallocz(sizeof(*ret));
> /* add error checks */
> ret->header->bboxes_offset = (char *)&ret->boxes - (char *)ret->header;
> ret->header->bboxes_step = sizeof(*ret->boxes);
> }
> 
> #define AV_BOUNDING_BOX_GET(header, idx) \
> ((AVBoundingBox *)((char *)(header) + (header)->bboxes_offset + (idx) *
> (header)->bboxes_step))

thanks, and I'll update the naming as what James mentioned.

> 
> You can do the same to lift the 128 limit on the name.

yes, we can now handle more variable arrays with this method.

For the special case 'char source[128]' in AVBoundingBoxHeader, it will be 
written
for several times, for example, vf_dnn_detect.c writes model name of detection
into source, and later, vf_dnn_classify.c (in plan) will append the model name 
of
classification into source. So, source will be at the end of the side data, and 
the side
data will be reallocated when needed.

> 
> 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 04/17] lavf: postpone removal of FF_API_COMPUTE_PKT_FIELDS2

2021-04-05 Thread Anton Khirnov
The infrastructure to fully handle generating timestamps e.g. for raw
video streamcopy is still not present.
---
 libavformat/mux.c | 8 
 libavformat/version.h | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index e98b86a81e..d8746f3c13 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -541,7 +541,7 @@ fail:
 #define AV_PKT_FLAG_UNCODED_FRAME 0x2000
 
 
-#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+#if FF_API_COMPUTE_PKT_FIELDS2
 FF_DISABLE_DEPRECATION_WARNINGS
 //FIXME merge with compute_pkt_fields
 static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket 
*pkt)
@@ -621,7 +621,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, 
AVStream *st, AVPacket *
 case AVMEDIA_TYPE_AUDIO:
 frame_size = (pkt->flags & AV_PKT_FLAG_UNCODED_FRAME) ?
  (*(AVFrame **)pkt->data)->nb_samples :
- av_get_audio_frame_duration(st->codec, pkt->size);
+ av_get_audio_frame_duration2(st->codecpar, pkt->size);
 
 /* HACK/FIXME, we skip the initial 0 size packets as they are most
  * likely equal to the encoder delay, but it would be better if we
@@ -779,7 +779,7 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt)
 
 static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket 
*pkt)
 {
-#if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
+#if !FF_API_COMPUTE_PKT_FIELDS2
 /* sanitize the timestamps */
 if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 
@@ -1140,7 +1140,7 @@ static int write_packet_common(AVFormatContext *s, 
AVStream *st, AVPacket *pkt,
 
 guess_pkt_duration(s, st, pkt);
 
-#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+#if FF_API_COMPUTE_PKT_FIELDS2
 if ((ret = compute_muxer_pkt_fields(s, st, pkt)) < 0 && 
!(s->oformat->flags & AVFMT_NOTIMESTAMPS))
 return ret;
 #endif
diff --git a/libavformat/version.h b/libavformat/version.h
index ced5600034..7ec1ed5248 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -55,9 +55,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  *
  */
-#ifndef FF_API_COMPUTE_PKT_FIELDS2
-#define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_OLD_OPEN_CALLBACKS
 #define FF_API_OLD_OPEN_CALLBACKS   (LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
@@ -115,6 +112,9 @@
 #ifndef FF_API_LAVF_PRIV_OPT
 #define FF_API_LAVF_PRIV_OPT(LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_COMPUTE_PKT_FIELDS2
+#define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE
-- 
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".

[FFmpeg-devel] [PATCH 01/17] lavu: postpone child_class_next API removal

2021-04-05 Thread Anton Khirnov
It has only been deprecated a year ago.
---
 libavutil/version.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/version.h b/libavutil/version.h
index e88e1ad08d..b97e4e5437 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -129,12 +129,12 @@
 #ifndef FF_API_PSEUDOPAL
 #define FF_API_PSEUDOPAL(LIBAVUTIL_VERSION_MAJOR < 57)
 #endif
-#ifndef FF_API_CHILD_CLASS_NEXT
-#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
 #ifndef FF_API_BUFFER_SIZE_T
 #define FF_API_BUFFER_SIZE_T(LIBAVUTIL_VERSION_MAJOR < 57)
 #endif
+#ifndef FF_API_CHILD_CLASS_NEXT
+#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 58)
+#endif
 #ifndef FF_API_D2STR
 #define FF_API_D2STR(LIBAVUTIL_VERSION_MAJOR < 58)
 #endif
-- 
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".

[FFmpeg-devel] Major bump

2021-04-05 Thread Anton Khirnov
Hi,
this patchset bumps major version of all the libraries and removes many
deprecated APIs, as discussed at length during past months. Patches
11-16 will be squashed together on push, but are sent separately for
ease of review. FATE passes (here at least).

As agreed during the last developer call, I am disabling the
uspp/mcdeint filters that depend on removed libavcodec APIs. They should
be easy to re-enable if anyone finds the motivation to update them.

I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
with usage of AVCodecContext.time_base for decoding, since removing them
without breakage requires a fair bit of additional infrastructure that
is not yet there. I have plans for all these and hopefully I'll get to
it before the next bump.

Carl asked during the last meeting for some reasoning for the bump. The
general reasons are that
- old APIs are unable to provide all the features of the new ones
  (that's usually why new APIs are added)
- old APIs tend to be harder to use correctly, they often have obscure
  quirks or corner cases
- maintaining compatibility wrappers for them is a major obstacle to
  further development
I'm appending some notes for the specific changes further down, they
could be added to the wiki or the website news entry.

Please comment,
-- 
Anton Khirnov

Major bump notes

libavcodec
--
* old audio/video decoding APIs avcodec_decode_video2 and
  avcodec_decode_audio4 were removed;
  they are replaced by avcodec_send_packet/avcodec_receive_frame, which
  decouple input and output and can return any number of output frames
  for a single input packet
* old audio/video encoding APIs avcodec_encode_video2 and
  avcodec_encode_audio2 were removed;
  they are replaced by avcodec_send_frame/avcodec_receive_packet, which
  decouple input and output and can return any number of output packets
  for a single input frame
* AVCodecContext.coded_frame removed without replacement
* AVCodecContext.side_data_only_packets removed, codecs (currently only flacenc)
  now always behave as if this field was set to 1
* AVCodecContext.vbv_delay removed, replaced by AV_PKT_DATA_CPB_PROPERTIES side 
data
* AVCodecContext.rtp_callback removed without replacement
* AVCodecContext.*_bits removed without replacement
* following AVCodecContext fields  removed, replaced by encoder-private options
- coder_type and FF_CODER_TYPE*
- b_frame_strategy
- mpeg_quant
- prediction_method and FF_PRED_*
- pre_me
- scenechange_threshold
- noise_reduction
- me_penalty_compensation
- brd_scale
- chromaoffset
- b_sensitivity
- context_model
- frame_skip_*
- min/max_prediction_order
- timecode_frame_start
- rtp_payload_size
* AVPacket.convergence_duration removed, use AVPacket.duration instead
* AVPacket API for pre-refcounted memory management were removed
- av_dup_packet
- av_copy_packet
- av_copy_packet_side_data
- av_free_packet
  users should use refcounted packet API instead
* av_packet_merge_side_data and av_packet_split_side_data removed without 
replacement,
  packets with merged side data are no longer supported
* AVPicture and its related APIs removed; it is replaced either by AVFrame API
  or imgutils in libavutil
* old bistream filtering API (using AVBitStreamFilterContext) removed, replaced 
by the API
  in libavcodec/bsf.h
* avcodec_copy_context removed, it never makes sense for users to call this 
function
* avcodec_get_context_defaults3 removed, users should allocate a new codec 
context
  instead of resettting an old one
* av_get_codec_tag_string replaced by av_fourcc_make_string/av_fourcc2str
* avcodec_get_chroma_sub_sample replaced by av_pix_fmt_get_chroma_sub_sample
* AVCodecContext accessors removed, AVCodecContext fields should be accessed 
directly
* AVHWAccel and its related functions removed from public API, as there was no 
reason
  for them to be user-visible
* AV_CODEC_CAP_INTRA_ONLY and AV_CODEC_CAP_INTRA_ONLY removed, use corresponding
  AVCodecDescriptor.props values instead
* av_lockmgr_register and AVLockOp removed, libavcodec handles locking 
internally
* codec registration APIs removed, all codecs are always registered
- avcodec_register
- avcodec_register_all
* av_codec_next replaced by av_codec_iterate
* AVCPBProperties.max/min/avg_bitrate types changed from int to int64_t
* avcodec_get_pix_fmt_loss replaced by av_get_pix_fmt_loss
* avcodec_find_best_pix_fmt_of_2 replaced by avcodec_find_best_pix_fmt_of_2
* avcodec_find_best_pix_fmt2 removed
* av_parser_change removed; dump_extradata, remove_extra or extract_extradata
  should be used instead
* FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS removed, ASS subtitles are always decoded 
without timings
* mpegvideo encoders' rc_strategy option removed, as it had no effect
* av_vdpau_get_profile removed, users should call av_vdpau_get_profile to set up
  VDPAU decoding
* libopenh264 encoder's 'slice_mode' option removed, as i

[FFmpeg-devel] [PATCH 02/17] lavf/matroskaenc: fix avio_printf argument types after bump

2021-04-05 Thread Anton Khirnov
Field precision supplied with the '*' specification must be an int.

Also, make sure converting those fields to int does not overflow.
---
 libavformat/matroskaenc.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index bbf231f2a4..609a588f78 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2143,7 +2143,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, 
AVIOContext *pb, const AVPac
 mkv_track *track = &mkv->tracks[pkt->stream_index];
 ebml_master blockgroup;
 buffer_size_t id_size, settings_size;
-int size;
+int size, id_size_int, settings_size_int;
 const char *id, *settings;
 int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
 const int flags = 0;
@@ -2156,6 +2156,10 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, 
AVIOContext *pb, const AVPac
&settings_size);
 settings = settings ? settings : "";
 
+if (id_size > INT_MAX - 2 || settings_size > INT_MAX - id_size - 2 ||
+pkt->size > INT_MAX - settings_size - id_size - 2)
+return AVERROR(EINVAL);
+
 size = id_size + 1 + settings_size + 1 + pkt->size;
 
 /* The following string is identical to the one in mkv_write_block so that
@@ -2175,7 +2179,10 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, 
AVIOContext *pb, const AVPac
 put_ebml_num(pb, track->track_num, track->track_num_size);
 avio_wb16(pb, ts - mkv->cluster_pts);
 avio_w8(pb, flags);
-avio_printf(pb, "%.*s\n%.*s\n%.*s", id_size, id, settings_size, settings, 
pkt->size, pkt->data);
+
+id_size_int   = id_size;
+settings_size_int = settings_size;
+avio_printf(pb, "%.*s\n%.*s\n%.*s", id_size_int, id, settings_size_int, 
settings, pkt->size, pkt->data);
 
 put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, pkt->duration);
 end_ebml_master(pb, blockgroup);
@@ -2352,6 +2359,8 @@ static int mkv_write_packet_internal(AVFormatContext *s, 
const AVPacket *pkt)
 } else {
 if (par->codec_id == AV_CODEC_ID_WEBVTT) {
 duration = mkv_write_vtt_blocks(s, pb, pkt);
+if (duration < 0)
+return duration;
 } else {
 ebml_master blockgroup = start_ebml_master(pb, 
MATROSKA_ID_BLOCKGROUP,

mkv_blockgroup_size(pkt->size,
-- 
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".

[FFmpeg-devel] [PATCH 03/17] lavf/webvttenc: fix avio_printf argument types after bump

2021-04-05 Thread Anton Khirnov
Field precision supplied with the '*' specification must be an int.
---
 libavformat/webvttenc.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 552bc38b65..809fead69f 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -65,6 +65,7 @@ static int webvtt_write_packet(AVFormatContext *ctx, AVPacket 
*pkt)
 {
 AVIOContext  *pb = ctx->pb;
 buffer_size_t id_size, settings_size;
+int id_size_int, settings_size_int;
 uint8_t *id, *settings;
 
 avio_printf(pb, "\n");
@@ -72,8 +73,12 @@ static int webvtt_write_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 id = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_IDENTIFIER,
  &id_size);
 
-if (id && id_size > 0)
-avio_printf(pb, "%.*s\n", id_size, id);
+if (id_size > INT_MAX)
+return AVERROR(EINVAL);
+
+id_size_int = id_size;
+if (id && id_size_int > 0)
+avio_printf(pb, "%.*s\n", id_size_int, id);
 
 webvtt_write_time(pb, pkt->pts);
 avio_printf(pb, " --> ");
@@ -82,8 +87,12 @@ static int webvtt_write_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 settings = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_SETTINGS,
&settings_size);
 
-if (settings && settings_size > 0)
-avio_printf(pb, " %.*s", settings_size, settings);
+if (settings_size_int > INT_MAX)
+return AVERROR(EINVAL);
+
+settings_size_int = settings_size;
+if (settings && settings_size_int > 0)
+avio_printf(pb, " %.*s", settings_size_int, settings);
 
 avio_printf(pb, "\n");
 
-- 
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".

[FFmpeg-devel] [PATCH 16/17] fate-mov-zombie: update ref for FF_API_OLD_ROTATE_API removal

2021-04-05 Thread Anton Khirnov
---
 tests/ref/fate/mov-zombie | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index 7b417e59dd..3001c6daa2 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -194,5 +194,5 @@ 
frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=188623|pkt_pts_time=2.
 
packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|size=580|pos=101820|flags=__
 
frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=191626|pkt_pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45]
 User Data Unregistered SEI message
 
-stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:rotate=0|tag:creation_time=2008-05-12T20:59:27.00Z|tag:language=eng|tag:handler_name=Apple
 Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:creation_time=2008-05-12T20:59:27.00Z|tag:language=eng|tag:handler_name=Apple
 Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264
 side_data|side_data_type=Display Matrix|displaymatrix=\n:   131072 
  0   0\n0001:0   65536   
0\n0002:0   0  1073741824\n|rotation=0
-- 
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".

[FFmpeg-devel] [PATCH 14/17] Update types after the FF_API_BUFFER_SIZE_T change.

2021-04-05 Thread Anton Khirnov
---
 fftools/ffprobe.c  | 2 +-
 libavcodec/decode.c| 2 +-
 libavcodec/mpeg12enc.c | 2 +-
 libavcodec/mscc.c  | 2 +-
 libavfilter/af_ashowinfo.c | 2 +-
 libavfilter/vf_showinfo.c  | 6 +++---
 libavformat/dump.c | 2 +-
 libavformat/framecrcenc.c  | 2 +-
 libavformat/hashenc.c  | 2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 38462e1ff3..c136562afe 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2165,7 +2165,7 @@ static void show_packet(WriterContext *w, InputFile 
*ifile, AVPacket *pkt, int p
   pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
 
 if (pkt->side_data_elems) {
-int size;
+size_t size;
 const uint8_t *side_metadata;
 
 side_metadata = av_packet_get_side_data(pkt, 
AV_PKT_DATA_STRINGS_METADATA, &size);
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 0956a6ac6f..49b21ff43b 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2101,7 +2101,7 @@ int ff_copy_palette(void *dst, const AVPacket *src, void 
*logctx)
 memcpy(dst, pal, AVPALETTE_SIZE);
 return 1;
 } else if (pal) {
-av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
+av_log(logctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
 }
 return 0;
 }
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 5676caef87..7d51278749 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -574,7 +574,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int 
picture_number)
 put_bits(&s->pb, 8, 0xff);  // marker_bits
 } else {
 av_log(s->avctx, AV_LOG_WARNING,
-"Warning Closed Caption size (%d) can not exceed 93 bytes "
+"Warning Closed Caption size (%zu) can not exceed 93 bytes 
"
 "and must be a multiple of 3\n", side_data->size);
 }
 }
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index fe02649623..d392363fa9 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -160,7 +160,7 @@ static int decode_frame(AVCodecContext *avctx,
 for (j = 0; j < 256; j++)
 s->pal[j] = 0xFF00 | AV_RL32(pal + j * 4);
 } else if (pal) {
-av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
+av_log(avctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
 }
 memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
 }
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index 9046e8d84a..1ac4c432ed 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -170,7 +170,7 @@ static void dump_audio_service_type(AVFilterContext *ctx, 
AVFrameSideData *sd)
 
 static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
 {
-av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", 
sd->type, sd->size);
+av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %zu bytes", 
sd->type, sd->size);
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 6208892005..69d1076079 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -314,7 +314,7 @@ static void dump_sei_unregistered_metadata(AVFilterContext 
*ctx, const AVFrameSi
 int i;
 
 if (sd->size < uuid_size) {
-av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", 
sd->size, uuid_size);
+av_log(ctx, AV_LOG_ERROR, "invalid data(%zu < UUID(%d-bytes))\n", 
sd->size, uuid_size);
 return;
 }
 
@@ -472,7 +472,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 av_log(ctx, AV_LOG_INFO, "pan/scan");
 break;
 case AV_FRAME_DATA_A53_CC:
-av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", 
sd->size);
+av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%zu bytes)", 
sd->size);
 break;
 case AV_FRAME_DATA_SPHERICAL:
 dump_spherical(ctx, frame, sd);
@@ -516,7 +516,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 dump_sei_unregistered_metadata(ctx, sd);
 break;
 default:
-av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
bytes)\n",
+av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%zu 
bytes)\n",
sd->type, sd->size);
 break;
 }
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 62ef5e9852..b89b3c63f3 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -496,7 +496,7 @@ static void dump_sidedata(void *ctx, const AVStream *st, 
const char *indent)
 break;
 default:
 av_log(ctx, AV_LOG_INFO,
-   "unknown side data type %d (%d bytes)

[FFmpeg-devel] [PATCH 17/17] Add missing const to AVInputFormat pointers.

2021-04-05 Thread Anton Khirnov
---
 fftools/ffmpeg_opt.c| 2 +-
 fftools/ffprobe.c   | 2 +-
 libavdevice/internal.h  | 2 +-
 libavdevice/utils.c | 2 +-
 libavfilter/lavfutils.c | 2 +-
 libavfilter/src_movie.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 807e783422..5a24aa7a03 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1068,7 +1068,7 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 {
 InputFile *f;
 AVFormatContext *ic;
-AVInputFormat *file_iformat = NULL;
+const AVInputFormat *file_iformat = NULL;
 int err, i, ret;
 int64_t timestamp;
 AVDictionary *unused_opts = NULL;
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index c136562afe..da4f21da79 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -257,7 +257,7 @@ static const OptionDef *options;
 /* FFprobe context */
 static const char *input_filename;
 static const char *print_input_filename;
-static AVInputFormat *iformat = NULL;
+static const AVInputFormat *iformat = NULL;
 
 static struct AVHashContext *hash;
 
diff --git a/libavdevice/internal.h b/libavdevice/internal.h
index e222cf204d..ce060c0f5d 100644
--- a/libavdevice/internal.h
+++ b/libavdevice/internal.h
@@ -22,7 +22,7 @@
 #include "libavformat/avformat.h"
 
 av_warn_unused_result
-int ff_alloc_input_device_context(struct AVFormatContext **avctx, struct 
AVInputFormat *iformat,
+int ff_alloc_input_device_context(struct AVFormatContext **avctx, const struct 
AVInputFormat *iformat,
   const char *format);
 
 #endif
diff --git a/libavdevice/utils.c b/libavdevice/utils.c
index ccd7318012..d9a52c53ab 100644
--- a/libavdevice/utils.c
+++ b/libavdevice/utils.c
@@ -20,7 +20,7 @@
 #include "libavutil/opt.h"
 #include "libavformat/avformat.h"
 
-int ff_alloc_input_device_context(AVFormatContext **avctx, AVInputFormat 
*iformat, const char *format)
+int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat 
*iformat, const char *format)
 {
 AVFormatContext *s;
 int ret = 0;
diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c
index 34051ee61d..2bc06257c6 100644
--- a/libavfilter/lavfutils.c
+++ b/libavfilter/lavfutils.c
@@ -26,7 +26,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
   int *w, int *h, enum AVPixelFormat *pix_fmt,
   const char *filename, void *log_ctx)
 {
-AVInputFormat *iformat = NULL;
+const AVInputFormat *iformat = NULL;
 AVFormatContext *format_ctx = NULL;
 const AVCodec *codec;
 AVCodecContext *codec_ctx = NULL;
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 5892500410..e449e7e0c2 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -205,7 +205,7 @@ static int guess_channel_layout(MovieStream *st, int 
st_index, void *log_ctx)
 static av_cold int movie_common_init(AVFilterContext *ctx)
 {
 MovieContext *movie = ctx->priv;
-AVInputFormat *iformat = NULL;
+const AVInputFormat *iformat = NULL;
 int64_t timestamp;
 int nb_streams = 1, ret, i;
 char default_streams[16], *stream_specs, *spec, *cursor;
-- 
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".

[FFmpeg-devel] [PATCH 15/17] fate: update refs for AVCPBProperties fields change after bump

2021-04-05 Thread Anton Khirnov
---
 tests/ref/fate/mxf-d10-user-comments | 2 +-
 tests/ref/fate/ts-demux  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ref/fate/mxf-d10-user-comments 
b/tests/ref/fate/mxf-d10-user-comments
index 13761fb0ce..609271ac05 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -6,7 +6,7 @@
 #codec_id 0: mpeg2video
 #dimensions 0: 1280x720
 #sar 0: 3/4
-0, -1,  0,1,   15, 0x0547870d, S=1,   24, 
0x5aa90ad0
+0, -1,  0,1,   15, 0x0547870d, S=1,   40, 
0x7ea50ad0
 0,  0,  1,1,   15, 0xe80a1612, F=0x0
 0,  1,  2,1,   15, 0xc5c50e2f, F=0x0
 0,  2,  3,1,   15, 0x51e28a04, F=0x0
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index cdf34d6af0..c20364483b 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -15,7 +15,7 @@
 1,   5760,   5760, 2880, 1536, 0xbab5129c
 1,   8640,   8640, 2880, 1536, 0x602f034b, S=1,1, 
0x00bd00bd
 1,  11520,  11520, 2880,  906, 0x69cdcbcd
-0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
0x00e000e0,   24, 0x663d0b52
+0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
0x00e000e0,   40, 0x91e10b52
 0,  33538,  33538, 1501,12560, 0xb559a3d4, F=0x0, S=1,
1, 0x00e000e0
 0,  35040,  35040, 1501,12704, 0x2614adf4, F=0x0, S=1,
1, 0x00e000e0
 0,  36541,  41046, 1501,51976, 0x9ff1dbfe, F=0x0, S=1,
1, 0x00e000e0
-- 
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".

[FFmpeg-devel] [PATCH 13/17] lavu/pixdesc: drop initializers for fields removed with FF_API_PLUS1_MINUS1

2021-04-05 Thread Anton Khirnov
---
 libavutil/pixdesc.c | 1050 +--
 1 file changed, 525 insertions(+), 525 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 18c7a0efc8..60dd341c3a 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -177,9 +177,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 1,
 .log2_chroma_h = 1,
 .comp = {
-{ 0, 1, 0, 0, 8, 0, 7, 1 },/* Y */
-{ 1, 1, 0, 0, 8, 0, 7, 1 },/* U */
-{ 2, 1, 0, 0, 8, 0, 7, 1 },/* V */
+{ 0, 1, 0, 0, 8 },/* Y */
+{ 1, 1, 0, 0, 8 },/* U */
+{ 2, 1, 0, 0, 8 },/* V */
 },
 .flags = AV_PIX_FMT_FLAG_PLANAR,
 },
@@ -189,9 +189,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 1,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 2, 0, 0, 8, 1, 7, 1 },/* Y */
-{ 0, 4, 1, 0, 8, 3, 7, 2 },/* U */
-{ 0, 4, 3, 0, 8, 3, 7, 4 },/* V */
+{ 0, 2, 0, 0, 8 },/* Y */
+{ 0, 4, 1, 0, 8 },/* U */
+{ 0, 4, 3, 0, 8 },/* V */
 },
 },
 [AV_PIX_FMT_YVYU422] = {
@@ -200,9 +200,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 1,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 2, 0, 0, 8, 1, 7, 1 },/* Y */
-{ 0, 4, 3, 0, 8, 3, 7, 4 },/* U */
-{ 0, 4, 1, 0, 8, 3, 7, 2 },/* V */
+{ 0, 2, 0, 0, 8 },/* Y */
+{ 0, 4, 3, 0, 8 },/* U */
+{ 0, 4, 1, 0, 8 },/* V */
 },
 },
 [AV_PIX_FMT_Y210LE] = {
@@ -211,9 +211,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 1,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */
-{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */
-{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */
+{ 0, 4, 0, 6, 10 },/* Y */
+{ 0, 8, 2, 6, 10 },/* U */
+{ 0, 8, 6, 6, 10 },/* V */
 },
 },
 [AV_PIX_FMT_Y210BE] = {
@@ -222,9 +222,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 1,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */
-{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */
-{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */
+{ 0, 4, 0, 6, 10 },/* Y */
+{ 0, 8, 2, 6, 10 },/* U */
+{ 0, 8, 6, 6, 10 },/* V */
 },
 .flags = AV_PIX_FMT_FLAG_BE,
 },
@@ -234,9 +234,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 0,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 3, 0, 0, 8, 2, 7, 1 },/* R */
-{ 0, 3, 1, 0, 8, 2, 7, 2 },/* G */
-{ 0, 3, 2, 0, 8, 2, 7, 3 },/* B */
+{ 0, 3, 0, 0, 8 },/* R */
+{ 0, 3, 1, 0, 8 },/* G */
+{ 0, 3, 2, 0, 8 },/* B */
 },
 .flags = AV_PIX_FMT_FLAG_RGB,
 },
@@ -246,9 +246,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w = 0,
 .log2_chroma_h = 0,
 .comp = {
-{ 0, 3, 2, 0, 8, 2, 7, 3 },/* R */
-{ 0, 3, 1, 0, 8, 2, 7, 2 },/* G */
-{ 0, 3, 0, 0, 8, 2, 7, 1 },/* B */
+{ 0, 3, 2, 0, 8 },/* R */
+{ 0, 3, 1, 0, 8 },/* G */
+{ 0, 3, 0, 0, 8 },/* B */
 },
 .flags = AV_PIX_FMT_FLAG_RGB,
 },
@@ -258,9 +258,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w= 0,
 .log2_chroma_h= 0,
 .comp = {
-{ 0, 4, 2, 4, 10, 3, 9, 2 },   /* R */
-{ 0, 4, 1, 2, 10, 3, 9, 3 },   /* G */
-{ 0, 4, 0, 0, 10, 3, 9, 4 },   /* B */
+{ 0, 4, 2, 4, 10 },   /* R */
+{ 0, 4, 1, 2, 10 },   /* G */
+{ 0, 4, 0, 0, 10 },   /* B */
 },
 .flags = AV_PIX_FMT_FLAG_RGB,
 },
@@ -270,9 +270,9 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .log2_chroma_w= 0,
 .log2_chroma_h= 0,
 .comp = {
-{ 0, 4, 0, 4, 10, 3, 9, 2 },   /* R */
-{ 0, 4, 1, 2, 10, 3, 9, 3 },   /* G */
-{ 0, 4, 2, 0, 10, 3, 9, 4 },   /* B */
+{ 0, 4, 0, 4, 10 },   /* R */
+{ 0, 4, 1, 2, 10 },  

[FFmpeg-devel] [PATCH 05/17] lavc: postpone FF_API_AVCTX_TIMEBASE

2021-04-05 Thread Anton Khirnov
There are still several decoders setting it and the situation is
non-trivial to resolve.
---
 libavcodec/version.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1444c19552..83ebba22d9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -51,9 +51,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#ifndef FF_API_AVCTX_TIMEBASE
-#define FF_API_AVCTX_TIMEBASE(LIBAVCODEC_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_CODED_FRAME
 #define FF_API_CODED_FRAME   (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
@@ -168,5 +165,8 @@
 #ifndef FF_API_INIT_PACKET
 #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_AVCTX_TIMEBASE
+#define FF_API_AVCTX_TIMEBASE(LIBAVCODEC_VERSION_MAJOR < 60)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
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".

[FFmpeg-devel] [PATCH 06/17] Disable vf_uspp/mcdeint.

2021-04-05 Thread Anton Khirnov
These filters depend on avcodec APIs that are to be removed. Some people
have expressed potential interest in updating these filters, so they are
merely disabled for now instead of being removed.
---
 configure | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/configure b/configure
index d7a3f507e8..cd8fcc1eda 100755
--- a/configure
+++ b/configure
@@ -7094,6 +7094,12 @@ esac
 
 enable frame_thread_encoder
 
+# these filters depend on removed avcodec APIs
+# they are kept disabled for now, but will be removed if
+# nobody updates and re-enables them
+disable mcdeint_filter
+disable uspp_filter
+
 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
 
 check_deps $CONFIG_LIST   \
-- 
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".

[FFmpeg-devel] [PATCH 12/17] fate-imgutils: update the test for FF_API_PSEUDOPAL removal

2021-04-05 Thread Anton Khirnov
---
 tests/ref/fate/imgutils | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index c968ea0e85..f510150ea1 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -62,7 +62,7 @@ yuv422p planes: 3, linesizes:  64  32  32   0, 
plane_sizes:  3072  1536
 yuv444p planes: 3, linesizes:  64  64  64   0, plane_sizes:  3072  
3072  3072 0, plane_offsets:  3072  3072 0, total_size: 9216
 yuv410p planes: 3, linesizes:  64  16  16   0, plane_sizes:  3072   
192   192 0, plane_offsets:  3072   192 0, total_size: 3456
 yuv411p planes: 3, linesizes:  64  16  16   0, plane_sizes:  3072   
768   768 0, plane_offsets:  3072   768 0, total_size: 4608
-grayplanes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
+grayplanes: 1, linesizes:  64   0   0   0, plane_sizes:  3072 
0 0 0, plane_offsets: 0 0 0, total_size: 3072
 monow   planes: 1, linesizes:   8   0   0   0, plane_sizes:   384 
0 0 0, plane_offsets: 0 0 0, total_size: 384
 monob   planes: 1, linesizes:   8   0   0   0, plane_sizes:   384 
0 0 0, plane_offsets: 0 0 0, total_size: 384
 pal8planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
@@ -71,12 +71,12 @@ yuvj422pplanes: 3, linesizes:  64  32  32   0, 
plane_sizes:  3072  1536
 yuvj444pplanes: 3, linesizes:  64  64  64   0, plane_sizes:  3072  
3072  3072 0, plane_offsets:  3072  3072 0, total_size: 9216
 uyvy422 planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144 
0 0 0, plane_offsets: 0 0 0, total_size: 6144
 uyyvyy411   planes: 1, linesizes:  96   0   0   0, plane_sizes:  4608 
0 0 0, plane_offsets: 0 0 0, total_size: 4608
-bgr8planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
+bgr8planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072 
0 0 0, plane_offsets: 0 0 0, total_size: 3072
 bgr4planes: 1, linesizes:  32   0   0   0, plane_sizes:  1536 
0 0 0, plane_offsets: 0 0 0, total_size: 1536
-bgr4_byte   planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
-rgb8planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
+bgr4_byte   planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072 
0 0 0, plane_offsets: 0 0 0, total_size: 3072
+rgb8planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072 
0 0 0, plane_offsets: 0 0 0, total_size: 3072
 rgb4planes: 1, linesizes:  32   0   0   0, plane_sizes:  1536 
0 0 0, plane_offsets: 0 0 0, total_size: 1536
-rgb4_byte   planes: 2, linesizes:  64   0   0   0, plane_sizes:  3072  
1024 0 0, plane_offsets:  3072 0 0, total_size: 4096
+rgb4_byte   planes: 1, linesizes:  64   0   0   0, plane_sizes:  3072 
0 0 0, plane_offsets: 0 0 0, total_size: 3072
 nv12planes: 2, linesizes:  64  64   0   0, plane_sizes:  3072  
1536 0 0, plane_offsets:  3072 0 0, total_size: 4608
 nv21planes: 2, linesizes:  64  64   0   0, plane_sizes:  3072  
1536 0 0, plane_offsets:  3072 0 0, total_size: 4608
 argbplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
-- 
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".

[FFmpeg-devel] [PATCH 09/17] lavf: do not derive timebase from avg_frame_rate

2021-04-05 Thread Anton Khirnov
avg_frame_rate is the _average_ framerate, its presence does not
guarantee that the stream is CFR, so it should not be used for setting
the timebase.
---
 libavformat/utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 13b1bc7c78..e82954e0e1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5865,9 +5865,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 enc_ctx->time_base = dec_ctx->time_base;
 }
 
-if (ost->avg_frame_rate.num)
-enc_ctx->time_base = av_inv_q(ost->avg_frame_rate);
-
 av_reduce(&enc_ctx->time_base.num, &enc_ctx->time_base.den,
   enc_ctx->time_base.num, enc_ctx->time_base.den, INT_MAX);
 
-- 
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".

[FFmpeg-devel] [PATCH 11/17] Bump major versions of all libraries.

2021-04-05 Thread Anton Khirnov
---
 libavcodec/version.h| 4 ++--
 libavdevice/version.h   | 4 ++--
 libavfilter/version.h   | 4 ++--
 libavformat/version.h   | 4 ++--
 libavutil/version.h | 4 ++--
 libswresample/version.h | 4 ++--
 libswscale/version.h| 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 83ebba22d9..b083d2acf8 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,8 +27,8 @@
 
 #include "libavutil/version.h"
 
-#define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR 135
+#define LIBAVCODEC_VERSION_MAJOR  59
+#define LIBAVCODEC_VERSION_MINOR   0
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 9fea3252c1..6021a0dd65 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -27,8 +27,8 @@
 
 #include "libavutil/version.h"
 
-#define LIBAVDEVICE_VERSION_MAJOR  58
-#define LIBAVDEVICE_VERSION_MINOR  14
+#define LIBAVDEVICE_VERSION_MAJOR  59
+#define LIBAVDEVICE_VERSION_MINOR   0
 #define LIBAVDEVICE_VERSION_MICRO 100
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 18e1a95c72..97bd90e49a 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -29,8 +29,8 @@
 
 #include "libavutil/version.h"
 
-#define LIBAVFILTER_VERSION_MAJOR   7
-#define LIBAVFILTER_VERSION_MINOR 111
+#define LIBAVFILTER_VERSION_MAJOR   8
+#define LIBAVFILTER_VERSION_MINOR   0
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 7ec1ed5248..435025b966 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
-#define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  77
+#define LIBAVFORMAT_VERSION_MAJOR  59
+#define LIBAVFORMAT_VERSION_MINOR   0
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libavutil/version.h b/libavutil/version.h
index b97e4e5437..943cfe94fd 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -78,8 +78,8 @@
  * @{
  */
 
-#define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  72
+#define LIBAVUTIL_VERSION_MAJOR  57
+#define LIBAVUTIL_VERSION_MINOR   0
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libswresample/version.h b/libswresample/version.h
index 35cf7f0c14..ed7ce529d2 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -28,8 +28,8 @@
 
 #include "libavutil/avutil.h"
 
-#define LIBSWRESAMPLE_VERSION_MAJOR   3
-#define LIBSWRESAMPLE_VERSION_MINOR  10
+#define LIBSWRESAMPLE_VERSION_MAJOR   4
+#define LIBSWRESAMPLE_VERSION_MINOR   0
 #define LIBSWRESAMPLE_VERSION_MICRO 100
 
 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, 
\
diff --git a/libswscale/version.h b/libswscale/version.h
index 7a616a42e0..0b3dd10ef2 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -26,8 +26,8 @@
 
 #include "libavutil/version.h"
 
-#define LIBSWSCALE_VERSION_MAJOR   5
-#define LIBSWSCALE_VERSION_MINOR  10
+#define LIBSWSCALE_VERSION_MAJOR   6
+#define LIBSWSCALE_VERSION_MINOR   0
 #define LIBSWSCALE_VERSION_MICRO 100
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
-- 
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".

[FFmpeg-devel] [PATCH 07/17] lavf/movenc: use framerate correctly in mov_write_tmcd_tag

2021-04-05 Thread Anton Khirnov
Current code uses its inverse.
---
 libavformat/movenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c00e38e72f..0b620a802d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2353,8 +2353,8 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack 
*track)
 return AVERROR(EINVAL);
 #endif
 } else {
-frame_duration = av_rescale(track->timescale, 
track->st->avg_frame_rate.num, track->st->avg_frame_rate.den);
-nb_frames  = ROUNDED_DIV(track->st->avg_frame_rate.den, 
track->st->avg_frame_rate.num);
+frame_duration = av_rescale(track->timescale, 
track->st->avg_frame_rate.den, track->st->avg_frame_rate.num);
+nb_frames  = ROUNDED_DIV(track->st->avg_frame_rate.num, 
track->st->avg_frame_rate.den);
 }
 
 if (nb_frames > 255) {
@@ -6234,7 +6234,7 @@ static int mov_create_timecode_track(AVFormatContext *s, 
int index, int src_inde
 return AVERROR(ENOMEM);
 track->par->codec_type = AVMEDIA_TYPE_DATA;
 track->par->codec_tag  = track->tag;
-track->st->avg_frame_rate = av_inv_q(rate);
+track->st->avg_frame_rate = rate;
 
 /* the tmcd track just contains one packet with the frame number */
 pkt->data = data;
-- 
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".

[FFmpeg-devel] [PATCH 10/17] fftools/ffmpeg: copy average framerate for streamcopy, when known

2021-04-05 Thread Anton Khirnov
---
 fftools/ffmpeg.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 8e6206647f..3ad11452da 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3144,7 +3144,11 @@ static int init_output_stream_streamcopy(OutputStream 
*ost)
 
 if (!ost->frame_rate.num)
 ost->frame_rate = ist->framerate;
-ost->st->avg_frame_rate = ost->frame_rate;
+
+if (ost->frame_rate.num)
+ost->st->avg_frame_rate = ost->frame_rate;
+else
+ost->st->avg_frame_rate = ist->st->avg_frame_rate;
 
 ret = avformat_transfer_internal_stream_timing_info(of->ctx->oformat, 
ost->st, ist->st, copy_tb);
 if (ret < 0)
-- 
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".

[FFmpeg-devel] [PATCH 08/17] fftools/ffmpeg: when framerate is set, prefer its inverse as output timebase

2021-04-05 Thread Anton Khirnov
Codec timebase is not well-defined for streamcopy, so it should only be
used as the last resort.
---
 fftools/ffmpeg.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 46bb014de8..8e6206647f 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3151,8 +3151,12 @@ static int init_output_stream_streamcopy(OutputStream 
*ost)
 return ret;
 
 // copy timebase while removing common factors
-if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
-ost->st->time_base = av_add_q(av_stream_get_codec_timebase(ost->st), 
(AVRational){0, 1});
+if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0) {
+if (ost->frame_rate.num)
+ost->st->time_base = av_inv_q(ost->frame_rate);
+else
+ost->st->time_base = 
av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
+}
 
 // copy estimated duration as a hint to the muxer
 if (ost->st->duration <= 0 && ist->st->duration > 0)
-- 
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] Major bump

2021-04-05 Thread Lynne
Apr 5, 2021, 13:09 by an...@khirnov.net:

> Hi,
> this patchset bumps major version of all the libraries and removes many
> deprecated APIs, as discussed at length during past months. Patches
> 11-16 will be squashed together on push, but are sent separately for
> ease of review. FATE passes (here at least).
>

Is lavr removal done automatically or with another patch?

Hoping you don't rush through with pushing this, It'll take me some time
and back and forth with haasn to improve Vulkan.
___
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] Major bump

2021-04-05 Thread James Almer

On 4/5/2021 8:09 AM, Anton Khirnov wrote:

Hi,
this patchset bumps major version of all the libraries and removes many
deprecated APIs, as discussed at length during past months. Patches
11-16 will be squashed together on push, but are sent separately for
ease of review. FATE passes (here at least).

As agreed during the last developer call, I am disabling the
uspp/mcdeint filters that depend on removed libavcodec APIs. They should
be easy to re-enable if anyone finds the motivation to update them.

I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
with usage of AVCodecContext.time_base for decoding, since removing them
without breakage requires a fair bit of additional infrastructure that
is not yet there. I have plans for all these and hopefully I'll get to
it before the next bump.

Carl asked during the last meeting for some reasoning for the bump. The
general reasons are that
- old APIs are unable to provide all the features of the new ones
   (that's usually why new APIs are added)
- old APIs tend to be harder to use correctly, they often have obscure
   quirks or corner cases
- maintaining compatibility wrappers for them is a major obstacle to
   further development
I'm appending some notes for the specific changes further down, they
could be added to the wiki or the website news entry.

Please comment,


The deprecated APIs should be removed one by one before the commit that 
bumps the versions, so any potential issues or regressions can be 
bisected to the culprit instead of the "Bump and disable everything" 
commit. The latter was done last bump and it was a bit hectic.
This means that the changes from 12 to 16 should be in the respective 
API removal commit to not break FATE, of course.


Andreas also found out that some crypto modules that are being switch 
from int to size_t apparently need more changes than just the switch 
flip. See 
https://github.com/mkver/FFmpeg/commit/1d830b0495399bb59a296d7bb3e2b2ab88a32fc1

___
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 01/17] lavu: postpone child_class_next API removal

2021-04-05 Thread Marton Balint



On Mon, 5 Apr 2021, Anton Khirnov wrote:


It has only been deprecated a year ago.


Considering that this API has limited public usage, I don't think we have 
to be strict about the 2 years here, so IMHO it is fine to remove it 
at the bump.


Regards,
Marton


---
libavutil/version.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/version.h b/libavutil/version.h
index e88e1ad08d..b97e4e5437 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -129,12 +129,12 @@
#ifndef FF_API_PSEUDOPAL
#define FF_API_PSEUDOPAL(LIBAVUTIL_VERSION_MAJOR < 57)
#endif
-#ifndef FF_API_CHILD_CLASS_NEXT
-#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
#ifndef FF_API_BUFFER_SIZE_T
#define FF_API_BUFFER_SIZE_T(LIBAVUTIL_VERSION_MAJOR < 57)
#endif
+#ifndef FF_API_CHILD_CLASS_NEXT
+#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 58)
+#endif
#ifndef FF_API_D2STR
#define FF_API_D2STR(LIBAVUTIL_VERSION_MAJOR < 58)
#endif
--
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".

___
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] Major bump

2021-04-05 Thread Andreas Rheinhardt
Anton Khirnov:
> Hi,
> this patchset bumps major version of all the libraries and removes many
> deprecated APIs, as discussed at length during past months. Patches
> 11-16 will be squashed together on push, but are sent separately for
> ease of review. FATE passes (here at least).
> 
> As agreed during the last developer call, I am disabling the
> uspp/mcdeint filters that depend on removed libavcodec APIs. They should
> be easy to re-enable if anyone finds the motivation to update them.
> 
> I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
> with usage of AVCodecContext.time_base for decoding, since removing them
> without breakage requires a fair bit of additional infrastructure that
> is not yet there. I have plans for all these and hopefully I'll get to
> it before the next bump.
> 
> Carl asked during the last meeting for some reasoning for the bump. The
> general reasons are that
> - old APIs are unable to provide all the features of the new ones
>   (that's usually why new APIs are added)
> - old APIs tend to be harder to use correctly, they often have obscure
>   quirks or corner cases
> - maintaining compatibility wrappers for them is a major obstacle to
>   further development
> I'm appending some notes for the specific changes further down, they
> could be added to the wiki or the website news entry.
> 
> Please comment,
> 
Seems like we have duplicated work here; my branch for major bump
preparations is here: https://github.com/mkver/FFmpeg/commits/bump (it
is not based upon current master, but a month or so old). It contains
quite a lot of things that are missing here, like lots of
constifications (i.e. AVFormatContext.(audio|video|subtitle)_codec;
avcodec_find_(de|en)coder and the corresponding *_by_name functions
return const AVCodec*; av_find_best_stream() has been made
const-correct; avdevice_list_(input_sources|output_sinks); the
avdevice_next API (the last next API in existence -- does someone know
why?).

Your list contains errors, besides the first entry being duplicated:

> * AV_CODEC_CAP_INTRA_ONLY and AV_CODEC_CAP_INTRA_ONLY removed, use 
> corresponding
>   AVCodecDescriptor.props values instead
...
> * avcodec_find_best_pix_fmt_of_2 replaced by avcodec_find_best_pix_fmt_of_2

- Andreas
___
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 14/17] Update types after the FF_API_BUFFER_SIZE_T change.

2021-04-05 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
>  fftools/ffprobe.c  | 2 +-
>  libavcodec/decode.c| 2 +-
>  libavcodec/mpeg12enc.c | 2 +-
>  libavcodec/mscc.c  | 2 +-
>  libavfilter/af_ashowinfo.c | 2 +-
>  libavfilter/vf_showinfo.c  | 6 +++---
>  libavformat/dump.c | 2 +-
>  libavformat/framecrcenc.c  | 2 +-
>  libavformat/hashenc.c  | 2 +-
>  9 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 38462e1ff3..c136562afe 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2165,7 +2165,7 @@ static void show_packet(WriterContext *w, InputFile 
> *ifile, AVPacket *pkt, int p
>pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
>  
>  if (pkt->side_data_elems) {
> -int size;
> +size_t size;
>  const uint8_t *side_metadata;
>  
>  side_metadata = av_packet_get_side_data(pkt, 
> AV_PKT_DATA_STRINGS_METADATA, &size);
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 0956a6ac6f..49b21ff43b 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -2101,7 +2101,7 @@ int ff_copy_palette(void *dst, const AVPacket *src, 
> void *logctx)
>  memcpy(dst, pal, AVPALETTE_SIZE);
>  return 1;
>  } else if (pal) {
> -av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
> +av_log(logctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
>  }
>  return 0;
>  }
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index 5676caef87..7d51278749 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -574,7 +574,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, 
> int picture_number)
>  put_bits(&s->pb, 8, 0xff);  // marker_bits
>  } else {
>  av_log(s->avctx, AV_LOG_WARNING,
> -"Warning Closed Caption size (%d) can not exceed 93 
> bytes "
> +"Warning Closed Caption size (%zu) can not exceed 93 
> bytes "
>  "and must be a multiple of 3\n", side_data->size);
>  }
>  }
> diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
> index fe02649623..d392363fa9 100644
> --- a/libavcodec/mscc.c
> +++ b/libavcodec/mscc.c
> @@ -160,7 +160,7 @@ static int decode_frame(AVCodecContext *avctx,
>  for (j = 0; j < 256; j++)
>  s->pal[j] = 0xFF00 | AV_RL32(pal + j * 4);
>  } else if (pal) {
> -av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
> +av_log(avctx, AV_LOG_ERROR, "Palette size %zu is wrong\n", size);
>  }
>  memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
>  }
> diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
> index 9046e8d84a..1ac4c432ed 100644
> --- a/libavfilter/af_ashowinfo.c
> +++ b/libavfilter/af_ashowinfo.c
> @@ -170,7 +170,7 @@ static void dump_audio_service_type(AVFilterContext *ctx, 
> AVFrameSideData *sd)
>  
>  static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
>  {
> -av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", 
> sd->type, sd->size);
> +av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %zu bytes", 
> sd->type, sd->size);
>  }
>  
>  static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 6208892005..69d1076079 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -314,7 +314,7 @@ static void 
> dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi
>  int i;
>  
>  if (sd->size < uuid_size) {
> -av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", 
> sd->size, uuid_size);
> +av_log(ctx, AV_LOG_ERROR, "invalid data(%zu < UUID(%d-bytes))\n", 
> sd->size, uuid_size);
>  return;
>  }
>  
> @@ -472,7 +472,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  av_log(ctx, AV_LOG_INFO, "pan/scan");
>  break;
>  case AV_FRAME_DATA_A53_CC:
> -av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", 
> sd->size);
> +av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%zu bytes)", 
> sd->size);
>  break;
>  case AV_FRAME_DATA_SPHERICAL:
>  dump_spherical(ctx, frame, sd);
> @@ -516,7 +516,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  dump_sei_unregistered_metadata(ctx, sd);
>  break;
>  default:
> -av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> bytes)\n",
> +av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%zu 
> bytes)\n",
> sd->type, sd->size);
>  break;
>  }
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 62ef5e9852..b89b3c63f3 100644
> --- a/l

Re: [FFmpeg-devel] [PATCH 15/17] fate: update refs for AVCPBProperties fields change after bump

2021-04-05 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
>  tests/ref/fate/mxf-d10-user-comments | 2 +-
>  tests/ref/fate/ts-demux  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/ref/fate/mxf-d10-user-comments 
> b/tests/ref/fate/mxf-d10-user-comments
> index 13761fb0ce..609271ac05 100644
> --- a/tests/ref/fate/mxf-d10-user-comments
> +++ b/tests/ref/fate/mxf-d10-user-comments
> @@ -6,7 +6,7 @@
>  #codec_id 0: mpeg2video
>  #dimensions 0: 1280x720
>  #sar 0: 3/4
> -0, -1,  0,1,   15, 0x0547870d, S=1,   24, 
> 0x5aa90ad0
> +0, -1,  0,1,   15, 0x0547870d, S=1,   40, 
> 0x7ea50ad0
>  0,  0,  1,1,   15, 0xe80a1612, F=0x0
>  0,  1,  2,1,   15, 0xc5c50e2f, F=0x0
>  0,  2,  3,1,   15, 0x51e28a04, F=0x0
> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> index cdf34d6af0..c20364483b 100644
> --- a/tests/ref/fate/ts-demux
> +++ b/tests/ref/fate/ts-demux
> @@ -15,7 +15,7 @@
>  1,   5760,   5760, 2880, 1536, 0xbab5129c
>  1,   8640,   8640, 2880, 1536, 0x602f034b, S=1,1, 
> 0x00bd00bd
>  1,  11520,  11520, 2880,  906, 0x69cdcbcd
> -0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
> 0x00e000e0,   24, 0x663d0b52
> +0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
> 0x00e000e0,   40, 0x91e10b52
>  0,  33538,  33538, 1501,12560, 0xb559a3d4, F=0x0, S=1,   
>  1, 0x00e000e0
>  0,  35040,  35040, 1501,12704, 0x2614adf4, F=0x0, S=1,   
>  1, 0x00e000e0
>  0,  36541,  41046, 1501,51976, 0x9ff1dbfe, F=0x0, S=1,   
>  1, 0x00e000e0
> 
There is a problem here: The alignment of int64_t, uint64_t is only four
for 32bit x86 (and probably other arches); as a consequence,
sizeof(AVCPBProperties) == 36 (not 40) and the checksums are different.
One way to fix this would be to switch the size field to 64bits; a more
hacky way would be to add a dummy element.

- Andreas
___
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] Major bump

2021-04-05 Thread James Almer

On 4/5/2021 12:01 PM, Andreas Rheinhardt wrote:

Anton Khirnov:

Hi,
this patchset bumps major version of all the libraries and removes many
deprecated APIs, as discussed at length during past months. Patches
11-16 will be squashed together on push, but are sent separately for
ease of review. FATE passes (here at least).

As agreed during the last developer call, I am disabling the
uspp/mcdeint filters that depend on removed libavcodec APIs. They should
be easy to re-enable if anyone finds the motivation to update them.

I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
with usage of AVCodecContext.time_base for decoding, since removing them
without breakage requires a fair bit of additional infrastructure that
is not yet there. I have plans for all these and hopefully I'll get to
it before the next bump.

Carl asked during the last meeting for some reasoning for the bump. The
general reasons are that
- old APIs are unable to provide all the features of the new ones
   (that's usually why new APIs are added)
- old APIs tend to be harder to use correctly, they often have obscure
   quirks or corner cases
- maintaining compatibility wrappers for them is a major obstacle to
   further development
I'm appending some notes for the specific changes further down, they
could be added to the wiki or the website news entry.

Please comment,


Seems like we have duplicated work here; my branch for major bump
preparations is here: https://github.com/mkver/FFmpeg/commits/bump (it
is not based upon current master, but a month or so old). It contains
quite a lot of things that are missing here, like lots of
constifications (i.e. AVFormatContext.(audio|video|subtitle)_codec;
avcodec_find_(de|en)coder and the corresponding *_by_name functions
return const AVCodec*; av_find_best_stream() has been made
const-correct; avdevice_list_(input_sources|output_sinks); the
avdevice_next API (the last next API in existence -- does someone know
why?).


I sent a patch adding an iterate API and it was suggested it should not 
be not applied. Lavd is supposed to be either merged into lavf, or 
rewritten to stop depending on lavf, so better not add API that would 
ultimately be deprecated and removed.




Your list contains errors, besides the first entry being duplicated:


* AV_CODEC_CAP_INTRA_ONLY and AV_CODEC_CAP_INTRA_ONLY removed, use corresponding
   AVCodecDescriptor.props values instead

...

* avcodec_find_best_pix_fmt_of_2 replaced by avcodec_find_best_pix_fmt_of_2


- Andreas
___
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] Major bump

2021-04-05 Thread Nicolas George
James Almer (12021-04-05):
>  Lavd is supposed to be either merged into lavf, or rewritten to
> stop depending on lavf

The second one is out of question in the short term, it has already been
discussed.

Regards,

-- 
  Nicolas George


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 15/17] fate: update refs for AVCPBProperties fields change after bump

2021-04-05 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2021-04-05 17:34:42)
> Anton Khirnov:
> > ---
> >  tests/ref/fate/mxf-d10-user-comments | 2 +-
> >  tests/ref/fate/ts-demux  | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/ref/fate/mxf-d10-user-comments 
> > b/tests/ref/fate/mxf-d10-user-comments
> > index 13761fb0ce..609271ac05 100644
> > --- a/tests/ref/fate/mxf-d10-user-comments
> > +++ b/tests/ref/fate/mxf-d10-user-comments
> > @@ -6,7 +6,7 @@
> >  #codec_id 0: mpeg2video
> >  #dimensions 0: 1280x720
> >  #sar 0: 3/4
> > -0, -1,  0,1,   15, 0x0547870d, S=1,   24, 
> > 0x5aa90ad0
> > +0, -1,  0,1,   15, 0x0547870d, S=1,   40, 
> > 0x7ea50ad0
> >  0,  0,  1,1,   15, 0xe80a1612, F=0x0
> >  0,  1,  2,1,   15, 0xc5c50e2f, F=0x0
> >  0,  2,  3,1,   15, 0x51e28a04, F=0x0
> > diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> > index cdf34d6af0..c20364483b 100644
> > --- a/tests/ref/fate/ts-demux
> > +++ b/tests/ref/fate/ts-demux
> > @@ -15,7 +15,7 @@
> >  1,   5760,   5760, 2880, 1536, 0xbab5129c
> >  1,   8640,   8640, 2880, 1536, 0x602f034b, S=1,1, 
> > 0x00bd00bd
> >  1,  11520,  11520, 2880,  906, 0x69cdcbcd
> > -0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
> > 0x00e000e0,   24, 0x663d0b52
> > +0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
> > 0x00e000e0,   40, 0x91e10b52
> >  0,  33538,  33538, 1501,12560, 0xb559a3d4, F=0x0, S=1, 
> >1, 0x00e000e0
> >  0,  35040,  35040, 1501,12704, 0x2614adf4, F=0x0, S=1, 
> >1, 0x00e000e0
> >  0,  36541,  41046, 1501,51976, 0x9ff1dbfe, F=0x0, S=1, 
> >1, 0x00e000e0
> > 
> There is a problem here: The alignment of int64_t, uint64_t is only four
> for 32bit x86 (and probably other arches); as a consequence,
> sizeof(AVCPBProperties) == 36 (not 40) and the checksums are different.
> One way to fix this would be to switch the size field to 64bits; a more
> hacky way would be to add a dummy element.

I said this before - IMO we should just stop doing side data checksums
here. They make no sense - side data is simply not guaranteed to have
the same in-memory representation everywhere.

Bending public API to work around broken tests is really not the way to go.

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

Re: [FFmpeg-devel] [PATCH] avformat/mov: check offset for overflow in mov_probe()

2021-04-05 Thread Michael Niedermayer
On Sun, Apr 04, 2021 at 07:18:22PM -0300, James Almer wrote:
> On 4/4/2021 6:44 PM, Michael Niedermayer wrote:
> > Fixes: Invalid read of size 4
> > Fixes: ASAN_Deadlysignal.zip
> > 
> > Found-by: Hardik Shah 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavformat/mov.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 7805330bf9..ef73f3199d 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -7161,6 +7161,8 @@ static int mov_probe(const AVProbeData *p)
> >   score  = FFMAX(score, AVPROBE_SCORE_EXTENSION);
> >   break;
> >   }
> > +if ((uint64_t)size + 8 > INT64_MAX - offset)
> > +break;
> >   offset += size;
> >   }
> >   if (score > AVPROBE_SCORE_MAX - 50 && moov_offset != -1) {
> 
> Would something like this also work?
> 
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 1974498d1e..cd9d9996b3 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -7119,7 +7119,7 @@ static int mov_probe(const AVProbeData *p)
> >  int64_t size;
> >  int minsize = 8;
> >  /* ignore invalid offset */
> > -if ((offset + 8) > (unsigned int)p->buf_size)
> > +if ((offset + 8ULL) > (unsigned int)p->buf_size)
> >  break;
> >  size = AV_RB32(p->buf + offset);
> >  if (size == 1 && offset + 16 <= (unsigned int)p->buf_size) {
> > @@ -7166,6 +7166,8 @@ static int mov_probe(const AVProbeData *p)
> >  score  = FFMAX(score, AVPROBE_SCORE_EXTENSION);
> >  break;
> >  }
> > +if (size > INT64_MAX - offset)
> > +break;
> >  offset += size;
> >  }
> >  if (score > AVPROBE_SCORE_MAX - 50 && moov_offset != -1) {
> 
> I think it conveys what it's trying to do more clearly than your version,
> where the + 8 on top of size is not immediately clear where it comes from.

yes that works, i will apply this

thx

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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] avutil/video_enc_params: schedule the size overflow check for removal

2021-04-05 Thread James Almer

On 4/4/2021 3:13 PM, James Almer wrote:

av_buffer_create() will start taking a size argument of size_t type.

Signed-off-by: James Almer 
---
  libavutil/video_enc_params.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c
index 635176ab91..e6a8e38d94 100644
--- a/libavutil/video_enc_params.c
+++ b/libavutil/video_enc_params.c
@@ -63,10 +63,12 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum 
AVVideoEncParamsType t
  par = av_video_enc_params_alloc(type, nb_blocks, &size);
  if (!par)
  return NULL;
+#if FF_API_BUFFER_SIZE_T
  if (size > INT_MAX) {
  av_free(par);
  return NULL;
  }
+#endif
  buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
  if (!buf) {
  av_freep(&par);


Will apply.
___
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] lavd/avfoundation: Allow to change interleaving of samples on the fly

2021-04-05 Thread Thilo Borgmann
Hi,

seems like someone at Apple thought its a good idea to allow this inside the 
framework


-Thilo
From e44b0e0e338043660fe59f66b01cc24729cc241f Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Tue, 2 Mar 2021 23:23:06 +0100
Subject: [PATCH] lavd/avfoundation: Allow to change interleaving of samples on
 the fly

---
 libavdevice/avfoundation.m | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 59d5b0af4f..20d2a3b241 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -736,7 +736,6 @@ static int get_audio_config(AVFormatContext *s)
 return 1;
 }
 
-if (ctx->audio_non_interleaved) {
 CMBlockBufferRef block_buffer = 
CMSampleBufferGetDataBuffer(ctx->current_audio_frame);
 ctx->audio_buffer_size= 
CMBlockBufferGetDataLength(block_buffer);
 ctx->audio_buffer = av_malloc(ctx->audio_buffer_size);
@@ -744,7 +743,6 @@ static int get_audio_config(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "error allocating audio buffer\n");
 return 1;
 }
-}
 
 CFRelease(ctx->current_audio_frame);
 ctx->current_audio_frame = nil;
@@ -1103,12 +1101,24 @@ static int avf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 CMBlockBufferRef block_buffer = 
CMSampleBufferGetDataBuffer(ctx->current_audio_frame);
 int block_buffer_size = 
CMBlockBufferGetDataLength(block_buffer);
 
+CMFormatDescriptionRef format_desc  = 
CMSampleBufferGetFormatDescription(ctx->current_audio_frame);
+AudioStreamBasicDescription *basic_desc = 
CMAudioFormatDescriptionGetStreamBasicDescription(format_desc);
+
 if (!block_buffer || !block_buffer_size) {
 return AVERROR(EIO);
 }
 
-if (ctx->audio_non_interleaved && block_buffer_size > 
ctx->audio_buffer_size) {
-return AVERROR_BUFFER_TOO_SMALL;
+if (basic_desc) {
+ctx->audio_non_interleaved = basic_desc->mFormatFlags & 
kAudioFormatFlagIsNonInterleaved;
+}
+
+if (block_buffer_size > ctx->audio_buffer_size) {
+ctx->audio_buffer_size = block_buffer_size;
+ctx->audio_buffer  = av_realloc(ctx->audio_buffer, 
block_buffer_size);
+if (!ctx->audio_buffer) {
+av_log(s, AV_LOG_ERROR, "error allocating audio buffer\n");
+return 1;
+}
 }
 
 if (av_new_packet(pkt, block_buffer_size) < 0) {
-- 
2.20.1 (Apple Git-117)

___
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] lavd/avfoundation: Allow to change interleaving of samples on the fly

2021-04-05 Thread Andreas Rheinhardt
Thilo Borgmann:
> Hi,
> 
> seems like someone at Apple thought its a good idea to allow this inside the 
> framework
> 
> 
> 
> +if (block_buffer_size > ctx->audio_buffer_size) {
> +ctx->audio_buffer_size = block_buffer_size;
> +ctx->audio_buffer  = av_realloc(ctx->audio_buffer, 
> block_buffer_size);
> +if (!ctx->audio_buffer) {
> +av_log(s, AV_LOG_ERROR, "error allocating audio 
> buffer\n");
> +return 1;
> +}
>  }

Leak on error; furthermore setting the new size before it has been
successfully allocated is probably not good.
(Not commenting on the rest of the patch.)

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

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

[FFmpeg-devel] [PATCH] avformat/dashdec: Also fetch final partial segment

2021-04-05 Thread Matt Robinson
Currently, the DASH demuxer omits the final segment for a non-live
stream (using SegmentTemplate) if it is shorter than the other segments.

Correct calc_max_seg_no to round up when calulating the number of
segments instead of rounding down to resolve this issue.

Signed-off-by: Matt Robinson 
---
 libavformat/dashdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 6f3f28dcc7..73effd85db 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1445,7 +1445,7 @@ static int64_t calc_max_seg_no(struct representation 
*pls, DASHContext *c)
 } else if (c->is_live && pls->fragment_duration) {
 num = pls->first_seq_no + (((get_current_time_in_sec() - 
c->availability_start_time)) * pls->fragment_timescale)  / 
pls->fragment_duration;
 } else if (pls->fragment_duration) {
-num = pls->first_seq_no + (c->media_presentation_duration * 
pls->fragment_timescale) / pls->fragment_duration;
+num = pls->first_seq_no + av_rescale_rnd(1, 
c->media_presentation_duration * pls->fragment_timescale, 
pls->fragment_duration, AV_ROUND_UP);
 }
 
 return num;
-- 
2.25.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] Major bump

2021-04-05 Thread Anton Khirnov
Quoting James Almer (2021-04-05 13:57:12)
> On 4/5/2021 8:09 AM, Anton Khirnov wrote:
> > Hi,
> > this patchset bumps major version of all the libraries and removes many
> > deprecated APIs, as discussed at length during past months. Patches
> > 11-16 will be squashed together on push, but are sent separately for
> > ease of review. FATE passes (here at least).
> > 
> > As agreed during the last developer call, I am disabling the
> > uspp/mcdeint filters that depend on removed libavcodec APIs. They should
> > be easy to re-enable if anyone finds the motivation to update them.
> > 
> > I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
> > with usage of AVCodecContext.time_base for decoding, since removing them
> > without breakage requires a fair bit of additional infrastructure that
> > is not yet there. I have plans for all these and hopefully I'll get to
> > it before the next bump.
> > 
> > Carl asked during the last meeting for some reasoning for the bump. The
> > general reasons are that
> > - old APIs are unable to provide all the features of the new ones
> >(that's usually why new APIs are added)
> > - old APIs tend to be harder to use correctly, they often have obscure
> >quirks or corner cases
> > - maintaining compatibility wrappers for them is a major obstacle to
> >further development
> > I'm appending some notes for the specific changes further down, they
> > could be added to the wiki or the website news entry.
> > 
> > Please comment,
> 
> The deprecated APIs should be removed one by one before the commit that 
> bumps the versions, so any potential issues or regressions can be 
> bisected to the culprit instead of the "Bump and disable everything" 
> commit. The latter was done last bump and it was a bit hectic.

I like that option less because it means there are commits in master
that break ABI but don't change soname. And I never really saw
bump-related bisecting problems, it's usually clear what the culprit is.
But if others prefer to first remove and then bump then I won't fight
for it very hard.

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

Re: [FFmpeg-devel] Major bump

2021-04-05 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting James Almer (2021-04-05 13:57:12)
>> On 4/5/2021 8:09 AM, Anton Khirnov wrote:
>>> Hi,
>>> this patchset bumps major version of all the libraries and removes many
>>> deprecated APIs, as discussed at length during past months. Patches
>>> 11-16 will be squashed together on push, but are sent separately for
>>> ease of review. FATE passes (here at least).
>>>
>>> As agreed during the last developer call, I am disabling the
>>> uspp/mcdeint filters that depend on removed libavcodec APIs. They should
>>> be easy to re-enable if anyone finds the motivation to update them.
>>>
>>> I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
>>> with usage of AVCodecContext.time_base for decoding, since removing them
>>> without breakage requires a fair bit of additional infrastructure that
>>> is not yet there. I have plans for all these and hopefully I'll get to
>>> it before the next bump.
>>>
>>> Carl asked during the last meeting for some reasoning for the bump. The
>>> general reasons are that
>>> - old APIs are unable to provide all the features of the new ones
>>>(that's usually why new APIs are added)
>>> - old APIs tend to be harder to use correctly, they often have obscure
>>>quirks or corner cases
>>> - maintaining compatibility wrappers for them is a major obstacle to
>>>further development
>>> I'm appending some notes for the specific changes further down, they
>>> could be added to the wiki or the website news entry.
>>>
>>> Please comment,
>>
>> The deprecated APIs should be removed one by one before the commit that 
>> bumps the versions, so any potential issues or regressions can be 
>> bisected to the culprit instead of the "Bump and disable everything" 
>> commit. The latter was done last bump and it was a bit hectic.
> 
> I like that option less because it means there are commits in master
> that break ABI but don't change soname. And I never really saw
> bump-related bisecting problems, it's usually clear what the culprit is.
> But if others prefer to first remove and then bump then I won't fight
> for it very hard.
> I agree with James here. Bisectability is important and so are atomic
commits.

- Andreas
___
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] Major bump

2021-04-05 Thread James Almer

On 4/5/2021 4:20 PM, Anton Khirnov wrote:

Quoting James Almer (2021-04-05 13:57:12)

On 4/5/2021 8:09 AM, Anton Khirnov wrote:

Hi,
this patchset bumps major version of all the libraries and removes many
deprecated APIs, as discussed at length during past months. Patches
11-16 will be squashed together on push, but are sent separately for
ease of review. FATE passes (here at least).

As agreed during the last developer call, I am disabling the
uspp/mcdeint filters that depend on removed libavcodec APIs. They should
be easy to re-enable if anyone finds the motivation to update them.

I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
with usage of AVCodecContext.time_base for decoding, since removing them
without breakage requires a fair bit of additional infrastructure that
is not yet there. I have plans for all these and hopefully I'll get to
it before the next bump.

Carl asked during the last meeting for some reasoning for the bump. The
general reasons are that
- old APIs are unable to provide all the features of the new ones
(that's usually why new APIs are added)
- old APIs tend to be harder to use correctly, they often have obscure
quirks or corner cases
- maintaining compatibility wrappers for them is a major obstacle to
further development
I'm appending some notes for the specific changes further down, they
could be added to the wiki or the website news entry.

Please comment,


The deprecated APIs should be removed one by one before the commit that
bumps the versions, so any potential issues or regressions can be
bisected to the culprit instead of the "Bump and disable everything"
commit. The latter was done last bump and it was a bit hectic.


I like that option less because it means there are commits in master
that break ABI but don't change soname. And I never really saw
bump-related bisecting problems, it's usually clear what the culprit is.
But if others prefer to first remove and then bump then I won't fight
for it very hard.


A couple dozen commits upstreamed simultaneously that remove the 
scheduled API one by one before the soname is bumped are not going to 
generate any inconvenience for anyone (It's not like we'll push them in 
batches during a extended period, which could result in people fetching 
a snapshot in the middle of it), and the benefits to bisection and 
history browsing are IMO worth 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] [PATCH 1/2] avformat/url: fix ff_make_absolute_url with Windows file paths

2021-04-05 Thread Marton Balint
Ugly, but a lot less broken than it was.

Fixes ticket #9166.

Signed-off-by: Marton Balint 
---
 libavformat/url.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/libavformat/url.c b/libavformat/url.c
index 77d610d95f..222d7d8a10 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -149,6 +149,18 @@ int ff_url_decompose(URLComponents *uc, const char *url, 
const char *end)
 return 0;
 }
 
+static int is_fq_dos_path(const char *path)
+{
+if ((path[0] >= 'a' && path[0] <= 'z' || path[0] >= 'A' && path[0] <= 'Z') 
&&
+ path[1] == ':' &&
+(path[2] == '/' || path[2] == '\\'))
+return 1;
+if ((path[0] == '/' || path[0] == '\\') &&
+(path[1] == '/' || path[1] == '\\'))
+return 1;
+return 0;
+}
+
 static int append_path(char *root, char *out_end, char **rout,
const char *in, const char *in_end)
 {
@@ -185,6 +197,7 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
 char *out, *out_end, *path;
 const char *keep, *base_path_end;
 int use_base_path, simplify_path = 0, ret;
+const char *base_separators = "/";
 
 /* This is tricky.
For HTTP, http://server/site/page + ../media/file
@@ -211,6 +224,15 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
 
 if (!base)
 base = "";
+if (HAVE_DOS_PATHS) {
+if ((ret = ff_url_decompose(&ub, base, NULL)) < 0)
+goto error;
+if (is_fq_dos_path(base) || av_strstart(base, "file:", NULL) || 
ub.path == ub.url) {
+base_separators = "/\\";
+if (is_fq_dos_path(rel))
+base = "";
+}
+}
 if ((ret = ff_url_decompose(&ub, base, NULL)) < 0 ||
 (ret = ff_url_decompose(&uc, rel,  NULL)) < 0)
 goto error;
@@ -249,7 +271,7 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
 if (use_base_path) {
 base_path_end = ub.url_component_end_path;
 if (URL_COMPONENT_HAVE(uc, path))
-while (base_path_end > ub.path && base_path_end[-1] != '/')
+while (base_path_end > ub.path && !strchr(base_separators, 
base_path_end[-1]))
 base_path_end--;
 }
 if (keep > ub.path)
-- 
2.26.2

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

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

[FFmpeg-devel] [PATCH 2/2] avformat/url: add ff_make_absolulte_url2 to be able to test windows path cases

2021-04-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/tests/url.c | 33 ++---
 libavformat/url.c   | 12 +---
 libavformat/url.h   | 10 ++
 tests/ref/fate/url  | 20 
 4 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
index 2eb597bb5e..8644a3e826 100644
--- a/libavformat/tests/url.c
+++ b/libavformat/tests/url.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
 #include "libavformat/url.h"
 #include "libavformat/avformat.h"
 
@@ -48,19 +49,30 @@ static void test_decompose(const char *url)
 
 static void test(const char *base, const char *rel)
 {
-char buf[200], buf2[200];
+char buf[200], buf2[200], buf_dos[200], buf_native[200];
 int ret;
 
-ret = ff_make_absolute_url(buf, sizeof(buf), base, rel);
+ret = ff_make_absolute_url2(buf, sizeof(buf), base, rel, 0);
 if (ret < 0) {
 printf("%50s %-20s => error %s\n", base, rel, av_err2str(ret));
 return;
 }
 printf("%50s %-20s => %s\n", base, rel, buf);
+ret = ff_make_absolute_url2(buf_dos, sizeof(buf_dos), base, rel, 1);
+if (ret < 0)
+snprintf(buf_dos, sizeof(buf_dos), "error %s", av_err2str(ret));
+ret = ff_make_absolute_url(buf_native, sizeof(buf_native), base, rel);
+if (ret < 0)
+snprintf(buf_native, sizeof(buf_native), "error %s", av_err2str(ret));
+if (strcmp(buf, buf_dos))
+printf("%50s %-20sDOS %s\n", base, rel, buf_dos);
+if (HAVE_DOS_PATHS && strcmp(buf_dos, buf_native) ||
+!HAVE_DOS_PATHS && strcmp(buf, buf_native))
+printf("Native mismatch\n");
 if (base) {
 /* Test in-buffer replacement */
 snprintf(buf2, sizeof(buf2), "%s", base);
-ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel);
+ff_make_absolute_url2(buf2, sizeof(buf2), buf2, rel, 0);
 if (strcmp(buf, buf2)) {
 printf("In-place handling of %s + %s failed\n", base, rel);
 exit(1);
@@ -121,6 +133,21 @@ int main(void)
 test("http://server/foo/bar";, "..doubledotfile");
 test("http://server/foo/bar";, "double..dotfile");
 test("http://server/foo/bar";, "doubledotfile..");
+test("file1", "file2");
+test("dir/file1", "file2");
+test("dir/file1", "../file2");
+test("dir\\file1", "file2");
+test("srv\\shr\\file", "..\\..\\dummy");
+test("srv\\shr\\file", "dummy");
+test("srv\\shr\\file", "srv2\\shr2\\file2");
+test("srv\\shr\\file", "d:/file");
+test("C:\\dir\\a", "..\\file");
+test("C:\\dir\\a", "srv\\shr\\file");
+test("C:\\dir\\a", "d:\\file");
+test("http://a/b";, "srv\\shr\\file");
+test("http://a/b";, "//srv/shr/file");
+test("http://a/b";, "d:\\file");
+test("http://a/b";, "C:/file");
 
 /* From https://tools.ietf.org/html/rfc3986#section-5.4 */
 test("http://a/b/c/d;p?q";, "g:h");   // g:h
diff --git a/libavformat/url.c b/libavformat/url.c
index 222d7d8a10..f53fdf59d8 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -190,8 +190,8 @@ static int append_path(char *root, char *out_end, char 
**rout,
 return 0;
 }
 
-int ff_make_absolute_url(char *buf, int size, const char *base,
-  const char *rel)
+int ff_make_absolute_url2(char *buf, int size, const char *base,
+  const char *rel, int handle_dos_paths)
 {
 URLComponents ub, uc;
 char *out, *out_end, *path;
@@ -224,7 +224,7 @@ int ff_make_absolute_url(char *buf, int size, const char 
*base,
 
 if (!base)
 base = "";
-if (HAVE_DOS_PATHS) {
+if (handle_dos_paths) {
 if ((ret = ff_url_decompose(&ub, base, NULL)) < 0)
 goto error;
 if (is_fq_dos_path(base) || av_strstart(base, "file:", NULL) || 
ub.path == ub.url) {
@@ -316,6 +316,12 @@ error:
 return ret;
 }
 
+int ff_make_absolute_url(char *buf, int size, const char *base,
+ const char *rel)
+{
+return ff_make_absolute_url2(buf, size, base, rel, HAVE_DOS_PATHS);
+}
+
 AVIODirEntry *ff_alloc_dir_entry(void)
 {
 AVIODirEntry *entry = av_mallocz(sizeof(AVIODirEntry));
diff --git a/libavformat/url.h b/libavformat/url.h
index f13e851a14..3bb1cf89f7 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -308,6 +308,16 @@ int ff_url_join(char *str, int size, const char *proto,
  * @param size the size of buf
  * @param base the base url, may be equal to buf.
  * @param rel the new url, which is interpreted relative to base
+ * @param handle_dos_paths handle DOS paths for file or unspecified protocol
+ */
+int ff_make_absolute_url2(char *buf, int size, const char *base,
+ const char *rel, int handle_dos_paths);
+
+/**
+ * Convert a relative url into an absolute url, given a base url.
+ *
+ * Same as ff_make_absolute_url2 with handle_d

Re: [FFmpeg-devel] [PATCH] mov: Skip computing SAR from invalid display matrix elements

2021-04-05 Thread Vittorio Giovara
On Tue, Mar 30, 2021 at 6:55 PM Vittorio Giovara 
wrote:

> Hello,
> I was debugging an issue with a video file containing an invalid
> display matrix, probably produced by a non conforming software.
>
> The content of the matrix is:
> :0   65536   0
> 0001:   -1   0   0
> 0002:0   0  1073741824
>
> The -1 (stored as 4294967295) was probably a 1 shifted 32 times instead
> of 16. The problem is that this value is bypassing the validation check
> in the code below, and the resulting computed SAR value becomes 1:65536.
>
> This change interprets extremely low entries as invalid and makes sure
> to skip them in the SAR computation. This passes fate, but I haven't been
> able to test this extensively.
> Please see the attached patch, any feedback or better solution is welcome.
>

Hi,
in case of no objections, I'd push this patch tomorrow, and send the
discussed patchset to the mailing list right after.
Thanks
-- 
Vittorio
___
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/dashdec: Also fetch final partial segment

2021-04-05 Thread Steven Liu


> 2021年4月6日 上午1:45,Matt Robinson  写道:
> 
> Currently, the DASH demuxer omits the final segment for a non-live
> stream (using SegmentTemplate) if it is shorter than the other segments.
> 
> Correct calc_max_seg_no to round up when calulating the number of
> segments instead of rounding down to resolve this issue.
> 
> Signed-off-by: Matt Robinson 
> ---
> libavformat/dashdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 6f3f28dcc7..73effd85db 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1445,7 +1445,7 @@ static int64_t calc_max_seg_no(struct representation 
> *pls, DASHContext *c)
> } else if (c->is_live && pls->fragment_duration) {
> num = pls->first_seq_no + (((get_current_time_in_sec() - 
> c->availability_start_time)) * pls->fragment_timescale)  / 
> pls->fragment_duration;
> } else if (pls->fragment_duration) {
> -num = pls->first_seq_no + (c->media_presentation_duration * 
> pls->fragment_timescale) / pls->fragment_duration;
> +num = pls->first_seq_no + av_rescale_rnd(1, 
> c->media_presentation_duration * pls->fragment_timescale, 
> pls->fragment_duration, AV_ROUND_UP);
> }
> 
> return num;
> -- 
> 2.25.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".

LGTM


Thanks

Steven Liu



___
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] Major bump

2021-04-05 Thread Steven Liu


> 2021年4月5日 下午7:09,Anton Khirnov  写道:
> 
> Hi,
> this patchset bumps major version of all the libraries and removes many
> deprecated APIs, as discussed at length during past months. Patches
> 11-16 will be squashed together on push, but are sent separately for
> ease of review. FATE passes (here at least).
> 
> As agreed during the last developer call, I am disabling the
> uspp/mcdeint filters that depend on removed libavcodec APIs. They should
> be easy to re-enable if anyone finds the motivation to update them.
> 
> I am postponing the removal of compute_muxer_pkt_fields() in lavf, along
> with usage of AVCodecContext.time_base for decoding, since removing them
> without breakage requires a fair bit of additional infrastructure that
> is not yet there. I have plans for all these and hopefully I'll get to
> it before the next bump.
> 
> Carl asked during the last meeting for some reasoning for the bump. The
> general reasons are that
> - old APIs are unable to provide all the features of the new ones
>  (that's usually why new APIs are added)
> - old APIs tend to be harder to use correctly, they often have obscure
>  quirks or corner cases
> - maintaining compatibility wrappers for them is a major obstacle to
>  further development
> I'm appending some notes for the specific changes further down, they
> could be added to the wiki or the website news entry.
> 
> Please comment,
> -- 
> Anton Khirnov
> 
> Major bump notes
> 
> libavcodec
> --
> * old audio/video decoding APIs avcodec_decode_video2 and
>  avcodec_decode_audio4 were removed;
>  they are replaced by avcodec_send_packet/avcodec_receive_frame, which
>  decouple input and output and can return any number of output frames
>  for a single input packet
> * old audio/video encoding APIs avcodec_encode_video2 and
>  avcodec_encode_audio2 were removed;
>  they are replaced by avcodec_send_frame/avcodec_receive_packet, which
>  decouple input and output and can return any number of output packets
>  for a single input frame
> * AVCodecContext.coded_frame removed without replacement
> * AVCodecContext.side_data_only_packets removed, codecs (currently only 
> flacenc)
>  now always behave as if this field was set to 1
> * AVCodecContext.vbv_delay removed, replaced by AV_PKT_DATA_CPB_PROPERTIES 
> side data
> * AVCodecContext.rtp_callback removed without replacement
> * AVCodecContext.*_bits removed without replacement
> * following AVCodecContext fields  removed, replaced by encoder-private 
> options
>- coder_type and FF_CODER_TYPE*
>- b_frame_strategy
>- mpeg_quant
>- prediction_method and FF_PRED_*
>- pre_me
>- scenechange_threshold
>- noise_reduction
>- me_penalty_compensation
>- brd_scale
>- chromaoffset
>- b_sensitivity
>- context_model
>- frame_skip_*
>- min/max_prediction_order
>- timecode_frame_start
>- rtp_payload_size
> * AVPacket.convergence_duration removed, use AVPacket.duration instead
> * AVPacket API for pre-refcounted memory management were removed
>- av_dup_packet
>- av_copy_packet
>- av_copy_packet_side_data
>- av_free_packet
>  users should use refcounted packet API instead
> * av_packet_merge_side_data and av_packet_split_side_data removed without 
> replacement,
>  packets with merged side data are no longer supported
> * AVPicture and its related APIs removed; it is replaced either by AVFrame API
>  or imgutils in libavutil
> * old bistream filtering API (using AVBitStreamFilterContext) removed, 
> replaced by the API
>  in libavcodec/bsf.h
> * avcodec_copy_context removed, it never makes sense for users to call this 
> function
> * avcodec_get_context_defaults3 removed, users should allocate a new codec 
> context
>  instead of resettting an old one
> * av_get_codec_tag_string replaced by av_fourcc_make_string/av_fourcc2str
> * avcodec_get_chroma_sub_sample replaced by av_pix_fmt_get_chroma_sub_sample
> * AVCodecContext accessors removed, AVCodecContext fields should be accessed 
> directly
> * AVHWAccel and its related functions removed from public API, as there was 
> no reason
>  for them to be user-visible
> * AV_CODEC_CAP_INTRA_ONLY and AV_CODEC_CAP_INTRA_ONLY removed, use 
> corresponding
>  AVCodecDescriptor.props values instead
> * av_lockmgr_register and AVLockOp removed, libavcodec handles locking 
> internally
> * codec registration APIs removed, all codecs are always registered
>- avcodec_register
>- avcodec_register_all
> * av_codec_next replaced by av_codec_iterate
> * AVCPBProperties.max/min/avg_bitrate types changed from int to int64_t
> * avcodec_get_pix_fmt_loss replaced by av_get_pix_fmt_loss
> * avcodec_find_best_pix_fmt_of_2 replaced by avcodec_find_best_pix_fmt_of_2
Is this typo? Maybe you want said avcodec_find_best_pix_fmt2?
> * avcodec_find_best_pix_fmt2 removed
> * av_parser_change removed; dump_extradata, remove_extra or extract_extradata
>  should be used instead
> * FF_SUB_TEXT_FMT_ASS_WIT

Re: [FFmpeg-devel] Major bump

2021-04-05 Thread Steven Liu


> 2021年4月6日 上午10:02,Steven Liu  写道:
> 
> Is this typo? Maybe you want said avcodec_find_best_pix_fmt2?
av_find_best_pix_fmt_of_2


Thanks

Steven Liu



___
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/9] avcodec/encode: Fix check for allowed LJPEG pixel formats

2021-04-05 Thread Andreas Rheinhardt
The pix_fmts of the LJPEG encoder already contain all supported pixel
formats (including the ones only supported when strictness is unofficial
or less); yet the check in ff_encode_preinit() ignored this list in case
strictness is unofficial or less. But the encoder presumed that it is
always applied and blacklists some of the entries in pix_fmts when
strictness is > unofficial. The result is that if one uses an entry not
on that list and sets strictness to unofficial, said entry passes both
checks and this can lead to segfaults lateron (e.g. when using gray).

Fix this by removing the exception for LJPEG in ff_encode_preinit().

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/encode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index a93bb3ccf7..89df5235da 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -565,7 +565,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
 break;
 if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
-&& !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == 
AV_CODEC_ID_LJPEG)
+&& !(avctx->codec_id == AV_CODEC_ID_MJPEG
  && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) 
{
 char buf[128];
 snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
-- 
2.27.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".

[FFmpeg-devel] [PATCH 2/9] avcodec/mpegvideo_enc: Make AMV encoder usable without MJPEG encoder

2021-04-05 Thread Andreas Rheinhardt
Up until now the relevant checks all checked for the existence of the
MJPEG encoder only.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 79c4071bad..7c9d1bd894 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -789,17 +789,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->delay  = s->low_delay ? 0 : (s->max_b_frames + 1);
 s->rtp_mode   = 1;
 break;
+#if CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER
 case AV_CODEC_ID_MJPEG:
 case AV_CODEC_ID_AMV:
 s->out_format = FMT_MJPEG;
 s->intra_only = 1; /* force intra only for jpeg */
-if (!CONFIG_MJPEG_ENCODER)
-return AVERROR_ENCODER_NOT_FOUND;
 if ((ret = ff_mjpeg_encode_init(s)) < 0)
 return ret;
 avctx->delay = 0;
 s->low_delay = 1;
 break;
+#endif
 case AV_CODEC_ID_SPEEDHQ:
 s->out_format = FMT_SPEEDHQ;
 s->intra_only = 1; /* force intra only for SHQ */
@@ -1097,7 +1097,7 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
 ff_rate_control_uninit(s);
 
 ff_mpv_common_end(s);
-if (CONFIG_MJPEG_ENCODER &&
+if ((CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER) &&
 s->out_format == FMT_MJPEG)
 ff_mjpeg_encode_close(s);
 
@@ -1926,7 +1926,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 frame_end(s);
 
-if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
+   if ((CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER) && s->out_format == 
FMT_MJPEG)
 ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
 
 if (avctx->rc_buffer_size) {
@@ -2596,11 +2596,12 @@ static av_always_inline void 
encode_mb_internal(MpegEncContext *s,
 if (CONFIG_H263_ENCODER)
 ff_h263_encode_mb(s, s->block, motion_x, motion_y);
 break;
+#if CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER
 case AV_CODEC_ID_MJPEG:
 case AV_CODEC_ID_AMV:
-if (CONFIG_MJPEG_ENCODER)
-ff_mjpeg_encode_mb(s, s->block);
+ff_mjpeg_encode_mb(s, s->block);
 break;
+#endif
 case AV_CODEC_ID_SPEEDHQ:
 if (CONFIG_SPEEDHQ_ENCODER)
 ff_speedhq_encode_mb(s, s->block);
@@ -2853,7 +2854,8 @@ static void write_slice_end(MpegEncContext *s){
 }
 
 ff_mpeg4_stuffing(&s->pb);
-}else if(CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG){
+} else if ((CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER) &&
+   s->out_format == FMT_MJPEG) {
 ff_mjpeg_encode_stuffing(s);
 } else if (CONFIG_SPEEDHQ_ENCODER && s->out_format == FMT_SPEEDHQ) {
 ff_speedhq_end_slice(s);
@@ -3921,11 +3923,14 @@ static int encode_picture(MpegEncContext *s, int 
picture_number)
 s->mb_x = s->mb_y = 0;
 s->last_bits= put_bits_count(&s->pb);
 switch(s->out_format) {
+#if CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER
 case FMT_MJPEG:
-if (CONFIG_MJPEG_ENCODER && s->huffman != HUFFMAN_TABLE_OPTIMAL)
+/* s->huffman == HUFFMAN_TABLE_OPTIMAL can only be true for MJPEG. */
+if (!CONFIG_MJPEG_ENCODER || s->huffman != HUFFMAN_TABLE_OPTIMAL)
 ff_mjpeg_encode_picture_header(s->avctx, &s->pb, 
&s->intra_scantable,
s->pred, s->intra_matrix, 
s->chroma_intra_matrix);
 break;
+#endif
 case FMT_SPEEDHQ:
 if (CONFIG_SPEEDHQ_ENCODER)
 ff_speedhq_encode_picture_header(s);
-- 
2.27.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".

[FFmpeg-devel] [PATCH 3/9] avcodec/mjpegenc: Remove dependency of AMV encoder on mjpegenc_huffman

2021-04-05 Thread Andreas Rheinhardt
Using optimal Huffman tables is not supported for AMV and always
disabled by ff_mpv_encode_init(); therefore one can build
the AMV encoder without mjpegenc_huffman if one adds the necessary
compile-time checks.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile   | 3 +--
 libavcodec/mjpegenc.c | 9 ++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 33a280cf69..4a597f727a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -199,8 +199,7 @@ OBJS-$(CONFIG_AMRWB_DECODER)   += amrwbdec.o 
celp_filters.o   \
   celp_math.o acelp_filters.o \
   acelp_vectors.o \
   acelp_pitch_delay.o
-OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o \
-  mjpegenc_huffman.o
+OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o
 OBJS-$(CONFIG_ANM_DECODER) += anm.o
 OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o
 OBJS-$(CONFIG_APE_DECODER) += apedec.o
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 596b7544ca..e5d2e24d66 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -65,6 +65,7 @@ static av_cold void init_uni_ac_vlc(const uint8_t 
huff_size_ac[256],
 }
 }
 
+#if CONFIG_MJPEG_ENCODER
 /**
  * Encodes and outputs the entire frame in the JPEG format.
  *
@@ -171,6 +172,7 @@ static void mjpeg_build_optimal_huffman(MJpegContext *m)
  m->bits_ac_chrominance,
  m->val_ac_chrominance);
 }
+#endif
 
 /**
  * Writes the complete JPEG frame when optimal huffman tables are enabled,
@@ -186,11 +188,11 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
 PutBitContext *pbc = &s->pb;
 int mb_y = s->mb_y - !s->mb_x;
 int ret;
-MJpegContext *m;
-
-m = s->mjpeg_ctx;
 
+#if CONFIG_MJPEG_ENCODER
 if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {
+MJpegContext *m = s->mjpeg_ctx;
+
 mjpeg_build_optimal_huffman(m);
 
 // Replace the VLCs with the optimal ones.
@@ -206,6 +208,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
s->pred, s->intra_matrix, 
s->chroma_intra_matrix);
 mjpeg_encode_picture_frame(s);
 }
+#endif
 
 ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
 put_bits_count(&s->pb) / 4 + 1000);
-- 
2.27.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".

[FFmpeg-devel] [PATCH 4/9] avcodec/mpegvideo_enc: Remove redundant pixel format checks

2021-04-05 Thread Andreas Rheinhardt
All encoders using ff_mpv_encode_init() already have pix_fmts set
so that the pixel format is already checked in ff_encode_preinit().
The one exception to this is MJPEG whose check remains.

(Btw: The AVCodec.pix_fmts check for AMV is stricter than the check
in ff_mpv_encode_init().)

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 7c9d1bd894..0f38f63de3 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -302,16 +302,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 mpv_encode_defaults(s);
 
 switch (avctx->codec_id) {
-case AV_CODEC_ID_MPEG2VIDEO:
-if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
-avctx->pix_fmt != AV_PIX_FMT_YUV422P) {
-av_log(avctx, AV_LOG_ERROR,
-   "only YUV420 and YUV422 are supported\n");
-return AVERROR(EINVAL);
-}
-break;
 case AV_CODEC_ID_MJPEG:
-case AV_CODEC_ID_AMV:
 format_supported = 0;
 /* JPEG color space */
 if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
@@ -334,20 +325,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 return AVERROR(EINVAL);
 }
 break;
-case AV_CODEC_ID_SPEEDHQ:
-if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
-avctx->pix_fmt != AV_PIX_FMT_YUV422P &&
-avctx->pix_fmt != AV_PIX_FMT_YUV444P) {
-av_log(avctx, AV_LOG_ERROR,
-   "only YUV420/YUV422/YUV444 are supported (no alpha support 
yet)\n");
-return AVERROR(EINVAL);
-}
-break;
-default:
-if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
-av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n");
-return AVERROR(EINVAL);
-}
 }
 
 switch (avctx->pix_fmt) {
-- 
2.27.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".

[FFmpeg-devel] [PATCH 5/9] avcodec/ljpegenc: Allow full range yuv420p, yuv422p, yuv444p by default

2021-04-05 Thread Andreas Rheinhardt
The documentation for AV_PIX_FMT_YUVJ420P reads:
"planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of
AV_PIX_FMT_YUV420P and setting color_range"
Yet the LJPEG encoder only accepts full scale yuv420p when strictness is
set to unofficial or lower; with default strictness it emits a nonsense
error message that says that limit range YUV is unofficial. This has
been changed to allow full range yuv420p, yuv422p and yuv444p irrespective
of the level of strictness.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ljpegenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 056b80b4b5..dd91c729d4 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -295,10 +295,11 @@ static av_cold int ljpeg_encode_init(AVCodecContext 
*avctx)
  avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
  avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
  avctx->color_range == AVCOL_RANGE_MPEG) &&
+avctx->color_range != AVCOL_RANGE_JPEG   &&
 avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
 av_log(avctx, AV_LOG_ERROR,
-   "Limited range YUV is non-standard, set strict_std_compliance 
to "
-   "at least unofficial to use it.\n");
+   "Non full-range YUV is non-standard, set strict_std_compliance "
+   "to at most unofficial to use it.\n");
 return AVERROR(EINVAL);
 }
 
-- 
2.27.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".

[FFmpeg-devel] [PATCH 6/9] avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmts

2021-04-05 Thread Andreas Rheinhardt
Currently said list contains only the pixel formats that are always
supported irrespective of the range and the value of
strict_std_compliance. This makes the MJPEG encoder an outlier as all
other codecs put all potentially supported pixel formats into said list
and error out if the chosen pixel format is unsupported. This commit
brings it therefore in line with the other encoders.

The behaviour of fftools/ffmpeg_filter.c has been preserved. A more
informed decision would be possible if colour range were available
at this point, but it isn't.

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_filter.c  | 20 +++-
 libavcodec/encode.c  |  4 +---
 libavcodec/ljpegenc.c| 14 +++---
 libavcodec/mjpegenc.c| 11 ++-
 libavcodec/mjpegenc_common.c | 16 
 libavcodec/mjpegenc_common.h |  2 ++
 libavcodec/mpegvideo_enc.c   | 28 +---
 7 files changed, 40 insertions(+), 55 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4ab769c07b..5c44b75eff 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -39,22 +39,16 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/samplefmt.h"
 
-static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum 
AVCodecID codec_id, const enum AVPixelFormat default_formats[])
+// FIXME: YUV420P etc. are actually supported with full color range,
+// yet the latter information isn't available here.
+static const enum AVPixelFormat *get_compliance_normal_pix_fmts(enum AVCodecID 
codec_id, const enum AVPixelFormat default_formats[])
 {
 static const enum AVPixelFormat mjpeg_formats[] =
 { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
-  AV_PIX_FMT_YUV420P,  AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV444P,
   AV_PIX_FMT_NONE };
-static const enum AVPixelFormat ljpeg_formats[] =
-{ AV_PIX_FMT_BGR24   , AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR0,
-  AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
-  AV_PIX_FMT_YUV420P , AV_PIX_FMT_YUV444P , AV_PIX_FMT_YUV422P,
-  AV_PIX_FMT_NONE};
 
 if (codec_id == AV_CODEC_ID_MJPEG) {
 return mjpeg_formats;
-} else if (codec_id == AV_CODEC_ID_LJPEG) {
-return ljpeg_formats;
 } else {
 return default_formats;
 }
@@ -70,8 +64,8 @@ static enum AVPixelFormat choose_pixel_fmt(AVStream *st, 
AVCodecContext *enc_ctx
 int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
 enum AVPixelFormat best= AV_PIX_FMT_NONE;
 
-if (enc_ctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
-p = get_compliance_unofficial_pix_fmts(enc_ctx->codec_id, p);
+if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+p = get_compliance_normal_pix_fmts(enc_ctx->codec_id, p);
 }
 for (; *p != AV_PIX_FMT_NONE; p++) {
 best = av_find_best_pix_fmt_of_2(best, *p, target, has_alpha, 
NULL);
@@ -118,8 +112,8 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 exit_program(1);
 
 p = ost->enc->pix_fmts;
-if (ost->enc_ctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
-p = get_compliance_unofficial_pix_fmts(ost->enc_ctx->codec_id, p);
+if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+p = get_compliance_normal_pix_fmts(ost->enc_ctx->codec_id, p);
 }
 
 for (; *p != AV_PIX_FMT_NONE; p++) {
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 89df5235da..9a4140f91a 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -564,9 +564,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
 if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
 break;
-if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
-&& !(avctx->codec_id == AV_CODEC_ID_MJPEG
- && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) 
{
+if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE) {
 char buf[128];
 snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
 av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid 
or not supported\n",
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index dd91c729d4..74a2cdcc46 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -289,19 +289,11 @@ static av_cold int ljpeg_encode_close(AVCodecContext 
*avctx)
 
 static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
 {
+int ret = ff_mjpeg_encode_check_pix_fmt(avctx);
 LJpegEncContext *s = avctx->priv_data;
 
-if ((avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
- avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
- avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
- avctx->color_range == AVCOL_RANGE_MPEG) &&
-avctx->color_range != AVCOL_RANGE_JPEG   

[FFmpeg-devel] [PATCH 7/9] fftools/ffmpeg_filter: Avoid allocations when configuring output filters

2021-04-05 Thread Andreas Rheinhardt
Use an AVBPrint to handle the (typically short) strings involved here.

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_filter.c | 99 +
 1 file changed, 41 insertions(+), 58 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 5c44b75eff..61ca793058 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -127,45 +127,39 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 return NULL;
 }
 
-/* Define a function for building a string containing a list of
- * allowed formats. */
-#define DEF_CHOOSE_FORMAT(suffix, type, var, supported_list, none, get_name)   
\
-static char *choose_ ## suffix (OutputFilter *ofilter) 
\
+/* Define a function for appending a list of allowed formats
+ * to an AVBPrint. If nonempty, the list will have a header. */
+#define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, 
printf_format, get_name) \
+static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint)  
\
 {  
\
+if (ofilter->var == none && !ofilter->supported_list)  
\
+return;
\
+av_bprintf(bprint, #name "="); 
\
 if (ofilter->var != none) {
\
-get_name(ofilter->var);
\
-return av_strdup(name);
\
-} else if (ofilter->supported_list) {  
\
+av_bprintf(bprint, printf_format, get_name(ofilter->var)); 
\
+} else {   
\
 const type *p; 
\
-AVIOContext *s = NULL; 
\
-uint8_t *ret;  
\
-int len;   
\
-   
\
-if (avio_open_dyn_buf(&s) < 0) 
\
-exit_program(1);   
\

\
 for (p = ofilter->supported_list; *p != none; p++) {   
\
-get_name(*p);  
\
-avio_printf(s, "%s|", name);   
\
+av_bprintf(bprint, printf_format "|", get_name(*p));   
\
 }  
\
-len = avio_close_dyn_buf(s, &ret); 
\
-ret[len - 1] = 0;  
\
-return ret;
\
-} else 
\
-return NULL;   
\
+if (bprint->len > 0)   
\
+bprint->str[--bprint->len] = '\0'; 
\
+}  
\
+av_bprint_chars(bprint, ':', 1);   
\
 }
 
 //DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, 
AV_PIX_FMT_NONE,
 //  GET_PIX_FMT_NAME)
 
 DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
-  AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME)
+  AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name)
 
 DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
-  GET_SAMPLE_RATE_NAME)
+  "%d", )
 
 DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 
0,
-  GET_CH_LAYOUT_NAME)
+  "0x%"PRIx64, )
 
 int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
 {
@@ -525,7 +519,7 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 AVCodecContext *codec  = ost->enc_ctx;
 AVFilterContext *last_filter = out->filter_ctx;
 int pad_idx = out->pad_idx;
-char *sample_fmts, *sample_rates, *channel_layouts;
+AVBPrint args;
 char name[255];
 int ret;
 
@@ -548,65 +542,52 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
avfilter_get_by_name(filter_name),   \
filter_name, a

[FFmpeg-devel] [PATCH 9/9] fftools/ffmpeg_filter: Don't needlessly copy string

2021-04-05 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_filter.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index a4b4638abb..400f5a4188 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -593,7 +593,6 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 }
 
 if (ost->apad && of->shortest) {
-char args[256];
 int i;
 
 for (i=0; ictx->nb_streams; i++)
@@ -601,8 +600,7 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 break;
 
 if (ictx->nb_streams) {
-snprintf(args, sizeof(args), "%s", ost->apad);
-AUTO_INSERT_FILTER("-apad", "apad", args);
+AUTO_INSERT_FILTER("-apad", "apad", ost->apad);
 }
 }
 
-- 
2.27.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".

[FFmpeg-devel] [PATCH 8/9] fftools/ffmpeg_filter: Don't write string that is never used

2021-04-05 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_filter.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 61ca793058..a4b4638abb 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -463,8 +463,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 
 if ((pix_fmts = choose_pix_fmts(ofilter))) {
 AVFilterContext *filter;
-snprintf(name, sizeof(name), "format_out_%d_%d",
- ost->file_index, ost->index);
+
 ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
"format", pix_fmts, NULL, 
fg->graph);
-- 
2.27.0

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

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

Re: [FFmpeg-devel] [PATCH V2] libavcodec/qsvdec: reinit decoder according to decode() return value

2021-04-05 Thread Xiang, Haihao
On Tue, 2021-03-23 at 16:34 +0800, wenbin.c...@intel.com wrote:
> From: "Chen,Wenbin" 
> 
> FFmpeg-qsv decoder reinit codec when width and height change, but there
> are not only resolution change need to reinit codec. I change it to use
> return value from DecodeFrameAsync() to decide whether decoder need to
> be reinitialized.
> 
> Signed-off-by Wenbin Chen 
> ---
>  libavcodec/qsvdec.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 5f2e641373..88232f5d8d 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -481,6 +481,13 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext
> *q,
>  
>  } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_ERR_MORE_SURFACE);
>  
> +if (ret == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) {
> +q->reinit_flag = 1;
> +av_log(avctx, AV_LOG_DEBUG, "Video parameter change\n");
> +av_freep(&sync);
> +return 0;
> +}
> +
>  if (ret != MFX_ERR_NONE &&
>  ret != MFX_ERR_MORE_DATA &&
>  ret != MFX_WRN_VIDEO_PARAM_CHANGED &&
> @@ -632,9 +639,9 @@ static int qsv_process_data(AVCodecContext *avctx,
> QSVContext *q,
>  
>  ret = qsv_decode_header(avctx, q, pkt, pix_fmt, ¶m);
>  
> -if (ret >= 0 && (q->orig_pix_fmt !=
> ff_qsv_map_fourcc(param.mfx.FrameInfo.FourCC) ||
> +if (q->reinit_flag || (ret >= 0 && (q->orig_pix_fmt !=
> ff_qsv_map_fourcc(param.mfx.FrameInfo.FourCC) ||
>  avctx->coded_width  != param.mfx.FrameInfo.Width ||
> -avctx->coded_height != param.mfx.FrameInfo.Height)) {
> +avctx->coded_height != param.mfx.FrameInfo.Height))) {
>  AVPacket zero_pkt = {0};
>  
>  if (q->buffered_count) {

LTGM, thanks!

-Haihao

___
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] libavcodec/qsvdec: use the param from decodeHeader to configure surface

2021-04-05 Thread Xiang, Haihao
On Tue, 2021-03-23 at 06:45 +, Chen, Wenbin wrote:
> > -Original Message-
> > From: Xiang, Haihao 
> > Sent: Tuesday, March 23, 2021 12:10 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Chen, Wenbin 
> > Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/qsvdec: use the param from
> > decodeHeader to configure surface
> > 
> > On Mon, 2021-03-22 at 14:31 +0800, wenbin.c...@intel.com wrote:
> > > From: "Chen,Wenbin" 
> > > 
> > > MSDK recognizes both yuv420p10 and yuv420p9 as MFX_FOURCC_P010,
> > 
> > but param
> > > are different. When decode yuv420p9 video, ffmpeg-qsv will use
> > > yuv420p10le to configure surface which is different with param from
> > > DecoderHeader and this will lead to error. Now change it use
> > > param from decoderHeader to configure surface.
> > 
> > 
> > Both yuv420p10 and yuv420p9 have 3 planes (
> > https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/pixdesc.c#L1359-
> > L1406) ,
> > but MFX_FOURCC_P010 has 2 planes only. MSDK doesn't recognizes
> > yuv420p10 and
> > yuv420p9 as MFX_FOURCC_P010. FFmpeg-qsv uses p010le instead of
> > yuv420p10le to
> > configure surface for 10bit video.
> > 
> 
> Sorry, I didn't describe the problem well. I mean when MSDK decodeHeader a
> 9bit video
> It will return MFX_FOURCC_P010, but its frameInfo is 9bit. However FFmpeg-qsv
> will use P010's parameter
> to configure surface which will be 10bit, and if ffmpeg-qsv send 10bit surface
> to decode 9bit video MSDK will report an error.
> 

So it will use yuv420p10le for a 9bit video, right? A potential issue here is
the depth info will be lost in the pipeline, a filter after qsv decoder will
take it as 10bit frame instead of 9bit frame. 

Thanks
Haihao


> > 
> > > 
> > > Signed-off-by Wenbin Chen 
> > > ---
> > >  libavcodec/qsvdec.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> > > index 569ccd4fba..3ab48ea7a2 100644
> > > --- a/libavcodec/qsvdec.c
> > > +++ b/libavcodec/qsvdec.c
> > > @@ -309,13 +309,13 @@ static int alloc_frame(AVCodecContext *avctx,
> > 
> > QSVContext
> > > *q, QSVFrame *frame)
> > >  if (frame->frame->format == AV_PIX_FMT_QSV) {
> > >  frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
> > >  } else {
> > > -frame->surface.Info = q->frame_info;
> > > -
> > >  frame->surface.Data.PitchLow = frame->frame->linesize[0];
> > >  frame->surface.Data.Y= frame->frame->data[0];
> > >  frame->surface.Data.UV   = frame->frame->data[1];
> > >  }
> > > 
> > > +frame->surface.Info = q->frame_info;
> > > +
> > >  if (q->frames_ctx.mids) {
> > >  ret = ff_qsv_find_surface_idx(&q->frames_ctx, frame);
> > >  if (ret < 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".