[FFmpeg-cvslog] configure: Lower Android API level requirement of mediandk
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:35 2024 +0800| [309cff378cdb6961df4f38335f8bf29537331bd6] | committer: Zhao Zhili configure: Lower Android API level requirement of mediandk AImage_delete is introduced in API level 24, while AMediaFormat_new is introduced in API level 21. We only need API level 21 to support NDK mediacodec. This change doesn't break or change of android_camera_indev since camera2ndk still needs API level 24. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=309cff378cdb6961df4f38335f8bf29537331bd6 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 02711bf930..93be64bf1d 100755 --- a/configure +++ b/configure @@ -6645,7 +6645,7 @@ check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 check_lib psapi"windows.h psapi.h"GetProcessMemoryInfo -lpsapi check_lib android android/native_window.h ANativeWindow_acquire -landroid -check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk +check_lib mediandk "stdint.h media/NdkMediaFormat.h" AMediaFormat_new -lmediandk check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk enabled appkit && check_apple_framework AppKit ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: Fix unused variable warning
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:37 2024 +0800| [32fa20c0c924cd941ab3965fb017201581c73df7] | committer: Zhao Zhili avcodec/mediacodec_wrapper: Fix unused variable warning > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32fa20c0c924cd941ab3965fb017201581c73df7 --- libavcodec/mediacodec_wrapper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index a9c8b522e0..96c88a 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -365,6 +365,7 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx) (void)VP9Profile3HDR; (void)VP9Profile2HDR10Plus; (void)VP9Profile3HDR10Plus; +(void)MPEG4ProfileSimpleFace; (void)AV1ProfileMain10; (void)AV1ProfileMain10HDR10; (void)AV1ProfileMain10HDR10Plus; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: Fix return empty packet when bsf is used
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:38 2024 +0800| [a5a3788f562066a830a925d71cdbe8650e457e3b] | committer: Zhao Zhili avcodec/mediacodecenc: Fix return empty packet when bsf is used Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5a3788f562066a830a925d71cdbe8650e457e3b --- libavcodec/mediacodecenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index b59de75b9b..e562181120 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -534,7 +534,7 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return 0; } -if (ret != AVERROR(EAGAIN)) +if (ret < 0 && ret != AVERROR(EAGAIN)) return ret; if (!s->frame->buf[0]) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: link to NDK mediacodec API directly
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:36 2024 +0800| [98b5e80fd6980e641199e9ce3bc27100e2df17a4] | committer: Zhao Zhili avcodec/mediacodec_wrapper: link to NDK mediacodec API directly Drop support of Android version before 5.0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=98b5e80fd6980e641199e9ce3bc27100e2df17a4 --- configure | 2 +- libavcodec/mediacodec_wrapper.c | 164 +--- 2 files changed, 36 insertions(+), 130 deletions(-) diff --git a/configure b/configure index 93be64bf1d..aa78342de6 100755 --- a/configure +++ b/configure @@ -3133,7 +3133,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder" dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32" ffnvcodec_deps_any="libdl LoadLibrary" -mediacodec_deps="android" +mediacodec_deps="android mediandk" nvdec_deps="ffnvcodec" vaapi_x11_deps="xlib_x11" videotoolbox_hwaccel_deps="videotoolbox pthreads" diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 306359071e..a9c8b522e0 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1828,25 +1828,8 @@ typedef struct FFAMediaFormatNdk { void *libmedia; AMediaFormat *impl; -AMediaFormat *(*new)(void); -media_status_t (*delete)(AMediaFormat*); - -const char* (*toString)(AMediaFormat*); - -bool (*getInt32)(AMediaFormat*, const char *name, int32_t *out); -bool (*getInt64)(AMediaFormat*, const char *name, int64_t *out); -bool (*getFloat)(AMediaFormat*, const char *name, float *out); -bool (*getSize)(AMediaFormat*, const char *name, size_t *out); -bool (*getBuffer)(AMediaFormat*, const char *name, void** data, size_t *size); -bool (*getString)(AMediaFormat*, const char *name, const char **out); bool (*getRect)(AMediaFormat *, const char *name, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); - -void (*setInt32)(AMediaFormat*, const char* name, int32_t value); -void (*setInt64)(AMediaFormat*, const char* name, int64_t value); -void (*setFloat)(AMediaFormat*, const char* name, float value); -void (*setString)(AMediaFormat*, const char* name, const char* value); -void (*setBuffer)(AMediaFormat*, const char* name, const void* data, size_t size); void (*setRect)(AMediaFormat *, const char *name, int32_t left, int32_t top, int32_t right, int32_t bottom); } FFAMediaFormatNdk; @@ -1858,34 +1841,6 @@ typedef struct FFAMediaCodecNdk { AMediaCodec *impl; ANativeWindow *window; -AMediaCodec* (*createCodecByName)(const char *name); -AMediaCodec* (*createDecoderByType)(const char *mime_type); -AMediaCodec* (*createEncoderByType)(const char *mime_type); -media_status_t (*delete)(AMediaCodec*); - -media_status_t (*configure)(AMediaCodec *, -const AMediaFormat *format, -ANativeWindow *surface, -AMediaCrypto *crypto, -uint32_t flags); -media_status_t (*start)(AMediaCodec*); -media_status_t (*stop)(AMediaCodec*); -media_status_t (*flush)(AMediaCodec*); - -uint8_t* (*getInputBuffer)(AMediaCodec*, size_t idx, size_t *out_size); -uint8_t* (*getOutputBuffer)(AMediaCodec*, size_t idx, size_t *out_size); - -ssize_t (*dequeueInputBuffer)(AMediaCodec*, int64_t timeoutUs); -media_status_t (*queueInputBuffer)(AMediaCodec*, size_t idx, - long offset, size_t size, - uint64_t time, uint32_t flags); - -ssize_t (*dequeueOutputBuffer)(AMediaCodec*, AMediaCodecBufferInfo *info, int64_t timeoutUs); -AMediaFormat* (*getOutputFormat)(AMediaCodec*); - -media_status_t (*releaseOutputBuffer)(AMediaCodec*, size_t idx, bool render); -media_status_t (*releaseOutputBufferAtTime)(AMediaCodec *mData, size_t idx, int64_t timestampNs); - // Available since API level 28. media_status_t (*getName)(AMediaCodec*, char** out_name); void (*releaseName)(AMediaCodec*, char* name); @@ -1925,38 +1880,15 @@ static FFAMediaFormat *mediaformat_ndk_create(AMediaFormat *impl) #define GET_OPTIONAL_SYMBOL(sym) \ format->sym = dlsym(format->libmedia, "AMediaFormat_" #sym); -#define GET_SYMBOL(sym) \ -GET_OPTIONAL_SYMBOL(sym)\ -if (!format->sym) \ -goto error; - -GET_SYMBOL(new) -GET_SYMBOL(delete) - -GET_SYMBOL(toString) - -GET_SYMBOL(getInt32) -GET_SYMBOL(getInt64) -GET_SYMBOL(getFloat) -GET_SYMBOL(getSize) -GET_SYMBOL(getBuffer) -GET_SYMBOL(getString) GET_OPTIONAL_SYMBOL(getRect) - -GET_SYMBOL(setInt32) -GET_SYMBOL(setInt64) -GET_SYMBOL(setFloat) -GET_SYMBOL(setString) -GET_SYMBOL(setBuffer) GET_OPTIONA
[FFmpeg-cvslog] avcodec/mediacodecenc: Add global header support
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:40 2024 +0800| [9e4991519575b3642e5fa63635f22de8f7c61b8b] | committer: Zhao Zhili avcodec/mediacodecenc: Add global header support The extradata is generated by encoding a dummy frame, then reset the encoder state by mediacodec flush(). It only works for pixel format other than AV_PIX_FMT_MEDIACODEC, since I'm not sure how to create a dummy frame safely with AV_PIX_FMT_MEDIACODEC. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e4991519575b3642e5fa63635f22de8f7c61b8b --- configure | 6 +- libavcodec/mediacodecenc.c | 166 + 2 files changed, 155 insertions(+), 17 deletions(-) diff --git a/configure b/configure index aa78342de6..8101b4fce6 100755 --- a/configure +++ b/configure @@ -3315,6 +3315,7 @@ ac3_mf_encoder_deps="mediafoundation" av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" av1_mediacodec_decoder_deps="mediacodec" av1_mediacodec_encoder_deps="mediacodec" +av1_mediacodec_encoder_select="extract_extradata_bsf" av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" av1_nvenc_encoder_select="atsc_a53" h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" @@ -3325,7 +3326,7 @@ h264_cuvid_decoder_select="h264_mp4toannexb_bsf" h264_mediacodec_decoder_deps="mediacodec" h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" h264_mediacodec_encoder_deps="mediacodec" -h264_mediacodec_encoder_select="h264_metadata" +h264_mediacodec_encoder_select="extract_extradata_bsf h264_metadata" h264_mf_encoder_deps="mediafoundation" h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" @@ -3345,7 +3346,7 @@ hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf" hevc_mediacodec_decoder_deps="mediacodec" hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" hevc_mediacodec_encoder_deps="mediacodec" -hevc_mediacodec_encoder_select="hevc_metadata" +hevc_mediacodec_encoder_select="extract_extradata_bsf hevc_metadata" hevc_mf_encoder_deps="mediafoundation" hevc_nvenc_encoder_deps="nvenc" hevc_nvenc_encoder_select="atsc_a53" @@ -3377,6 +3378,7 @@ mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m" mpeg4_cuvid_decoder_deps="cuvid" mpeg4_mediacodec_decoder_deps="mediacodec" mpeg4_mediacodec_encoder_deps="mediacodec" +mpeg4_mediacodec_encoder_select="extract_extradata_bsf" mpeg4_mmal_decoder_deps="mmal" mpeg4_omx_encoder_deps="omx" mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m" diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 8caaad729a..64816ccf0a 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -23,6 +23,7 @@ #include "config_components.h" #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/hwcontext_mediacodec.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -74,6 +75,7 @@ typedef struct MediaCodecEncContext { int bitrate_mode; int level; int pts_as_dts; +int extract_extradata; } MediaCodecEncContext; enum { @@ -112,6 +114,23 @@ static void mediacodec_output_format(AVCodecContext *avctx) ff_AMediaFormat_delete(out_format); } +static int extract_extradata_support(AVCodecContext *avctx) +{ +const AVBitStreamFilter *bsf = av_bsf_get_by_name("extract_extradata"); + +if (!bsf) { +av_log(avctx, AV_LOG_WARNING, "extract_extradata bsf not found\n"); +return 0; +} + +for (int i = 0; bsf->codec_ids[i] != AV_CODEC_ID_NONE; i++) { +if (bsf->codec_ids[i] == avctx->codec_id) +return 1; +} + +return 0; +} + static int mediacodec_init_bsf(AVCodecContext *avctx) { MediaCodecEncContext *s = avctx->priv_data; @@ -120,20 +139,32 @@ static int mediacodec_init_bsf(AVCodecContext *avctx) int crop_right = s->width - avctx->width; int crop_bottom = s->height - avctx->height; -if (!crop_right && !crop_bottom) +/* Nothing can be done for this format now */ +if (avctx->pix_fmt == AV_PIX_FMT_MEDIACODEC) return 0; -if (avctx->codec_id == AV_CODEC_ID_H264) -ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", - crop_right, crop_bottom); -else if (avctx->codec_id == AV_CODEC_ID_HEVC) -ret = snprintf(str, sizeof(str), "hevc_metadata=crop_right=%d:crop_bottom=%d", - crop_right, crop_bottom); -else +s->extract_extradata = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) && + extract_extradata_support(avctx); +if (!crop_right && !crop_bottom && !s->extract_extradata) return 0; -if (ret >= sizeof(str)) -return AVERROR_BUFFER_TOO_SMALL; +ret = 0; +if (crop_right || crop_bottom) { +if (avctx->codec_id == AV_CODEC_ID_H264) +ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", + crop_right, crop_
[FFmpeg-cvslog] avcodec/mediacodecenc: Remove write only variable
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:39 2024 +0800| [3cfea6993ac5185543d0d1142e93d6f96baee3c0] | committer: Zhao Zhili avcodec/mediacodecenc: Remove write only variable Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3cfea6993ac5185543d0d1142e93d6f96baee3c0 --- libavcodec/mediacodecenc.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index e562181120..8caaad729a 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -352,9 +352,7 @@ bailout: return ret; } -static int mediacodec_receive(AVCodecContext *avctx, - AVPacket *pkt, - int *got_packet) +static int mediacodec_receive(AVCodecContext *avctx, AVPacket *pkt) { MediaCodecEncContext *s = avctx->priv_data; FFAMediaCodec *codec = s->codec; @@ -400,7 +398,7 @@ static int mediacodec_receive(AVCodecContext *avctx, memcpy(s->extradata, out_buf + out_info.offset, out_info.size); ff_AMediaCodec_releaseOutputBuffer(codec, index, false); // try immediately -return mediacodec_receive(avctx, pkt, got_packet); +return mediacodec_receive(avctx, pkt); } ret = ff_get_encode_buffer(avctx, pkt, out_info.size + s->extradata_size, 0); @@ -419,7 +417,6 @@ static int mediacodec_receive(AVCodecContext *avctx, if (out_info.flags & ff_AMediaCodec_getBufferFlagKeyFrame(codec)) pkt->flags |= AV_PKT_FLAG_KEY; ret = 0; -*got_packet = 1; av_log(avctx, AV_LOG_TRACE, "receive packet pts %" PRId64 " dts %" PRId64 " flags %d extradata %d\n", @@ -510,7 +507,6 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) { MediaCodecEncContext *s = avctx->priv_data; int ret; -int got_packet = 0; // Return on three case: // 1. Serious error @@ -525,7 +521,7 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return ret; } -ret = mediacodec_receive(avctx, pkt, &got_packet); +ret = mediacodec_receive(avctx, pkt); if (s->bsf) { if (!ret || ret == AVERROR_EOF) ret = av_bsf_send_packet(s->bsf, pkt); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: add AV_CODEC_CAP_ENCODER_FLUSH support
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:41 2024 +0800| [66161166dccd9f9d6c1d0fa39edb0d170aff52d1] | committer: Zhao Zhili avcodec/mediacodecenc: add AV_CODEC_CAP_ENCODER_FLUSH support Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66161166dccd9f9d6c1d0fa39edb0d170aff52d1 --- libavcodec/mediacodecenc.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 64816ccf0a..c87a0d86c5 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -705,6 +705,15 @@ static av_cold int mediacodec_close(AVCodecContext *avctx) return 0; } +static av_cold void mediacodec_flush(AVCodecContext *avctx) +{ +MediaCodecEncContext *s = avctx->priv_data; +if (s->bsf) +av_bsf_flush(s->bsf); +av_frame_unref(s->frame); +ff_AMediaCodec_flush(s->codec); +} + static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = { &(const AVCodecHWConfigInternal) { .public = { @@ -755,13 +764,15 @@ const FFCodec ff_ ## short_name ## _mediacodec_encoder = { \ CODEC_LONG_NAME(long_name " Android MediaCodec encoder"), \ .p.type = AVMEDIA_TYPE_VIDEO, \ .p.id = codec_id, \ -.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY \ -| AV_CODEC_CAP_HARDWARE,\ +.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | \ +AV_CODEC_CAP_HARDWARE | \ +AV_CODEC_CAP_ENCODER_FLUSH, \ .priv_data_size = sizeof(MediaCodecEncContext), \ .p.pix_fmts = avc_pix_fmts, \ .init = mediacodec_init,\ FF_CODEC_RECEIVE_PACKET_CB(mediacodec_encode), \ .close= mediacodec_close, \ +.flush= mediacodec_flush, \ .p.priv_class = &short_name ## _mediacodec_class, \ .caps_internal= FF_CODEC_CAP_INIT_CLEANUP, \ .p.wrapper_name = "mediacodec", \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools: Fix implicit-const-int-float-conversion warning
ffmpeg | branch: master | Zhao Zhili | Wed Apr 17 12:37:42 2024 +0800| [1b416311852c085bd91743486df2086f508efdcd] | committer: Zhao Zhili fftools: Fix implicit-const-int-float-conversion warning Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b416311852c085bd91743486df2086f508efdcd --- fftools/cmdutils.c | 2 +- fftools/ffmpeg_opt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 2120fc7935..a8f5c6d89b 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -311,7 +311,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, *(int *)dst = num; } else if (po->type == OPT_TYPE_INT64) { -ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, INT64_MAX, &num); +ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, (double)INT64_MAX, &num); if (ret < 0) goto finish; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 6526e8e3e8..910e4a336b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -317,7 +317,7 @@ static int opt_filter_threads(void *optctx, const char *opt, const char *arg) static int opt_abort_on(void *optctx, const char *opt, const char *arg) { static const AVOption opts[] = { -{ "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, +{ "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, (double)INT64_MAX, .unit = "flags" }, { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT}, .unit = "flags" }, { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" }, { NULL }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: Fix return empty packet when bsf is used
ffmpeg | branch: release/7.0 | Zhao Zhili | Wed Apr 17 12:37:38 2024 +0800| [13e93ffbfd08598b8952aa7ce42ec4abe6d5ebfd] | committer: Zhao Zhili avcodec/mediacodecenc: Fix return empty packet when bsf is used Signed-off-by: Zhao Zhili (cherry picked from commit a5a3788f562066a830a925d71cdbe8650e457e3b) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13e93ffbfd08598b8952aa7ce42ec4abe6d5ebfd --- libavcodec/mediacodecenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 984014f1b1..fcb84ef0ac 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -533,7 +533,7 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return 0; } -if (ret != AVERROR(EAGAIN)) +if (ret < 0 && ret != AVERROR(EAGAIN)) return ret; if (!s->frame->buf[0]) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/aac/aacdec: remove double colon
ffmpeg | branch: master | James Almer | Tue Apr 23 11:02:00 2024 -0300| [63702d5f9c92b69dcd07c84d4d870f4e4544bf9f] | committer: James Almer avcodec/aac/aacdec: remove double colon Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63702d5f9c92b69dcd07c84d4d870f4e4544bf9f --- libavcodec/aac/aacdec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aac/aacdec.h b/libavcodec/aac/aacdec.h index 9d04f25108..4cf764e2e9 100644 --- a/libavcodec/aac/aacdec.h +++ b/libavcodec/aac/aacdec.h @@ -75,13 +75,13 @@ enum CouplingPoint { union { \ int RENAME_FIXED(name) elems; \ float name elems; \ -}; +} #define INTFLOAT_ALIGNED_UNION(alignment, name, nb_elems)\ union { \ DECLARE_ALIGNED(alignment, int, RENAME_FIXED(name))[nb_elems]; \ DECLARE_ALIGNED(alignment, float, name)[nb_elems]; \ -}; +} /** * Long Term Prediction */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/movenc: remove one level of indentation
ffmpeg | branch: master | James Almer | Tue Apr 23 12:46:49 2024 -0300| [ce33a5f16d7aebe18394c4f158a020da36055a23] | committer: James Almer avformat/movenc: remove one level of indentation Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce33a5f16d7aebe18394c4f158a020da36055a23 --- libavformat/movenc.c | 57 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 1a0502bbb1..e9bbfd67cf 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6672,6 +6672,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s, #if CONFIG_IAMFENC static int mov_build_iamf_packet(AVFormatContext *s, MOVTrack *trk, AVPacket *pkt) { +uint8_t *data; int ret; if (pkt->stream_index == trk->first_iamf_idx) { @@ -6685,40 +6686,34 @@ static int mov_build_iamf_packet(AVFormatContext *s, MOVTrack *trk, AVPacket *pk if (ret < 0) return ret; -if (pkt->stream_index == trk->last_iamf_idx) { -uint8_t *data; - -ret = avio_close_dyn_buf(trk->iamf_buf, &data); -trk->iamf_buf = NULL; - -if (!ret) { -if (pkt->size) { -// Either all or none of the packets for a single -// IA Sample may be empty. -av_log(s, AV_LOG_ERROR, "Unexpected packet from " -"stream #%d\n", pkt->stream_index); -ret = AVERROR_INVALIDDATA; -} -av_free(data); -return ret; -} -av_buffer_unref(&pkt->buf); -pkt->buf = av_buffer_create(data, ret, NULL, NULL, 0); -if (!pkt->buf) { -av_free(data); -return AVERROR(ENOMEM); +if (pkt->stream_index != trk->last_iamf_idx) +return AVERROR(EAGAIN); + +ret = avio_close_dyn_buf(trk->iamf_buf, &data); +trk->iamf_buf = NULL; +if (!ret) { +if (pkt->size) { +// Either all or none of the packets for a single +// IA Sample may be empty. +av_log(s, AV_LOG_ERROR, "Unexpected packet from " + "stream #%d\n", pkt->stream_index); +ret = AVERROR_INVALIDDATA; } -pkt->data = data; -pkt->size = ret; -pkt->stream_index = trk->first_iamf_idx; +av_free(data); +return ret; +} -ret = avio_open_dyn_buf(&trk->iamf_buf); -if (ret < 0) -return ret; -} else -ret = AVERROR(EAGAIN); +av_buffer_unref(&pkt->buf); +pkt->buf = av_buffer_create(data, ret, NULL, NULL, 0); +if (!pkt->buf) { +av_free(data); +return AVERROR(ENOMEM); +} +pkt->data = data; +pkt->size = ret; +pkt->stream_index = trk->first_iamf_idx; -return ret; +return avio_open_dyn_buf(&trk->iamf_buf); } #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Remove .travis.yml
ffmpeg | branch: master | Martin Storsjö | Wed Apr 17 14:45:23 2024 +0300| [cdf71f789b2f94877983f2f2e586e099a7f0e586] | committer: Martin Storsjö Remove .travis.yml Travis is no longer relevant for attempting to run CI jobs in our setup. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdf71f789b2f94877983f2f2e586e099a7f0e586 --- .travis.yml | 30 -- 1 file changed, 30 deletions(-) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 784b7bdf73..00 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: c -sudo: false -os: - - linux - - osx -addons: - apt: -packages: - - nasm - - diffutils -compiler: - - clang - - gcc -matrix: -exclude: -- os: osx - compiler: gcc -cache: - directories: -- ffmpeg-samples -before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi -install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi -script: - - mkdir -p ffmpeg-samples - - ./configure --samples=ffmpeg-samples --cc=$CC - - make -j 8 - - make fate-rsync - - make check -j 8 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc: use HOSTEXESUF when calling print_options
ffmpeg | branch: master | Timo Rothenpieler | Tue Apr 23 23:57:05 2024 +0200| [61f27e5f71f8a972410daf241a9de067d9915ce1] | committer: Timo Rothenpieler doc: use HOSTEXESUF when calling print_options This is neccesary on WSL, and has no averse effects in normal environments. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61f27e5f71f8a972410daf241a9de067d9915ce1 --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 67586e4b74..98d29f1c66 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -60,7 +60,7 @@ GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi) $(GENTEXI): TAG = GENTEXI $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF) - $(M)doc/print_options $* > $@ + $(M)doc/print_options$(HOSTEXESUF) $* > $@ doc/%.html: TAG = HTML doc/%-all.html: TAG = HTML ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tools: add target_enc_fuzzer.c
ffmpeg | branch: master | Michael Niedermayer | Sat Apr 20 02:51:53 2024 +0200| [fb4a1eaadfbf1c212716d4608d5ef2a1833b6c12] | committer: Michael Niedermayer tools: add target_enc_fuzzer.c Sponsored-by: Sovereign Tech Fund Reviewed-by: James Almer Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb4a1eaadfbf1c212716d4608d5ef2a1833b6c12 --- Makefile | 3 + tools/Makefile| 3 + tools/target_enc_fuzzer.c | 203 ++ 3 files changed, 209 insertions(+) diff --git a/Makefile b/Makefile index b309dbc4db..de727cbe00 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,9 @@ $(TOOLS): %$(EXESUF): %.o target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) +target_enc_%_fuzzer$(EXESUF): target_enc_%_fuzzer.o $(FF_DEP_LIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) + tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) diff --git a/tools/Makefile b/tools/Makefile index 72e8e709a8..2a11fa0ae6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -5,6 +5,9 @@ TOOLS-$(CONFIG_ZLIB) += cws2fws tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c $(COMPILE_C) -DFFMPEG_DECODER=$* +tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c + $(COMPILE_C) -DFFMPEG_ENCODER=$* + tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c $(COMPILE_C) -DFFMPEG_BSF=$* diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c new file mode 100644 index 00..4357d37636 --- /dev/null +++ b/tools/target_enc_fuzzer.c @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2024 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Based on target_dec_fuzzer + */ + +#include "config.h" +#include "libavutil/avassert.h" +#include "libavutil/avstring.h" +#include "libavutil/cpu.h" +#include "libavutil/imgutils.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mem.h" + +#include "libavcodec/avcodec.h" +#include "libavcodec/bytestream.h" +#include "libavcodec/codec_internal.h" +#include "libavformat/avformat.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +extern const FFCodec * codec_list[]; + +static void error(const char *err) +{ +fprintf(stderr, "%s", err); +exit(1); +} + +static const FFCodec *c = NULL; + +// Ensure we don't loop forever +const uint32_t maxiteration = 8096; + + +static int encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt) +{ +int ret; + +ret = avcodec_send_frame(enc_ctx, frame); +if (ret < 0) +return ret; + +while (ret >= 0) { +ret = avcodec_receive_packet(enc_ctx, pkt); +if (ret == AVERROR(EAGAIN)) { +return 0; +} else if (ret < 0) { +return ret; +} + +av_packet_unref(pkt); +} +av_assert0(0); +} + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +uint64_t maxpixels_per_frame = 512 * 512; +uint64_t maxpixels; + +const uint8_t *end = data + size; +uint32_t it = 0; +uint64_t nb_samples = 0; +AVDictionary *opts = NULL; + +if (!c) { +#define ENCODER_SYMBOL0(CODEC) ff_##CODEC##_encoder +#define ENCODER_SYMBOL(CODEC) ENCODER_SYMBOL0(CODEC) +extern FFCodec ENCODER_SYMBOL(FFMPEG_ENCODER); +codec_list[0] = &ENCODER_SYMBOL(FFMPEG_ENCODER); + +c = &ENCODER_SYMBOL(FFMPEG_ENCODER); +av_log_set_level(AV_LOG_PANIC); +} + +av_assert0(c->p.type == AVMEDIA_TYPE_VIDEO); + +maxpixels = maxpixels_per_frame * maxiteration; + +maxpixels_per_frame = FFMIN(maxpixels_per_frame , maxpixels); + +AVCodecContext* ctx = avcodec_alloc_context3(&c->p); +if (!ctx) +error("Failed memory allocation"); + +if (ctx->max_pixels == 0 || ctx->max_pixels > maxpixels_per_frame) +ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs + +ctx->pix_fmt = AV_PIX_FMT_YUV420P; +if (size > 1024) { +GetByteCont
[FFmpeg-cvslog] avfilter/signature_lookup: Fix 2 differences to the refernce SW
ffmpeg | branch: master | Michael Niedermayer | Mon Apr 22 00:43:19 2024 +0200| [25cb66369e7b81bd280f0bdd6d51a0e2e11881e3] | committer: Michael Niedermayer avfilter/signature_lookup: Fix 2 differences to the refernce SW Fixes: CID1403227 Division or modulo by float zero Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25cb66369e7b81bd280f0bdd6d51a0e2e11881e3 --- libavfilter/signature_lookup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index ab7320d47f..a3086b38cc 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -496,10 +496,10 @@ static MatchingInfo evaluate_parameters(AVFilterContext *ctx, SignatureContext * continue; /* matching sequence is too short */ if ((double) goodfcount / (double) fcount < sc->thit) continue; -if ((double) goodfcount*0.5 < FFMAX(gooda, goodb)) +if ((double) goodfcount*0.5 <= FFMAX(gooda, goodb)) continue; -meandist = (double) goodfcount / (double) distsum; +meandist = (double) distsum / (double) goodfcount; if (meandist < minmeandist || status == (STATUS_END_REACHED | STATUS_BEGIN_REACHED) || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/signature_lookup: Dont copy uninitialized stuff around
ffmpeg | branch: master | Michael Niedermayer | Mon Apr 22 00:57:43 2024 +0200| [e7174e66ac6025cea4b8e590525314d3aea6a134] | committer: Michael Niedermayer avfilter/signature_lookup: Dont copy uninitialized stuff around Fixes: CID1403238 Uninitialized pointer read Fixes: CID1403239 Uninitialized pointer read Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7174e66ac6025cea4b8e590525314d3aea6a134 --- libavfilter/signature_lookup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index a3086b38cc..a0ca818a9b 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -448,14 +448,14 @@ static MatchingInfo evaluate_parameters(AVFilterContext *ctx, SignatureContext * } if (tolerancecount > 2) { -a = aprev; -b = bprev; if (dir == DIR_NEXT) { /* turn around */ a = infos->first; b = infos->second; dir = DIR_PREV; } else { +a = aprev; +b = bprev; break; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/cbs_h2645: Check NAL space
ffmpeg | branch: master | Michael Niedermayer | Mon Apr 22 03:23:10 2024 +0200| [b91e3c4c908228901b1ec120d59ddf5a86c3b3b8] | committer: Michael Niedermayer avcodec/cbs_h2645: Check NAL space Found-by-reviewing: CID1419833 Untrusted loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b91e3c4c908228901b1ec120d59ddf5a86c3b3b8 --- libavcodec/cbs_h2645.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index fe2e383ff3..1a45d424ba 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -709,7 +709,11 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, start = bytestream2_tell(&gbc); for(i = 0; i < num_nalus; i++) { +if (bytestream2_get_bytes_left(&gbc) < 2) +return AVERROR_INVALIDDATA; size = bytestream2_get_be16(&gbc); +if (bytestream2_get_bytes_left(&gbc) < size) +return AVERROR_INVALIDDATA; bytestream2_skip(&gbc, size); } end = bytestream2_tell(&gbc); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_thumbnail_cuda: Set ret before checking it
ffmpeg | branch: master | Michael Niedermayer | Mon Apr 22 03:09:54 2024 +0200| [02301017d28422e4d0a4badb16f2226e70ec534a] | committer: Michael Niedermayer avfilter/vf_thumbnail_cuda: Set ret before checking it Fixes: CID1418336 Logically dead code Sponsored-by: Sovereign Tech Fund Reviewed-by: Timo Rothenpieler Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02301017d28422e4d0a4badb16f2226e70ec534a --- libavfilter/vf_thumbnail_cuda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_thumbnail_cuda.c b/libavfilter/vf_thumbnail_cuda.c index 0459070800..8efb54f079 100644 --- a/libavfilter/vf_thumbnail_cuda.c +++ b/libavfilter/vf_thumbnail_cuda.c @@ -291,7 +291,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) hist[i] = 4 * hist[i]; } -CHECK_CU(cu->cuCtxPopCurrent(&dummy)); +ret = CHECK_CU(cu->cuCtxPopCurrent(&dummy)); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/test/opt: test the AV_OPT_SERIALIZE_SKIP_DEFAULTS flag
ffmpeg | branch: master | James Almer | Fri Apr 12 19:51:13 2024 -0300| [a9df9f95c43992d60c99cbd2f6bd28a104ed5d0b] | committer: James Almer avutil/test/opt: test the AV_OPT_SERIALIZE_SKIP_DEFAULTS flag Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9df9f95c43992d60c99cbd2f6bd28a104ed5d0b --- libavutil/tests/opt.c | 5 + tests/ref/fate/opt| 1 + 2 files changed, 6 insertions(+) diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c index ccf3a54f96..32301ba842 100644 --- a/libavutil/tests/opt.c +++ b/libavutil/tests/opt.c @@ -279,6 +279,11 @@ int main(void) if (av_opt_serialize(&test_ctx, 0, 0, &buf, '=', ',') >= 0) { printf("%s\n", buf); av_free(buf); +if (av_opt_serialize(&test_ctx, 0, AV_OPT_SERIALIZE_SKIP_DEFAULTS, &buf, '=', ',') >= 0) { +if (strlen(buf)) +printf("%s\n", buf); +av_free(buf); +} } } av_opt_free(&test_ctx); diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt index f4fce1bd49..43bf0929a3 100644 --- a/tests/ref/fate/opt +++ b/tests/ref/fate/opt @@ -179,6 +179,7 @@ Setting entry with key 'array_int' to value '' Setting entry with key 'array_str' to value 'str0|str\|1|str\\2' Setting entry with key 'array_dict' to value 'k00=v00:k01=v\,01,k10=v\\=1\\:0' num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x0001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=1,flt=0.33,dbl=0.33,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str2,array_dict=k00\=v00:k01\=v\\\,01\,k10\=v\=1:0 +flt=0.33,dbl=0.33,array_int= Testing av_set_options_string() Setting options string '' ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/tests/opt: test av_opt_find2()
ffmpeg | branch: master | James Almer | Sat Apr 13 11:18:30 2024 -0300| [855d4b52547b2f8fc38b400e5d18cf44e621e163] | committer: James Almer avutil/tests/opt: test av_opt_find2() Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=855d4b52547b2f8fc38b400e5d18cf44e621e163 --- libavutil/tests/opt.c | 49 + tests/ref/fate/opt| 7 +++ 2 files changed, 56 insertions(+) diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c index 32301ba842..d43391025a 100644 --- a/libavutil/tests/opt.c +++ b/libavutil/tests/opt.c @@ -409,5 +409,54 @@ int main(void) av_opt_free(&test_ctx); } +printf("\nTesting av_opt_find2()\n"); +{ +TestContext test_ctx = { 0 }; +ChildContext child_ctx = { 0 }; +void *target; +const AVOption *opt; + +test_ctx.class = &test_class; +child_ctx.class = &child_class; +test_ctx.child = &child_ctx; + +av_log_set_level(AV_LOG_QUIET); + +// Should succeed. num exists and has opt_flags 1 +opt = av_opt_find2(&test_ctx, "num", NULL, 1, 0, &target); +if (opt && target == &test_ctx) +printf("OK'%s'\n", opt->name); +else +printf("Error 'num'\n"); + +// Should fail. num64 exists but has opt_flags 1, not 2 +opt = av_opt_find(&test_ctx, "num64", NULL, 2, 0); +if (opt) +printf("OK'%s'\n", opt->name); +else +printf("Error 'num64'\n"); + +// Should fail. child_num exists but in a child object we're not searching +opt = av_opt_find(&test_ctx, "child_num", NULL, 0, 0); +if (opt) +printf("OK'%s'\n", opt->name); +else +printf("Error 'child_num'\n"); + +// Should succeed. child_num exists in a child object we're searching +opt = av_opt_find2(&test_ctx, "child_num", NULL, 0, AV_OPT_SEARCH_CHILDREN, &target); +if (opt && target == &child_ctx) +printf("OK'%s'\n", opt->name); +else +printf("Error 'child_num'\n"); + +// Should fail. foo doesn't exist +opt = av_opt_find(&test_ctx, "foo", NULL, 0, 0); +if (opt) +printf("OK'%s'\n", opt->name); +else +printf("Error 'foo'\n"); +} + return 0; } diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt index 43bf0929a3..f780097622 100644 --- a/tests/ref/fate/opt +++ b/tests/ref/fate/opt @@ -449,3 +449,10 @@ Setting options string 'a_very_long_option_name_that_will_need_to_be_ellipsized_ Setting 'a_very_long_option_name_that_will_need_to_be_ellipsized_around_here' to value '42' Option 'a_very_long_option_name_that_will_need_to_be_ellipsized_around_here' not found Error 'a_very_long_option_name_that_will_need_to_be_ellipsized_around_here=42' + +Testing av_opt_find2() +OK'num' +Error 'num64' +Error 'child_num' +OK'child_num' +Error 'foo' ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/opt: add support for children objects in av_opt_serialize
ffmpeg | branch: master | James Almer | Fri Apr 12 19:10:25 2024 -0300| [8616cfe0890e49437d2b373f97a9c791eb1b7c4c] | committer: James Almer avutil/opt: add support for children objects in av_opt_serialize Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8616cfe0890e49437d2b373f97a9c791eb1b7c4c --- doc/APIchanges| 3 +++ libavutil/opt.c | 65 ++- libavutil/opt.h | 1 + libavutil/tests/opt.c | 49 +++--- libavutil/version.h | 2 +- tests/ref/fate/opt| 2 +- 6 files changed, 96 insertions(+), 26 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 63e7a47126..05912d2ed0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-04-11 - xx - lavu 59.16.100 - opt.h + Add AV_OPT_SERIALIZE_SEARCH_CHILDREN. + 2024-04-11 - xx - lavc 61.5.102 - avcodec.h AVCodecContext.decoded_side_data may now be set by libavcodec after calling avcodec_open2(). diff --git a/libavutil/opt.c b/libavutil/opt.c index d11e9d2ac5..ecbf7efe5f 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -2386,26 +2386,22 @@ int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_fla return av_opt_is_set_to_default(target, o); } -int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, - const char key_val_sep, const char pairs_sep) +static int opt_serialize(void *obj, int opt_flags, int flags, int *cnt, + AVBPrint *bprint, const char key_val_sep, const char pairs_sep) { const AVOption *o = NULL; +void *child = NULL; uint8_t *buf; -AVBPrint bprint; -int ret, cnt = 0; +int ret; const char special_chars[] = {pairs_sep, key_val_sep, '\0'}; -if (pairs_sep == '\0' || key_val_sep == '\0' || pairs_sep == key_val_sep || -pairs_sep == '\\' || key_val_sep == '\\') { -av_log(obj, AV_LOG_ERROR, "Invalid separator(s) found."); -return AVERROR(EINVAL); -} - -if (!obj || !buffer) -return AVERROR(EINVAL); - -*buffer = NULL; -av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED); +if (flags & AV_OPT_SERIALIZE_SEARCH_CHILDREN) +while (child = av_opt_child_next(obj, child)) { +ret = opt_serialize(child, opt_flags, flags, cnt, bprint, +key_val_sep, pairs_sep); +if (ret < 0) +return ret; +} while (o = av_opt_next(obj, o)) { if (o->type == AV_OPT_TYPE_CONST) @@ -2417,18 +2413,45 @@ int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, if (flags & AV_OPT_SERIALIZE_SKIP_DEFAULTS && av_opt_is_set_to_default(obj, o) > 0) continue; if ((ret = av_opt_get(obj, o->name, 0, &buf)) < 0) { -av_bprint_finalize(&bprint, NULL); +av_bprint_finalize(bprint, NULL); return ret; } if (buf) { -if (cnt++) -av_bprint_append_data(&bprint, &pairs_sep, 1); -av_bprint_escape(&bprint, o->name, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0); -av_bprint_append_data(&bprint, &key_val_sep, 1); -av_bprint_escape(&bprint, buf, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0); +if ((*cnt)++) +av_bprint_append_data(bprint, &pairs_sep, 1); +av_bprint_escape(bprint, o->name, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0); +av_bprint_append_data(bprint, &key_val_sep, 1); +av_bprint_escape(bprint, buf, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0); av_freep(&buf); } } + +return 0; +} + +int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, + const char key_val_sep, const char pairs_sep) +{ +AVBPrint bprint; +int ret, cnt = 0; + +if (pairs_sep == '\0' || key_val_sep == '\0' || pairs_sep == key_val_sep || +pairs_sep == '\\' || key_val_sep == '\\') { +av_log(obj, AV_LOG_ERROR, "Invalid separator(s) found."); +return AVERROR(EINVAL); +} + +if (!obj || !buffer) +return AVERROR(EINVAL); + +*buffer = NULL; +av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED); + +ret = opt_serialize(obj, opt_flags, flags, &cnt, &bprint, +key_val_sep, pairs_sep); +if (ret < 0) +return ret; + ret = av_bprint_finalize(&bprint, buffer); if (ret < 0) return ret; diff --git a/libavutil/opt.h b/libavutil/opt.h index e6013662f6..855e363091 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -929,6 +929,7 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) #define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x000
[FFmpeg-cvslog] fftools/ffmpeg_mux_init: allow mapping a stream group from one of the inputs
ffmpeg | branch: master | James Almer | Mon Apr 15 12:04:07 2024 -0300| [ecf87dd2309f809cf399421c33d2295c7bd0] | committer: James Almer fftools/ffmpeg_mux_init: allow mapping a stream group from one of the inputs Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ecf87dd2309f809cf399421c33d2295c7bd0 --- doc/ffmpeg.texi | 28 - fftools/ffmpeg_mux_init.c | 154 +- 2 files changed, 177 insertions(+), 5 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index e996ab945f..da37e3ad37 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -663,10 +663,11 @@ Not all muxers support embedded thumbnails, and those who do, only support a few Creates a program with the specified @var{title}, @var{program_num} and adds the specified @var{stream}(s) to it. -@item -stream_group type=@var{type}:st=@var{stream}[:st=@var{stream}][:stg=@var{stream_group}][:id=@var{stream_group_id}...] (@emph{output}) +@item -stream_group [map=@var{input_file_id}=@var{stream_group}][type=@var{type}:]st=@var{stream}[:st=@var{stream}][:stg=@var{stream_group}][:id=@var{stream_group_id}...] (@emph{output}) -Creates a stream group of the specified @var{type}, @var{stream_group_id} and adds the specified -@var{stream}(s) and/or previously defined @var{stream_group}(s) to it. +Creates a stream group of the specified @var{type} and @var{stream_group_id}, or by +@var{map}ping an input group, adding the specified @var{stream}(s) and/or previously +defined @var{stream_group}(s) to it. @var{type} can be one of the following: @table @option @@ -863,6 +864,27 @@ all sub-mix element's @var{annotations}s @end table +E.g. to create an scalable 5.1 IAMF file from several WAV input files +@example +ffmpeg -i front.wav -i back.wav -i center.wav -i lfe.wav +-map 0:0 -map 1:0 -map 2:0 -map 3:0 -c:a opus +-stream_group type=iamf_audio_element:id=1:st=0:st=1:st=2:st=3, +demixing=parameter_id=998, +recon_gain=parameter_id=101, +layer=ch_layout=stereo, +layer=ch_layout=5.1, +-stream_group type=iamf_mix_presentation:id=2:stg=0:annotations=en-us=Mix_Presentation, +submix=parameter_id=100:parameter_rate=48000|element=stg=0:parameter_id=100:annotations=en-us=Scalable_Submix|layout=sound_system=stereo|layout=sound_system=5.1 +-streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 output.iamf +@end example + +To copy the two stream groups (Audio Element and Mix Presentation) from an input IAMF file with four +streams into an mp4 output +@example +ffmpeg -i input.iamf -c:a copy -stream_group map=0=0:st=0:st=1:st=2:st=3 -stream_group map=0=1:stg=0 +-streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 output.mp4 +@end example + @item -target @var{type} (@emph{output}) Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, @code{dv50}). @var{type} may be prefixed with @code{pal-}, @code{ntsc-} or diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 6d8bd5bcdf..a46b0628d8 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -2232,11 +2232,137 @@ fail: return ret; } +static int of_serialize_options(Muxer *mux, void *obj, AVBPrint *bp) +{ +char *ptr; +int ret; + +ret = av_opt_serialize(obj, 0, AV_OPT_SERIALIZE_SKIP_DEFAULTS | AV_OPT_SERIALIZE_SEARCH_CHILDREN, + &ptr, '=', ':'); +if (ret < 0) { +av_log(mux, AV_LOG_ERROR, "Failed to serialize group\n"); +return ret; +} + +av_bprintf(bp, "%s", ptr); +ret = strlen(ptr); +av_free(ptr); + +return ret; +} + +#define SERIALIZE(parent, child) do { \ +ret = of_serialize_options(mux, parent->child, bp); \ +if (ret < 0)\ +return ret; \ +} while (0) + +#define SERIALIZE_LOOP(parent, child, suffix, separator) do {\ +for (int j = 0; j < parent->nb_## child ## suffix; j++) {\ +av_bprintf(bp, separator#child "="); \ +SERIALIZE(parent, child ## suffix[j]); \ +}\ +} while (0) + +static int64_t get_stream_group_index_from_id(Muxer *mux, int64_t id) +{ +AVFormatContext *oc = mux->fc; + +for (unsigned i = 0; i < oc->nb_stream_groups; i++) +if (oc->stream_groups[i]->id == id) +return oc->stream_groups[i]->index; + +return AVERROR(EINVAL); +} + +static int of_map_group(Muxer *mux, AVDictionary **dict, AVBPrint *bp, const char *map) +{ +AVStreamGroup *stg; +int ret, file_idx, stream_idx; +char *ptr; + +file_idx = strtol(map, &ptr, 0); +if (file_idx >= nb_input_files || file_idx < 0 || map == ptr) { +av_log(mux, AV_LOG_ERROR, "Invalid input file index: %d.\n", file_idx); +return AVERROR(EINVAL); +} + +stream
[FFmpeg-cvslog] avcodec/codec_par: always clear extradata_size in avcodec_parameters_to_context()
ffmpeg | branch: master | James Almer | Sat Apr 20 20:26:24 2024 -0300| [c4e3d6cdb066425a5f5a2e05def9470a47a6082c] | committer: James Almer avcodec/codec_par: always clear extradata_size in avcodec_parameters_to_context() Missed in d383ae43c266b160348db04f2fd17ccf30286784. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c4e3d6cdb066425a5f5a2e05def9470a47a6082c --- libavcodec/codec_par.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index 212cb97d77..790ea01d10 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -250,6 +250,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec, } av_freep(&codec->extradata); +codec->extradata_size = 0; if (par->extradata) { codec->extradata = av_mallocz(par->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/demux: extract extradata from packets when context update is requested
ffmpeg | branch: master | James Almer | Sun Apr 21 12:18:51 2024 -0300| [757367e068679e0f2884262ab7c1f53de490e6ad] | committer: James Almer avformat/demux: extract extradata from packets when context update is requested If the demuxer doesn't set extradata in the stream's codecpar, a need_context_update request will delete the previously extracted extradata in the stream's internal AVCodecContext. As we can't ensure the old extradata is valid for the stream in its post context update request state, try to get extradata from the new packet instead of attempting to preserve the old in some form. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=757367e068679e0f2884262ab7c1f53de490e6ad --- libavformat/demux.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c index abfd5fee7d..ecefe7e0a7 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1319,6 +1319,8 @@ fail: return ret; } +static int extract_extradata(FFFormatContext *si, AVStream *st, const AVPacket *pkt); + static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) { FFFormatContext *const si = ffformatcontext(s); @@ -1373,6 +1375,16 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) return ret; } +if (!sti->avctx->extradata) { +sti->extract_extradata.inited = 0; + +ret = extract_extradata(si, st, pkt); +if (ret < 0) { +av_packet_unref(pkt); +return ret; +} +} + sti->codec_desc = avcodec_descriptor_get(sti->avctx->codec_id); sti->need_context_update = 0; @@ -2427,6 +2439,7 @@ static int extract_extradata_init(AVStream *st) if (!ret) goto finish; +av_bsf_free(&sti->extract_extradata.bsf); ret = av_bsf_alloc(f, &sti->extract_extradata.bsf); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/codec_par: always clear extradata_size in avcodec_parameters_to_context()
ffmpeg | branch: release/7.0 | James Almer | Sat Apr 20 20:26:24 2024 -0300| [506fbe681c178560cb4ca65b8645b81a143b7d61] | committer: James Almer avcodec/codec_par: always clear extradata_size in avcodec_parameters_to_context() Missed in d383ae43c266b160348db04f2fd17ccf30286784. Signed-off-by: James Almer (cherry picked from commit c4e3d6cdb066425a5f5a2e05def9470a47a6082c) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=506fbe681c178560cb4ca65b8645b81a143b7d61 --- libavcodec/codec_par.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index 212cb97d77..790ea01d10 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -250,6 +250,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec, } av_freep(&codec->extradata); +codec->extradata_size = 0; if (par->extradata) { codec->extradata = av_mallocz(par->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc/APIchanges: fix date for the latest entry
ffmpeg | branch: master | James Almer | Wed Apr 24 00:18:52 2024 -0300| [725d3b6f170e40c526a832870c3837f52b4ba7e0] | committer: James Almer doc/APIchanges: fix date for the latest entry And add the commit hash while at it. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=725d3b6f170e40c526a832870c3837f52b4ba7e0 --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 05912d2ed0..0566fcdcc5 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,7 +2,7 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: -2024-04-11 - xx - lavu 59.16.100 - opt.h +2024-04-24 - 8616cfe0890 - lavu 59.16.100 - opt.h Add AV_OPT_SERIALIZE_SEARCH_CHILDREN. 2024-04-11 - xx - lavc 61.5.102 - avcodec.h ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vp9: Fix regression introduced in 0ba05857
ffmpeg | branch: master | Haihao Xiang | Mon Apr 22 14:57:08 2024 +0800| [8c62d77139ca07390414fcfd26b2a4d506fed3b9] | committer: Haihao Xiang lavc/vp9: Fix regression introduced in 0ba05857 It is possible that ff_progress_frame_await() is called but ff_progress_frame_report() isn't called when a hardware acceleration method is used, so a thread for vp9 decoding might get stuck. Reviewed-by: Andreas Rheinhardt Signed-off-by: Haihao Xiang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c62d77139ca07390414fcfd26b2a4d506fed3b9 --- libavcodec/vp9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 3adfb98f2d..6e2d18bf95 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -1735,9 +1735,9 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame, if (ret < 0) goto fail; } -ff_progress_frame_report(&s->s.frames[CUR_FRAME].tf, INT_MAX); finish: +ff_progress_frame_report(&s->s.frames[CUR_FRAME].tf, INT_MAX); // ref frame setup for (int i = 0; i < 8; i++) ff_progress_frame_replace(&s->s.refs[i], &s->next_refs[i]); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: set quality in cq mode
ffmpeg | branch: release/6.1 | Zhao Zhili | Sun Dec 17 20:50:53 2023 +0800| [f914c18de502a3bd8a907149f8742605f7798c0c] | committer: Zhao Zhili avcodec/mediacodecenc: set quality in cq mode >From AOSP doc, these values are device and codec specific, but lower values generally result in more efficient (smaller-sized) encoding. For example, global_quality 50 on Pixel 6 results a 1080P 30 FPS HEVC with 3744 kb/s, while global_quality 80 results 28178 kb/s. Fix #10689 Signed-off-by: Zhao Zhili (cherry picked from commit 287e22f745c0b7290ce1e80fc7cd161b41ca6997) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f914c18de502a3bd8a907149f8742605f7798c0c --- libavcodec/mediacodecenc.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index a1ae5d5ec5..7eae542248 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -268,8 +268,11 @@ static av_cold int mediacodec_init(AVCodecContext *avctx) if (avctx->bit_rate) ff_AMediaFormat_setInt32(format, "bitrate", avctx->bit_rate); -if (s->bitrate_mode >= 0) +if (s->bitrate_mode >= 0) { ff_AMediaFormat_setInt32(format, "bitrate-mode", s->bitrate_mode); +if (s->bitrate_mode == BITRATE_MODE_CQ && avctx->global_quality > 0) +ff_AMediaFormat_setInt32(format, "quality", avctx->global_quality); +} // frame-rate and i-frame-interval are required to configure codec if (avctx->framerate.num >= avctx->framerate.den && avctx->framerate.den > 0) { s->fps = avctx->framerate.num / avctx->framerate.den; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".