[FFmpeg-devel] [PATCH] HWAccel infrastructure (take 5)
Reimar Döffinger
Reimar.Doeffinger
Fri Feb 20 18:22:03 CET 2009
On Fri, Feb 20, 2009 at 06:06:08PM +0100, Gwenole Beauchesne wrote:
> static inline int is_hwaccel_format(int imgfmt)
> {
> switch (get_video_hwaccel()) {
> case HWACCEL_VAAPI: return IMGFMT_IS_VAAPI(imgfmt) != 0;
> case HWACCEL_VDPAU: return IMGFMT_IS_VDPAU(imgfmt) != 0;
> case HWACCEL_XVMC: return IMGFMT_IS_XVMC(imgfmt) != 0;
> }
> return 0;
> }
>
> static enum PixelFormat get_format(struct AVCodecContext *avctx,
> const enum PixelFormat *fmt){
> enum PixelFormat selected_format = PIX_FMT_NONE;
> int imgfmt;
> sh_video_t *sh = avctx->opaque;
> int i, try_hwaccel;
>
> for (try_hwaccel = 1; try_hwaccel >= 0; --try_hwaccel) {
> for (i = 0; fmt[i] != PIX_FMT_NONE; i++){
> imgfmt = pixfmt2imgfmt(fmt[i]);
> if ((try_hwaccel ^ is_hwaccel_format(imgfmt)) != 0)
> continue;
> mp_msg(MSGT_DECVIDEO, MSGL_INFO,
> MSGTR_MPCODECS_TryingPixfmt, i);
> if (query_format(sh, imgfmt)) {
> selected_format = fmt[i];
> break;
> }
Well, it is still reimplementing the FFmpeg function, even though for
MPlayer it is not such an issue since IMGFMT_IS_.. is relatively easy
to do, it may be more effort for other applications.
Also this approach doesn't seem like such a good idea to me, currently (and I do not
see that changing) for MPlayer the hardware-acceleration format is
implicitly specified by the -vo, adding another way to specify the same
thing can't do any good IMO - letting the hwaccel option select the vo
seems like not such a good idea, since it is necessary to specify the vo
to get things like denoising etc.. Hardware-decoding within FFmpeg to a
uncompressed buffer is a different case of course.
More information about the ffmpeg-devel
mailing list