Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 834393 - media-sound/moc-2.6_alpha3-r5 with ffmpeg-5.0: ffmpeg.c:69:9: error: unknown type name ‘AVCodecContext’
Summary: media-sound/moc-2.6_alpha3-r5 with ffmpeg-5.0: ffmpeg.c:69:9: error: unknown ...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Sound Team
URL:
Whiteboard: Workaround dep applied; could disable...
Keywords: PATCH
Depends on:
Blocks: ffmpeg-5.0
  Show dependency tree
 
Reported: 2022-02-28 20:21 UTC by Kobboi
Modified: 2024-08-14 06:58 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.gz (build.log.gz,7.17 KB, application/gzip)
2022-02-28 20:21 UTC, Kobboi
Details
emerge-info.txt (emerge-info.txt,8.00 KB, text/plain)
2022-02-28 20:21 UTC, Kobboi
Details
patch for ffmpeg6 (ffmpeg6.patch,9.15 KB, patch)
2023-10-08 08:26 UTC, Felix Neumärker
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kobboi 2022-02-28 20:21:30 UTC
Making all in ffmpeg
make[3]: Entering directory '/var/tmp/portage/media-sound/moc-2.6_alpha3-r5/work/moc-2.6-alpha3/decoder_plugins/ffmpeg'
/bin/sh ../../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../..   -I../.. -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw  -I../.. -O2 -march=znver3 -pipe -g -ggdb3 -Wall -W  -c -o libffmpeg_decoder_la-ffmpeg.lo `test -f 'ffmpeg.c' || echo './'`ffmpeg.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw -I../.. -O2 -march=znver3 -pipe -g -ggdb3 -Wall -W -c ffmpeg.c  -fPIC -DPIC -o .libs/libffmpeg_decoder_la-ffmpeg.o
ffmpeg.c:69:9: error: unknown type name ‘AVCodecContext’
   69 |         AVCodecContext *enc;
      |         ^~~~~~~~~~~~~~
ffmpeg.c: In function ‘find_first_audio’:
ffmpeg.c:198:40: error: ‘AVStream’ has no member named ‘codec’
  198 |                 if (ic->streams[result]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
      |                                        ^~
ffmpeg.c: At top level:
ffmpeg.c:295:43: warning: ‘enum AVLockOp’ declared inside parameter list will not be visible outside of this definition or declaration
  295 | static int locking_cb (void **mutex, enum AVLockOp op)
      |                                           ^~~~~~~~
ffmpeg.c:295:52: error: parameter 2 (‘op’) has incomplete type
  295 | static int locking_cb (void **mutex, enum AVLockOp op)
      |                                      ~~~~~~~~~~~~~~^~
ffmpeg.c: In function ‘locking_cb’:
ffmpeg.c:300:14: error: ‘AV_LOCK_CREATE’ undeclared (first use in this function); did you mean ‘AV_LOG_TRACE’?
  300 |         case AV_LOCK_CREATE:
      |              ^~~~~~~~~~~~~~
      |              AV_LOG_TRACE
ffmpeg.c:300:14: note: each undeclared identifier is reported only once for each function it appears in
ffmpeg.c:304:14: error: ‘AV_LOCK_OBTAIN’ undeclared (first use in this function)
  304 |         case AV_LOCK_OBTAIN:
      |              ^~~~~~~~~~~~~~
ffmpeg.c:307:14: error: ‘AV_LOCK_RELEASE’ undeclared (first use in this function)
  307 |         case AV_LOCK_RELEASE:
      |              ^~~~~~~~~~~~~~~
ffmpeg.c:310:14: error: ‘AV_LOCK_DESTROY’ undeclared (first use in this function)
  310 |         case AV_LOCK_DESTROY:
      |              ^~~~~~~~~~~~~~~
ffmpeg.c:295:52: warning: unused parameter ‘op’ [-Wunused-parameter]
  295 | static int locking_cb (void **mutex, enum AVLockOp op)
      |                                      ~~~~~~~~~~~~~~^~
ffmpeg.c: In function ‘ffmpeg_init’:
ffmpeg.c:379:9: warning: implicit declaration of function ‘avcodec_register_all’ [-Wimplicit-function-declaration]
  379 |         avcodec_register_all ();
      |         ^~~~~~~~~~~~~~~~~~~~
ffmpeg.c:380:9: warning: implicit declaration of function ‘av_register_all’ [-Wimplicit-function-declaration]
  380 |         av_register_all ();
      |         ^~~~~~~~~~~~~~~
ffmpeg.c:386:14: warning: implicit declaration of function ‘av_lockmgr_register’ [-Wimplicit-function-declaration]
  386 |         rc = av_lockmgr_register (locking_cb);
      |              ^~~~~~~~~~~~~~~~~~~
ffmpeg.c: In function ‘fmt_from_sample_fmt’:
ffmpeg.c:472:26: error: request for member ‘sample_fmt’ in something not a structure or union
  472 |         switch (data->enc->sample_fmt) {
      |                          ^~
ffmpeg.c: In function ‘is_seek_broken’:
ffmpeg.c:522:13: warning: implicit declaration of function ‘avcodec_version’; did you mean ‘avformat_version’? [-Wimplicit-function-declaration]
  522 |         if (avcodec_version () < AV_VERSION_INT(55,8,100))
      |             ^~~~~~~~~~~~~~~
      |             avformat_version
ffmpeg.c: In function ‘set_downmixing’:
ffmpeg.c:538:57: error: request for member ‘channel_layout’ in something not a structure or union
  538 |         if (av_get_channel_layout_nb_channels (data->enc->channel_layout) <= 2)
      |                                                         ^~
ffmpeg.c:541:18: error: request for member ‘request_channel_layout’ in something not a structure or union
  541 |         data->enc->request_channel_layout = AV_CH_LAYOUT_STEREO;
      |                  ^~
ffmpeg.c: In function ‘ffmpeg_open_internal’:
ffmpeg.c:676:33: error: ‘AVStream’ has no member named ‘codec’
  676 |         data->enc = data->stream->codec;
      |                                 ^~
ffmpeg.c:678:54: error: request for member ‘codec_id’ in something not a structure or union
  678 |         data->codec = avcodec_find_decoder (data->enc->codec_id);
      |                                                      ^~
ffmpeg.c:709:26: error: request for member ‘flags’ in something not a structure or union
  709 |                 data->enc->flags |= AV_CODEC_FLAG_TRUNCATED;
      |                          ^~
ffmpeg.c:709:37: error: ‘AV_CODEC_FLAG_TRUNCATED’ undeclared (first use in this function); did you mean ‘AV_CODEC_CAP_TRUNCATED’?
  709 |                 data->enc->flags |= AV_CODEC_FLAG_TRUNCATED;
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
      |                                     AV_CODEC_CAP_TRUNCATED
ffmpeg.c:711:13: warning: implicit declaration of function ‘avcodec_open2’; did you mean ‘avio_open2’? [-Wimplicit-function-declaration]
  711 |         if (avcodec_open2 (data->enc, data->codec, NULL) < 0)
      |             ^~~~~~~~~~~~~
      |             avio_open2
ffmpeg.c:721:65: error: request for member ‘sample_fmt’ in something not a structure or union
  721 |                            av_get_sample_fmt_name (data->enc->sample_fmt));
      |                                                             ^~

ffmpeg.c:722:17: warning: implicit declaration of function ‘avcodec_close’; did you mean ‘avio_close’? [-Wimplicit-function-declaration]
  722 |                 avcodec_close (data->enc);
      |                 ^~~~~~~~~~~~~
      |                 avio_close
ffmpeg.c: In function ‘ffmpeg_can_decode’:
ffmpeg.c:806:13: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  806 |         fmt = av_probe_input_format (&probe_data, 1);
      |             ^
ffmpeg.c: In function ‘decode_packet’:
ffmpeg.c:980:23: warning: implicit declaration of function ‘avcodec_decode_audio4’ [-Wimplicit-function-declaration]
  980 |                 len = avcodec_decode_audio4 (data->enc, frame, &got_frame, pkt);
      |                       ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c:1002:63: error: request for member ‘sample_fmt’ in something not a structure or union
 1002 |               is_planar = av_sample_fmt_is_planar (data->enc->sample_fmt);
      |                                                             ^~

ffmpeg.c:1005:60: error: request for member ‘channels’ in something not a structure or union
 1005 |                                                 * data->enc->channels;
      |                                                            ^~
ffmpeg.c:1007:43: error: request for member ‘channels’ in something not a structure or union
 1007 |                 if (is_planar && data->enc->channels > 1) {
      |                                           ^~
ffmpeg.c:1013:60: error: request for member ‘channels’ in something not a structure or union
 1013 |                                 for (ch = 0; ch < data->enc->channels; ch += 1)
      |                                                            ^~
ffmpeg.c:1014:77: error: request for member ‘channels’ in something not a structure or union
 1014 |                         memcpy (packed + (sample * data->enc->channels + ch)
      |                                                             ^~

ffmpeg.c: In function ‘seek_in_stream’:
ffmpeg.c:1073:25: error: ‘AVStream’ has no member named ‘cur_dts’
 1073 |         if (data->stream->cur_dts > seek_ts)
      |                         ^~
ffmpeg.c:1082:9: warning: implicit declaration of function ‘avcodec_flush_buffers’ [-Wimplicit-function-declaration]
 1082 |         avcodec_flush_buffers (data->stream->codec);
      |         ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c:1082:44: error: ‘AVStream’ has no member named ‘codec’
 1082 |         avcodec_flush_buffers (data->stream->codec);
      |                                            ^~
ffmpeg.c: In function ‘ffmpeg_decode’:
ffmpeg.c:1114:43: error: request for member ‘channels’ in something not a structure or union
 1114 |         sound_params->channels = data->enc->channels;
      |                                           ^~
ffmpeg.c:1115:39: error: request for member ‘sample_rate’ in something not a structure or union
 1115 |         sound_params->rate = data->enc->sample_rate;
      |                                       ^~
ffmpeg.c: In function ‘ffmpeg_our_format_mime’:
ffmpeg.c:1283:13: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1283 |         fmt = av_guess_format (NULL, NULL, mime_type);
      |             ^
make[3]: *** [Makefile:542: libffmpeg_decoder_la-ffmpeg.lo] Error 1


Reproducible: Always
Comment 1 Kobboi 2022-02-28 20:21:44 UTC
Created attachment 766047 [details]
build.log.gz
Comment 2 Kobboi 2022-02-28 20:21:46 UTC
Created attachment 766048 [details]
emerge-info.txt
Comment 3 Kobboi 2022-02-28 20:23:03 UTC
Compiles fine with:
* USE=ffmpeg and ffmpeg-4.4.1
* USE=-ffmpeg and ffmpeg-5.0
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-01-21 10:02:36 UTC
I have mixed feelings about this.  On one hand, we can just mask USE=ffmpeg (and get rid of one patch while at it).  On the other, we're on alpha from ~2016.  On the third, I'm sure it has spoken out users.
Comment 5 Sebastian Parborg 2023-05-05 12:57:10 UTC
I'm a long time user of moc and I have contributed features and fixes to it in the past.

I would be sad to see it go as it is the only terminal music client left to my knowledge that allows the user to do the old school "the folder contents is the playlist" kind of playback.

@Michał I did see that there are some unreleased updates in the svn repo that other distributions are packaging and shipping. The svn log does state that some of those updates are ffmpeg related, so perhaps this might already be fixed upstream in those versions.

If that is the case, then I can try to contact the upstream maintainer and see if we can get an other point release.
Comment 6 Larry the Git Cow gentoo-dev 2023-05-29 20:51:46 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37ecc67590a8204f78b24402b096d3dd73dabbc6

commit 37ecc67590a8204f78b24402b096d3dd73dabbc6
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-05-29 20:50:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-05-29 20:50:36 +0000

    media-sound/moc: depend on <ffmpeg-5
    
    Bug: https://bugs.gentoo.org/834393
    Signed-off-by: Sam James <sam@gentoo.org>

 media-sound/moc/moc-2.6_alpha3-r6.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 7 Felix Neumärker 2023-10-08 08:26:47 UTC
Created attachment 872289 [details, diff]
patch for ffmpeg6

This patch is a combination of latest svn version of ffmpeg and
removing functions which have been dropped with ffmpeg6 as follows:

diff --git a/decoder_plugins/ffmpeg/ffmpeg.c b/decoder_plugins/ffmpeg/ffmpeg.c
index c043b5a..3029001 100644
--- a/decoder_plugins/ffmpeg/ffmpeg.c
+++ b/decoder_plugins/ffmpeg/ffmpeg.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <errno.h>
 
+#include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
 #include <libavutil/mathematics.h>
 #if HAVE_LIBAVUTIL_CHANNEL_LAYOUT_H
@@ -761,8 +762,10 @@ static void *ffmpeg_open_internal (struct ffmpeg_data *data)
 	}
 
 	set_downmixing (data);
+#if LIBAVCODEC_VERSION_MAJOR < 60
 	if (data->codec->capabilities & AV_CODEC_CAP_TRUNCATED)
 		data->enc->flags |= AV_CODEC_FLAG_TRUNCATED;
+#endif
 
 	if (avcodec_open2 (data->enc, data->codec, NULL) < 0)
 	{
@@ -1197,8 +1200,10 @@ static bool seek_in_stream (struct ffmpeg_data *data, int sec)
 		seek_ts += data->stream->start_time;
 	}
 
+#if LIBAVCODEC_VERSION_MAJOR < 60
 	if (data->stream->cur_dts > seek_ts)
 		flags |= AVSEEK_FLAG_BACKWARD;
+#endif
 
 	rc = av_seek_frame (data->ic, data->stream->index, seek_ts, flags);
 	if (rc < 0) {
--
Comment 8 Paweł Metelski 2023-10-08 22:06:50 UTC
The upstream bug report - http://moc.daper.net/comment/6590#comment-6590 - says:

> Yes, I Know
> It's a known issue and at first look it doesn't seem to be a major fix. But my > time is very limited at present and it may not be addressed for a short while.

Perhaps Felix's patch could be submitted there as a pull request?
Comment 9 Felix Neumärker 2023-10-10 21:32:25 UTC
I started collecting and bring-in some patches - See here https://github.com/xdch47/moc/compare/svn-trunk...patches-trunk.

Not sure how stable those are and how to bring those upstream.

For those, who want to give it try, at my overlay (gpo-xdch47) there is an ebuild 
<https://github.com/xdch47/gpo-xdch47/blob/c98be0428644d1051b86e44df03f49d7ae9f1a7b/media-sound/moc/moc-2.6_alpha3_p2.ebuild
Comment 10 Guido Jäkel 2023-12-25 14:21:22 UTC
> For those, who want to give it try, at my overlay (gpo-xdch47) there is an
> ebuild 
> <https://github.com/xdch47/gpo-xdch47/blob/
> c98be0428644d1051b86e44df03f49d7ae9f1a7b/media-sound/moc/moc-2.6_alpha3_p2.
> ebuild

Your ebuild is able to build with ffmpeg-6.0-r7 and "works for me (tm)": mocp is starting and able to play an mp3.

Thank you!
Comment 11 Pacho Ramos gentoo-dev 2024-05-18 10:35:41 UTC
(In reply to Felix Neumärker from comment #9)
> I started collecting and bring-in some patches - See here
> https://github.com/xdch47/moc/compare/svn-trunk...patches-trunk.
> 
> Not sure how stable those are and how to bring those upstream.
> 
> For those, who want to give it try, at my overlay (gpo-xdch47) there is an
> ebuild 
> <https://github.com/xdch47/gpo-xdch47/blob/
> c98be0428644d1051b86e44df03f49d7ae9f1a7b/media-sound/moc/moc-2.6_alpha3_p2.
> ebuild

Supposedly upstream uses the forum for those contributions:
https://moc.daper.net/forum/21

But I have no idea about how responsive will he be.

Maybe you could try to maintain this package via proxy maintainers project and migrate to your patched version:
https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers