[FFmpeg-devel] [PATCH v2 2/3] avformat/file: dup file descriptor for pipe protocol

2022-12-11 Thread Zhao Zhili
From: Zhao Zhili This can fix read/write error when user close the file descriptor earlier. Now user can close the file descriptor earlier to avoid file descriptor leak. So it's safer in both way. --- libavformat/file.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

Re: [FFmpeg-devel] [PATCH] avformat/file: add fd protocol

2022-12-10 Thread Zhao Zhili
> From: ffmpeg-devel On Behalf Of Anton > Khirnov > Sent: 2022年12月9日 22:32 > To: FFmpeg development discussions and patches > Cc: Zhao Zhili > Subject: Re: [FFmpeg-devel] [PATCH] avformat/file: add fd protocol > > Quoting Zhao Zhili (2022-11-18 19:48:02) > > Fr

[FFmpeg-devel] [PATCH v3 3/7] avcodec/mediacodecenc: use bsf to handle crop

2022-12-09 Thread Zhao Zhili
From: Zhao Zhili It's well known that mediacodec encoder requires 16x16 alignment. Use our bsf to fix the crop info. --- v3: don't change the dimension for AV_PIX_FMT_MEDIACODEC. It can have side effect. configure | 2 + libavcodec/mediacodecenc.c | 78

Re: [FFmpeg-devel] [PATCH] avformat/file: add fd protocol

2022-12-08 Thread Zhao Zhili
On Thu, 2022-12-08 at 16:28 +0100, Andreas Rheinhardt wrote: > Marvin Scholz: > > > > On 8 Dec 2022, at 16:11, Zhao Zhili wrote: > > > > > On Mon, 2022-12-05 at 10:51 +0800, zhilizhao(赵志立) wrote: > > > > > On Nov 19, 2022, at

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mediacodecenc: add option to select codec by name

2022-12-08 Thread Zhao Zhili
On Mon, 2022-11-28 at 00:55 +0800, Zhao Zhili wrote: > From: Zhao Zhili > > --- > libavcodec/mediacodecenc.c | 8 +++- > libavcodec/version.h | 2 +- > 2 files changed, 8 insertions(+), 2 deletions(-) > > Applied.

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mediacodec: fix missing crop info when use NDK MediaCodec

2022-12-08 Thread Zhao Zhili
On Thu, 2022-11-24 at 00:49 +0800, Zhao Zhili wrote: > From: Zhao Zhili > > --- > libavcodec/mediacodec_wrapper.c | 38 - > -- > libavcodec/mediacodec_wrapper.h | 24 +++ > libavcodec/mediacodecdec_common.c | 4 &

Re: [FFmpeg-devel] [PATCH] avformat/file: add fd protocol

2022-12-08 Thread Zhao Zhili
On Mon, 2022-12-05 at 10:51 +0800, zhilizhao(赵志立) wrote: > > On Nov 19, 2022, at 02:48, Zhao Zhili > > wrote: > > > > From: Zhao Zhili > > > > Unlike the pipe protocol, fd protocol has seek support if it > > corresponding to a regular file. > &g

Re: [FFmpeg-devel] Defect: MediaCodec Encoder - Pixel ColorSpace of many Adreno GPUs not supported

2022-12-07 Thread Zhao Zhili
> From: ffmpeg-devel On Behalf Of Ben Temple > Sent: 2022年12月7日 6:53 > To: ffmpeg-devel@ffmpeg.org; Zhao Zhili > Subject: [FFmpeg-devel] Defect: MediaCodec Encoder - Pixel ColorSpace of many > Adreno GPUs not supported > > MediaCodec Encoder: Pixel ColorSpac

[FFmpeg-devel] [PATCH v2 4/7] avcodec/mediacodecenc: use bsf to handle crop

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili It's well known that mediacodec encoder requires 16x16 alignment. Use our bsf to fix the crop info. --- configure | 2 ++ libavcodec/mediacodecenc.c | 65 +++--- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git

[FFmpeg-devel] [PATCH v2 7/7] avcodec/mediacodecenc: add pts_as_dts option

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili It works since most of Android devices don't output B frames by default. The behavior is documented by Android now, although there is some exception in history, which should have been fixed now. --- libavcodec/mediacodecenc.c | 8 libavcodec/version.h | 2 +- 2

[FFmpeg-devel] [PATCH v2 6/7] avcodec/mediacodecenc: add max-bframes support

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 8e28a50e0d..e9cff8167a 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -264,6 +264,8 @@ static av_cold

[FFmpeg-devel] [PATCH v2 1/7] avcodec/mediacodecenc: make each encoder has its own option

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 69246ad693..4f9185342f 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec

[FFmpeg-devel] [PATCH v2 0/7] MediaCodec encoder: Fix width/height alignment issue and add more options

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili v2: Reorder 1/7 and 2/7. Zhao Zhili (7): avcodec/mediacodecenc: make each encoder has its own option avcodec/mediacodecenc: add bitrate_mode option avcodec/mediacodecenc: add level option avcodec/mediacodecenc: use bsf to handle crop avcodec/mediacodecenc: remove

[FFmpeg-devel] [PATCH v2 3/7] avcodec/mediacodecenc: add level option

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 143 - libavcodec/version.h | 2 +- 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index ec0e0b3a86..2f78567451 100644

[FFmpeg-devel] [PATCH v2 2/7] avcodec/mediacodecenc: add bitrate_mode option

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 25 + libavcodec/version.h | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 4f9185342f..ec0e0b3a86 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v2 5/7] avcodec/mediacodecenc: remove the strategy to create DTS

2022-12-07 Thread Zhao Zhili
From: Zhao Zhili Use input PTS as DTS has multiple problems: 1. If there is no reordering, it's better to just use the output PTS as DTS, since encoder may change the timestamp value (do it on purpose or rounding error). 2. If there is reordering, input PTS should be shift a few frames as DTS

[FFmpeg-devel] [PATCH 7/7] avcodec/mediacodecenc: add pts_as_dts option

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili It works since most of Android devices don't output B frames by default. The behavior is documented by Android now, although there is some exception in history, which should have been fixed now. --- libavcodec/mediacodecenc.c | 8 libavcodec/version.h | 2 +- 2

[FFmpeg-devel] [PATCH 2/7] avcodec/mediacodecenc: make each encoder has its own option

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 42 ++ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index c8d8f84e46..c28cce56c6 100644 --- a/libavcodec/mediacodecenc.c +++ b

[FFmpeg-devel] [PATCH 1/7] avcodec/mediacodecenc: add bitrate_mode option

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 25 + libavcodec/version.h | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 69246ad693..c8d8f84e46 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 3/7] avcodec/mediacodecenc: add level option

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 143 - libavcodec/version.h | 2 +- 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index c28cce56c6..d098880941 100644

[FFmpeg-devel] [PATCH 6/7] avcodec/mediacodecenc: add max-bframes support

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 4b0397d1ea..9378563fac 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -264,6 +264,8 @@ static av_cold

[FFmpeg-devel] [PATCH 5/7] avcodec/mediacodecenc: remove the strategy to create DTS

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili Use input PTS as DTS has multiple problems: 1. If there is no reordering, it's better to just use the output PTS as DTS, since encoder may change the timestamp value (do it on purpose or rounding error). 2. If there is reordering, input PTS should be shift a few frames as DTS

[FFmpeg-devel] [PATCH 4/7] avcodec/mediacodecenc: use bsf to handle crop

2022-12-04 Thread Zhao Zhili
From: Zhao Zhili It's well known that mediacodec encoder requires 16x16 alignment. Use our bsf to fix the crop info. --- configure | 2 ++ libavcodec/mediacodecenc.c | 65 +++--- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git

[FFmpeg-devel] [RFC PATCH] fftools/ffmpeg: make main function actually return

2022-12-01 Thread Zhao Zhili
From: Zhao Zhili --- When working on mediacodec encoder, I test it by making fftools/ffmpeg into a lib, since JNI requires a JVM environment. There are three steps mostly: 1. Rename main() function 2. Reset global variables 3. Make main() function actuall return There is no point for this patch

[FFmpeg-devel] [PATCH 3/3] avcodec/mediacodecenc: configure profile

2022-11-27 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 693faca118..69246ad693 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -213,6 +213,11 @@ static

[FFmpeg-devel] [PATCH 2/3] avcodec/mediacodec_wrapper: use hardcoded value of profiles from MediaCodecInfo

2022-11-27 Thread Zhao Zhili
From: Zhao Zhili Those are static const values and documented at https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel No runtime query is needed. Now the method can be used without JVM. --- libavcodec/mediacodec_wrapper.c | 98

[FFmpeg-devel] [PATCH 1/3] avcodec/mediacodecenc: add option to select codec by name

2022-11-27 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodecenc.c | 8 +++- libavcodec/version.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index a4390a9df6..693faca118 100644 --- a/libavcodec/mediacodecenc.c +++ b

[FFmpeg-devel] [PATCH 2/2] avcodec/mediacodecenc: check missing Surface

2022-11-23 Thread Zhao Zhili
From: Zhao Zhili It's an invalid combination of Java MediaCodec with ANativeWindow. --- libavcodec/mediacodecenc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 7cdde59945..a4390a9df6 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 1/2] avcodec/mediacodec: fix missing crop info when use NDK MediaCodec

2022-11-23 Thread Zhao Zhili
From: Zhao Zhili --- libavcodec/mediacodec_wrapper.c | 38 --- libavcodec/mediacodec_wrapper.h | 24 +++ libavcodec/mediacodecdec_common.c | 4 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b

Re: [FFmpeg-devel] [Internet][PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support

2022-11-21 Thread Zhao Zhili
On Sun, 2022-11-20 at 14:49 +0800, Zhao Zhili wrote: > From: Zhao Zhili > > > v2: > > Rebased on master. > > 01/12: Use crop-width/crop-height as fallback and add TODO. Co- > authored-by: Aman Karmani > 07/12: Fix libavcodec/version.h conflict > 10/12: Cha

Re: [FFmpeg-devel] [PATCH 0/2] lavc/videotoolbox: use objpool instead of allocating memory each frame

2022-11-20 Thread Zhao Zhili
On Sat, 2022-11-19 at 16:35 -0500, Rick Kern wrote: > objpool was only being used in fftools, but it's useful in other > components to reduce alloation time and memory fragmentation. > > This patch set moves objpool to libavutil, so it can be used by > lavc/videotoolboxenc for data being passed

[FFmpeg-devel] [PATCH v3 12/12] fftools/ffmpeg_demux: set default hwaccel_output_format for mediacodec

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili --- Fix commit subject ffmpeg_opt -> ffmpeg_demux fftools/ffmpeg_demux.c | 4 1 file changed, 4 insertions(+) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 76778d774d..d2a6d39703 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demu

[FFmpeg-devel] [PATCH v2 09/12] avcodec/mediacodec: add ANativeWindow support

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili ANativeWindow can be used without JVM. --- libavcodec/mediacodec_surface.c | 46 --- libavcodec/mediacodec_surface.h | 8 -- libavcodec/mediacodec_wrapper.c | 30 +++- libavcodec/mediacodec_wrapper.h | 8

[FFmpeg-devel] [PATCH v2 08/12] avutil/hwcontext_mediacodec: add ANativeWindow support

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavutil/hwcontext_mediacodec.c | 56 +++- libavutil/hwcontext_mediacodec.h | 11 +++ libavutil/version.h | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/libavutil

[FFmpeg-devel] [PATCH v2 07/12] avcodec/mediacodecdec: enable NDK mediacodec

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- Changelog | 1 + libavcodec/mediacodecdec.c| 10 +- libavcodec/mediacodecdec_common.c | 23 +++ libavcodec/mediacodecdec_common.h | 1 + libavcodec/version.h | 4 ++-- 5

[FFmpeg-devel] [PATCH v2 12/12] fftools/ffmpeg_opt: set default hwaccel_output_format for mediacodec

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili --- fftools/ffmpeg_demux.c | 4 1 file changed, 4 insertions(+) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 76778d774d..d2a6d39703 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -625,6 +625,10 @@ static void add_input_streams

[FFmpeg-devel] [PATCH v2 06/12] avcodec/mediacodec: add NDK media codec wrapper

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- configure | 2 + libavcodec/mediacodec_wrapper.c | 596 +- libavcodec/mediacodec_wrapper.h | 8 +- libavcodec/mediacodecdec.c| 2 +- libavcodec/mediacodecdec_common.c | 2

[FFmpeg-devel] [PATCH v2 11/12] avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili --- libavutil/hwcontext.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ab9ad3703e..3396598269 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -397,10 +397,14 @@ int

[FFmpeg-devel] [PATCH v2 05/12] avcodec/mediacodec_wrapper: separate implementation from interface

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili This is in preparation for NDK media codec wrapper. Signed-off-by: Zhao Zhili --- libavcodec/mediacodec_wrapper.c | 244 +- libavcodec/mediacodec_wrapper.h | 255 +++- 2 files changed, 394 insertions(+), 105 deletions

[FFmpeg-devel] [PATCH v2 10/12] avcodec: add MediaCodec encoder

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- Changelog | 1 + configure | 4 + libavcodec/Makefile | 2 + libavcodec/allcodecs.c | 2 + libavcodec/mediacodec_wrapper.c | 101 ++- libavcodec/mediacodec_wrapper.h

[FFmpeg-devel] [PATCH v2 04/12] avcodec/mediacodecdec_common: fix useless av_buffer_unref

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Since frame->buf[0] is always NULL in this case, av_buffer_unref has no effect. If it's not NULL, double-free will happen. Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mediacodecdec_common.c

[FFmpeg-devel] [PATCH v2 03/12] avcodec/mediacodecdec_common: fix misuse av_free/av_freep

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index f430cfed31..4c48b9142e 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v2 02/12] avcodec/mediacodecdec: don't break out if both input and output port return try again

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili At the beginning of decoding, if we feed mediacodec too fast, the input port will return try again. It takes some time for mediacodec to consume bitstream and output frame. So the output port also return try again. It possible that mediacodec_receive_frame doesn't consume any

[FFmpeg-devel] [PATCH v2 01/12] avcodec/mediacodec: fix incorrect crop info

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili The crop info is optional, but used unconditionally. Co-authored-by: Aman Karmani Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b

[FFmpeg-devel] [PATCH v2 00/12] Add MediaCodec encoder and NDK MediaCodec support

2022-11-19 Thread Zhao Zhili
From: Zhao Zhili v2: Rebased on master. 01/12: Use crop-width/crop-height as fallback and add TODO. Co-authored-by: Aman Karmani 07/12: Fix libavcodec/version.h conflict 10/12: Change default i-frame-interval to 1 and add log message; bump minor version 12/12: Fix rebase conflict v1

Re: [FFmpeg-devel] [PATCH 01/12] avcodec/mediacodec: fix incorrect crop info

2022-11-19 Thread Zhao Zhili
On Sat, 2022-11-19 at 00:20 -0800, Aman Karmani wrote: > Thank you for your work on this patchset! > > On Sun, Oct 23, 2022 at 8:17 PM Zhao Zhili > wrote: > > From: Zhao Zhili > > > > The crop info is optional, but used unconditionally. >

[FFmpeg-devel] [PATCH] avformat/file: add fd protocol

2022-11-18 Thread Zhao Zhili
From: Zhao Zhili Unlike the pipe protocol, fd protocol has seek support if it corresponding to a regular file. --- Sometimes it's the only way to access files via file descriptor, e.g., requesting a shared file on Android: https://developer.android.com/training/secure-file-sharing/request-file

Re: [FFmpeg-devel] [Internet][PATCH 00/12] Add MediaCodec encoder and NDK MediaCodec support

2022-11-13 Thread Zhao Zhili
the NDK MediaCodec API > > instead. > > > > // Martin > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubs

Re: [FFmpeg-devel] [Internet][PATCH 00/12] Add MediaCodec encoder and NDK MediaCodec support

2022-11-11 Thread Zhao Zhili
ec encoder > and NDK MediaCodec support > > On Thu, Nov 10, 2022 at 7:36 PM "zhilizhao(赵志立)" > wrote: > > > > Ping for review. > > > > > On Oct 24, 2022, at 11:16, Zhao Zhili wrote: > > > > > > From: Zhao Zhili > > > &

[FFmpeg-devel] [PATCH] avcodec/libx265: fix build error

2022-11-03 Thread Zhao Zhili
From: Zhao Zhili x265_sei is available since X265_BUILD 88. Bump required version to 89 to fix the regression from commit 1f585030137, and remove a conditional compilation. Signed-off-by: Zhao Zhili --- configure| 2 +- libavcodec/libx265.c | 2 -- 2 files changed, 1 insertion

[FFmpeg-devel] [PATCH] avcodec/libx265: fix build error

2022-11-03 Thread Zhao Zhili
From: Zhao Zhili x265_sei is available since X265_BUILD 88. This fixes a regression from commit 1f585030137. Signed-off-by: Zhao Zhili --- libavcodec/libx265.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 4aa96e1f2d..e36f20a812

[FFmpeg-devel] [PATCH 05/12] avcodec/mediacodec_wrapper: separate implementation from interface

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili This is in preparation for NDK media codec wrapper. Signed-off-by: Zhao Zhili --- libavcodec/mediacodec_wrapper.c | 244 +- libavcodec/mediacodec_wrapper.h | 255 +++- 2 files changed, 394 insertions(+), 105 deletions

[FFmpeg-devel] [PATCH 07/12] avcodec/mediacodecdec: enable NDK mediacodec

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- Changelog | 1 + libavcodec/mediacodecdec.c| 10 +- libavcodec/mediacodecdec_common.c | 23 +++ libavcodec/mediacodecdec_common.h | 1 + libavcodec/version.h | 2 +- 5

[FFmpeg-devel] [PATCH 09/12] avcodec/mediacodec: add ANativeWindow support

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili ANativeWindow can be used without JVM. --- libavcodec/mediacodec_surface.c | 46 --- libavcodec/mediacodec_surface.h | 8 -- libavcodec/mediacodec_wrapper.c | 30 +++- libavcodec/mediacodec_wrapper.h | 8

[FFmpeg-devel] [PATCH 06/12] avcodec/mediacodec: add NDK media codec wrapper

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- configure | 2 + libavcodec/mediacodec_wrapper.c | 596 +- libavcodec/mediacodec_wrapper.h | 8 +- libavcodec/mediacodecdec.c| 2 +- libavcodec/mediacodecdec_common.c | 2

[FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_opt: set default hwaccel_output_format for mediacodec

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili --- fftools/ffmpeg_opt.c | 4 1 file changed, 4 insertions(+) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 9245e02813..9c15858c05 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -785,6 +785,10 @@ static void add_input_streams

[FFmpeg-devel] [PATCH 11/12] avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili --- libavutil/hwcontext.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ab9ad3703e..3396598269 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -397,10 +397,14 @@ int

[FFmpeg-devel] [PATCH 08/12] avutil/hwcontext_mediacodec: add ANativeWindow support

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavutil/hwcontext_mediacodec.c | 56 +++- libavutil/hwcontext_mediacodec.h | 11 +++ libavutil/version.h | 4 +-- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/libavutil

[FFmpeg-devel] [PATCH 10/12] avcodec: add MediaCodec encoder

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- Changelog | 1 + configure | 4 + libavcodec/Makefile | 2 + libavcodec/allcodecs.c | 2 + libavcodec/mediacodec_wrapper.c | 102 ++- libavcodec/mediacodec_wrapper.h

[FFmpeg-devel] [PATCH 04/12] avcodec/mediacodecdec_common: fix useless av_buffer_unref

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Since frame->buf[0] is always NULL in this case, av_buffer_unref has no effect. If it's not NULL, double-free will happen. Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mediacodecdec_common.c

[FFmpeg-devel] [PATCH 01/12] avcodec/mediacodec: fix incorrect crop info

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili The crop info is optional, but used unconditionally. Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 2a605e7f5b..c1cbb28488

[FFmpeg-devel] [PATCH 03/12] avcodec/mediacodecdec_common: fix misuse av_free/av_freep

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index c1cbb28488..940b4e02d5 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 02/12] avcodec/mediacodecdec: don't break out if both input and output port return try again

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili At the beginning of decoding, if we feed mediacodec too fast, the input port will return try again. It takes some time for mediacodec to consume bitstream and output frame. So the output port also return try again. It possible that mediacodec_receive_frame doesn't consume any

[FFmpeg-devel] [PATCH 00/12] Add MediaCodec encoder and NDK MediaCodec support

2022-10-23 Thread Zhao Zhili
From: Zhao Zhili Firstly, some bugs were fixed (patch 1-4). Patch 5 and 6 make mediacodec_wrapper support Java MediaCodec and NDK MediaCodec. The use case I'm considering is run FFmpeg on cmdline without JVM, for example, run FFmpeg inside of termux (an Android terminal emulator). It's well

[FFmpeg-devel] [PATCH] avcodec/mediacodec: fix incorrect crop info

2022-10-10 Thread Zhao Zhili
From: Zhao Zhili The crop info is optional, but used unconditionally. Signed-off-by: Zhao Zhili --- libavcodec/mediacodecdec_common.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 2a605e7f5b..c1cbb28488

Re: [FFmpeg-devel] [PATCH 2/2] avformat/mp3dec: remove a call to avio_tell()

2022-10-08 Thread Zhao Zhili
On Tue, 2022-10-04 at 11:01 +0200, Anton Khirnov wrote: > Quoting Zhao Zhili (2022-09-25 06:28:41) > > From: Zhao Zhili > > > > --- > > libavformat/mp3dec.c | 9 - > > 1 file changed, 4 insertions(+), 5 deletions(-) > &g

Re: [FFmpeg-devel] [PATCH v2] avformat/mpegtsenc: add omit_rai flag

2022-10-08 Thread Zhao Zhili
On Sun, 2022-10-02 at 21:16 +0200, Marton Balint wrote: > > On Fri, 30 Sep 2022, Zhao Zhili wrote: > > > From: Zhao Zhili > > > > Add PCR at keyframe can be undesirable when -pcr_period is > > specified. Add an flag to disable this behavior. > > > &

[FFmpeg-devel] [PATCH v2] avformat/mpegtsenc: add omit_rai flag

2022-09-29 Thread Zhao Zhili
From: Zhao Zhili Add PCR at keyframe can be undesirable when -pcr_period is specified. Add an flag to disable this behavior. Signed-off-by: Zhao Zhili --- v2: change pcr_at_keyframe to omit_rai doc/muxers.texi | 2 ++ libavformat/mpegtsenc.c | 6 +- 2 files changed, 7 insertions

[FFmpeg-devel] [PATCH] avformat/mpegtsenc: add pcr_at_keyframe flag

2022-09-27 Thread Zhao Zhili
From: Zhao Zhili Add PCR at keyframe can be undesirable when -pcr_period is specified. Add an flag to disable this behavior. Signed-off-by: Zhao Zhili --- doc/muxers.texi | 2 ++ libavformat/mpegtsenc.c | 8 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc

Re: [FFmpeg-devel] [PATCH] avformat/mov: Speed up finding MOVFragmentIndexItem

2022-09-26 Thread Zhao Zhili
> -Original Message- > From: ffmpeg-devel-boun...@ffmpeg.org On > Behalf Of Andreas Rheinhardt > Sent: 2022年9月25日 7:21 > To: ffmpeg-devel@ffmpeg.org > Cc: Andreas Rheinhardt > Subject: [FFmpeg-devel] [PATCH] avformat/mov: Speed up finding > MOVFragmentIndexItem > > The

[FFmpeg-devel] [PATCH 2/2] avformat/mp3dec: remove a call to avio_tell()

2022-09-24 Thread Zhao Zhili
From: Zhao Zhili --- libavformat/mp3dec.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index a9e494452d..05c13228bc 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -424,15 +424,14 @@ static int

[FFmpeg-devel] [PATCH 1/2] avformat/mp3dec: avoid seek back and forth

2022-09-24 Thread Zhao Zhili
From: Zhao Zhili avio_seek() is called inside check(). Seeking to 'off' then seeking to 'off + i' is unefficient, and it can loop 64 * 1024 times in the worst case. When probe a malformed file over HTTP, it looks like stucked forvever. ffio_ensure_seekback() doesn't solve the issue when

Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: fix -Wparentheses warning

2022-09-23 Thread Zhao Zhili
3. syyskuuta 2022, 20.40.30 EEST Zhao Zhili a écrit : > > From: Zhao Zhili > > > > Signed-off-by: Zhao Zhili > > --- > > libavcodec/mjpegdec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec

Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: fix -Wparentheses warning

2022-09-23 Thread Zhao Zhili
> -Original Message- > From: ffmpeg-devel-boun...@ffmpeg.org On > Behalf Of Andreas Rheinhardt > Sent: 2022年9月23日 23:11 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: fix -Wparentheses > warning > > Zhao

[FFmpeg-devel] [PATCH] avcodec/mjpegdec: fix -Wparentheses warning

2022-09-23 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c594950500..d77c644d3b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2866,7 +2866,7

[FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: configure min_hard_comp unconditionally

2022-09-16 Thread Zhao Zhili
From: Zhao Zhili There are two issues here. Firstly, the floating-point comparison is always true. Seconly, the code depends on the default value of min_hard_comp implicitly, which can be dangerous. Partially fixes ticket 9859. --- fftools/ffmpeg_filter.c | 3 +-- 1 file changed, 1 insertion

Re: [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample

2022-09-16 Thread Zhao Zhili
> From: Wang Yaqiang > > When determining whether a packet should be decrypted, > should use the stsd_id of the fragment where the current packet is located. > > Signed-off-by: Wang Yaqiang > --- > libavformat/isom.h | 1 + > libavformat/mov.c | 7 --- > 2 files changed, 5

[FFmpeg-devel] [PATCH] swresample/swresample: fix assert failure

2022-09-09 Thread Zhao Zhili
From: Zhao Zhili Fix #9908. Regression since 8a5896ec1f6. Signed-off-by: Zhao Zhili --- libswresample/swresample.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 6f04d130d3..624309c2a0 100644 --- a/libswresample/swresample.c

Re: [FFmpeg-devel] [PATCH v3] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix

2022-09-06 Thread Zhao Zhili
On Mon, 2022-09-05 at 18:40 +0800, 1035567...@qq.com wrote: > From: Wang Yaqiang > > For example, if the jpeg contains exif information > and the rotation direction is included in the exif, > the displaymatrix will be set on the side_data of the frame when > decoding. > However, when ffplay is

[FFmpeg-devel] [PATCH] fftools/ffmpeg: fix av_display_rotation_set() type cast

2022-08-31 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- fftools/ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index fbabbe6ea2..ecaf3bd984 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3263,7 +3263,7 @@ static int

Re: [FFmpeg-devel] [PATCH] fftools/ffplay: fix rotation incorrect when frame contains the side_data(type is AV_FRAME_DATA_DISPLAYMATRIX)

2022-08-31 Thread Zhao Zhili
> -Original Message- > From: ffmpeg-devel-boun...@ffmpeg.org On > Behalf Of 1035567...@qq.com > Sent: 2022年8月31日 18:45 > To: ffmpeg-devel@ffmpeg.org > Cc: Wang Yaqiang ; 1445440...@qq.com > Subject: [FFmpeg-devel] [PATCH] fftools/ffplay: fix rotation incorrect when > frame contains

Re: [FFmpeg-devel] [PATCH v3] mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx

2022-08-16 Thread Zhao Zhili
On Tue, 2022-08-16 at 17:32 +0100, Derek Buitenhuis wrote: > On 8/16/2022 5:21 PM, Zhao Zhili wrote: > > get_frag_time() can be called with an mp4 file which has no sidx at > > all. In that case, > > dst_st should have a higher priority than other streams, even if >

Re: [FFmpeg-devel] [PATCH v3] mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx

2022-08-16 Thread Zhao Zhili
> -Original Message- > From: ffmpeg-devel-boun...@ffmpeg.org On > Behalf Of Derek Buitenhuis > Sent: 2022年8月16日 22:49 > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v3] mov: Compare frag times in correct time > base when seeking a stream without a corresponding sidx >

Re: [FFmpeg-devel] [PATCH v2] mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx

2022-08-14 Thread Zhao Zhili
On Fri, 2022-08-12 at 16:22 +0100, Derek Buitenhuis wrote: > On 8/9/2022 10:38 AM, "zhilizhao(赵志立)" wrote: > > It’s suspicious to return a timestamp with unknown timebase. > > Would you suggest erroring in the case where there's no frag_stream? > That could > make sense. Or just continue the

[FFmpeg-devel] [PATCH] avutil/hwcontext_videotoolbox: add missing include for AVFrame

2022-08-04 Thread Zhao Zhili
From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavutil/hwcontext_videotoolbox.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/hwcontext_videotoolbox.h b/libavutil/hwcontext_videotoolbox.h index b6bdcf243d..25dde85df5 100644 --- a/libavutil/hwcontext_videotoolbox.h +++ b

[FFmpeg-devel] [PATCH 2/2] avformat/mov: fix encryption index in the case of multiple trun

2022-07-30 Thread Zhao Zhili
From: Zhao Zhili frag_stream_info->index_entry isn't the first sample/trun index. cenc.frag_index_entry_base failed to catch the case since current_index > 0. Fix ticket #9807. --- libavformat/isom.h | 3 ++- libavformat/mov.c | 10 ++ 2 files changed, 8 insertions(+), 5 del

[FFmpeg-devel] [PATCH 1/2] avformat/mov: fix frag_index.current out of sync

2022-07-30 Thread Zhao Zhili
From: Zhao Zhili frag_index.current is used by cenc_filter, and is updated inside mov_read_moof. It can out of sync regarding to mov_read_packet. Partly fix ticket #9807. --- libavformat/mov.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git

[FFmpeg-devel] [PATCH v2 2/3] avformat/flvdec: make key frame timestamps more accurate

2022-07-28 Thread Zhao Zhili
From: Zhao Zhili There was an implicit cast from double to int64_t in time unit of second. --- libavformat/flvdec.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 8dba92661b..10f0ea7736 100644 --- a/libavformat

[FFmpeg-devel] [PATCH v2 3/3] avformat/flvenc: fix shadowed variable ts

2022-07-28 Thread Zhao Zhili
From: Zhao Zhili --- libavformat/flvenc.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 1c4ffb985a..5d574fa790 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -993,12 +993,9 @@ static int

[FFmpeg-devel] [PATCH v2 1/3] avformat/flvenc: fix timestamp of key frame index

2022-07-28 Thread Zhao Zhili
From: Zhao Zhili Firstly, the timestamps generated from framerate are inaccurate for variable framerate mode. Secondly, the timestamps always start from zero, while pts/dts can start from nonzero. FLV demuxer rejects such index with message: "Found invalid index entries, clearing the

[FFmpeg-devel] [PATCH v2 0/3] avformat/flv: fix timestamps of key frame index

2022-07-28 Thread Zhao Zhili
From: Zhao Zhili v2: Simplify patch 2/3 as Michael's suggestion. Zhao Zhili (3): avformat/flvenc: fix timestamp of key frame index avformat/flvdec: make key frame timestamps more accurate avformat/flvenc: fix shadowed variable ts libavformat/flvdec.c | 13

[FFmpeg-devel] [PATCH] avdevice/v4l2: fix leak of timefilter

2022-07-26 Thread Zhao Zhili
From: Zhao Zhili Fixes ticket #9844. --- I don't have a camera for test. So I'm not sure if it's the only case of memleak in ticket #9844. libavdevice/v4l2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 5340382d57..be422d7c8c 100644

[FFmpeg-devel] [PATCH 3/3] avformat/flvenc: fix shadowed variable ts

2022-07-14 Thread Zhao Zhili
From: Zhao Zhili --- libavformat/flvenc.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 1c4ffb985a..5d574fa790 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -993,12 +993,9 @@ static int

[FFmpeg-devel] [PATCH 1/2] avformat/flvenc: fix timestamp of key frame index

2022-07-13 Thread Zhao Zhili
From: Zhao Zhili Firstly, the timestamps generated from framerate are inaccurate for variable framerate mode. Secondly, the timestamps always start from zero, while pts/dts can start from nonzero. FLV demuxer rejects such index with message: "Found invalid index entries, clearing the

[FFmpeg-devel] [PATCH 2/2] avformat/flvdec: make key frame timestamps more accurate

2022-07-13 Thread Zhao Zhili
From: Zhao Zhili There is an implicit cast from double to int64_t in time unit of second. --- libavformat/flvdec.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index c5d3c63bd0..a78d720295 100644

[FFmpeg-devel] [PATCH v3] avformat/mov: discard data streams with all zero sample_delta

2022-07-06 Thread Zhao Zhili
From: Zhao Zhili Streams with all zero sample_delta in 'stts' have all zero dts. They have higher chance be chose by mov_find_next_sample(), which leads to seek again and again. For example, GoPro created a 'GoPro SOS' stream: Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s

[FFmpeg-devel] [PATCH v2] avformat/mov: discard data streams with all zero sample_delta

2022-07-06 Thread Zhao Zhili
From: Zhao Zhili Streams with all zero sample_delta in 'stts' have all zero dts. They have higher chance be chose by mov_find_next_sample(), which leads to seek again and again. For example, GoPro created a 'GoPro SOS' stream: Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s

[FFmpeg-devel] [PATCH] avformat/mov: discard data streams with all zero sample_delta

2022-07-05 Thread Zhao Zhili
From: Zhao Zhili Streams with all zero sample_delta in 'stts' have all zero dts. They have higher chance be chose by mov_find_next_sample(), which leads to seek again and again. For example, GoPro created a 'GoPro SOS' stream: Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s

[FFmpeg-devel] [PATCH v2] avcodec/apedec: fix prediction

2022-06-30 Thread Zhao Zhili
From: Zhao Zhili Regression since ed0001482a74b60f3d5bc5. Tested with: ./ffmpeg -i foo.ape -f md5 - for samples in #9816 and #2239. It gives the same result as before ed0001482a for ticket #9816, and doesn't break ticket #2239. Signed-off-by: Zhao Zhili --- libavcodec/apedec.c | 2 +- 1

[FFmpeg-devel] [PATCH] avcodec/apedec: fix prediction

2022-06-30 Thread Zhao Zhili
From: Zhao Zhili Fixes ticket #9816. Regression since ed0001482a74b60f3d5bc5. Prediction value larger than INT32_MAX should be treated as negative. The code already depends on undefined right shift behavior before the patch, which doesn't get fixed by the patch. Signed-off-by: Zhao Zhili

<    2   3   4   5   6   7   8   9   10   >