[WASAPI] set stream audio category
[xbmc.git] / xbmc / cores / RetroPlayer / rendering / RenderTranslator.cpp
blob1256af7721e4fdbf14c8320f292dbf5912c96529
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "RenderTranslator.h"
11 #include <stdint.h>
13 using namespace KODI;
14 using namespace RETRO;
16 const char* CRenderTranslator::TranslatePixelFormat(AVPixelFormat format)
18 switch (format)
20 case AV_PIX_FMT_0RGB32:
21 return "0RGB32";
22 case AV_PIX_FMT_RGBA:
23 return "RGBA32";
24 case AV_PIX_FMT_RGB565:
25 return "RGB565";
26 case AV_PIX_FMT_RGB555:
27 return "RGB555";
28 default:
29 break;
32 return "unknown";
35 const char* CRenderTranslator::TranslateScalingMethod(SCALINGMETHOD scalingMethod)
37 switch (scalingMethod)
39 case SCALINGMETHOD::NEAREST:
40 return "nearest";
41 case SCALINGMETHOD::LINEAR:
42 return "linear";
43 default:
44 break;
47 return "";
50 unsigned int CRenderTranslator::TranslateWidthToBytes(unsigned int width, AVPixelFormat format)
52 unsigned int bpp = 0;
54 switch (format)
56 case AV_PIX_FMT_0RGB32:
57 case AV_PIX_FMT_RGBA:
59 bpp = sizeof(uint32_t);
60 break;
62 case AV_PIX_FMT_RGB555:
64 bpp = sizeof(uint16_t);
65 break;
67 case AV_PIX_FMT_RGB565:
69 bpp = sizeof(uint16_t);
70 break;
72 default:
73 break;
76 return width * bpp;