I think exact conditionals should be more like 61.0.100 but for single test it worked ...
for some reason our x264 failed to encode (segfault) on i686 with AVX ? but x265 worked .... this is not yet for commiting, but more like for testing with ffmpeg git. cc: ffmpeg-devel in case they have better suggestions on fixing our code for upcoming ffmpeg. cingg git URL: git://git.cinelerra-gg.org/goodguy/cinelerra run ./autogen.sh configure: ./configure --with-git-ffmpeg=https://git.ffmpeg.org/ffmpeg.git --with-single-user rm thirdparty/src/ffmpeg.git.patch2 rm thirdparty/src/ffmpeg.git.patch8 make make install run from build directory bin/cin (with DISPLAY variable set) ср, 9 апр. 2025 г., 14:49 Andrew Randrianasulu <randrianas...@gmail.com>: > > ffmpeg shallow git copy > > commit 890b8da1ce27fd365eaffefc7efcbadae9f01f2a > > our patches 2 and 8 fail, but this is not really my point yet .... > > > ffmpeg.C:313:42: error: 'avcodec_close' was not declared in this scope; > did you mean 'avio_close'? > ffmpeg.C:476:33: error: 'avcodec_close' was not declared in this scope; > did you mean 'avio_close'? > ffmpeg.C:1307:37: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'interlaced_frame' > ffmpeg.C:1309:37: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'interlaced_frame' > ffmpeg.C:1309:66: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'top_field_first' > ffmpeg.C:1311:37: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'interlaced_frame' > ffmpeg.C:1311:67: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'top_field_first' > ffmpeg.C:1340:36: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'key_frame' > ffmpeg.C:1512:24: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'interlaced_frame' > ffmpeg.C:1513:24: error: 'AVFrame' {aka 'struct AVFrame'} has no member > named 'top_field_first' > ffmpeg.C:3847:29: error: 'av_stream_get_side_data' was not declared in > this scope; did you mean 'av_frame_get_side_data'? > > mplayer switched for now to branch 7.1 until it get updates. > > i see in doc/APIchanges > > > 2023-05-04 - 0fc9c1f6828 - lavu 58.7.100 - frame.h > Deprecate AVFrame.interlaced_frame, > AVFrame.top_field_first, and > AVFrame.key_frame. > Add AV_FRAME_FLAG_INTERLACED, AV_FRAME_FLAG_TOP_FIELD_FIRST, and > AV_FRAME_FLAG_KEY flags as replacement. > > but not sure how to use them yet. >
diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C index 1f7f027e..1b027a7f 100644 --- a/cinelerra-5.1/cinelerra/bdwrite.C +++ b/cinelerra-5.1/cinelerra/bdwrite.C @@ -2586,7 +2586,11 @@ static int field_probe(AVFormatContext *fmt_ctx, AVStream *st) } ret = avcodec_receive_frame(ctx, ipic); if( ret >= 0 ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) ilaced = ipic->interlaced_frame ? 1 : 0; +#else + ilaced = ipic->flags & AV_FRAME_FLAG_INTERLACED ? 1 : 0; +#endif break; } if( ret != AVERROR(EAGAIN) ) @@ -2769,7 +2773,9 @@ int media_info::scan() ret = scan(fmt_ctx); for( int i=0; i<(int)streams.size(); ++i ) +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(streams[i]->ctx); +#endif avformat_close_input(&fmt_ctx); return ret; diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 075ef4dd..8aee2c2a 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -310,7 +310,9 @@ FFStream::FFStream(FFMPEG *ffmpeg, AVStream *st, int fidx) FFStream::~FFStream() { frm_lock->lock("FFStream::~FFStream"); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if( reading > 0 || writing > 0 ) avcodec_close(avctx); +#endif if( avctx ) avcodec_free_context(&avctx); if( fmt_ctx ) avformat_close_input(&fmt_ctx); if( hw_device_ctx ) av_buffer_unref(&hw_device_ctx); @@ -473,7 +475,9 @@ int FFStream::decode_activate() if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) { ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n", ffmpeg->fmt_ctx->url); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(avctx); +#endif avcodec_free_context(&avctx); av_buffer_unref(&hw_device_ctx); hw_device_ctx = 0; @@ -1303,7 +1307,7 @@ int FFVideoStream::probe(int64_t pos) if( ret > 0 ) { //printf("codec interlace: %i \n",frame->interlaced_frame); //printf("codec tff: %i \n",frame->top_field_first); - +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if (!frame->interlaced_frame) ffmpeg->interlace_from_codec = AV_FIELD_PROGRESSIVE; if ((frame->interlaced_frame) && (frame->top_field_first)) @@ -1311,7 +1315,14 @@ int FFVideoStream::probe(int64_t pos) if ((frame->interlaced_frame) && (!frame->top_field_first)) ffmpeg->interlace_from_codec = AV_FIELD_BB; //printf("Interlace mode from codec: %i\n", ffmpeg->interlace_from_codec); - +#esle + if (!frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) + ffmpeg->interlace_from_codec = AV_FIELD_PROGRESSIVE; + if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) + ffmpeg->interlace_from_codec = AV_FIELD_TT; + if ((frame->flags & AV_FRAME_FLAG_INTERLACED ) && (!frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) + ffmpeg->interlace_from_codec = AV_FIELD_BB; +#endif } if( frame->format == AV_PIX_FMT_NONE || frame->width <= 0 || frame->height <= 0 ) @@ -1337,7 +1348,11 @@ int FFVideoStream::load(VFrame *vframe, int64_t pos) while( ret>=0 && !flushed && curr_pos<=pos && --i>=0 ) { ret = read_frame(frame); if( ret > 0 ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if( frame->key_frame && seeking < 0 ) { +#else + if( (frame->flags & AV_FRAME_FLAG_KEY) && seeking < 0 ) { +#endif int use_cache = ffmpeg->get_use_cache(); if( use_cache < 0 ) { // for reverse read, reload file frame_cache from keyframe to pos @@ -1509,8 +1524,15 @@ int FFVideoStream::drain() int FFVideoStream::encode_frame(AVFrame *frame) { if( frame ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) frame->interlaced_frame = interlaced; frame->top_field_first = top_field_first; +#else + if(top_field_first) + frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; + if(interlaced) + frame->flags |= AV_FRAME_FLAG_INTERLACED; +#endif } if( frame && frame->format == AV_PIX_FMT_VAAPI ) { // ugly int ret = avcodec_send_frame(avctx, frame); @@ -3844,7 +3866,20 @@ double FFVideoStream::get_rotation_angle() #else int size = 0; #endif + +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size); +#else + int32_t *matrix = NULL; + if (!matrix) { + const AVPacketSideData *psd = av_packet_side_data_get(st->codecpar->coded_side_data, + st->codecpar->nb_coded_side_data, + AV_PKT_DATA_DISPLAYMATRIX); + if (psd) + matrix = (int32_t *)psd->data; + } + +#endif int len = size/sizeof(*matrix); if( !matrix || len < 5 ) return 0; const double s = 1/65536.; diff --git a/cinelerra-5.1/cinelerra/fileac3.C b/cinelerra-5.1/cinelerra/fileac3.C index 63654f32..34469aef 100644 --- a/cinelerra-5.1/cinelerra/fileac3.C +++ b/cinelerra-5.1/cinelerra/fileac3.C @@ -191,7 +191,9 @@ int FileAC3::close_file() if(codec_context) { encode_flush(); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(codec_context); +#endif avcodec_free_context(&codec_context); codec = 0; }
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".