[FFmpeg-cvslog] avcodec/avcodec: Don't mention removed function
ffmpeg | branch: master | Andreas Rheinhardt | Wed Jun 29 20:35:08 2022 +0200| [9a167a15c7918d56a6a1f8d26ea17649566befb8] | committer: Andreas Rheinhardt avcodec/avcodec: Don't mention removed function avcodec_thread_init() has been removed in 9a79bb552a518f26bec1b5306a03b76076bcf8eb. Reviewed-by: Anton Khirnov Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a167a15c7918d56a6a1f8d26ea17649566befb8 --- libavcodec/avcodec.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4dae23d06e..cb5c25bf63 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1518,7 +1518,6 @@ typedef struct AVCodecContext { * It will return only after finishing all tasks. * The user may replace this with some multithreaded implementation, * the default implementation will execute the parts serially. - * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. * @param c context passed also to func * @param count the number of things to execute * @param arg2 argument passed unchanged to func ___ 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/hevcdec: Return immediately upon hevc_init_context() failure
ffmpeg | branch: master | Andreas Rheinhardt | Wed Jun 29 13:29:56 2022 +0200| [03b2ed9a50dc6cbf332a2d93e4c8811b88e6df7f] | committer: Andreas Rheinhardt avcodec/hevcdec: Return immediately upon hevc_init_context() failure This function is only called from the decoder's init function and given that this decoder has FF_CODEC_CAP_INIT_CLEANUP set, hevc_decode_free() is called automatically (currently it would be called twice with the second call being redundant). Reviewed-by: Anton Khirnov Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03b2ed9a50dc6cbf332a2d93e4c8811b88e6df7f --- libavcodec/hevcdec.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 7ab012d68f..7037048d53 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3647,34 +3647,34 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) s->HEVClcList = av_mallocz(sizeof(HEVCLocalContext*) * s->threads_number); s->sList = av_mallocz(sizeof(HEVCContext*) * s->threads_number); if (!s->HEVClc || !s->HEVClcList || !s->sList) -goto fail; +return AVERROR(ENOMEM); s->HEVClcList[0] = s->HEVClc; s->sList[0] = s; s->cabac_state = av_malloc(HEVC_CONTEXTS); if (!s->cabac_state) -goto fail; +return AVERROR(ENOMEM); s->output_frame = av_frame_alloc(); if (!s->output_frame) -goto fail; +return AVERROR(ENOMEM); for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { s->DPB[i].frame = av_frame_alloc(); if (!s->DPB[i].frame) -goto fail; +return AVERROR(ENOMEM); s->DPB[i].tf.f = s->DPB[i].frame; s->DPB[i].frame_grain = av_frame_alloc(); if (!s->DPB[i].frame_grain) -goto fail; +return AVERROR(ENOMEM); } s->max_ra = INT_MAX; s->md5_ctx = av_md5_alloc(); if (!s->md5_ctx) -goto fail; +return AVERROR(ENOMEM); ff_bswapdsp_init(&s->bdsp); @@ -3684,10 +3684,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) ff_hevc_reset_sei(&s->sei); return 0; - -fail: -hevc_decode_free(avctx); -return AVERROR(ENOMEM); } #if HAVE_THREADS ___ 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/hevcdec: Remove redundant context_initialized
ffmpeg | branch: master | Andreas Rheinhardt | Wed Jun 29 13:14:39 2022 +0200| [a3b833c3ea9caf54d1a07980343bb82d9337105f] | committer: Andreas Rheinhardt avcodec/hevcdec: Remove redundant context_initialized All contexts are always initialized during init, regardless of whether frame threading is in use or not. Reviewed-by: Anton Khirnov Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3b833c3ea9caf54d1a07980343bb82d9337105f --- libavcodec/hevcdec.c | 7 --- libavcodec/hevcdec.h | 1 - 2 files changed, 8 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index e84c30dd13..7ab012d68f 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3679,7 +3679,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) ff_bswapdsp_init(&s->bdsp); s->dovi_ctx.logctx = avctx; -s->context_initialized = 1; s->eos = 0; ff_hevc_reset_sei(&s->sei); @@ -3699,12 +3698,6 @@ static int hevc_update_thread_context(AVCodecContext *dst, HEVCContext *s0 = src->priv_data; int i, ret; -if (!s->context_initialized) { -ret = hevc_init_context(dst); -if (ret < 0) -return ret; -} - for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ff_hevc_unref_frame(s, &s->DPB[i], ~0); if (s0->DPB[i].frame->buf[0]) { diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index de861b88b3..ff2199aa5a 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -563,7 +563,6 @@ typedef struct HEVCContext { // type of the first VCL NAL of the current frame enum HEVCNALUnitType first_nal_type; -uint8_t context_initialized; int is_nalff; ///< this flag is != 0 if bitstream is encapsulated ///< as a format defined in 14496-15 int apply_defdispwin; ___ 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/exrenc: add grayf32 format support
ffmpeg | branch: master | Paul B Mahol | Thu Jun 30 15:04:24 2022 +0200| [3f72155fc664b6abccd194d71cbec44183ab64d9] | committer: Paul B Mahol avcodec/exrenc: add grayf32 format support > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f72155fc664b6abccd194d71cbec44183ab64d9 --- libavcodec/exrenc.c | 8 1 file changed, 8 insertions(+) diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c index 459afebb82..9138684bcb 100644 --- a/libavcodec/exrenc.c +++ b/libavcodec/exrenc.c @@ -54,8 +54,10 @@ enum ExrPixelType { static const char abgr_chlist[4] = { 'A', 'B', 'G', 'R' }; static const char bgr_chlist[4] = { 'B', 'G', 'R', 'A' }; +static const char y_chlist[4] = { 'Y' }; static const uint8_t gbra_order[4] = { 3, 1, 0, 2 }; static const uint8_t gbr_order[4] = { 1, 0, 2, 0 }; +static const uint8_t y_order[4] = { 0 }; typedef struct EXRScanlineData { uint8_t *compressed_data; @@ -106,6 +108,11 @@ static int encode_init(AVCodecContext *avctx) s->ch_names = abgr_chlist; s->ch_order = gbra_order; break; +case AV_PIX_FMT_GRAYF32: +s->planes = 1; +s->ch_names = y_chlist; +s->ch_order = y_order; +break; default: av_assert0(0); } @@ -546,6 +553,7 @@ const FFCodec ff_exr_encoder = { FF_CODEC_ENCODE_CB(encode_frame), .close = encode_close, .p.pix_fmts = (const enum AVPixelFormat[]) { + AV_PIX_FMT_GRAYF32, AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, AV_PIX_FMT_NONE }, ___ 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/ac3_parser{,_internal}: expose AC-3 bit_rate_code
ffmpeg | branch: master | Jan Ekström | Fri Jun 3 12:34:47 2022 +0300| [92dc9c9d682a3f7f552d61cdbfca7ae6607de0ee] | committer: Jan Ekström avcodec/ac3_parser{,_internal}: expose AC-3 bit_rate_code Required by MP4's AC3SpecificBox and MPEG-TS AC-3 audio_descriptor, of which the former is implemented in our MP4 writer. Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92dc9c9d682a3f7f552d61cdbfca7ae6607de0ee --- libavcodec/ac3_parser.c | 5 - libavcodec/ac3_parser_internal.h | 1 + libavcodec/version.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 119b1598c5..4f154bb7c4 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -70,6 +70,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) return AAC_AC3_PARSE_ERROR_BSID; hdr->num_blocks = 6; +hdr->ac3_bit_rate_code = -1; /* set default mix levels */ hdr->center_mix_level = 5; // -4.5dB @@ -89,6 +90,8 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) if(frame_size_code > 37) return AAC_AC3_PARSE_ERROR_FRAME_SIZE; +hdr->ac3_bit_rate_code = (frame_size_code >> 1); + skip_bits(gbc, 5); // skip bsid, already got it hdr->bitstream_mode = get_bits(gbc, 3); @@ -106,7 +109,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; -hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; +hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->ac3_bit_rate_code] * 1000) >> hdr->sr_shift; hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT; diff --git a/libavcodec/ac3_parser_internal.h b/libavcodec/ac3_parser_internal.h index dd57dc95a6..bd4e1bbffb 100644 --- a/libavcodec/ac3_parser_internal.h +++ b/libavcodec/ac3_parser_internal.h @@ -60,6 +60,7 @@ typedef struct AC3HeaderInfo { uint8_t channels; uint16_t frame_size; uint64_t channel_layout; +int8_t ac3_bit_rate_code; /** @} */ } AC3HeaderInfo; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0ef6c991f3..1008fead27 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 34 +#define LIBAVCODEC_VERSION_MINOR 35 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ 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] {configure,avformat/movenc}: enable AC-3 parser for movenc
ffmpeg | branch: master | Jan Ekström | Wed May 4 13:51:09 2022 +0300| [3bb23a8b3cee3a59028854f2821cbdc3152cff71] | committer: Jan Ekström {configure,avformat/movenc}: enable AC-3 parser for movenc This simplifies the code to no longer have #ifs in a manner which does not require handling avpriv_ac3_parse_header returning ENOSYS. As an existing example, the MPEG-TS muxer already requires the AC-3 parser, and in order to fix existing issues with the current AC-3 movenc code, switching to use the AC-3 parser is required, so this is an enabling change for that. Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3bb23a8b3cee3a59028854f2821cbdc3152cff71 --- configure| 2 +- libavformat/movenc.c | 4 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/configure b/configure index 0de9b2abcb..fea512e8ef 100755 --- a/configure +++ b/configure @@ -3444,7 +3444,7 @@ mlp_demuxer_select="mlp_parser" mmf_muxer_select="riffenc" mov_demuxer_select="iso_media riffdec" mov_demuxer_suggest="zlib" -mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf" +mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" mp3_demuxer_select="mpegaudio_parser" mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 106b5a6807..b799491fd4 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -408,7 +408,6 @@ struct eac3_info { } substream[1]; /* TODO: support 8 independent substreams */ }; -#if CONFIG_AC3_PARSER static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) { AC3HeaderInfo *hdr = NULL; @@ -549,7 +548,6 @@ end: return ret; } -#endif static int mov_write_eac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track) { @@ -6093,7 +6091,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } -#if CONFIG_AC3_PARSER } else if (par->codec_id == AV_CODEC_ID_EAC3) { size = handle_eac3(mov, pkt, trk); if (size < 0) @@ -6101,7 +6098,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) else if (!size) goto end; avio_write(pb, pkt->data, size); -#endif } else if (par->codec_id == AV_CODEC_ID_EIA_608) { size = 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] avformat/movenc: move eac3_info definition so that it can be used for AC-3
ffmpeg | branch: master | Jan Ekström | Fri May 27 09:20:24 2022 +0300| [b6897e9c082687634c78e4c133f21c3baea16415] | committer: Jan Ekström avformat/movenc: move eac3_info definition so that it can be used for AC-3 Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6897e9c082687634c78e4c133f21c3baea16415 --- libavformat/movenc.c | 66 ++-- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8316fd9a45..b9e3f1a63e 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -328,6 +328,39 @@ static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) return 0x11; } +struct eac3_info { +AVPacket *pkt; +uint8_t ec3_done; +uint8_t num_blocks; + +/* Layout of the EC3SpecificBox */ +/* maximum bitrate */ +uint16_t data_rate; +int8_t ac3_bit_rate_code; +/* number of independent substreams */ +uint8_t num_ind_sub; +struct { +/* sample rate code (see ff_ac3_sample_rate_tab) 2 bits */ +uint8_t fscod; +/* bit stream identification 5 bits */ +uint8_t bsid; +/* one bit reserved */ +/* audio service mixing (not supported yet) 1 bit */ +/* bit stream mode 3 bits */ +uint8_t bsmod; +/* audio coding mode 3 bits */ +uint8_t acmod; +/* sub woofer on 1 bit */ +uint8_t lfeon; +/* 3 bits reserved */ +/* number of dependent substreams associated with this substream 4 bits */ +uint8_t num_dep_sub; +/* channel locations of the dependent substream(s), if any, 9 bits */ +uint16_t chan_loc; +/* if there is no dependent substream, then one bit reserved instead */ +} substream[1]; /* TODO: support 8 independent substreams */ +}; + static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track) { GetBitContext gbc; @@ -376,39 +409,6 @@ static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *trac return 11; } -struct eac3_info { -AVPacket *pkt; -uint8_t ec3_done; -uint8_t num_blocks; - -/* Layout of the EC3SpecificBox */ -/* maximum bitrate */ -uint16_t data_rate; -int8_t ac3_bit_rate_code; -/* number of independent substreams */ -uint8_t num_ind_sub; -struct { -/* sample rate code (see ff_ac3_sample_rate_tab) 2 bits */ -uint8_t fscod; -/* bit stream identification 5 bits */ -uint8_t bsid; -/* one bit reserved */ -/* audio service mixing (not supported yet) 1 bit */ -/* bit stream mode 3 bits */ -uint8_t bsmod; -/* audio coding mode 3 bits */ -uint8_t acmod; -/* sub woofer on 1 bit */ -uint8_t lfeon; -/* 3 bits reserved */ -/* number of dependent substreams associated with this substream 4 bits */ -uint8_t num_dep_sub; -/* channel locations of the dependent substream(s), if any, 9 bits */ -uint16_t chan_loc; -/* if there is no dependent substream, then one bit reserved instead */ -} substream[1]; /* TODO: support 8 independent substreams */ -}; - static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) { AC3HeaderInfo *hdr = 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] avformat/movenc: utilize existing AC-3 parsing workflow for AC-3
ffmpeg | branch: master | Jan Ekström | Fri May 6 17:25:15 2022 +0300| [3854c58d9e55ba297b47c1840c159cd39b373b6a] | committer: Jan Ekström avformat/movenc: utilize existing AC-3 parsing workflow for AC-3 Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3854c58d9e55ba297b47c1840c159cd39b373b6a --- libavformat/movenc.c | 46 ++ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9e3f1a63e..96a34b75b0 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -363,44 +363,34 @@ struct eac3_info { static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track) { -GetBitContext gbc; +struct eac3_info *info = track->eac3_priv; PutBitContext pbc; uint8_t buf[3]; -int fscod, bsid, bsmod, acmod, lfeon, frmsizecod; -if (track->vos_len < 7) { +if (!info || !info->ec3_done) { av_log(s, AV_LOG_ERROR, "Cannot write moov atom before AC3 packets." " Set the delay_moov flag to fix this.\n"); return AVERROR(EINVAL); } +if (info->ac3_bit_rate_code < 0) { +av_log(s, AV_LOG_ERROR, + "No valid AC3 bit rate code for data rate of %d!\n", + info->data_rate); +return AVERROR(EINVAL); +} + avio_wb32(pb, 11); ffio_wfourcc(pb, "dac3"); -init_get_bits(&gbc, track->vos_data + 4, (track->vos_len - 4) * 8); -fscod = get_bits(&gbc, 2); -frmsizecod = get_bits(&gbc, 6); -bsid = get_bits(&gbc, 5); -bsmod = get_bits(&gbc, 3); -acmod = get_bits(&gbc, 3); -if (acmod == 2) { -skip_bits(&gbc, 2); // dsurmod -} else { -if ((acmod & 1) && acmod != 1) -skip_bits(&gbc, 2); // cmixlev -if (acmod & 4) -skip_bits(&gbc, 2); // surmixlev -} -lfeon = get_bits1(&gbc); - init_put_bits(&pbc, buf, sizeof(buf)); -put_bits(&pbc, 2, fscod); -put_bits(&pbc, 5, bsid); -put_bits(&pbc, 3, bsmod); -put_bits(&pbc, 3, acmod); -put_bits(&pbc, 1, lfeon); -put_bits(&pbc, 5, frmsizecod >> 1); // bit_rate_code +put_bits(&pbc, 2, info->substream[0].fscod); +put_bits(&pbc, 5, info->substream[0].bsid); +put_bits(&pbc, 3, info->substream[0].bsmod); +put_bits(&pbc, 3, info->substream[0].acmod); +put_bits(&pbc, 1, info->substream[0].lfeon); +put_bits(&pbc, 5, info->ac3_bit_rate_code); // bit_rate_code put_bits(&pbc, 5, 0); // reserved flush_put_bits(&pbc); @@ -6029,8 +6019,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) if ((par->codec_id == AV_CODEC_ID_DNXHD || par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_HEVC || - par->codec_id == AV_CODEC_ID_TRUEHD || - par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len && + par->codec_id == AV_CODEC_ID_TRUEHD) && !trk->vos_len && !TAG_IS_AVCI(trk->tag)) { /* copy frame to create needed atoms */ trk->vos_len = size; @@ -6107,7 +6096,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } -} else if (par->codec_id == AV_CODEC_ID_EAC3) { +} else if (par->codec_id == AV_CODEC_ID_AC3 || + par->codec_id == AV_CODEC_ID_EAC3) { size = handle_eac3(mov, pkt, trk); if (size < 0) return size; ___ 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: enable handle_eac3 to handle AC-3 tracks
ffmpeg | branch: master | Jan Ekström | Wed Jun 1 09:45:54 2022 +0300| [ad1672529faf6579bd8f28167582587511c4f795] | committer: Jan Ekström avformat/movenc: enable handle_eac3 to handle AC-3 tracks Add the AC-3 frame type, as well as early exit from additional packet parsing in case of AC-3, as only a single packet is required to get the required information. Additionally, expose ac3_bit_rate_code via the eac3_info struct as it is required for AC3SpecificBox. Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad1672529faf6579bd8f28167582587511c4f795 --- libavformat/movenc.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b799491fd4..8316fd9a45 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -384,6 +384,7 @@ struct eac3_info { /* Layout of the EC3SpecificBox */ /* maximum bitrate */ uint16_t data_rate; +int8_t ac3_bit_rate_code; /* number of independent substreams */ uint8_t num_ind_sub; struct { @@ -414,8 +415,12 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) struct eac3_info *info; int num_blocks, ret; -if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info -return AVERROR(ENOMEM); +if (!track->eac3_priv) { +if (!(track->eac3_priv = av_mallocz(sizeof(*info +return AVERROR(ENOMEM); + +((struct eac3_info *)track->eac3_priv)->ac3_bit_rate_code = -1; +} info = track->eac3_priv; if (!info->pkt && !(info->pkt = av_packet_alloc())) @@ -432,6 +437,8 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) } info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000); +info->ac3_bit_rate_code = FFMAX(info->ac3_bit_rate_code, +hdr->ac3_bit_rate_code); num_blocks = hdr->num_blocks; if (!info->ec3_done) { @@ -443,7 +450,8 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) /* this should always be the case, given that our AC-3 parser * concatenates dependent frames to their independent parent */ -if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) { +if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT || +hdr->frame_type == EAC3_FRAME_TYPE_AC3_CONVERT) { /* substream ids must be incremental */ if (hdr->substreamid > info->num_ind_sub + 1) { ret = AVERROR(EINVAL); @@ -475,6 +483,14 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) info->substream[hdr->substreamid].acmod = hdr->channel_mode; info->substream[hdr->substreamid].lfeon = hdr->lfe_on; +if (track->par->codec_id == AV_CODEC_ID_AC3) { +// with AC-3 we only require the information of a single packet, +// so we can finish as soon as the basic values of the bit stream +// have been set to the track's informational structure. +info->ec3_done = 1; +goto concatenate; +} + /* Parse dependent substream(s), if any */ if (pkt->size != hdr->frame_size) { int cumul_size = hdr->frame_size; ___ 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: handle OOM situations when parsing AC-3 headers
ffmpeg | branch: master | Jan Ekström | Fri May 6 17:03:04 2022 +0300| [c9de096851803d45444ae9dfe3a390a2d53ac71b] | committer: Jan Ekström avformat/movenc: handle OOM situations when parsing AC-3 headers Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9de096851803d45444ae9dfe3a390a2d53ac71b --- libavformat/movenc.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 96a34b75b0..a942271beb 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -416,7 +416,10 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) if (!info->pkt && !(info->pkt = av_packet_alloc())) return AVERROR(ENOMEM); -if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) { +if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0)) { +if (ret == AVERROR(ENOMEM)) +goto end; + /* drop the packets until we see a good one */ if (!track->entry) { av_log(mov->fc, AV_LOG_WARNING, "Dropping invalid packet from start of the stream\n"); ___ 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: limit ISOBMFF AC-3 mapping to bsids <=8
ffmpeg | branch: master | Jan Ekström | Wed Jun 22 09:58:27 2022 +0300| [5eb8da6a81a11909d3908b47a9620096b8f3d654] | committer: Jan Ekström avformat/movenc: limit ISOBMFF AC-3 mapping to bsids <=8 This leaves out RealAudio DolbyNet, which utilizes bsids 9 and 10, It is not clear whether the interpreted bit rate value (divided by 2 or 4 depending on the variant), or the original bit rate value should be utilized to receive the bit_rate_code index. Signed-off-by: Jan Ekström > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5eb8da6a81a11909d3908b47a9620096b8f3d654 --- libavformat/movenc.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index a942271beb..0ef6b3c76e 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -374,6 +374,14 @@ static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *trac return AVERROR(EINVAL); } +if (info->substream[0].bsid > 8) { +av_log(s, AV_LOG_ERROR, + "RealAudio AC-3/DolbyNet with bsid %d is not defined by the " + "ISOBMFF specification in ETSI TS 102 366!\n", + info->substream[0].bsid); +return AVERROR(EINVAL); +} + if (info->ac3_bit_rate_code < 0) { av_log(s, AV_LOG_ERROR, "No valid AC3 bit rate code for data rate of %d!\n", ___ 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: Fix invalid check
ffmpeg | branch: master | Andreas Rheinhardt | Thu Jun 30 22:09:55 2022 +0200| [e4be88704f617c8fccf87068037726debb56985e] | committer: Andreas Rheinhardt avformat/movenc: Fix invalid check Regression since c9de096851803d45444ae9dfe3a390a2d53ac71b. Fixes Coverity ID 1506839. Reviewed-by: Jan Ekström Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4be88704f617c8fccf87068037726debb56985e --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0ef6b3c76e..a4dace7c1d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -424,7 +424,7 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) if (!info->pkt && !(info->pkt = av_packet_alloc())) return AVERROR(ENOMEM); -if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0)) { +if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size)) < 0) { if (ret == AVERROR(ENOMEM)) goto end; ___ 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] Makefile: Prompt for reconfigure on lavc/hwaccels.h modification
ffmpeg | branch: master | Andreas Rheinhardt | Sun Jun 26 10:27:21 2022 +0200| [e9f2eb198bc4b2a623385ba55b169e0f975ccb87] | committer: Andreas Rheinhardt Makefile: Prompt for reconfigure on lavc/hwaccels.h modification Adding a new AVHWAccel also adds a new CONFIG variable for it and said config variables are typically used to calculate the size of stack arrays. In such a context, an undefined CONFIG variable does not evaluate to zero; instead it leads to a compilation failure. Therefore treat this file like the other files containing lists of configurable components and prompt for reconfiguration if it is modified. (E.g. a44fba0b5b3b4090f9238751736198ddd1f0f1d5 led to compilation failures for me.) Reviewed-by: Paul B Mahol Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9f2eb198bc4b2a623385ba55b169e0f975ccb87 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 35365f09d4..61f79e27ae 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,7 @@ tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS) CONFIGURABLE_COMPONENTS = \ $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \ $(SRC_PATH)/libavcodec/bitstream_filters.c \ +$(SRC_PATH)/libavcodec/hwaccels.h \ $(SRC_PATH)/libavcodec/parsers.c\ $(SRC_PATH)/libavformat/protocols.c \ ___ 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/libx264: Avoid duplicating strings
ffmpeg | branch: master | Andreas Rheinhardt | Fri Jun 24 10:22:05 2022 +0200| [bf13a177d2dd8be5287541d0115b303e861241ad] | committer: Andreas Rheinhardt avcodec/libx264: Avoid duplicating strings Also removes some unchecked allocations. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf13a177d2dd8be5287541d0115b303e861241ad --- libavcodec/libx264.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 616d855067..98ec030865 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -62,7 +62,8 @@ typedef struct X264Context { int sei_size; char *preset; char *tune; -char *profile; +const char *profile; +char *profile_opt; char *level; int fastfirstpass; char *wpredp; @@ -832,26 +833,27 @@ static av_cold int X264_init(AVCodecContext *avctx) if (x4->fastfirstpass) x264_param_apply_fastfirstpass(&x4->params); +x4->profile = x4->profile_opt; /* Allow specifying the x264 profile through AVCodecContext. */ if (!x4->profile) switch (avctx->profile) { case FF_PROFILE_H264_BASELINE: -x4->profile = av_strdup("baseline"); +x4->profile = "baseline"; break; case FF_PROFILE_H264_HIGH: -x4->profile = av_strdup("high"); +x4->profile = "high"; break; case FF_PROFILE_H264_HIGH_10: -x4->profile = av_strdup("high10"); +x4->profile = "high10"; break; case FF_PROFILE_H264_HIGH_422: -x4->profile = av_strdup("high422"); +x4->profile = "high422"; break; case FF_PROFILE_H264_HIGH_444: -x4->profile = av_strdup("high444"); +x4->profile = "high444"; break; case FF_PROFILE_H264_MAIN: -x4->profile = av_strdup("main"); +x4->profile = "main"; break; default: break; @@ -1098,7 +1100,7 @@ static av_cold void X264_init_static(FFCodec *codec) static const AVOption options[] = { { "preset","Set the encoding preset (cf. x264 --fullhelp)", OFFSET(preset),AV_OPT_TYPE_STRING, { .str = "medium" }, 0, 0, VE}, { "tune", "Tune the encoding params (cf. x264 --fullhelp)", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, -{ "profile", "Set profile restrictions (cf. x264 --fullhelp) ", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, +{ "profile", "Set profile restrictions (cf. x264 --fullhelp)", OFFSET(profile_opt), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, { "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE}, {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, ___ 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/v4l2_m2m: Check if the file descriptor is valid before closing
ffmpeg | branch: master | Wujian(Chin) | Tue Jun 28 11:15:12 2022 +| [26e7d7b14e7a3912aa0ce59ebab191a9c2d9edfa] | committer: Steven Liu avcodec/v4l2_m2m: Check if the file descriptor is valid before closing Fixes ticket #9507. Reviewed-by: Steven Liu Signed-off-by: wujian_nanjing > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26e7d7b14e7a3912aa0ce59ebab191a9c2d9edfa --- libavcodec/v4l2_m2m.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c index 51932baf84..984936004d 100644 --- a/libavcodec/v4l2_m2m.c +++ b/libavcodec/v4l2_m2m.c @@ -251,7 +251,8 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context) ff_v4l2_context_release(&s->capture); sem_destroy(&s->refsync); -close(s->fd); +if (s->fd >= 0) +close(s->fd); av_frame_unref(s->frame); av_frame_free(&s->frame); av_packet_unref(&s->buf_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".