Re: [MPlayer-dev-eng] [FFmpeg-devel] [PATCH 0/20] removal of deprecated features
I am forwarding this mail to mplayer-dev-eng list in the hopes that maybe someone would like to work on updating mplayer to the new ff* api. thanks to reimar for updating some api already and rtogni for posting a patch and also wm4 for suggesting checking patches from mplayer2 to avoid duplicating work. -compn On Wed, 5 Aug 2015 21:31:38 +0200 Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote:
On 04.08.2015 07:57, Reimar Döffinger wrote:
I do have on more proposal, but the problem is it needs someone to do the work. For each removed feature, prepare documentation "a monkey could follow" on how to replace it (you could call it a transition guide). Even better, a script that automates it where reasonable.
I think this is a very good idea.
In some cases it is just a matter of copy-pasting some existing wrapper code, particularly if we remove that wrapper code it is useful if people still have it available in the new release. If it's just a few hours of someone's time who even doesn't need to understand the code, I think we can very confidently say "not really our problem" if some applications still use it.
Agreed.
If we that way find out that there are non-trivial cases or cases where the code gets a lot more complicated it might be a hint the new API is still crap and we maybe should come up with something better first.
A more complete usage list for the deprecated APIs is:
FF_API_PIX_FMT: 71 amide avbin avifile bino blender chromium-browser dff dolphin-emu dvbcut dvswitch ffdiaporama ffmpeg2theora ffmpegthumbnailer ffmpegthumbs ffms2 fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders gnash gpac gst-libav1.0 guvcview harvid hedgewars info-beamer jugglemaster karlyriceditor kino kodi lightspark lebiniou libam7xxx libavg libde265 libextractor libquicktime linphone lives lynkeos.app mlt mplayer mplayer2 mrpt opal opencv openmw openscenegraph ovito paraview performous pjproject qutecom rbdoom3bfg renpy shotdetect sflphone strigi survex transcode vcmi vlc vtk vtk6 vxl wxsvg x264 xjadeo xpra yorick-av zoneminder
FF_API_AVFRAME_LAVC: 53 alsa-plugins amarok aubio avbin blender chromaprint dff dolphin-emu dvbcut ffdiaporama ffmpegthumbnailer ffmpegthumbs fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders goldendict gpac gst-libav1.0 hedgewars info-beamer jugglemaster kino libavg libextractor libquicktime lightspark linphone mplayer mplayer2 mrpt opal opencv openscenegraph ovito paraview performous pianopar qutecom renpy shotdetect spek squeezelite transcode vcmi vlc vtk vtk6 vxl xine-lib-1.2 xpra yorick-av zoneminder
FF_API_GET_BUFFER: 9 avifile dvswitch gmerlin-avdecoder gst-libav1.0 libavg mplayer mplayer2 openmw openscenegraph
FF_API_AUDIOCONVERT: 7 alsa-plugins cantata ffdiaporama moc mplayer2 mpv vlc
FF_API_SWS_CPU_CAPS: 6 fuse-emulator-utils kodi mlt mplayer2 vlc zoneminder
FF_API_DEINTERLACE: 5 blender dff ffmpegthumbnailer ffmpegthumbs vxl
FF_API_AVFRAME_LAVC(qscale): 3 ffmpeg2theora kodi xine-lib-1.2
FF_API_CODEC_ID: 3 chromium-browser dvswitch ffms2
FF_API_CONTEXT_SIZE: 3 mplayer mplayer2 xine-lib-1.2
FF_API_REQUEST_CHANNELS: 3 mplayer mplayer2 renpy
FF_API_AV_REVERSE: 2 mplayer mplayer2
FF_API_AVCODEC_RESAMPLE: 2 mlt mplayer
FF_API_DESTRUCT_PACKET: 2 lives openmw
FF_API_AVFILTERBUFFER: 2 ffdiaporama pianobar
FF_API_AVFILTERPAD_PUBLIC: 1 mplayer
FF_API_VIMA_DECODER: 1 mplayer
FF_API_PIX_FMT and FF_API_AVFRAME_LAVC are still widely used, but the "patch-monkey" could deal with the changes and also with FF_API_AUDIOCONVERT, FF_API_SWS_CPU_CAPS, FF_API_CODEC_ID, FF_API_CONTEXT_SIZE, FF_API_REQUEST_CHANNELS and FF_API_VIMA_DECODER.
Regarding FF_API_GET_BUFFER, get_buffer should be replaced with get_buffer2, but it's not clear how release_buffer/reget_buffer should be replaced. Can someone explain/document this?
To get rid of FF_API_DEINTERLACE, one should 'use yadif (in libavfilter) instead'. Well, ... how?
Then, as part of FF_API_AVFRAME_LAVC(qscale), the fields qscale_table, qstride and qscale_type of AVFrame are to be removed, but (at least in FFmpeg) these are used by the not deprecated functions av_frame_set_qp_table and av_frame_get_qp_table, so they shouldn't be removed. Anyway it's not clear how to replace their usage.
Why is FF_API_AV_REVERSE deprecated? It is used in FFmpeg's libavutil/eval.c.
One should 'use libswresample instead' of FF_API_AVCODEC_RESAMPLE. A more detailed explanation would be good.
Same holds for FF_API_DESTRUCT_PACKET, where one should 'use the AVBuffer API instead'.
For FF_API_AVFILTERBUFFER no replacement is documented.
FF_API_AVFILTERPAD_PUBLIC should be replaced by avfilter_pad_get_name and avfilter_pad_get_type, but it seems that mplayer also uses others.
Better documentation would surely be helpful.
Btw. the magic option to enable compatibility is still somewhat useful as it lists and allows testing the specific changes that are coming up. But I agree it's only a minor help.
The problem with such a magic option is that it combines the disadvantages of removing and not removing: Programs using the old API get broken by default and the deprecated functionality remains in the code base.
Best regards, Andreas
On Tue, 11 Aug 2015 21:00:36 -0400 compn <tempn@mi.rr.com> wrote:
I am forwarding this mail to mplayer-dev-eng list in the hopes that maybe someone would like to work on updating mplayer to the new ff* api.
thanks to reimar for updating some api already and rtogni for posting a patch and also wm4 for suggesting checking patches from mplayer2 to avoid duplicating work.
-compn
[...]
A more complete usage list for the deprecated APIs is:
FF_API_PIX_FMT: 71 Fixed by Reimar r37443
amide avbin avifile bino blender chromium-browser dff dolphin-emu dvbcut dvswitch ffdiaporama ffmpeg2theora ffmpegthumbnailer ffmpegthumbs ffms2 fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders gnash gpac gst-libav1.0 guvcview harvid hedgewars info-beamer jugglemaster karlyriceditor kino kodi lightspark lebiniou libam7xxx libavg libde265 libextractor libquicktime linphone lives lynkeos.app mlt mplayer mplayer2 mrpt opal opencv openmw openscenegraph ovito paraview performous pjproject qutecom rbdoom3bfg renpy shotdetect sflphone strigi survex transcode vcmi vlc vtk vtk6 vxl wxsvg x264 xjadeo xpra yorick-av zoneminder
FF_API_AVFRAME_LAVC: 53 Fixed by me r37445
alsa-plugins amarok aubio avbin blender chromaprint dff dolphin-emu dvbcut ffdiaporama ffmpegthumbnailer ffmpegthumbs fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders goldendict gpac gst-libav1.0 hedgewars info-beamer jugglemaster kino libavg libextractor libquicktime lightspark linphone mplayer mplayer2 mrpt opal opencv openscenegraph ovito paraview performous pianopar qutecom renpy shotdetect spek squeezelite transcode vcmi vlc vtk vtk6 vxl xine-lib-1.2 xpra yorick-av zoneminder
FF_API_GET_BUFFER: 9 This is the big one. Replace with get_buffer2(), but this is not a 1:1 substitution. reget_buffer() is gone, but we already don't use it anymore (it points to get_buffer). To free the buffer there is some callback to be set in get_buffer2 (as I get from the comments in avcodec.h).
IIRC we need get buffer (instead of using the default from libavcodec) for two things: hw decoding and direct rendering. I had a quick look to other projects based on MPlayer: mplayer2 still uses get_buffer, so it's no help; mpv uses get_buffer2 at least for hw decoders, but I need to check the details.
avifile dvswitch gmerlin-avdecoder gst-libav1.0 libavg mplayer mplayer2 openmw openscenegraph
FF_API_AUDIOCONVERT: 7 Not relevant for MPlayer
alsa-plugins cantata ffdiaporama moc mplayer2 mpv vlc
FF_API_SWS_CPU_CAPS: 6 Not relevant for MPlayer
fuse-emulator-utils kodi mlt mplayer2 vlc zoneminder
FF_API_DEINTERLACE: 5 Not relevant for MPlayer (lavcdeint was removed by Michael in r37388 four months ago)
blender dff ffmpegthumbnailer ffmpegthumbs vxl
FF_API_AVFRAME_LAVC(qscale): 3 Not relevant for MPlayer
ffmpeg2theora kodi xine-lib-1.2
FF_API_CODEC_ID: 3 Not relevant for MPlayer
chromium-browser dvswitch ffms2
FF_API_CONTEXT_SIZE: 3 To be checked
mplayer mplayer2 xine-lib-1.2
FF_API_REQUEST_CHANNELS: 3 Fixed by me in r37447
mplayer mplayer2 renpy
FF_API_AV_REVERSE: 2 Patch by Andreas Cadhalpun, applied in r37448
mplayer mplayer2
FF_API_AVCODEC_RESAMPLE: 2 Patch in review
mlt mplayer
FF_API_DESTRUCT_PACKET: 2 Not relevant for MPlayer
lives openmw
FF_API_AVFILTERBUFFER: 2 Not relevant for MPlayer
ffdiaporama pianobar
FF_API_AVFILTERPAD_PUBLIC: 1 I don't think this is fixable. From what I got at a first look, vf_lavfi creates its own source and sink filters, and adds them to the chain. To do this it uses AVFilterPad, os the new functions to get name and type are useless. I don't know if this filter still works today; apart from minor details the file is unchanged since 2011. The commit message also warned about the beta interface of libavfilter at the time.
The filter is not built by default, so compilation and functionality of MPlayer are unaffected.
mplayer
FF_API_VIMA_DECODER: 1 Fixed by me in r37446 mplayer
[...]
If you have any comment or additions please replay. Ciao, Roberto
On 14.08.2015 22:06, Roberto Togni wrote:
FF_API_GET_BUFFER: 9 This is the big one. Replace with get_buffer2(), but this is not a 1:1 substitution. reget_buffer() is gone, but we already don't use it anymore (it points to get_buffer). To free the buffer there is some callback to be set in get_buffer2 (as I get from the comments in avcodec.h).
IIRC we need get buffer (instead of using the default from libavcodec) for two things: hw decoding and direct rendering.
I had a quick look to other projects based on MPlayer: mplayer2 still uses get_buffer, so it's no help; mpv uses get_buffer2 at least for hw decoders, but I need to check the details.
As far as I understood this API change, one needs to do the following: Replace get_buffer/avcodec_default_get_buffer with get_buffer2/avcodec_default_get_buffer2, which has an additional 'int flags' argument. Don't use AVFrame->type, AVFrame->buffer_hints and AVFrame->reference. Remove reget_buffer and change release_buffer into a void(void *opaque, uint8_t *data) free callback function. The custom get_buffer2 implementation now must set AVFrame->buf[] with av_buffer_create, which can be passed a function pointer for the free callback.
FF_API_CONTEXT_SIZE: 3 To be checked
This API is only removed from Libav, not from FFmpeg, so ... Last time I checked, compiling mplayer with Libav didn't work anyway.
FF_API_AVCODEC_RESAMPLE: 2 Patch in review
Nice. :-)
FF_API_DESTRUCT_PACKET: 2 Not relevant for MPlayer
Unfortunately I missed this previously, but mplayer does use this API in libmpdemux/demux_lavf.c. I guess the part using it can just be removed?
FF_API_AVFILTERPAD_PUBLIC: 1 I don't think this is fixable.
I think so too.
From what I got at a first look, vf_lavfi creates its own source and sink filters, and adds them to the chain. To do this it uses AVFilterPad, os the new functions to get name and type are useless. I don't know if this filter still works today; apart from minor details the file is unchanged since 2011. The commit message also warned about the beta interface of libavfilter at the time.
The filter is not built by default, so compilation and functionality of MPlayer are unaffected.
Indeed, that's not used by default. I wasn't aware of that. But still, this filter should probably be removed.
If you have any comment or additions please replay.
I also missed that mplayer still uses FF_API_OLD_ENCODE_VIDEO, namely avcodec_encode_video. That should be simple to fix: Replace avcodec_encode_video(avctx, buf, buf_size, frame); with: int got_packet; AVPacket avpkt; memset(&avpkt, 0, sizeof(AVPacket)); avpkt->data = buf; avpkt->size = buf_size; avcodec_encode_video2(avctx, &avpkt, frame, &got_packet); Best regards, Andreas
participants (3)
-
Andreas Cadhalpun -
compn -
Roberto Togni