[Cin] CinGG and ffmpeg 4.4

Andrew Randrianasulu randrianasulu at gmail.com
Tue May 4 11:35:31 CEST 2021


I tried to add 'const' keyword, it Will not fix All errors but hopefully
reduce their amount?

I installed termux on this Android tablet, and inside termux installed git
and Midnight commander)



On Tuesday, May 4, 2021, Andrew Randrianasulu <randrianasulu at gmail.com>
wrote:

>
>
> On Monday, May 3, 2021, Phyllis Smith via Cin <cin at lists.cinelerra-gg.org>
> wrote:
>
>> Andrea,
>> I am starting to look at this also -- sorry I missed the conversation
>> between you and Andrew and glad you included it here so I can try to
>> follow.  I can at least confirm: "patch4" can be for sure deleted -- the
>> ffmpeg-4.3 patch 4 was deleted from GIT on about 15 October 2020 and
>> ffmpeg.git.patch4 should have been deleted then also.  I will update with
>> progress as I get there but have not used the latest from Andrew yet and
>> currently getting the following errors too:
>>
>> ffmpeg.C:410:44: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:416:44: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:421:35: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:723:11: error: ‘AVStream’ {aka ‘struct AVStream’} has no member
>> named ‘nb_index_entries’
>> ffmpeg.C:723:46: error: ‘AVStream’ {aka ‘struct AVStream’} has no member
>> named ‘index_entries’
>> ffmpeg.C:2092:79: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:2128:71: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:2325:39: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:2333:38: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:2555:31: error: invalid conversion from ‘const AVInputFormat*’
>> to ‘AVInputFormat*’ [-fpermissive]
>> ffmpeg.C:2762:47: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:3008:35: error: ‘AVStream’ {aka ‘struct AVStream’} has no member
>> named ‘codec’
>> ffmpeg.C:3008:10: error: ‘avcodec_copy_context’ was not declared in this
>> scope; did you mean ‘avcodec_free_context’?
>> ffmpeg.C:3654:77: error: cannot convert ‘int*’ to ‘size_t*’ {aka ‘long
>> unsigned int*’}
>> ffmpeg.C:3882:42: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:3888:42: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:3895:50: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> ffmpeg.C:4070:19: error: ‘AVStream’ {aka ‘struct AVStream’} has no member
>> named ‘nb_index_entries’
>> ffmpeg.C:4073:27: error: ‘AVStream’ {aka ‘struct AVStream’} has no member
>> named ‘index_entries’
>>
>> fileffmpeg.C:162:71: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> fileffmpeg.C:193:71: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> fileffmpeg.C:1849:53: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>> fileffmpeg.C:1887:53: error: invalid conversion from ‘const AVCodec*’ to
>> ‘AVCodec*’ [-fpermissive]
>>
>
>
> For those in file ffmpeg  try to add const in front of AVCodec at lines
> 162, 193, 1849 and  1887?
>
> For ffmpeg.C.. Try to add const to same AVCodec but obviously in some
> cases it will be at lines *before* indicated (where for example *dencoder
> of this type was  declared. Like for line 3895 you will find declaration at
> line 3878.. Not sure about
>
> ffmpeg.C:3654:77: error: cannot convert ‘int*’ to ‘size_t*’ {aka ‘long
> unsigned int*’}
>
> May be try to change those int types in function to size_t or something?
>
>
>> On Sun, May 2, 2021 at 10:48 AM Andrew Randrianasulu via Cin <
>> cin at lists.cinelerra-gg.org> wrote:
>>
>>>
>>>
>>> On Sunday, May 2, 2021, Andrea paz via Cin <cin at lists.cinelerra-gg.org>
>>> wrote:
>>>
>>>> Hi, regarding the attempt to use ffmpeg-4.4, I realized that from a
>>>> certain point on the mails became private between Andrew and me and
>>>> therefore they do not appear in the mailing list. I will report here
>>>> the content of those mails, but I anticipate that I could not get
>>>> CinGG to work with ffmpeg-4.4.
>>>>
>>>
>>> ...
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210504/1b78d0b2/attachment.htm>
-------------- next part --------------
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index df39763c..73de0b63 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -404,7 +404,7 @@ int FFStream::decode_activate()
 		}
 		while( ret >= 0 && st != 0 && !reading ) {
 			AVCodecID codec_id = st->codecpar->codec_id;
-			AVCodec *decoder = 0;
+			const AVCodec *decoder = 0;
 			if( is_video() ) {
 				if( ffmpeg->opt_video_decoder )
 					decoder = avcodec_find_decoder_by_name(ffmpeg->opt_video_decoder);
@@ -2089,7 +2089,7 @@ void FFMPEG::scan_audio_options(Asset *asset, EDL *edl)
 		cin_fmt = (int)av_get_sample_fmt(cin_sample_fmt);
 	if( cin_fmt < 0 ) {
 		char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
-		AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
+		const AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
 			avcodec_find_encoder_by_name(audio_codec) : 0;
 		if( av_codec && av_codec->sample_fmts )
 			cin_fmt = find_best_sample_fmt_of_list(av_codec->sample_fmts, AV_SAMPLE_FMT_FLT);
@@ -2125,7 +2125,7 @@ void FFMPEG::scan_video_options(Asset *asset, EDL *edl)
 			cin_fmt = (int)av_get_pix_fmt(cin_pix_fmt);
 	if( cin_fmt < 0 ) {
 		char video_codec[BCSTRLEN];  video_codec[0] = 0;
-		AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
+		const AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
 			avcodec_find_encoder_by_name(video_codec) : 0;
 		if( av_codec && av_codec->pix_fmts ) {
 			if( 0 && edl ) { // frequently picks a bad answer
@@ -2322,7 +2322,7 @@ int FFCodecRemaps::add(const char *val)
 
 int FFCodecRemaps::update(AVCodecID &codec_id, AVCodec *&decoder)
 {
-	AVCodec *codec = avcodec_find_decoder(codec_id);
+	const AVCodec *codec = avcodec_find_decoder(codec_id);
 	if( !codec ) return -1;
 	const char *name = codec->name;
 	FFCodecRemaps &map = *this;
@@ -2542,7 +2542,7 @@ int FFMPEG::init_decoder(const char *filename)
 	char *sp = strrchr(bp, '.');
 	if( !sp ) sp = bp + strlen(bp);
 	FILE *fp = 0;
-	AVInputFormat *ifmt = 0;
+	const AVInputFormat *ifmt = 0;
 	if( sp ) {
 		strcpy(sp, ".opts");
 		fp = fopen(file_opts, "r");
@@ -2759,7 +2759,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 	AVCodecContext *ctx = 0;
 
 	const AVCodecDescriptor *codec_desc = 0;
-	AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
+	const AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
 	if( !codec ) {
 		eprintf(_("cant find codec %s:%s\n"), codec_name, filename);
 		ret = 1;
@@ -3875,7 +3875,7 @@ AVCodecContext *FFMPEG::activate_decoder(AVStream *st)
 	AVDictionary *copts = 0;
 	av_dict_copy(&copts, opts, 0);
 	AVCodecID codec_id = st->codecpar->codec_id;
-	AVCodec *decoder = 0;
+	const AVCodec *decoder = 0;
 	switch( st->codecpar->codec_type ) {
 	case AVMEDIA_TYPE_VIDEO:
 		if( opt_video_decoder )
diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C
index a71d692a..8ac0a77d 100644
--- a/cinelerra-5.1/cinelerra/fileffmpeg.C
+++ b/cinelerra-5.1/cinelerra/fileffmpeg.C
@@ -159,7 +159,7 @@ void FFMpegPixelFormat::update_formats()
 	pixfmts.remove_all_objects();
 	char video_codec[BCSTRLEN]; video_codec[0] = 0;
 	const char *vcodec = vid_config->asset->vcodec;
-	AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
+	const AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
 		avcodec_find_encoder_by_name(video_codec) : 0;
 	const AVPixelFormat *pix_fmts = av_codec ? av_codec->pix_fmts : 0;
 	if( pix_fmts ) {
@@ -190,7 +190,7 @@ void FFMpegSampleFormat::update_formats()
 	samplefmts.remove_all_objects();
 	char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
 	const char *acodec = aud_config->asset->acodec;
-	AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
+	const AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
 		avcodec_find_encoder_by_name(audio_codec) : 0;
 	const AVSampleFormat *sample_fmts = av_codec ? av_codec->sample_fmts : 0;
 	if( sample_fmts ) {
@@ -1844,7 +1844,7 @@ int FFOptionsViewAudio::handle_event()
 	const char *name = asset->acodec;
 	char audio_format[BCSTRLEN];  audio_format[0] = 0;
 	char audio_codec[BCSTRLEN];   audio_codec[0] = 0;
-	AVCodec *codec = !ret &&
+	const AVCodec *codec = !ret &&
 	    !FFMPEG::get_format(audio_format, "audio", name) &&
 	    !FFMPEG::get_codec(audio_codec, "audio", name) ?
 		avcodec_find_encoder_by_name(audio_codec) : 0;
@@ -1882,7 +1882,7 @@ int FFOptionsViewVideo::handle_event()
 	const char *name = asset->vcodec;
 	char video_format[BCSTRLEN];  video_format[0] = 0;
 	char video_codec[BCSTRLEN];   video_codec[0] = 0;
-	AVCodec *codec = !ret &&
+	const AVCodec *codec = !ret &&
 	    !FFMPEG::get_format(video_format, "video", name) &&
 	    !FFMPEG::get_codec(video_codec, "video", name) ?
 		avcodec_find_encoder_by_name(video_codec) : 0;


More information about the Cin mailing list