xref: /haiku/src/add-ons/media/plugins/ffmpeg/gfx_util.h (revision aa3083e086e5a929c061c72983e09d916c548a38)
1 /*
2  * Copyright (C) 2014 Colin Günther <coling@gmx.de>.
3  *
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 
7 /******************************************************************************
8 /
9 /	File:			gfx_util.h
10 /
11 /	Description:	utility functions for ffmpeg codec wrappers for BeOs R5.
12 /
13 /	Disclaimer:		This decoder is based on undocumented APIs.
14 /					Therefore it is likely, if not certain, to break in future
15 /					versions of BeOS. This piece of software is in no way
16 /					connected to or even supported by Be, Inc.
17 /
18 /	Copyright (C) 2001 François Revol. All Rights Reserved.
19 /
20 ******************************************************************************/
21 
22 #ifndef __FFUTILS_H__
23 #define __FFUTILS_H__
24 
25 // BeOS and libavcodec bitmap formats
26 #include <GraphicsDefs.h>
27 extern "C" {
28 	#include "libavcodec/avcodec.h"
29 }
30 
31 #if LIBAVCODEC_VERSION_INT < ((54 << 16) | (50 << 8))
32 typedef PixelFormat AVPixelFormat;
33 #endif
34 
35 
36 // this function will be used by the wrapper to write into
37 // the Media Kit provided buffer from the self-allocated ffmpeg codec buffer
38 // it also will do some colorspace and planar/chunky conversions.
39 // these functions should be optimized with overlay in mind.
40 //typedef void (*gfx_convert_func) (AVPicture *in, AVPicture *out, long line_count, long size);
41 // will become:
42 typedef void (*gfx_convert_func) (AVFrame *in, AVFrame *out, int width, int height);
43 
44 // this function will try to find the best colorspaces for both the ff-codec and
45 // the Media Kit sides.
46 gfx_convert_func resolve_colorspace(color_space cs, AVPixelFormat pixelFormat, int width, int height);
47 
48 const char *pixfmt_to_string(int format);
49 
50 color_space pixfmt_to_colorspace(int format);
51 AVPixelFormat colorspace_to_pixfmt(color_space format);
52 
53 void dump_ffframe_audio(AVFrame *frame, const char *name);
54 void dump_ffframe_video(AVFrame *frame, const char *name);
55 
56 #endif
57