xref: /haiku/src/add-ons/media/plugins/ffmpeg/gfx_util.h (revision 4e3137c085bae361922078f123dceb92da700640)
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 // this function will be used by the wrapper to write into
32 // the Media Kit provided buffer from the self-allocated ffmpeg codec buffer
33 // it also will do some colorspace and planar/chunky conversions.
34 // these functions should be optimized with overlay in mind.
35 //typedef void (*gfx_convert_func) (AVPicture *in, AVPicture *out, long line_count, long size);
36 // will become:
37 typedef void (*gfx_convert_func) (AVFrame *in, AVFrame *out, int width, int height);
38 
39 // this function will try to find the best colorspaces for both the ff-codec and
40 // the Media Kit sides.
41 gfx_convert_func resolve_colorspace(color_space cs, PixelFormat pixelFormat, int width, int height);
42 
43 const char *pixfmt_to_string(int format);
44 
45 color_space pixfmt_to_colorspace(int format);
46 PixelFormat colorspace_to_pixfmt(color_space format);
47 
48 void dump_ffframe_audio(AVFrame *frame, const char *name);
49 void dump_ffframe_video(AVFrame *frame, const char *name);
50 
51 #endif
52