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