Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/Application.cpp xbmc_vidonme/xbmc/Application.cpp
- --- xbmc_orig/xbmc/Application.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/Application.cpp 2013-06-12 16:40:34.000000000 +0200
- @@ -5080,7 +5080,9 @@
- m_pPlayer->DoAudioWork();
- // do any processing that isn't needed on each run
- +
- if( m_slowTimer.GetElapsedMilliseconds() > 500 )
- +
- {
- m_slowTimer.Reset();
- ProcessSlow();
- @@ -5613,6 +5615,17 @@
- return false;
- }
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +void CApplication::OnA10Created()
- +{
- + if( !m_pPlayer )
- + return;
- +
- + //need switch to fullscreen
- + SwitchToFullScreen();
- + m_pPlayer->OnA10Created();
- +}
- +#endif
- void CApplication::Minimize()
- {
- g_Windowing.Minimize();
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/Application.h xbmc_vidonme/xbmc/Application.h
- --- xbmc_orig/xbmc/Application.h 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/Application.h 2013-06-12 16:40:34.000000000 +0200
- @@ -360,6 +360,9 @@
- bool SwitchToFullScreen();
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + void OnA10Created();
- +#endif
- CSplash* GetSplash() { return m_splash; }
- void SetRenderGUI(bool renderGUI);
- protected:
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/a10/DllLibcedarv.h xbmc_vidonme/xbmc/cores/a10/DllLibcedarv.h
- --- xbmc_orig/xbmc/cores/a10/DllLibcedarv.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/a10/DllLibcedarv.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,60 @@
- +#pragma once
- +/*
- + * Copyright (C) 2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +#ifndef __DLLLIBCEDARVH__
- +#define __DLLLIBCEDARVH__
- +
- +#include "system.h"
- +
- +#include "DynamicDll.h"
- +
- +
- +class DllLibA10decoderInterface
- +{
- +public:
- + virtual ~DllLibA10decoderInterface() {};
- +
- + virtual cedarv_decoder_t* libcedarv_init(int *ret)=0;
- + virtual int libcedarv_exit(cedarv_decoder_t *p)=0;
- + virtual int mem_get_phy_addr(int addr)=0;
- + virtual void* mem_palloc(unsigned int size, unsigned int align)=0;
- + virtual void mem_pfree(void* p)=0;
- +};
- +
- +class DllLibA10decoder : public DllDynamic, DllLibA10decoderInterface
- +{
- + DECLARE_DLL_WRAPPER(DllLibA10decoder, "libbdv.so")
- +
- + DEFINE_METHOD1(cedarv_decoder_t *, libcedarv_init, (int *p1))
- + DEFINE_METHOD1(int, libcedarv_exit, (cedarv_decoder_t *p1))
- + DEFINE_METHOD1(int, mem_get_phy_addr, (int p1))
- + DEFINE_METHOD2(void*, mem_palloc, (unsigned int p1, unsigned int p2))
- + DEFINE_METHOD1(void, mem_pfree, (void *p1))
- +
- + BEGIN_METHOD_RESOLVE()
- + RESOLVE_METHOD(libcedarv_init)
- + RESOLVE_METHOD(libcedarv_exit)
- + RESOLVE_METHOD(mem_get_phy_addr)
- + RESOLVE_METHOD(mem_palloc)
- + RESOLVE_METHOD(mem_pfree)
- + END_METHOD_RESOLVE()
- +};
- +
- +#endif //__DLLLIBCEDARV__
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/a10/drv_display_sun4i.h xbmc_vidonme/xbmc/cores/a10/drv_display_sun4i.h
- --- xbmc_orig/xbmc/cores/a10/drv_display_sun4i.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/a10/drv_display_sun4i.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,794 @@
- +#ifndef __DRV_DISPLAY_H__
- +#define __DRV_DISPLAY_H__
- +
- +#define __bool signed char
- +
- +typedef struct {__u8 alpha;__u8 red;__u8 green; __u8 blue; }__disp_color_t;
- +typedef struct {__s32 x; __s32 y; __u32 width; __u32 height;}__disp_rect_t;
- +typedef struct {__u32 width;__u32 height; }__disp_rectsz_t;
- +typedef struct {__s32 x; __s32 y; }__disp_pos_t;
- +
- +
- +typedef enum
- +{
- + DISP_FORMAT_1BPP =0x0,
- + DISP_FORMAT_2BPP =0x1,
- + DISP_FORMAT_4BPP =0x2,
- + DISP_FORMAT_8BPP =0x3,
- + DISP_FORMAT_RGB655 =0x4,
- + DISP_FORMAT_RGB565 =0x5,
- + DISP_FORMAT_RGB556 =0x6,
- + DISP_FORMAT_ARGB1555 =0x7,
- + DISP_FORMAT_RGBA5551 =0x8,
- + DISP_FORMAT_ARGB888 =0x9,//alpha padding to 0xff
- + DISP_FORMAT_ARGB8888 =0xa,
- + DISP_FORMAT_RGB888 =0xb,
- + DISP_FORMAT_ARGB4444 =0xc,
- +
- + DISP_FORMAT_YUV444 =0x10,
- + DISP_FORMAT_YUV422 =0x11,
- + DISP_FORMAT_YUV420 =0x12,
- + DISP_FORMAT_YUV411 =0x13,
- + DISP_FORMAT_CSIRGB =0x14,
- +}__disp_pixel_fmt_t;
- +
- +
- +typedef enum
- +{
- + DISP_MOD_INTERLEAVED =0x1, //interleaved,1¸öµØÖ·
- + DISP_MOD_NON_MB_PLANAR =0x0, //ÎÞºê¿éƽÃæģʽ,3¸öµØÖ·,RGB/YUVÿ¸öchannel·Ö±ð´æ·Å
- + DISP_MOD_NON_MB_UV_COMBINED =0x2, //ÎÞºê¿éUV´ò°üģʽ,2¸öµØÖ·,YºÍUV·Ö±ð´æ·Å
- + DISP_MOD_MB_PLANAR =0x4, //ºê¿éƽÃæģʽ,3¸öµØÖ·,RGB/YUVÿ¸öchannel·Ö±ð´æ·Å
- + DISP_MOD_MB_UV_COMBINED =0x6, //ºê¿éUV´ò°üģʽ ,2¸öµØÖ·,YºÍUV·Ö±ð´æ·Å
- +}__disp_pixel_mod_t;
- +
- +typedef enum
- +{
- +//for interleave argb8888
- + DISP_SEQ_ARGB =0x0,//AÔÚ¸ßλ
- + DISP_SEQ_BGRA =0x2,
- +
- +//for nterleaved yuv422
- + DISP_SEQ_UYVY =0x3,
- + DISP_SEQ_YUYV =0x4,
- + DISP_SEQ_VYUY =0x5,
- + DISP_SEQ_YVYU =0x6,
- +
- +//for interleaved yuv444
- + DISP_SEQ_AYUV =0x7,
- + DISP_SEQ_VUYA =0x8,
- +
- +//for uv_combined yuv420
- + DISP_SEQ_UVUV =0x9,
- + DISP_SEQ_VUVU =0xa,
- +
- +//for 16bpp rgb
- + DISP_SEQ_P10 = 0xd,//p1ÔÚ¸ßλ
- + DISP_SEQ_P01 = 0xe,//p0ÔÚ¸ßλ
- +
- +//for planar format or 8bpp rgb
- + DISP_SEQ_P3210 = 0xf,//p3ÔÚ¸ßλ
- + DISP_SEQ_P0123 = 0x10,//p0ÔÚ¸ßλ
- +
- +//for 4bpp rgb
- + DISP_SEQ_P76543210 = 0x11,
- + DISP_SEQ_P67452301 = 0x12,
- + DISP_SEQ_P10325476 = 0x13,
- + DISP_SEQ_P01234567 = 0x14,
- +
- +//for 2bpp rgb
- + DISP_SEQ_2BPP_BIG_BIG = 0x15,//15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
- + DISP_SEQ_2BPP_BIG_LITTER = 0x16,//12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3
- + DISP_SEQ_2BPP_LITTER_BIG = 0x17,//3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12
- + DISP_SEQ_2BPP_LITTER_LITTER = 0x18,//0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
- +
- +//for 1bpp rgb
- + DISP_SEQ_1BPP_BIG_BIG = 0x19,//31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
- + DISP_SEQ_1BPP_BIG_LITTER = 0x1a,//24,25,26,27,28,29,30,31,16,17,18,19,20,21,22,23,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7
- + DISP_SEQ_1BPP_LITTER_BIG = 0x1b,//7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24
- + DISP_SEQ_1BPP_LITTER_LITTER = 0x1c,//0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
- +}__disp_pixel_seq_t;
- +
- +typedef enum
- +{
- + DISP_3D_SRC_MODE_TB = 0x0,//top bottom
- + DISP_3D_SRC_MODE_FP = 0x1,//frame packing,left and right picture in separate address
- + DISP_3D_SRC_MODE_SSF = 0x2,//side by side full
- + DISP_3D_SRC_MODE_SSH = 0x3,//side by side half
- + DISP_3D_SRC_MODE_LI = 0x4,//line interleaved
- +}__disp_3d_src_mode_t;
- +
- +typedef enum
- +{
- + DISP_3D_OUT_MODE_CI_1 = 0x5,//column interlaved 1
- + DISP_3D_OUT_MODE_CI_2 = 0x6,//column interlaved 2
- + DISP_3D_OUT_MODE_CI_3 = 0x7,//column interlaved 3
- + DISP_3D_OUT_MODE_CI_4 = 0x8,//column interlaved 4
- + DISP_3D_OUT_MODE_LIRGB = 0x9,//line interleaved rgb
- +
- + DISP_3D_OUT_MODE_TB = 0x0,//top bottom
- + DISP_3D_OUT_MODE_FP = 0x1,//frame packing
- + DISP_3D_OUT_MODE_SSF = 0x2,//side by side full
- + DISP_3D_OUT_MODE_SSH = 0x3,//side by side half
- + DISP_3D_OUT_MODE_LI = 0x4,//line interleaved
- + DISP_3D_OUT_MODE_FA = 0xa,//field alternative
- +}__disp_3d_out_mode_t;
- +
- +typedef enum
- +{
- + DISP_BT601 = 0,
- + DISP_BT709 = 1,
- + DISP_YCC = 2,
- + DISP_VXYCC = 3,
- +}__disp_cs_mode_t;
- +
- +typedef enum
- +{
- + DISP_COLOR_RANGE_16_255 = 0,
- + DISP_COLOR_RANGE_0_255 = 1,
- + DISP_COLOR_RANGE_16_235 = 2,
- +}__disp_color_range_t;
- +
- +typedef enum
- +{
- + DISP_OUTPUT_TYPE_NONE = 0,
- + DISP_OUTPUT_TYPE_LCD = 1,
- + DISP_OUTPUT_TYPE_TV = 2,
- + DISP_OUTPUT_TYPE_HDMI = 4,
- + DISP_OUTPUT_TYPE_VGA = 8,
- +}__disp_output_type_t;
- +
- +typedef enum
- +{
- + DISP_TV_NONE = 0,
- + DISP_TV_CVBS = 1,
- + DISP_TV_YPBPR = 2,
- + DISP_TV_SVIDEO = 4,
- +}__disp_tv_output_t;
- +
- +typedef enum
- +{
- + DISP_TV_MOD_480I = 0,
- + DISP_TV_MOD_576I = 1,
- + DISP_TV_MOD_480P = 2,
- + DISP_TV_MOD_576P = 3,
- + DISP_TV_MOD_720P_50HZ = 4,
- + DISP_TV_MOD_720P_60HZ = 5,
- + DISP_TV_MOD_1080I_50HZ = 6,
- + DISP_TV_MOD_1080I_60HZ = 7,
- + DISP_TV_MOD_1080P_24HZ = 8,
- + DISP_TV_MOD_1080P_50HZ = 9,
- + DISP_TV_MOD_1080P_60HZ = 0xa,
- + DISP_TV_MOD_1080P_24HZ_3D_FP = 0x17,
- + DISP_TV_MOD_720P_50HZ_3D_FP = 0x18,
- + DISP_TV_MOD_720P_60HZ_3D_FP = 0x19,
- + DISP_TV_MOD_1080P_25HZ = 0x1a,
- + DISP_TV_MOD_1080P_30HZ = 0x1b,
- + DISP_TV_MOD_PAL = 0xb,
- + DISP_TV_MOD_PAL_SVIDEO = 0xc,
- + DISP_TV_MOD_NTSC = 0xe,
- + DISP_TV_MOD_NTSC_SVIDEO = 0xf,
- + DISP_TV_MOD_PAL_M = 0x11,
- + DISP_TV_MOD_PAL_M_SVIDEO = 0x12,
- + DISP_TV_MOD_PAL_NC = 0x14,
- + DISP_TV_MOD_PAL_NC_SVIDEO = 0x15,
- + DISP_TV_MODE_NUM = 0x1c,
- +}__disp_tv_mode_t;
- +
- +typedef enum
- +{
- + DISP_TV_DAC_SRC_COMPOSITE = 0,
- + DISP_TV_DAC_SRC_LUMA = 1,
- + DISP_TV_DAC_SRC_CHROMA = 2,
- + DISP_TV_DAC_SRC_Y = 4,
- + DISP_TV_DAC_SRC_PB = 5,
- + DISP_TV_DAC_SRC_PR = 6,
- + DISP_TV_DAC_SRC_NONE = 7,
- +}__disp_tv_dac_source;
- +
- +typedef enum
- +{
- + DISP_VGA_H1680_V1050 = 0,
- + DISP_VGA_H1440_V900 = 1,
- + DISP_VGA_H1360_V768 = 2,
- + DISP_VGA_H1280_V1024 = 3,
- + DISP_VGA_H1024_V768 = 4,
- + DISP_VGA_H800_V600 = 5,
- + DISP_VGA_H640_V480 = 6,
- + DISP_VGA_H1440_V900_RB = 7,//not support yet
- + DISP_VGA_H1680_V1050_RB = 8,//not support yet
- + DISP_VGA_H1920_V1080_RB = 9,
- + DISP_VGA_H1920_V1080 = 0xa,
- + DISP_VGA_H1280_V720 = 0xb,
- + DISP_VGA_MODE_NUM = 0xc,
- +}__disp_vga_mode_t;
- +
- +
- +typedef enum
- +{
- + DISP_LCDC_SRC_DE_CH1 = 0,
- + DISP_LCDC_SRC_DE_CH2 = 1,
- + DISP_LCDC_SRC_DMA = 2,
- + DISP_LCDC_SRC_WHITE = 3,
- + DISP_LCDC_SRC_BLACK = 4,
- + DISP_LCDC_SRC_BLUT = 5,
- +}__disp_lcdc_src_t;
- +
- +typedef enum
- +{
- + DISP_LCD_BRIGHT_LEVEL0 = 0,
- + DISP_LCD_BRIGHT_LEVEL1 = 1,
- + DISP_LCD_BRIGHT_LEVEL2 = 2,
- + DISP_LCD_BRIGHT_LEVEL3 = 3,
- + DISP_LCD_BRIGHT_LEVEL4 = 4,
- + DISP_LCD_BRIGHT_LEVEL5 = 5,
- + DISP_LCD_BRIGHT_LEVEL6 = 6,
- + DISP_LCD_BRIGHT_LEVEL7 = 7,
- + DISP_LCD_BRIGHT_LEVEL8 = 8,
- + DISP_LCD_BRIGHT_LEVEL9 = 9,
- + DISP_LCD_BRIGHT_LEVEL10 = 0xa,
- + DISP_LCD_BRIGHT_LEVEL11 = 0xb,
- + DISP_LCD_BRIGHT_LEVEL12 = 0xc,
- + DISP_LCD_BRIGHT_LEVEL13 = 0xd,
- + DISP_LCD_BRIGHT_LEVEL14 = 0xe,
- + DISP_LCD_BRIGHT_LEVEL15 = 0xf,
- +}__disp_lcd_bright_t;
- +
- +typedef enum
- +{
- + DISP_LAYER_WORK_MODE_NORMAL = 0, //normal work mode
- + DISP_LAYER_WORK_MODE_PALETTE = 1, //palette work mode
- + DISP_LAYER_WORK_MODE_INTER_BUF = 2, //internal frame buffer work mode
- + DISP_LAYER_WORK_MODE_GAMMA = 3, //gamma correction work mode
- + DISP_LAYER_WORK_MODE_SCALER = 4, //scaler work mode
- +}__disp_layer_work_mode_t;
- +
- +typedef enum
- +{
- + DISP_VIDEO_NATUAL = 0,
- + DISP_VIDEO_SOFT = 1,
- + DISP_VIDEO_VERYSOFT = 2,
- + DISP_VIDEO_SHARP = 3,
- + DISP_VIDEO_VERYSHARP = 4
- +}__disp_video_smooth_t;
- +
- +typedef enum
- +{
- + DISP_HWC_MOD_H32_V32_8BPP = 0,
- + DISP_HWC_MOD_H64_V64_2BPP = 1,
- + DISP_HWC_MOD_H64_V32_4BPP = 2,
- + DISP_HWC_MOD_H32_V64_4BPP = 3,
- +}__disp_hwc_mode_t;
- +
- +typedef enum
- +{
- + DISP_EXIT_MODE_CLEAN_ALL = 0,
- + DISP_EXIT_MODE_CLEAN_PARTLY = 1,//only clean interrupt temply
- +}__disp_exit_mode_t;
- +
- +
- +typedef enum//only for debug!!!
- +{
- + DISP_REG_SCALER0 = 0,
- + DISP_REG_SCALER1 = 1,
- + DISP_REG_IMAGE0 = 2,
- + DISP_REG_IMAGE1 = 3,
- + DISP_REG_LCDC0 = 4,
- + DISP_REG_LCDC1 = 5,
- + DISP_REG_TVEC0 = 6,
- + DISP_REG_TVEC1 = 7,
- + DISP_REG_CCMU = 8,
- + DISP_REG_PIOC = 9,
- + DISP_REG_PWM = 10,
- +}__disp_reg_index_t;
- +
- +
- +typedef struct
- +{
- + __u32 addr[3]; // frame bufferµÄÄÚÈݵØÖ·£¬¶ÔÓÚrgbÀàÐÍ£¬Ö»ÓÐaddr[0]ÓÐЧ
- + __disp_rectsz_t size;//µ¥Î»ÊÇpixel
- + __disp_pixel_fmt_t format;
- + __disp_pixel_seq_t seq;
- + __disp_pixel_mod_t mode;
- + __bool br_swap; // blue red color swap flag, FALSE:RGB; TRUE:BGR,only used in rgb format
- + __disp_cs_mode_t cs_mode; //color space
- + __bool b_trd_src; //if 3d source, used for scaler mode layer
- + __disp_3d_src_mode_t trd_mode; //source 3d mode, used for scaler mode layer
- + __u32 trd_right_addr[3];//used when in frame packing 3d mode
- +}__disp_fb_t;
- +
- +typedef struct
- +{
- + __disp_layer_work_mode_t mode; //layer work mode
- + __bool b_from_screen;
- + __u8 pipe; //layer pipe,0/1,if in scaler mode, scaler0 must be pipe0, scaler1 must be pipe1
- + __u8 prio; //layer priority,can get layer prio,but never set layer prio,´Óµ×ÖÁ¶¥,ÓÅÏȼ¶ÓɵÍÖÁ¸ß
- + __bool alpha_en; //layer global alpha enable
- + __u16 alpha_val; //layer global alpha value
- + __bool ck_enable; //layer color key enable
- + __disp_rect_t src_win; // framebuffer source window,only care x,y if is not scaler mode
- + __disp_rect_t scn_win; // screen window
- + __disp_fb_t fb; //framebuffer
- + __bool b_trd_out; //if output 3d mode, used for scaler mode layer
- + __disp_3d_out_mode_t out_trd_mode; //output 3d mode, used for scaler mode layer
- +}__disp_layer_info_t;
- +
- +typedef struct
- +{
- + __disp_color_t ck_max;
- + __disp_color_t ck_min;
- + __u32 red_match_rule;//0/1:always match; 2:match if min<=color<=max; 3:match if color>max or color<min
- + __u32 green_match_rule;//0/1:always match; 2:match if min<=color<=max; 3:match if color>max or color<min
- + __u32 blue_match_rule;//0/1:always match; 2:match if min<=color<=max; 3:match if color>max or color<min
- +}__disp_colorkey_t;
- +
- +typedef struct
- +{
- + __s32 id;
- + __u32 addr[3];
- + __u32 addr_right[3];//used when in frame packing 3d mode
- + __bool interlace;
- + __bool top_field_first;
- + __u32 frame_rate; // *FRAME_RATE_BASE(ÏÖÔÚ¶¨Îª1000)
- + __u32 flag_addr;//dit maf flag address
- + __u32 flag_stride;//dit maf flag line stride
- + __bool maf_valid;
- + __bool pre_frame_valid;
- +}__disp_video_fb_t;
- +
- +typedef struct
- +{
- + __bool maf_enable;
- + __bool pre_frame_enable;
- +}__disp_dit_info_t;
- +
- +typedef struct
- +{
- + __disp_hwc_mode_t pat_mode;
- + __u32 addr;
- +}__disp_hwc_pattern_t;
- +
- +typedef struct
- +{
- + __disp_fb_t input_fb;
- + __disp_rect_t source_regn;
- + __disp_fb_t output_fb;
- + __disp_rect_t out_regn;
- +}__disp_scaler_para_t;
- +
- +typedef struct
- +{
- + __disp_fb_t fb;
- + __disp_rect_t src_win;//source region,only care x,y because of not scaler
- + __disp_rect_t scn_win;// sceen region
- +}__disp_sprite_block_para_t;
- +
- +typedef struct
- +{
- + __disp_rectsz_t screen_size;//used when the screen is not displaying on any output device(lcd/hdmi/vga/tv)
- + __disp_fb_t output_fb;
- +}__disp_capture_screen_para_t;
- +
- +typedef struct
- +{
- + __s32 (*Hdmi_open)(void);
- + __s32 (*Hdmi_close)(void);
- + __s32 (*hdmi_set_mode)(__disp_tv_mode_t mode);
- + __s32 (*hdmi_mode_support)(__disp_tv_mode_t mode);
- + __s32 (*hdmi_get_HPD_status)(void);
- + __s32 (*hdmi_set_pll)(__u32 pll, __u32 clk);
- +}__disp_hdmi_func;
- +
- +typedef struct
- +{
- + __u32 lcd_x;
- + __u32 lcd_y;
- + __u32 lcd_dclk_freq;
- + __u32 lcd_pwm_not_used;
- + __u32 lcd_pwm_ch;
- + __u32 lcd_pwm_freq;
- + __u32 lcd_pwm_pol;
- + __u32 lcd_srgb;
- + __u32 lcd_swap;
- +
- + __u32 lcd_if; //0:hv(sync+de); 1:8080; 2:ttl; 3:lvds
- +
- + __u32 lcd_uf;
- + __u32 lcd_vt;
- + __u32 lcd_ht;
- + __u32 lcd_vbp;
- + __u32 lcd_hbp;
- +
- + __u32 lcd_hv_if;
- + __u32 lcd_hv_smode;
- + __u32 lcd_hv_s888_if;
- + __u32 lcd_hv_syuv_if;
- + __u32 lcd_hv_vspw;
- + __u32 lcd_hv_hspw;
- + __u32 lcd_hv_lde_used;
- + __u32 lcd_hv_lde_iovalue;
- +
- + __u32 lcd_ttl_stvh;
- + __u32 lcd_ttl_stvdl;
- + __u32 lcd_ttl_stvdp;
- + __u32 lcd_ttl_ckvt;
- + __u32 lcd_ttl_ckvh;
- + __u32 lcd_ttl_ckvd;
- + __u32 lcd_ttl_oevt;
- + __u32 lcd_ttl_oevh;
- + __u32 lcd_ttl_oevd;
- + __u32 lcd_ttl_sthh;
- + __u32 lcd_ttl_sthd;
- + __u32 lcd_ttl_oehh;
- + __u32 lcd_ttl_oehd;
- + __u32 lcd_ttl_revd;
- + __u32 lcd_ttl_datarate;
- + __u32 lcd_ttl_revsel;
- + __u32 lcd_ttl_datainv_en;
- + __u32 lcd_ttl_datainv_sel;
- +
- + __u32 lcd_lvds_ch; // 0: single channel; 1:dual channel
- + __u32 lcd_lvds_mode; // 0:NS mode; 1:JEIDA mode
- + __u32 lcd_lvds_bitwidth; // 0:24bit; 1:18bit
- + __u32 lcd_lvds_io_cross; // 0:normal; 1:pn cross
- +
- + __u32 lcd_cpu_if;//0:18bit; 1:16bit mode0; 2:16bit mode1; 3:16bit mode2; 4:16bit mode3; 5:9bit; 6:8bit 256K; 7:8bit 65K
- + __u32 lcd_cpu_da;
- + __u32 lcd_frm;
- +
- + __u32 lcd_io_cfg0;
- + __u32 lcd_io_cfg1;
- + __u32 lcd_io_strength;
- +
- + __u32 lcd_gamma_correction_en;
- + __u32 lcd_gamma_tbl[256];
- +
- + __u32 lcd_hv_srgb_seq0;
- + __u32 lcd_hv_srgb_seq1;
- + __u32 lcd_hv_syuv_seq;
- + __u32 lcd_hv_syuv_fdly;
- +
- + __u32 port_index;
- + __u32 start_delay;//not need to config for user
- + __u32 tcon_index; //not need to config for user
- +}__panel_para_t;
- +
- +typedef struct
- +{
- + __u32 pixel_clk;//khz
- + __u32 hor_pixels;
- + __u32 ver_pixels;
- + __u32 hor_total_time;
- + __u32 hor_front_porch;
- + __u32 hor_sync_time;
- + __u32 hor_back_porch;
- + __u32 ver_total_time;
- + __u32 ver_front_porch;
- + __u32 ver_sync_time;
- + __u32 ver_back_porch;
- +}__disp_tcon_timing_t;
- +
- +typedef struct
- +{
- + __u32 base_lcdc0;
- + __u32 base_lcdc1;
- + __u32 base_pioc;
- + __u32 base_ccmu;
- + __u32 base_pwm;
- +}__reg_bases_t;
- +
- +typedef void (*LCD_FUNC) (__u32 sel);
- +typedef struct lcd_function
- +{
- + LCD_FUNC func;
- + __u32 delay;//ms
- +}__lcd_function_t;
- +
- +typedef struct lcd_flow
- +{
- + __lcd_function_t func[5];
- + __u32 func_num;
- + __u32 cur_step;
- +}__lcd_flow_t;
- +
- +typedef struct
- +{
- + void (*cfg_panel_info)(__panel_para_t * info);
- + __s32 (*cfg_open_flow)(__u32 sel);
- + __s32 (*cfg_close_flow)(__u32 sel);
- + __s32 (*lcd_user_defined_func)(__u32 sel, __u32 para1, __u32 para2, __u32 para3);
- +}__lcd_panel_fun_t;
- +
- +typedef struct
- +{
- + __bool enable;
- + __u32 active_state;
- + __u32 duty_ns;
- + __u32 period_ns;
- +}__pwm_info_t;
- +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- +
- +typedef enum
- +{
- + FB_MODE_SCREEN0 = 0,
- + FB_MODE_SCREEN1 = 1,
- + FB_MODE_DUAL_SAME_SCREEN_TB = 2,//two screen, top buffer for screen0, bottom buffer for screen1
- + FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS = 3,//two screen, they have same contents;
- +}__fb_mode_t;
- +
- +typedef struct
- +{
- + __fb_mode_t fb_mode;
- + __disp_layer_work_mode_t mode;
- + __u32 buffer_num;
- + __u32 width;
- + __u32 height;
- +
- + __u32 output_width;//used when scaler mode
- + __u32 output_height;//used when scaler mode
- +
- + __u32 primary_screen_id;//used when FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS
- + __u32 aux_output_width;//used when FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS
- + __u32 aux_output_height;//used when FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS
- +
- +//maybe not used anymore
- + __u32 line_length;//in byte unit
- + __u32 smem_len;
- + __u32 ch1_offset;//use when PLANAR or UV_COMBINED mode
- + __u32 ch2_offset;//use when PLANAR mode
- +}__disp_fb_create_para_t;
- +
- +typedef enum
- +{
- + DISP_INIT_MODE_SCREEN0 = 0,//fb0 for screen0
- + DISP_INIT_MODE_SCREEN1 = 1,//fb0 for screen1
- + DISP_INIT_MODE_TWO_DIFF_SCREEN = 2,//fb0 for screen0 and fb1 for screen1
- + DISP_INIT_MODE_TWO_SAME_SCREEN = 3,//fb0(up buffer for screen0, down buffer for screen1)
- + DISP_INIT_MODE_SCREEN0_PARTLY = 4,//fb0(fb size fix to 1920*1080,but the source window is variable according to the output)
- +}__disp_init_mode_t;
- +
- +
- +typedef struct
- +{
- + __bool b_init;
- + __disp_init_mode_t disp_mode;
- +
- + //for screen0 and screen1
- + __disp_output_type_t output_type[2];
- + __disp_tv_mode_t tv_mode[2];
- + __disp_vga_mode_t vga_mode[2];
- +
- + //for fb0 and fb1
- + __u32 buffer_num[2];
- + __bool scaler_mode[2];
- + __disp_pixel_fmt_t format[2];
- + __disp_pixel_seq_t seq[2];
- + __bool br_swap[2];
- +}__disp_init_t;
- +
- +
- +typedef enum tag_DISP_CMD
- +{
- +//----disp global----
- + DISP_CMD_RESERVE0 = 0x00,
- + DISP_CMD_RESERVE1 = 0x01,
- + DISP_CMD_SET_BKCOLOR = 0x3f,//fail when the value is 0x02 in linux,why???
- + DISP_CMD_GET_BKCOLOR = 0x03,
- + DISP_CMD_SET_COLORKEY = 0x04,
- + DISP_CMD_GET_COLORKEY = 0x05,
- + DISP_CMD_SET_PALETTE_TBL = 0x06,
- + DISP_CMD_GET_PALETTE_TBL = 0x07,
- + DISP_CMD_SCN_GET_WIDTH = 0x08,
- + DISP_CMD_SCN_GET_HEIGHT = 0x09,
- + DISP_CMD_GET_OUTPUT_TYPE = 0x0a,
- + DISP_CMD_SET_EXIT_MODE = 0x0c,
- + DISP_CMD_SET_GAMMA_TABLE = 0x0d,
- + DISP_CMD_GAMMA_CORRECTION_ON = 0x0e,
- + DISP_CMD_GAMMA_CORRECTION_OFF = 0x0f,
- + DISP_CMD_START_CMD_CACHE =0x10,
- + DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE = 0x11,
- + DISP_CMD_SET_BRIGHT = 0x12,
- + DISP_CMD_SET_CONTRAST = 0x13,
- + DISP_CMD_SET_SATURATION = 0x14,
- + DISP_CMD_GET_BRIGHT = 0x16,
- + DISP_CMD_GET_CONTRAST = 0x17,
- + DISP_CMD_GET_SATURATION = 0x18,
- + DISP_CMD_ENHANCE_ON = 0x1a,
- + DISP_CMD_ENHANCE_OFF = 0x1b,
- + DISP_CMD_GET_ENHANCE_EN = 0x1c,
- + DISP_CMD_CLK_ON = 0x1d,
- + DISP_CMD_CLK_OFF = 0x1e,
- + DISP_CMD_SET_SCREEN_SIZE = 0x1f,//when the screen is not used to display(lcd/tv/vga/hdmi) directly, maybe capture the screen and scaler to dram, or as a layer of another screen
- + DISP_CMD_CAPTURE_SCREEN = 0x20,//caputre screen and scaler to dram
- + DISP_CMD_DE_FLICKER_ON = 0x21,
- + DISP_CMD_DE_FLICKER_OFF = 0x22,
- + DISP_CMD_GET_DE_FLICKER_EN = 0x23,
- + DISP_CMD_DRC_ON = 0x24,
- + DISP_CMD_DRC_OFF = 0x25,
- + DISP_CMD_GET_DRC_EN = 0x26,
- + DISP_CMD_DE_FLICKER_SET_WINDOW = 0x27,
- + DISP_CMD_DRC_SET_WINDOW = 0x28,
- + DISP_CMD_SET_HUE = 0x29,
- + DISP_CMD_GET_HUE = 0x2a,
- +
- +//----layer----
- + DISP_CMD_LAYER_REQUEST = 0x40,
- + DISP_CMD_LAYER_RELEASE = 0x41,
- + DISP_CMD_LAYER_OPEN = 0x42,
- + DISP_CMD_LAYER_CLOSE = 0x43,
- + DISP_CMD_LAYER_SET_FB = 0x44,
- + DISP_CMD_LAYER_GET_FB = 0x45,
- + DISP_CMD_LAYER_SET_SRC_WINDOW = 0x46,
- + DISP_CMD_LAYER_GET_SRC_WINDOW = 0x47,
- + DISP_CMD_LAYER_SET_SCN_WINDOW = 0x48,
- + DISP_CMD_LAYER_GET_SCN_WINDOW = 0x49,
- + DISP_CMD_LAYER_SET_PARA = 0x4a,
- + DISP_CMD_LAYER_GET_PARA = 0x4b,
- + DISP_CMD_LAYER_ALPHA_ON = 0x4c,
- + DISP_CMD_LAYER_ALPHA_OFF = 0x4d,
- + DISP_CMD_LAYER_GET_ALPHA_EN = 0x4e,
- + DISP_CMD_LAYER_SET_ALPHA_VALUE = 0x4f,
- + DISP_CMD_LAYER_GET_ALPHA_VALUE = 0x50,
- + DISP_CMD_LAYER_CK_ON = 0x51,
- + DISP_CMD_LAYER_CK_OFF = 0x52,
- + DISP_CMD_LAYER_GET_CK_EN = 0x53,
- + DISP_CMD_LAYER_SET_PIPE = 0x54,
- + DISP_CMD_LAYER_GET_PIPE = 0x55,
- + DISP_CMD_LAYER_TOP = 0x56,
- + DISP_CMD_LAYER_BOTTOM = 0x57,
- + DISP_CMD_LAYER_GET_PRIO = 0x58,
- + DISP_CMD_LAYER_SET_SMOOTH = 0x59,
- + DISP_CMD_LAYER_GET_SMOOTH = 0x5a,
- + DISP_CMD_LAYER_SET_BRIGHT = 0x5b,//ÁÁ¶È
- + DISP_CMD_LAYER_SET_CONTRAST = 0x5c,//¶Ô±È¶È
- + DISP_CMD_LAYER_SET_SATURATION = 0x5d,//±¥ºÍ¶È
- + DISP_CMD_LAYER_SET_HUE = 0x5e,//É«µ÷,É«¶È
- + DISP_CMD_LAYER_GET_BRIGHT = 0x5f,
- + DISP_CMD_LAYER_GET_CONTRAST = 0x60,
- + DISP_CMD_LAYER_GET_SATURATION = 0x61,
- + DISP_CMD_LAYER_GET_HUE = 0x62,
- + DISP_CMD_LAYER_ENHANCE_ON = 0x63,
- + DISP_CMD_LAYER_ENHANCE_OFF = 0x64,
- + DISP_CMD_LAYER_GET_ENHANCE_EN = 0x65,
- + DISP_CMD_LAYER_VPP_ON = 0x67,
- + DISP_CMD_LAYER_VPP_OFF = 0x68,
- + DISP_CMD_LAYER_GET_VPP_EN = 0x69,
- + DISP_CMD_LAYER_SET_LUMA_SHARP_LEVEL = 0x6a,
- + DISP_CMD_LAYER_GET_LUMA_SHARP_LEVEL = 0x6b,
- + DISP_CMD_LAYER_SET_CHROMA_SHARP_LEVEL = 0x6c,
- + DISP_CMD_LAYER_GET_CHROMA_SHARP_LEVEL = 0x6d,
- + DISP_CMD_LAYER_SET_WHITE_EXTEN_LEVEL = 0x6e,
- + DISP_CMD_LAYER_GET_WHITE_EXTEN_LEVEL = 0x6f,
- + DISP_CMD_LAYER_SET_BLACK_EXTEN_LEVEL = 0x70,
- + DISP_CMD_LAYER_GET_BLACK_EXTEN_LEVEL = 0x71,
- +
- +//----scaler----
- + DISP_CMD_SCALER_REQUEST = 0x80,
- + DISP_CMD_SCALER_RELEASE = 0x81,
- + DISP_CMD_SCALER_EXECUTE = 0x82,
- + DISP_CMD_SCALER_EXECUTE_EX = 0x83,
- +
- +//----hwc----
- + DISP_CMD_HWC_OPEN = 0xc0,
- + DISP_CMD_HWC_CLOSE = 0xc1,
- + DISP_CMD_HWC_SET_POS = 0xc2,
- + DISP_CMD_HWC_GET_POS = 0xc3,
- + DISP_CMD_HWC_SET_FB = 0xc4,
- + DISP_CMD_HWC_SET_PALETTE_TABLE = 0xc5,
- +
- +//----video----
- + DISP_CMD_VIDEO_START = 0x100,
- + DISP_CMD_VIDEO_STOP = 0x101,
- + DISP_CMD_VIDEO_SET_FB = 0x102,
- + DISP_CMD_VIDEO_GET_FRAME_ID = 0x103,
- + DISP_CMD_VIDEO_GET_DIT_INFO = 0x104,
- +
- +//----lcd----
- + DISP_CMD_LCD_ON = 0x140,
- + DISP_CMD_LCD_OFF = 0x141,
- + DISP_CMD_LCD_SET_BRIGHTNESS = 0x142,
- + DISP_CMD_LCD_GET_BRIGHTNESS = 0x143,
- + DISP_CMD_LCD_CPUIF_XY_SWITCH = 0x146,
- + DISP_CMD_LCD_CHECK_OPEN_FINISH = 0x14a,
- + DISP_CMD_LCD_CHECK_CLOSE_FINISH = 0x14b,
- + DISP_CMD_LCD_SET_SRC = 0x14c,
- + DISP_CMD_LCD_USER_DEFINED_FUNC = 0x14d,
- +
- +//----tv----
- + DISP_CMD_TV_ON = 0x180,
- + DISP_CMD_TV_OFF = 0x181,
- + DISP_CMD_TV_SET_MODE = 0x182,
- + DISP_CMD_TV_GET_MODE = 0x183,
- + DISP_CMD_TV_AUTOCHECK_ON = 0x184,
- + DISP_CMD_TV_AUTOCHECK_OFF = 0x185,
- + DISP_CMD_TV_GET_INTERFACE = 0x186,
- + DISP_CMD_TV_SET_SRC = 0x187,
- + DISP_CMD_TV_GET_DAC_STATUS = 0x188,
- + DISP_CMD_TV_SET_DAC_SOURCE = 0x189,
- + DISP_CMD_TV_GET_DAC_SOURCE = 0x18a,
- +
- +//----hdmi----
- + DISP_CMD_HDMI_ON = 0x1c0,
- + DISP_CMD_HDMI_OFF = 0x1c1,
- + DISP_CMD_HDMI_SET_MODE = 0x1c2,
- + DISP_CMD_HDMI_GET_MODE = 0x1c3,
- + DISP_CMD_HDMI_SUPPORT_MODE = 0x1c4,
- + DISP_CMD_HDMI_GET_HPD_STATUS = 0x1c5,
- + DISP_CMD_HDMI_SET_SRC = 0x1c6,
- +
- +//----vga----
- + DISP_CMD_VGA_ON = 0x200,
- + DISP_CMD_VGA_OFF = 0x201,
- + DISP_CMD_VGA_SET_MODE = 0x202,
- + DISP_CMD_VGA_GET_MODE = 0x203,
- + DISP_CMD_VGA_SET_SRC = 0x204,
- +
- +//----sprite----
- + DISP_CMD_SPRITE_OPEN = 0x240,
- + DISP_CMD_SPRITE_CLOSE = 0x241,
- + DISP_CMD_SPRITE_SET_FORMAT = 0x242,
- + DISP_CMD_SPRITE_GLOBAL_ALPHA_ENABLE = 0x243,
- + DISP_CMD_SPRITE_GLOBAL_ALPHA_DISABLE = 0x244,
- + DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_ENABLE = 0x252,
- + DISP_CMD_SPRITE_SET_GLOBAL_ALPHA_VALUE = 0x245,
- + DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_VALUE = 0x253,
- + DISP_CMD_SPRITE_SET_ORDER = 0x246,
- + DISP_CMD_SPRITE_GET_TOP_BLOCK = 0x250,
- + DISP_CMD_SPRITE_GET_BOTTOM_BLOCK = 0x251,
- + DISP_CMD_SPRITE_SET_PALETTE_TBL = 0x247,
- + DISP_CMD_SPRITE_GET_BLOCK_NUM = 0x259,
- + DISP_CMD_SPRITE_BLOCK_REQUEST = 0x248,
- + DISP_CMD_SPRITE_BLOCK_RELEASE = 0x249,
- + DISP_CMD_SPRITE_BLOCK_OPEN = 0x257,
- + DISP_CMD_SPRITE_BLOCK_CLOSE = 0x258,
- + DISP_CMD_SPRITE_BLOCK_SET_SOURCE_WINDOW = 0x25a,
- + DISP_CMD_SPRITE_BLOCK_GET_SOURCE_WINDOW = 0x25b,
- + DISP_CMD_SPRITE_BLOCK_SET_SCREEN_WINDOW = 0x24a,
- + DISP_CMD_SPRITE_BLOCK_GET_SCREEN_WINDOW = 0x24c,
- + DISP_CMD_SPRITE_BLOCK_SET_FB = 0x24b,
- + DISP_CMD_SPRITE_BLOCK_GET_FB = 0x24d,
- + DISP_CMD_SPRITE_BLOCK_SET_PARA = 0x25c,
- + DISP_CMD_SPRITE_BLOCK_GET_PARA = 0x25d,
- + DISP_CMD_SPRITE_BLOCK_SET_TOP = 0x24e,
- + DISP_CMD_SPRITE_BLOCK_SET_BOTTOM = 0x24f,
- + DISP_CMD_SPRITE_BLOCK_GET_PREV_BLOCK = 0x254,
- + DISP_CMD_SPRITE_BLOCK_GET_NEXT_BLOCK = 0x255,
- + DISP_CMD_SPRITE_BLOCK_GET_PRIO = 0x256,
- +
- +//----framebuffer----
- + DISP_CMD_FB_REQUEST = 0x280,
- + DISP_CMD_FB_RELEASE = 0x281,
- + DISP_CMD_FB_GET_PARA = 0x282,
- + DISP_CMD_GET_DISP_INIT_PARA = 0x283,
- +
- +//---for Displayer Test --------
- + DISP_CMD_MEM_REQUEST = 0x2c0,
- + DISP_CMD_MEM_RELASE = 0x2c1,
- + DISP_CMD_MEM_GETADR = 0x2c2,
- + DISP_CMD_MEM_SELIDX = 0x2c3,
- +
- + DISP_CMD_SUSPEND = 0x2d0,
- + DISP_CMD_RESUME = 0x2d1,
- +
- + DISP_CMD_PRINT_REG = 0x2e0,
- +
- +//---pwm --------
- + DISP_CMD_PWM_SET_PARA = 0x300,
- + DISP_CMD_PWM_GET_PARA = 0x301,
- +}__disp_cmd_t;
- +
- +#define FBIOGET_LAYER_HDL_0 0x4700
- +#define FBIOGET_LAYER_HDL_1 0x4701
- +
- +#define FBIO_CLOSE 0x4710
- +#define FBIO_OPEN 0x4711
- +#define FBIO_ALPHA_ON 0x4712
- +#define FBIO_ALPHA_OFF 0x4713
- +#define FBIOPUT_ALPHA_VALUE 0x4714
- +
- +#define FBIO_DISPLAY_SCREEN0_ONLY 0x4720
- +#define FBIO_DISPLAY_SCREEN1_ONLY 0x4721
- +#define FBIO_DISPLAY_TWO_SAME_SCREEN_TB 0x4722
- +#define FBIO_DISPLAY_TWO_DIFF_SCREEN_SAME_CONTENTS 0x4723
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/a10/libcedarv.h xbmc_vidonme/xbmc/cores/a10/libcedarv.h
- --- xbmc_orig/xbmc/cores/a10/libcedarv.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/a10/libcedarv.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,348 @@
- +
- +#ifndef LIBCEDARV_H
- +#define LIBCEDARV_H
- +
- +#ifdef __cplusplus
- +extern "C" {
- +#endif
- +
- + #include "libve_typedef.h"
- +
- + //* Display Time Window
- + //* |<---window_width--->|<---window_width--->|
- + //* |<--------------------------------------->|
- + //* ^
- + //* Frame PTS
- + #define DISPLAY_TIME_WINDOW_WIDTH 15 //* when current time fall in one picture's display time window, this picture
- + //* can be show, otherwise it maybe too early or too late to show this picture.
- +
- + #define CEDARV_BVOP_DEC_LATE_THRESHOLD 60 //* decode B-VOP time late threshold, if the later than this value, the B-VOP
- + //* will be dropped without decoded.
- + #define CEDARV_VOP_DEC_LATE_THRESHOLD 1000 //* decode vop too late threshold, if the time of vop decode is later than this
- + //* value, the no-key frames before next key frame will be dropped all.
- +
- + typedef enum CEDARV_STREAM_FORMAT
- + {
- + CEDARV_STREAM_FORMAT_UNKNOW,
- + CEDARV_STREAM_FORMAT_MPEG2,
- + CEDARV_STREAM_FORMAT_MPEG4,
- + CEDARV_STREAM_FORMAT_REALVIDEO,
- + CEDARV_STREAM_FORMAT_H264,
- + CEDARV_STREAM_FORMAT_VC1,
- + CEDARV_STREAM_FORMAT_AVS,
- + CEDARV_STREAM_FORMAT_MJPEG,
- + CEDARV_STREAM_FORMAT_VP8,
- + CEDARV_STREAM_FORMAT_NETWORK
- + }cedarv_stream_format_e;
- +
- + typedef enum CEDARV_SUB_FORMAT
- + {
- + CEDARV_SUB_FORMAT_UNKNOW = 0,
- + CEDARV_MPEG2_SUB_FORMAT_MPEG1,
- + CEDARV_MPEG2_SUB_FORMAT_MPEG2,
- + CEDARV_MPEG4_SUB_FORMAT_XVID,
- + CEDARV_MPEG4_SUB_FORMAT_DIVX3,
- + CEDARV_MPEG4_SUB_FORMAT_DIVX4,
- + CEDARV_MPEG4_SUB_FORMAT_DIVX5,
- + CEDARV_MPEG4_SUB_FORMAT_SORENSSON_H263,
- + CEDARV_MPEG4_SUB_FORMAT_H263,
- + CEDARV_MPEG4_SUB_FORMAT_RMG2, //* H263 coded video stream muxed in '.rm' file.
- + CEDARV_MPEG4_SUB_FORMAT_VP6,
- + CEDARV_MPEG4_SUB_FORMAT_WMV1,
- + CEDARV_MPEG4_SUB_FORMAT_WMV2,
- + CEDARV_MPEG4_SUB_FORMAT_DIVX2, //MSMPEG4V2
- + CEDARV_MPEG4_SUB_FORMAT_DIVX1, //MSMPEG4V1
- + }cedarv_sub_format_e;
- +
- + typedef enum CEDARV_CONTAINER_FORMAT
- + {
- + CEDARV_CONTAINER_FORMAT_UNKNOW,
- + CEDARV_CONTAINER_FORMAT_AVI,
- + CEDARV_CONTAINER_FORMAT_ASF,
- + CEDARV_CONTAINER_FORMAT_DAT,
- + CEDARV_CONTAINER_FORMAT_FLV,
- + CEDARV_CONTAINER_FORMAT_MKV,
- + CEDARV_CONTAINER_FORMAT_MOV,
- + CEDARV_CONTAINER_FORMAT_MPG,
- + CEDARV_CONTAINER_FORMAT_PMP,
- + CEDARV_CONTAINER_FORMAT_RM,
- + CEDARV_CONTAINER_FORMAT_TS,
- + CEDARV_CONTAINER_FORMAT_VOB,
- + CEDARV_CONTAINER_FORMAT_WEBM,
- + CEDARV_CONTAINER_FORMAT_OGM,
- + }cedarv_container_format_e;
- +
- + typedef enum CEDARV_3D_MODE
- + {
- + //* for 2D pictures.
- + CEDARV_3D_MODE_NONE = 0,
- +
- + //* for double stream video like MVC and MJPEG.
- + CEDARV_3D_MODE_DOUBLE_STREAM,
- +
- + //* for single stream video.
- + CEDARV_3D_MODE_SIDE_BY_SIDE,
- + CEDARV_3D_MODE_TOP_TO_BOTTOM,
- + CEDARV_3D_MODE_LINE_INTERLEAVE,
- + CEDARV_3D_MODE_COLUME_INTERLEAVE
- +
- + }cedarv_3d_mode_e;
- +
- + typedef enum CEDARV_ANAGLAGH_TRANSFORM_MODE
- + {
- + //* for transmission from 'size by size' or 'top to bottom' mode to 'anaglagh' modes.
- + //* these values are just for output, 3d mode in stream information structure should
- + //* not set to these values.
- + CEDARV_ANAGLAGH_RED_BLUE,
- + CEDARV_ANAGLAGH_RED_GREEN,
- + CEDARV_ANAGLAGH_RED_CYAN,
- + CEDARV_ANAGLAGH_COLOR,
- + CEDARV_ANAGLAGH_HALF_COLOR,
- + CEDARV_ANAGLAGH_OPTIMIZED,
- + CEDARV_ANAGLAGH_YELLOW_BLUE,
- + CEDARV_ANAGLAGH_NONE,
- + }cedarv_anaglath_trans_mode_e;
- +
- + typedef struct CEDARV_STREAM_INFORMATION
- + {
- + cedarv_stream_format_e format;
- + cedarv_sub_format_e sub_format;
- + cedarv_container_format_e container_format;
- + u32 video_width; //* video picture width, if unknown please set it to 0;
- + u32 video_height; //* video picture height, if unknown please set it to 0;
- + u32 frame_rate; //* frame rate, multiplied by 1000, ex. 29.970 frames per second then frame_rate = 29970;
- + u32 frame_duration; //* how many us one frame should be display;
- + u32 aspect_ratio; //* pixel width to pixel height ratio, multiplied by 1000;
- + u32 init_data_len; //* data length of the initial data for decoder;
- + u8* init_data; //* some decoders may need initial data to start up;
- + u32 is_pts_correct; //* used for h.264 decoder current;
- +
- + cedarv_3d_mode_e _3d_mode;
- + }cedarv_stream_info_t;
- +
- +
- + #define CEDARV_FLAG_PTS_VALID 0x2
- + #define CEDARV_FLAG_FIRST_PART 0x8
- + #define CEDARV_FLAG_LAST_PART 0x10
- + #define CEDARV_FLAG_MPEG4_EMPTY_FRAME 0x20
- + #define CEDARV_FLAG_DECODE_NO_DELAY 0x40000000
- + #define CEDARV_FLAG_DATA_INVALID 0x80000000
- +
- + typedef struct CEDARV_STREAM_DATA_INFORMATION
- + {
- + u32 flags;
- + u32 lengh;
- + u64 pts;
- + u32 type;
- + }cedarv_stream_data_info_t;
- +
- +
- + typedef enum CEDARV_PIXEL_FORMAT
- + {
- + CEDARV_PIXEL_FORMAT_1BPP = 0x0,
- + CEDARV_PIXEL_FORMAT_2BPP = 0x1,
- + CEDARV_PIXEL_FORMAT_4BPP = 0x2,
- + CEDARV_PIXEL_FORMAT_8BPP = 0x3,
- + CEDARV_PIXEL_FORMAT_RGB655 = 0x4,
- + CEDARV_PIXEL_FORMAT_RGB565 = 0x5,
- + CEDARV_PIXEL_FORMAT_RGB556 = 0x6,
- + CEDARV_PIXEL_FORMAT_ARGB1555 = 0x7,
- + CEDARV_PIXEL_FORMAT_RGBA5551 = 0x8,
- + CEDARV_PIXEL_FORMAT_RGB888 = 0x9,
- + CEDARV_PIXEL_FORMAT_ARGB8888 = 0xa,
- + CEDARV_PIXEL_FORMAT_YUV444 = 0xb,
- + CEDARV_PIXEL_FORMAT_YUV422 = 0xc,
- + CEDARV_PIXEL_FORMAT_YUV420 = 0xd,
- + CEDARV_PIXEL_FORMAT_YUV411 = 0xe,
- + CEDARV_PIXEL_FORMAT_CSIRGB = 0xf,
- + CEDARV_PIXEL_FORMAT_AW_YUV420 = 0x10,
- + CEDARV_PIXEL_FORMAT_AW_YUV422 = 0x11,
- + CEDARV_PIXEL_FORMAT_AW_YUV411 = 0x12
- + }cedarv_pixel_format_e;
- +
- + #define CEDARV_PICT_PROP_NO_SYNC 0x1
- +
- + typedef struct CEDARV_PICTURE_INFORMATION
- + {
- + u32 id; //* picture id assigned by outside, decoder do not use this field;
- +
- + u32 width; //* width of picture content;
- + u32 height; //* height of picture content;
- + u32 top_offset; //* display region top offset;
- + u32 left_offset; //* display region left offset;
- + u32 display_width; //* display region width;
- + u32 display_height; //* display region height;
- + u32 store_width; //* stored picture width;
- + u32 store_height; //* stored picture height;
- +
- + u8 rotate_angle; //* how this picture has been rotated, 0: no rotate, 1: 90 degree (clock wise), 2: 180, 3: 270, 4: horizon flip, 5: vertical flig;
- + u8 horizontal_scale_ratio; //* what ratio this picture has been scaled down at horizon size, 0: 1/1, 1: 1/2, 2: 1/4, 3: 1/8;
- + u8 vertical_scale_ratio; //* what ratio this picture has been scaled down at vetical size, 0: 1/1, 1: 1/2, 2: 1/4, 3: 1/8;
- + u32 frame_rate; //* frame_rate, multiplied by 1000;
- + u32 aspect_ratio; //* pixel width to pixel height ratio, multiplied by 1000;
- + u32 pict_prop; //* picture property flags
- + u8 is_progressive; //* progressive or interlace picture;
- + u8 top_field_first; //* display top field first;
- + u8 repeat_top_field; //* if interlace picture, whether repeat the top field when display;
- + u8 repeat_bottom_field; //* if interlace picture, whether repeat the bottom field when display;
- + cedarv_pixel_format_e pixel_format;
- + u64 pts; //* presentation time stamp, in unit of milli-second;
- + u64 pcr; //* program clock reference;
- +
- + cedarv_3d_mode_e _3d_mode;
- + cedarv_anaglath_trans_mode_e anaglath_transform_mode;
- +
- + u32 size_y;
- + u32 size_u;
- + u32 size_v;
- + u32 size_alpha;
- +
- + u8* y; //* pixel data, it is interpreted based on pixel_format;
- + u8* u; //* pixel data, it is interpreted based on pixel_format;
- + u8* v; //* pixel data, it is interpreted based on pixel_format;
- + u8* alpha; //* pixel data, it is interpreted based on pixel_format;
- +
- + u32 size_y2;
- + u32 size_u2;
- + u32 size_v2;
- + u32 size_alpha2;
- +
- + u8 * y2;
- + u8 * u2;
- + u8 * v2;
- + u8 * alpha2;
- +
- + u32 display_3d_mode; //* this value has nothing to do with decoder, it is used for video render to
- + //* pass display mode to overlay module.
- + u32 flag_addr;//dit maf flag address
- + u32 flag_stride;//dit maf flag line stride
- + u8 maf_valid;
- + u8 pre_frame_valid;
- + }cedarv_picture_t;
- +
- + typedef enum CEDARV_RESULT
- + {
- + CEDARV_RESULT_OK = 0x0, //* operation success;
- + CEDARV_RESULT_FRAME_DECODED = 0x1, //* decode operation decodes one frame;
- + CEDARV_RESULT_KEYFRAME_DECODED = 0x3, //* decode operation decodes one key frame;
- + CEDARV_RESULT_NO_FRAME_BUFFER = 0x4, //* fail when try to get an empty frame buffer;
- + CEDARV_RESULT_NO_BITSTREAM = 0x5, //* fail when try to get bitstream frame;
- +
- + CEDARV_RESULT_ERR_FAIL = -1, //* operation fail;
- + CEDARV_RESULT_ERR_INVALID_PARAM = -2, //* failure caused by invalid function parameter;
- + CEDARV_RESULT_ERR_INVALID_STREAM = -3, //* failure caused by invalid video stream data;
- + CEDARV_RESULT_ERR_NO_MEMORY = -4, //* failure caused by memory allocation fail;
- + CEDARV_RESULT_ERR_UNSUPPORTED = -5, //* failure caused by not supported stream content;
- + }cedarv_result_e;
- +
- +
- + typedef enum CEDARV_STATUS
- + {
- + CEDARV_STATUS_STOP,
- + CEDARV_STATUS_PAUSE,
- + CEDARV_STATUS_PLAY,
- + CEDARV_STATUS_FORWARD,
- + CEDARV_STATUS_BACKWARD,
- + CEDARV_STATUS_PREVIEW
- + }cedarv_status_e;
- +
- + typedef enum CEDARV_IO_COMMAND
- + {
- + CEDARV_COMMAND_PLAY,
- + CEDARV_COMMAND_PAUSE,
- + CEDARV_COMMAND_FORWARD,
- + CEDARV_COMMAND_BACKWARD,
- + CEDARV_COMMAND_STOP,
- + CEDARV_COMMAND_JUMP,
- + CEDARV_COMMAND_ROTATE,
- + CEDARV_COMMAND_SET_TOTALMEMSIZE,
- +
- + CEDARV_COMMAND_DROP_B_FRAME,
- + CEDARV_COMMAND_DISABLE_3D,
- + CEDARV_COMMAN_SET_SYS_TIME,
- + //* for preview application.
- + CEDARV_COMMAND_PREVIEW_MODE, //* aux = 0, pbuffer = NULL,
- + //* return value always CEDARV_RESULT_OK, should be called before the 'open' fuction.
- + //reset vdeclib
- + CEDARV_COMMAND_RESET,
- +
- + //* set max output size for scale mode.
- + CEDARV_COMMAND_SET_MAX_OUTPUT_HEIGHT,
- + CEDARV_COMMAND_SET_MAX_OUTPUT_WIDTH,
- +
- + CEDARV_COMMAND_GET_STREAM_INFO, //* param = cedarv_stream_info_t*
- +
- + //* for mpeg2 tag play.
- + CEDARV_COMMAND_GET_SEQUENCE_INFO,
- + CEDARV_COMMAND_SET_SEQUENCE_INFO,
- +
- + //* for transforming 3d 'size by size' or 'top to bottom' pictures to 'anaglagh' pictures.
- + CEDARV_COMMAND_SET_STREAM_3D_MODE, //* reset the 3d mode of input stream.
- + CEDARV_COMMAND_SET_ANAGLATH_TRANS_MODE, //* select an output 3d mode, this will be used only to decide which analagh transform mode is used.
- + CEDARV_COMMAND_OPEN_ANAGLATH_TRANSFROM, //* open ve anaglath transformation
- + CEDARV_COMMAND_CLOSE_ANAGLATH_TRANSFROM, //* close ve anaglath transformation
- + CEDARV_COMMAND_GET_CHIP_VERSION,
- +
- + CEDARV_COMMAND_FLUSH,
- + CEDARV_COMMAND_CLOSE_MAF,
- + CEDARV_COMMAND_SET_DEMUX_TYPE
- + }cedarv_io_cmd_e;
- +
- +
- + typedef struct CEDARV_QUALITY
- + {
- + u32 vbv_buffer_usage; //* persentage of the VBV buffer;
- + u32 frame_num_in_vbv; //* bitstream frame number in vbv;
- + }cedarv_quality_t;
- +
- + typedef enum CDX_DECODE_VIDEO_STREAM_TYPE
- + {
- + CDX_VIDEO_STREAM_MAJOR = 0,
- + CDX_VIDEO_STREAM_MINOR,
- + CDX_VIDEO_STREAM_NONE,
- + }CDX_VIDEO_STREAM_TYPE;
- +
- + typedef struct CEDARV_DECODER cedarv_decoder_t;
- + struct CEDARV_DECODER
- + {
- + CDX_VIDEO_STREAM_TYPE video_stream_type;
- +
- + s32 (*open)(cedarv_decoder_t* p);
- + s32 (*close)(cedarv_decoder_t* p);
- + s32 (*decode)(cedarv_decoder_t* p);
- + s32 (*ioctrl)(cedarv_decoder_t* p, u32 cmd, u32 param);
- + s32 (*request_write)(cedarv_decoder_t*p, u32 require_size, u8** buf0, u32* size0, u8** buf1, u32* size1);
- + s32 (*update_data)(cedarv_decoder_t* p, cedarv_stream_data_info_t* data_info);
- +
- + s32 (*display_request)(cedarv_decoder_t* p, cedarv_picture_t* picture);
- + s32 (*display_release)(cedarv_decoder_t* p, u32 frame_index);
- + s32 (*picture_ready)(cedarv_decoder_t* p);
- + s32 (*display_dump_picture)(cedarv_decoder_t* p, cedarv_picture_t* picture);
- + s32 (*set_vstream_info)(cedarv_decoder_t* p, cedarv_stream_info_t* info);
- +
- + s32 (*query_quality)(cedarv_decoder_t* p, cedarv_quality_t* vq);
- +
- + void (*release_frame_buffer_sem)(void* cookie);
- + void (*free_vbs_buffer_sem)(void* cookie);
- +
- + void *cedarx_cookie;
- + };
- +
- + cedarv_decoder_t* libcedarv_init(s32 *ret);
- + s32 libcedarv_exit(cedarv_decoder_t* p);
- +
- + void libcedarv_free_vbs_buffer_sem(void* vdecoder);
- +
- + #define LIBVE_DEBUG
- + #ifdef LIBVE_DEBUG
- + #define __msg(msg...) {printf("%s:%d ", __FILE__, __LINE__); printf(msg); printf("\n");}
- + #else
- + #define __msg(msg...) ((void)0)
- + #endif
- +
- +#ifdef __cplusplus
- +}
- +#endif
- +
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/a10/libve_typedef.h xbmc_vidonme/xbmc/cores/a10/libve_typedef.h
- --- xbmc_orig/xbmc/cores/a10/libve_typedef.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/a10/libve_typedef.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,265 @@
- +
- +#ifndef LIBVE_TYPEDEF_H
- +#define LIBVE_TYPEDEF_H
- +
- +#ifdef __cplusplus
- +extern "C" {
- +#endif
- +
- + //*******************************************************//
- + //*************** Basic type definition. ****************//
- + //*******************************************************//
- + #ifndef u8
- + typedef unsigned char u8;
- + #endif
- + #ifndef u16
- + typedef unsigned short u16;
- + #endif
- + #ifndef u32
- + typedef unsigned int u32;
- + #endif
- + #ifndef u64
- + #ifdef COMPILER_ARMCC
- + typedef unsigned __int64 u64;
- + #else
- + typedef unsigned long long u64;
- + #endif
- + #endif
- + #ifndef s8
- + typedef signed char s8;
- + #endif
- + #ifndef s16
- + typedef signed short s16;
- + #endif
- + #ifndef s32
- + typedef signed int s32;
- + #endif
- + #ifndef s64
- + #ifdef COMPILER_ARMCC
- + typedef signed __int64 s64;
- + #else
- + typedef signed long long s64;
- + #endif
- + #endif
- + #ifndef Handle
- + typedef void* Handle;
- + #endif
- + #ifndef NULL
- + #define NULL ((void*)0)
- + #endif
- +
- + //*******************************************************//
- + //************ Define Stream Coding Formats. ************//
- + //*******************************************************//
- + typedef enum STREAM_FORMAT
- + {
- + STREAM_FORMAT_UNKNOW,
- + STREAM_FORMAT_MPEG2,
- + STREAM_FORMAT_MPEG4,
- + STREAM_FORMAT_REALVIDEO,
- + STREAM_FORMAT_H264,
- + STREAM_FORMAT_VC1,
- + STREAM_FORMAT_AVS,
- + STREAM_FORMAT_MJPEG,
- + STREAM_FORMAT_VP8
- + }stream_format_e;
- +
- + typedef enum STREAM_SUB_FORMAT
- + {
- + STREAM_SUB_FORMAT_UNKNOW = 0,
- + MPEG2_SUB_FORMAT_MPEG1,
- + MPEG2_SUB_FORMAT_MPEG2,
- + MPEG4_SUB_FORMAT_XVID,
- + MPEG4_SUB_FORMAT_DIVX3,
- + MPEG4_SUB_FORMAT_DIVX4,
- + MPEG4_SUB_FORMAT_DIVX5,
- + MPEG4_SUB_FORMAT_SORENSSON_H263,
- + MPEG4_SUB_FORMAT_H263,
- + MPEG4_SUB_FORMAT_RMG2, //* H263 coded video stream muxed in '.rm' file.
- + MPEG4_SUB_FORMAT_VP6,
- + MPEG4_SUB_FORMAT_WMV1,
- + MPEG4_SUB_FORMAT_WMV2,
- + MPEG4_SUB_FORMAT_DIVX2, //MSMPEGV2
- + MPEG4_SUB_FORMAT_DIVX1 //MSMPEGV1
- + }stream_sub_format_e;
- +
- + typedef enum CONTAINER_FORMAT
- + {
- + CONTAINER_FORMAT_UNKNOW,
- + CONTAINER_FORMAT_AVI,
- + CONTAINER_FORMAT_ASF,
- + CONTAINER_FORMAT_DAT,
- + CONTAINER_FORMAT_FLV,
- + CONTAINER_FORMAT_MKV,
- + CONTAINER_FORMAT_MOV,
- + CONTAINER_FORMAT_MPG,
- + CONTAINER_FORMAT_PMP,
- + CONTAINER_FORMAT_RM,
- + CONTAINER_FORMAT_TS,
- + CONTAINER_FORMAT_VOB,
- + CONTAINER_FORMAT_WEBM,
- + CONTAINER_FORMAT_OGM,
- + }container_format_e;
- +
- + //*******************************************************//
- + //**************** Define Pixel Formats. ****************//
- + //*******************************************************//
- + typedef enum PIXEL_FORMAT
- + {
- + PIXEL_FORMAT_1BPP = 0x0,
- + PIXEL_FORMAT_2BPP = 0x1,
- + PIXEL_FORMAT_4BPP = 0x2,
- + PIXEL_FORMAT_8BPP = 0x3,
- + PIXEL_FORMAT_RGB655 = 0x4,
- + PIXEL_FORMAT_RGB565 = 0x5,
- + PIXEL_FORMAT_RGB556 = 0x6,
- + PIXEL_FORMAT_ARGB1555 = 0x7,
- + PIXEL_FORMAT_RGBA5551 = 0x8,
- + PIXEL_FORMAT_RGB888 = 0x9,
- + PIXEL_FORMAT_ARGB8888 = 0xa,
- + PIXEL_FORMAT_YUV444 = 0xb,
- + PIXEL_FORMAT_YUV422 = 0xc,
- + PIXEL_FORMAT_YUV420 = 0xd,
- + PIXEL_FORMAT_YUV411 = 0xe,
- + PIXEL_FORMAT_CSIRGB = 0xf,
- +
- + PIXEL_FORMAT_AW_YUV420 = 0x10,
- + PIXEL_FORMAT_AW_YUV422 = 0x11,
- + PIXEL_FORMAT_AW_YUV411 = 0x12
- + }pixel_format_e;
- +
- +
- + //*******************************************************//
- + //************** Define DRAM Memory Type. ***************//
- + //*******************************************************//
- + typedef enum MEMORY_TYPE
- + {
- + MEMTYPE_DDR1_16BITS,
- + MEMTYPE_DDR1_32BITS,
- + MEMTYPE_DDR2_16BITS,
- + MEMTYPE_DDR2_32BITS,
- + MEMTYPE_DDR3_16BITS,
- + MEMTYPE_DDR3_32BITS
- + }memtype_e;
- +
- + typedef enum LIBVE_3D_MODE
- + {
- + //* for 2D pictures.
- + _3D_MODE_NONE = 0,
- +
- + //* for double stream video like MVC and MJPEG.
- + _3D_MODE_DOUBLE_STREAM,
- +
- + //* for single stream video.
- + _3D_MODE_SIDE_BY_SIDE,
- + _3D_MODE_TOP_TO_BOTTOM,
- + _3D_MODE_LINE_INTERLEAVE,
- + _3D_MODE_COLUME_INTERLEAVE,
- +
- + _3D_MODE_MAX
- +
- + }_3d_mode_e;
- +
- + typedef enum LIBVE_ANAGLAGH_TRANSFORM_MODE
- + {
- + ANAGLAGH_RED_BLUE = 0,
- + ANAGLAGH_RED_GREEN,
- + ANAGLAGH_RED_CYAN,
- + ANAGLAGH_COLOR,
- + ANAGLAGH_HALF_COLOR,
- + ANAGLAGH_OPTIMIZED,
- + ANAGLAGH_YELLOW_BLUE,
- + ANAGLAGH_NONE,
- + }anaglath_trans_mode_e;
- +
- +#define CEDARV_PICT_PROP_NO_SYNC 0x1
- +#define CEDARV_FLAG_DECODE_NO_DELAY 0x40000000
- +
- + //*******************************************************//
- + //************ Define Video Frame Structure. ************//
- + //*******************************************************//
- + typedef struct VIDEO_PICTURE
- + {
- + u32 id; //* picture id assigned by outside, decoder do not use this field;
- +
- + u32 width; //* width of picture content;
- + u32 height; //* height of picture content;
- + u32 store_width; //* stored picture width;
- + u32 store_height; //* stored picture height;
- + u32 top_offset; //* display region top offset;
- + u32 left_offset; //* display region left offset;
- + u32 display_width; //* display region width;
- + u32 display_height; //* display region height;
- +
- + u8 rotate_angle; //* how this picture has been rotated, 0: no rotate, 1: 90 degree (clock wise), 2: 180, 3: 270, 4: horizon flip, 5: vertical flig;
- + u8 horizontal_scale_ratio; //* what ratio this picture has been scaled down at horizon size, 0: 1/1, 1: 1/2, 2: 1/4, 3: 1/8;
- + u8 vertical_scale_ratio; //* what ratio this picture has been scaled down at vetical size, 0: 1/1, 1: 1/2, 2: 1/4, 3: 1/8;
- +
- + u32 frame_rate; //* frame_rate, multiplied by 1000;
- + u32 aspect_ratio; //* pixel width to pixel height ratio, multiplied by 1000;
- + u32 pict_prop; //* picture property flags
- + u8 is_progressive; //* progressive or interlace picture;
- + u8 top_field_first; //* display top field first;
- + u8 repeat_top_field; //* if interlace picture, whether repeat the top field when display;
- + u8 repeat_bottom_field; //* if interlace picture, whether repeat the bottom field when display;
- + pixel_format_e pixel_format;
- + u64 pts; //* presentation time stamp, in unit of milli-second;
- + u64 pcr; //* program clock reference;
- +
- + _3d_mode_e _3d_mode;
- + anaglath_trans_mode_e anaglath_transform_mode;
- + u32 size_y;
- + u32 size_u;
- + u32 size_v;
- + u32 size_alpha;
- +
- + u8* y; //* pixel data, it is interpreted based on pixel_format;
- + u8* u; //* pixel data, it is interpreted based on pixel_format;
- + u8* v; //* pixel data, it is interpreted based on pixel_format;
- + u8* alpha; //* pixel data, it is interpreted based on pixel_format;
- +
- + u32 size_y2;
- + u32 size_u2;
- + u32 size_v2;
- + u32 size_alpha2;
- +
- + u8* y2; //* pixel data, it is interpreted based on pixel_format;
- + u8* u2; //* pixel data, it is interpreted based on pixel_format;
- + u8* v2; //* pixel data, it is interpreted based on pixel_format;
- + u8* alpha2; //* pixel data, it is interpreted based on pixel_format;
- + u32 flag_addr;//dit maf flag address
- + u32 flag_stride;//dit maf flag line stride
- + u8 maf_valid;
- + u8 pre_frame_valid;
- + }vpicture_t;
- +
- + //*******************************************************//
- + //********** Define Bitstream Frame Structure. **********//
- + //*******************************************************//
- +
- + //* define stream type for double stream video, such as MVC.
- + //* in that case two video streams is send into libve.
- + typedef enum CEDARV_STREAM_TYPE
- + {
- + CEDARV_STREAM_TYPE_MAJOR,
- + CEDARV_STREAM_TYPE_MINOR,
- + }cedarv_stream_type_e;
- +
- + typedef struct VIDEO_STREAM_DATA
- + {
- + u8* data; //* stream data start address;
- + u32 length; //* stream length in unit of byte;
- + u64 pts; //* presentation time stamp, in unit of milli-second;
- + u64 pcr; //* program clock reference;
- + u8 valid; //* whether this stream frame is valid;
- + u32 id; //* stream frame identification.
- + cedarv_stream_type_e stream_type; //* major or minor stream in MVC.
- + u32 pict_prop;
- + }vstream_data_t;
- +
- +#ifdef __cplusplus
- +}
- +#endif
- +
- +#endif
- +
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -25,6 +25,10 @@
- #include "utils/fastmemcpy.h"
- #include "DllSwScale.h"
- +#if defined(__VIDONME_A10CODEC__)
- +#include "cores/a10/libcedarv.h"
- +#endif
- +
- // allocate a new picture (PIX_FMT_YUV420P)
- DVDVideoPicture* CDVDCodecUtils::AllocatePicture(int iWidth, int iHeight)
- {
- @@ -159,6 +163,26 @@
- return true;
- }
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +
- +bool CDVDCodecUtils::CopyPicture(YV12Image* pImage, const cedarv_picture_t *pSrc)
- +{
- + BYTE *d = pImage->plane[0];
- + int y_len = pSrc->size_y;
- + int u_len = pSrc->size_u;
- + int v_len = pSrc->size_v;
- +
- + int w = pImage->width * pImage->bpp;
- + int h = pImage->height;
- +
- + CLog::Log(LOGDEBUG, "CopyPicture:w:%d -- h:%d - y:%d - u:%d- v:%d\n", w, h, y_len, u_len,v_len);
- + fast_memcpy (d, pSrc->y, u_len);
- +
- + return true;
- +}
- +
- +#endif
- +
- DVDVideoPicture* CDVDCodecUtils::ConvertToNV12Picture(DVDVideoPicture *pSrc)
- {
- // Clone a YV12 picture to new NV12 picture.
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.h xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.h 2013-06-12 16:21:05.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.h 2013-06-12 16:40:35.000000000 +0200
- @@ -25,6 +25,10 @@
- struct YV12Image;
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +#include "cores/a10/libcedarv.h"
- +#endif
- +
- class CDVDCodecUtils
- {
- public:
- @@ -32,6 +36,9 @@
- static void FreePicture(DVDVideoPicture* pPicture);
- static bool CopyPicture(DVDVideoPicture* pDst, DVDVideoPicture* pSrc);
- static bool CopyPicture(YV12Image* pDst, DVDVideoPicture *pSrc);
- + #if defined(__DVDFAB_FUNC_A10CODEC__)
- + static bool CopyPicture(YV12Image* pDst, const cedarv_picture_t *pSrc);
- +#endif
- static DVDVideoPicture* ConvertToNV12Picture(DVDVideoPicture *pSrc);
- static DVDVideoPicture* ConvertToYUV422PackedPicture(DVDVideoPicture *pSrc, ERenderFormat format);
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -30,6 +30,12 @@
- #if defined(HAVE_VIDEOTOOLBOXDECODER)
- #include "Video/DVDVideoCodecVideoToolBox.h"
- #endif
- +
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +#include "Video/DVDVideoCodecA10.h"
- +#include "Application.h"
- +#endif
- +
- #include "Video/DVDVideoCodecFFmpeg.h"
- #include "Video/DVDVideoCodecOpenMax.h"
- #include "Video/DVDVideoCodecLibMpeg2.h"
- @@ -170,6 +176,9 @@
- hwSupport += "VAAPI:no ";
- #endif
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + hwSupport += "A10:yes";
- +#endif
- CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str());
- // dvd's have weird still-frames in it, which is not fully supported in ffmpeg
- @@ -177,6 +186,30 @@
- {
- if( (pCodec = OpenCodec(new CDVDVideoCodecLibMpeg2(), hint, options)) ) return pCodec;
- }
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +
- + if(!hint.software)
- + {
- + //all will using a10 codec
- + /*
- + if (hint.codec == CODEC_ID_H264 ||
- + hint.codec == CODEC_ID_MPEG2VIDEO ||
- + hint.codec == CODEC_ID_VC1 ||
- + hint.codec == CODEC_ID_MPEG4)
- + */
- + {
- + if(pCodec = OpenCodec(new CDVDVideoCodecA10(), hint, options))
- + {
- + CLog::Log(LOGDEBUG, "CDVDFactoryCodec, create a10 codec. info application");
- +
- + //TODO, this function need check it
- + g_application.OnA10Created();
- + return pCodec;
- + }
- + }
- + }
- +
- +#endif
- #if defined(HAVE_LIBVDADECODER)
- if (!hint.software && g_guiSettings.GetBool("videoplayer.usevda"))
- {
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.cpp xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,736 @@
- +#include "DVDVideoCodecA10.h"
- +#include "DVDClock.h"
- +#include "utils/log.h"
- +#include "threads/Atomics.h"
- +
- +#include <sys/ioctl.h>
- +#include <math.h>
- +#include "transform_color_format.h"
- +
- +#include "cores/VideoRenderers/LinuxRendererA10.h"
- +#include "cores/VideoRenderers/RenderFlags.h"
- +
- +#define A10DEBUG
- +#define MEDIAINFO
- +
- +extern void A10VLExit();
- +extern bool A10VLInit(int &width, int &height);
- +
- +static bool a10IsEnabled = false;
- +
- +void EnableA10Renderer ()
- +{
- + a10IsEnabled = true;
- +}
- +
- +bool IsEnableA10Renderer ()
- +{
- + return false;
- +}
- +
- +#define _4CC(c1,c2,c3,c4) (((u32)(c4)<<24)|((u32)(c3)<<16)|((u32)(c2)<<8)|(u32)(c1))
- +
- +static void freecallback(void *callbackpriv, void *pictpriv, cedarv_picture_t &pict)
- +{
- + ((CDVDVideoCodecA10*)callbackpriv)->FreePicture(pictpriv, pict);
- +}
- +
- +CDVDVideoCodecA10::CDVDVideoCodecA10()
- +{
- + m_hcedarv = NULL;
- + m_yuvdata = NULL;
- + m_hwrender = false;
- + memset(&m_picture, 0, sizeof(m_picture));
- +
- + //check libbdv dll is loaded
- +
- + if( !g_libbdv.IsLoaded() )
- + {
- + g_libbdv.EnableDelayedUnload(false);
- + if( !g_libbdv.Load() )
- + CLog::Log(LOGERROR, "Load codec failed !");
- + }
- +
- + m_convert_bitstream = false;
- +}
- +
- +CDVDVideoCodecA10::~CDVDVideoCodecA10()
- +{
- + Dispose();
- + A10VLExit();
- +}
- +
- +bool CDVDVideoCodecA10::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
- +{
- + //check dll is load success
- +
- + if( !g_libbdv.IsLoaded() )
- + {
- + CLog::Log(LOGERROR, "Load failed, cannot start the codec!");
- + return false;
- + }
- +
- + CLog::Log(LOGDEBUG, "--------------------- CDVDVideoCodecA10: Open, %d------------------------ ", hints.codec);
- +
- + s32 ret;
- +
- + if (getenv("NOA10")) {
- + CLog::Log(LOGERROR, "--------------------- CDVDVideoCodecA10: disable ------------------------ ");
- + CLog::Log(LOGNOTICE, "A10: disabled.\n");
- + return false;
- + }
- +
- + m_aspect = hints.aspect;
- +
- + memset(&m_info, 0, sizeof(m_info));
- +
- + m_info.frame_duration = 0;
- + m_info.video_width = hints.width;
- + m_info.video_height = hints.height;
- + m_info.aspect_ratio = 1000;
- + m_info.sub_format = CEDARV_SUB_FORMAT_UNKNOW;
- + m_info.container_format = CEDARV_CONTAINER_FORMAT_UNKNOW;
- + m_info.init_data_len = 0;
- + m_info.init_data = NULL;
- +
- + switch(hints.codec) {
- + //TODO: all the mapping ...
- +
- + //*CEDARV_STREAM_FORMAT_MPEG2
- + case CODEC_ID_MPEG1VIDEO:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG2;
- + m_info.sub_format = CEDARV_MPEG2_SUB_FORMAT_MPEG1;
- + break;
- + case CODEC_ID_MPEG2VIDEO:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG2;
- + m_info.sub_format = CEDARV_MPEG2_SUB_FORMAT_MPEG2;
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_H264
- + case CODEC_ID_H264:
- + m_info.format = CEDARV_STREAM_FORMAT_H264;
- + m_info.init_data_len = hints.extrasize;
- + m_info.init_data = (u8*)hints.extradata;
- + if(hints.codec_tag==27) //M2TS and TS
- + m_info.container_format = CEDARV_CONTAINER_FORMAT_TS;
- +
- +#if 0
- + //disable it temporary
- + // valid avcC data (bitstream) always starts with the value 1 (version)
- + if ( *(char*)hints.extradata == 1 )
- + {
- + CLog::Log(LOGDEBUG, "A10: try to enable bitstream convert.");
- +
- + m_convert_bitstream = bitstream_convert_init(hints.extradata, hints.extrasize);
- +
- + if( m_convert_bitstream )
- + {
- + CLog::Log(LOGDEBUG, "A10: enable bitstream convert.");
- + }
- + }
- +#endif
- +
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_MPEG4
- + case CODEC_ID_MPEG4:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + switch(m_hints.codec_tag)
- + {
- + case _4CC('D','I','V','X'):
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_DIVX4;
- + break;
- + case _4CC('D','X','5','0'):
- + case _4CC('D','I','V','5'):
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_DIVX5;
- + break;
- + case _4CC('X','V','I','D'):
- + case _4CC('M','P','4','V'):
- + case _4CC('P','M','P','4'):
- + case _4CC('F','M','P','4'):
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_XVID;
- + break;
- + default:
- + CLog::Log(LOGERROR, "A10: (MPEG4)Codec Tag %d is unknown.\n", m_hints.codec_tag);
- + return false;
- + }
- + break;
- +
- + //DIVX4
- + //DIVX5
- + //SORENSSON_H263
- + //H263
- + //RMG2
- +
- + //VP6
- + case CODEC_ID_VP6F:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_VP6;
- + m_info.init_data_len = hints.extrasize;
- + m_info.init_data = (u8*)hints.extradata;
- + break;
- + //WMV1
- + case CODEC_ID_WMV1:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_WMV1;
- + break;
- + //WMV2
- + case CODEC_ID_WMV2:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_WMV2;
- + break;
- + //DIVX1
- + case CODEC_ID_MSMPEG4V1:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_DIVX1;
- + break;
- + //DIVX2
- + case CODEC_ID_MSMPEG4V2:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_DIVX2;
- + break;
- + //DIVX3
- + case CODEC_ID_MSMPEG4V3:
- + m_info.format = CEDARV_STREAM_FORMAT_MPEG4;
- + m_info.sub_format = CEDARV_MPEG4_SUB_FORMAT_DIVX3;
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_REALVIDEO
- + case CODEC_ID_RV10:
- + case CODEC_ID_RV20:
- + case CODEC_ID_RV30:
- + case CODEC_ID_RV40:
- + m_info.format = CEDARV_STREAM_FORMAT_REALVIDEO;
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_VC1
- + case CODEC_ID_VC1:
- + m_info.format = CEDARV_STREAM_FORMAT_VC1;
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_AVS
- +
- + //*CEDARV_STREAM_FORMAT_MJPEG
- + case CODEC_ID_MJPEG:
- + m_info.format = CEDARV_STREAM_FORMAT_MJPEG;
- + break;
- +
- + //*CEDARV_STREAM_FORMAT_VP8
- + case CODEC_ID_VP8:
- + m_info.format = CEDARV_STREAM_FORMAT_VP8;
- + break;
- +
- + //*
- + default:
- + CLog::Log(LOGERROR, "A10: codecid %d is unknown.\n", hints.codec);
- + return false;
- + }
- +
- + m_hcedarv = g_libbdv.libcedarv_init(&ret);
- + if (ret < 0) {
- + CLog::Log(LOGERROR, "A10: libcedarv_init failed. (%d)\n", ret);
- + return false;
- + }
- +
- + ret = m_hcedarv->set_vstream_info(m_hcedarv, &m_info);
- + if (ret < 0) {
- + CLog::Log(LOGERROR, "A10: set_vstream_m_info failed. (%d), id(%d), format(%d)\n", ret, hints.codec, m_info.format);
- + return false;
- + }
- +
- + ret = m_hcedarv->open(m_hcedarv);
- + if(ret < 0) {
- + CLog::Log(LOGERROR, "A10: open failed. (%d)\n", ret);
- + return false;
- + }
- +
- + ret = m_hcedarv->ioctrl(m_hcedarv, CEDARV_COMMAND_PLAY, 0);
- + if (ret < 0) {
- + CLog::Log(LOGERROR, "A10: CEDARV_COMMAND_PLAY failed. (%d)\n", ret);
- + return false;
- + }
- +
- + CLog::Log(LOGDEBUG, "A10: cedar open.");
- +
- + int width = 0, height = 0;
- + A10VLInit (width, height);
- +
- + /*
- + pthread_attr_t attr;
- + pthread_attr_init(&attr);
- + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- + pthread_create(&m_thread_t, &attr, thread_decode, this);
- + pthread_attr_destroy(&attr);
- + */
- + return true;
- +}
- +
- +bool CDVDVideoCodecA10::DoOpen()
- +{
- + s32 ret;
- +
- + m_hcedarv = g_libbdv.libcedarv_init(&ret);
- + if (ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: libcedarv_init failed. (%d)\n", ret);
- + goto Error;
- + }
- +
- + ret = m_hcedarv->set_vstream_info(m_hcedarv, &m_info);
- + if (ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: set_vstream_info failed. (%d)\n", ret);
- + goto Error;
- + }
- +
- + ret = m_hcedarv->open(m_hcedarv);
- + if (ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: open failed. (%d)\n", ret);
- + goto Error;
- + }
- +
- + ret = m_hcedarv->ioctrl(m_hcedarv, CEDARV_COMMAND_PLAY, 0);
- + if (ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: CEDARV_COMMAND_PLAY failed. (%d)\n", ret);
- + goto Error;
- + }
- +
- + CLog::Log(LOGDEBUG, "A10: cedar open.");
- + return true;
- +
- +Error:
- +
- + Dispose();
- + return false;
- +}
- +
- +/*
- +* Dispose, Free all resources
- +*/
- +void CDVDVideoCodecA10::Dispose()
- +{
- + CLog::Log(LOGDEBUG, "A10: cedar dispose.");
- + A10VLFreeQueue();
- + /*if (m_yuvdata)
- + {
- + free(m_yuvdata);
- + m_yuvdata = NULL;
- + }
- + */
- + if (m_hcedarv)
- + {
- + m_hcedarv->ioctrl(m_hcedarv, CEDARV_COMMAND_STOP, 0);
- + m_hcedarv->close(m_hcedarv);
- + g_libbdv.libcedarv_exit(m_hcedarv);
- + m_hcedarv = NULL;
- + CLog::Log(LOGDEBUG, "A10: cedar dispose.");
- + }
- +
- + if (m_convert_bitstream)
- + {
- + if (m_sps_pps_context.sps_pps_data)
- + {
- + free(m_sps_pps_context.sps_pps_data);
- + m_sps_pps_context.sps_pps_data = NULL;
- + }
- + }
- +}
- +
- +/*
- +* returns one or a combination of VC_ messages
- +* pData and iSize can be NULL, this means we should flush the rest of the data.
- +*/
- +int CDVDVideoCodecA10::Decode(BYTE* pData, int iSize, double dts, double pts)
- +{
- + s32 ret;
- + u8 *buf0, *buf1;
- + u32 bufsize0, bufsize1;
- + cedarv_stream_data_info_t dinf;
- + cedarv_picture_t picture;
- +
- + int demuxer_bytes = iSize;
- + uint8_t *demuxer_content = pData;
- + bool bitstream_convered = false;
- +
- + if (!pData)
- + return VC_BUFFER;
- +
- + if (!m_hcedarv)
- + return VC_ERROR;
- +
- + //bitstream support
- +#if 0
- + if (m_convert_bitstream)
- + {
- + // convert demuxer packet from bitstream to bytestream (AnnexB)
- + int bytestream_size = 0;
- + uint8_t *bytestream_buff = NULL;
- +
- + bitstream_convert(demuxer_content, demuxer_bytes, &bytestream_buff, &bytestream_size);
- + if (bytestream_buff && (bytestream_size > 0))
- + {
- + bitstream_convered = true;
- + demuxer_bytes = bytestream_size;
- + demuxer_content = bytestream_buff;
- + }
- + }
- +#endif
- +
- + ret = m_hcedarv->request_write(m_hcedarv, demuxer_bytes, &buf0, &bufsize0, &buf1, &bufsize1);
- +
- + if(ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: request_write failed.\n");
- + return VC_ERROR;
- + }
- + if (bufsize1)
- + {
- + memcpy(buf0, demuxer_content, bufsize0);
- + memcpy(buf1, demuxer_content+bufsize0, bufsize1);
- + }
- + else
- + {
- + memcpy(buf0, demuxer_content, demuxer_bytes);
- + }
- +
- + memset(&dinf, 0, sizeof(dinf));
- + dinf.lengh = iSize;
- +#ifdef CEDARV_FLAG_DECODE_NO_DELAY
- + dinf.flags = CEDARV_FLAG_FIRST_PART | CEDARV_FLAG_LAST_PART | CEDARV_FLAG_DECODE_NO_DELAY;
- +#else
- + dinf.flags = CEDARV_FLAG_FIRST_PART | CEDARV_FLAG_LAST_PART;
- +#endif
- +
- + dinf.pts = llrint(pts);
- + dinf.flags |= CEDARV_FLAG_PTS_VALID;
- + m_hcedarv->update_data(m_hcedarv, &dinf);
- +
- + ret = m_hcedarv->decode(m_hcedarv);
- +
- +
- + //bitstream support
- + if (bitstream_convered)
- + free(demuxer_content);
- +
- + if (ret > 3 || ret < 0)
- + {
- + CLog::Log(LOGERROR, "A10: decode(%d): %d\n", iSize, ret);
- + }
- +
- + if (ret == 4)
- + {
- + CLog::Log(LOGNOTICE, "A10: Out of decoder frame buffers. Freeing the queue.\n");
- + A10VLFreeQueue();
- +
- + m_hcedarv->decode(m_hcedarv);
- + }
- +
- + ret = m_hcedarv->display_request(m_hcedarv, &picture);
- +
- + if (ret > 3 || ret < -1)
- + {
- + CLog::Log(LOGERROR, "A10: display_request(%d): %d\n", iSize, ret);
- + }
- +
- + if (ret == 0)
- + {
- + float aspect_ratio = m_aspect;
- + m_picture.pts = pts;
- + m_picture.dts = dts;
- + m_picture.iWidth = picture.display_width;
- + m_picture.iHeight = picture.display_height;
- +
- + if (picture.is_progressive) m_picture.iFlags &= ~DVP_FLAG_INTERLACED;
- + else m_picture.iFlags |= DVP_FLAG_INTERLACED;
- +
- + /* XXX: we suppose the screen has a 1.0 pixel ratio */ // CDVDVideo will compensate it.
- + if (aspect_ratio <= 0.0)
- + aspect_ratio = (float)m_picture.iWidth / (float)m_picture.iHeight;
- +
- + m_picture.iDisplayHeight = m_picture.iHeight;
- + m_picture.iDisplayWidth = ((int)lrint(m_picture.iHeight * aspect_ratio)) & -3;
- + if (m_picture.iDisplayWidth > m_picture.iWidth)
- + {
- + m_picture.iDisplayWidth = m_picture.iWidth;
- + m_picture.iDisplayHeight = ((int)lrint(m_picture.iWidth / aspect_ratio)) & -3;
- + }
- +#if 0
- + {
- + u32 width32;
- + u32 height32;
- + u32 height64;
- + u32 ysize;
- + u32 csize;
- +
- + m_picture.format = RENDER_FMT_YUV420P;
- +
- + width32 = (picture.display_width + 31) & ~31;
- + height32 = (picture.display_height + 31) & ~31;
- + height64 = (picture.display_height + 63) & ~63;
- +
- + ysize = width32*height32; //* for y.
- + csize = width32*height64/2; //* for u and v together.
- +
- + int display_height_align;
- + int display_width_align;
- + int dst_c_stride;
- + int dst_y_size;
- + int dst_c_size;
- + int alloc_size;
- +
- + picture.display_height = (picture.display_height + 7) & (~7);
- + display_height_align = (picture.display_height + 1) & (~1);
- + display_width_align = (picture.display_width + 15) & (~15);
- + dst_y_size = display_width_align * display_height_align;
- + dst_c_stride = (picture.display_width/2 + 15) & (~15);
- + dst_c_size = dst_c_stride * (display_height_align/2);
- + alloc_size = dst_y_size + dst_c_size * 2;
- +
- +
- + if (!m_yuvdata) {
- + m_yuvdata = (u8*)calloc(alloc_size, 1);
- + if (!m_yuvdata) {
- + CLog::Log(LOGERROR, "A10: can not alloc m_yuvdata!");
- + m_hcedarv->display_release(m_hcedarv, picture.id);
- + return VC_ERROR;
- + }
- + }
- + TransformToYUVPlaner (&picture, m_yuvdata, display_height_align, display_width_align, dst_c_stride, dst_y_size, dst_c_size);
- + if (!(m_picture.iFlags & DVP_FLAG_ALLOCATED)) {
- + u32 width16 = (picture.display_width + 15) & ~15;
- +
- + m_picture.iFlags |= DVP_FLAG_ALLOCATED;
- +
- + m_picture.iLineSize[0] = display_width_align; //Y
- + m_picture.iLineSize[1] = dst_c_stride; //U
- + m_picture.iLineSize[2] = dst_c_stride; //V
- + m_picture.iLineSize[3] = 0;
- +
- + m_picture.data[0] = m_yuvdata;
- + m_picture.data[1] = m_yuvdata+dst_y_size + dst_c_size;
- + m_picture.data[2] = m_yuvdata+dst_y_size;
- +
- + }
- +
- +
- + m_hcedarv->display_release(m_hcedarv, picture.id);
- + }
- +#else
- + //u8 *y_p = (u8 *)g_libbdv.mem_palloc (picture.size_y, 1024);
- + //u8 *u_p = (u8 *)g_libbdv.mem_palloc (picture.size_u, 1024);
- + //memcpy (y_p, picture.y, picture.size_y);
- + //memcpy (u_p, picture.u, picture.size_u);
- + //m_hcedarv->display_release(m_hcedarv, picture.id);
- + //picture.y = y_p;
- + //picture.u = u_p;
- + m_picture.format = RENDER_FMT_A10BUF;
- + m_picture.a10buffer = A10VLPutQueue(freecallback, (void*)this, NULL, picture);
- + m_picture.iFlags |= DVP_FLAG_ALLOCATED;
- +#endif
- +
- + return VC_PICTURE | VC_BUFFER;
- + }
- +
- + CLog::Log(LOGINFO, "A10: Decode need more data");
- +
- + return VC_BUFFER;
- +}
- +
- +/*
- +* Reset the decoder.
- +* Should be the same as calling Dispose and Open after each other
- +*/
- +void CDVDVideoCodecA10::Reset()
- +{
- + CLog::Log(LOGDEBUG, "A10: reset requested");
- + m_hcedarv->ioctrl(m_hcedarv, CEDARV_COMMAND_RESET, 0);
- +}
- +
- +/*
- +* returns true if successfull
- +* the data is valid until the next Decode call
- +*/
- +bool CDVDVideoCodecA10::GetPicture(DVDVideoPicture* pDvdVideoPicture)
- +{
- + if (m_picture.iFlags & DVP_FLAG_ALLOCATED)
- + {
- + *pDvdVideoPicture = m_picture;
- + return true;
- + }
- + return false;
- +}
- +
- +void CDVDVideoCodecA10::SetDropState(bool bDrop)
- +{
- +}
- +
- +const char* CDVDVideoCodecA10::GetName()
- +{
- + return "A10";
- +}
- +
- +void CDVDVideoCodecA10::FreePicture(void *pictpriv, cedarv_picture_t &pict)
- +{
- + m_hcedarv->display_release(m_hcedarv, pict.id);
- + //g_libbdv.mem_pfree (pict.y);
- + //g_libbdv.mem_pfree (pict.u);
- +}
- +
- +////////////////////////////////////////////////////////////////////////////////////////////
- +bool CDVDVideoCodecA10::bitstream_convert_init(void *in_extradata, int in_extrasize)
- +{
- + // based on h264_mp4toannexb_bsf.c (ffmpeg)
- + // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
- + // and Licensed GPL 2.1 or greater
- +
- + m_sps_pps_size = 0;
- + m_sps_pps_context.sps_pps_data = NULL;
- +
- + // nothing to filter
- + if (!in_extradata || in_extrasize < 6)
- + return false;
- +
- + uint16_t unit_size;
- + uint32_t total_size = 0;
- + uint8_t *out = NULL, unit_nb, sps_done = 0;
- + const uint8_t *extradata = (uint8_t*)in_extradata + 4;
- + static const uint8_t nalu_header[4] = {0, 0, 0, 1};
- +
- + // retrieve length coded size
- + m_sps_pps_context.length_size = (*extradata++ & 0x3) + 1;
- + if (m_sps_pps_context.length_size == 3)
- + {
- + CLog::Log(LOGDEBUG, "A10: bitstream_convert_init length_size.");
- + return false;
- + }
- +
- + // retrieve sps and pps unit(s)
- + unit_nb = *extradata++ & 0x1f; // number of sps unit(s)
- + if (!unit_nb)
- + {
- + unit_nb = *extradata++; // number of pps unit(s)
- + sps_done++;
- + }
- + while (unit_nb--)
- + {
- + unit_size = extradata[0] << 8 | extradata[1];
- + total_size += unit_size + 4;
- + if ( (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize) )
- + {
- + free(out);
- + return false;
- + }
- + out = (uint8_t*)realloc(out, total_size);
- + if (!out)
- + return false;
- +
- + memcpy(out + total_size - unit_size - 4, nalu_header, 4);
- + memcpy(out + total_size - unit_size, extradata + 2, unit_size);
- + extradata += 2 + unit_size;
- +
- + if (!unit_nb && !sps_done++)
- + unit_nb = *extradata++; // number of pps unit(s)
- + }
- +
- + m_sps_pps_context.sps_pps_data = out;
- + m_sps_pps_context.size = total_size;
- + m_sps_pps_context.first_idr = 1;
- +
- + return true;
- +}
- +
- +bool CDVDVideoCodecA10::bitstream_convert(BYTE* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size)
- +{
- + // based on h264_mp4toannexb_bsf.c (ffmpeg)
- + // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
- + // and Licensed GPL 2.1 or greater
- +
- + uint8_t *buf = pData;
- + uint32_t buf_size = iSize;
- + uint8_t unit_type;
- + int32_t nal_size;
- + uint32_t cumul_size = 0;
- + const uint8_t *buf_end = buf + buf_size;
- +
- + do
- + {
- + if (buf + m_sps_pps_context.length_size > buf_end)
- + goto fail;
- +
- + if (m_sps_pps_context.length_size == 1)
- + nal_size = buf[0];
- + else if (m_sps_pps_context.length_size == 2)
- + nal_size = buf[0] << 8 | buf[1];
- + else
- + nal_size = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
- +
- + buf += m_sps_pps_context.length_size;
- + unit_type = *buf & 0x1f;
- +
- + if (buf + nal_size > buf_end || nal_size < 0)
- + goto fail;
- +
- + // prepend only to the first type 5 NAL unit of an IDR picture
- + if (m_sps_pps_context.first_idr && unit_type == 5)
- + {
- + bitstream_alloc_and_copy(poutbuf, poutbuf_size,
- + m_sps_pps_context.sps_pps_data, m_sps_pps_context.size, buf, nal_size);
- + m_sps_pps_context.first_idr = 0;
- + }
- + else
- + {
- + bitstream_alloc_and_copy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size);
- + if (!m_sps_pps_context.first_idr && unit_type == 1)
- + m_sps_pps_context.first_idr = 1;
- + }
- +
- + buf += nal_size;
- + cumul_size += nal_size + m_sps_pps_context.length_size;
- + } while (cumul_size < buf_size);
- +
- + return true;
- +
- +fail:
- + free(*poutbuf);
- + *poutbuf = NULL;
- + *poutbuf_size = 0;
- + return false;
- +}
- +
- +void CDVDVideoCodecA10::bitstream_alloc_and_copy(
- + uint8_t **poutbuf, int *poutbuf_size,
- + const uint8_t *sps_pps, uint32_t sps_pps_size,
- + const uint8_t *in, uint32_t in_size)
- +{
- + // based on h264_mp4toannexb_bsf.c (ffmpeg)
- + // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
- + // and Licensed GPL 2.1 or greater
- +
- +#define CHD_WB32(p, d) { \
- + ((uint8_t*)(p))[3] = (d); \
- + ((uint8_t*)(p))[2] = (d) >> 8; \
- + ((uint8_t*)(p))[1] = (d) >> 16; \
- + ((uint8_t*)(p))[0] = (d) >> 24; }
- +
- + uint32_t offset = *poutbuf_size;
- + uint8_t nal_header_size = offset ? 3 : 4;
- +
- + *poutbuf_size += sps_pps_size + in_size + nal_header_size;
- + *poutbuf = (uint8_t*)realloc(*poutbuf, *poutbuf_size);
- + if (sps_pps)
- + memcpy(*poutbuf + offset, sps_pps, sps_pps_size);
- +
- + memcpy(*poutbuf + sps_pps_size + nal_header_size + offset, in, in_size);
- + if (!offset)
- + {
- + CHD_WB32(*poutbuf + sps_pps_size, 1);
- + }
- + else
- + {
- + (*poutbuf + offset + sps_pps_size)[0] = 0;
- + (*poutbuf + offset + sps_pps_size)[1] = 0;
- + (*poutbuf + offset + sps_pps_size)[2] = 1;
- + }
- +}
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.h xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,169 @@
- +#pragma once
- +
- +/*
- + * Copyright (C) 2005-2008 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#include "guilib/Geometry.h"
- +#include "DVDVideoCodec.h"
- +#include "DVDStreamInfo.h"
- +
- +extern "C" {
- +#include "cores/a10/libcedarv.h"
- +#include "cores/a10/DllLibcedarv.h"
- +};
- +
- +class CDVDVideoCodecA10 : public CDVDVideoCodec
- +{
- +public:
- +
- + CDVDVideoCodecA10();
- + virtual ~CDVDVideoCodecA10();
- +
- + /*
- + * Open the decoder, returns true on success
- + */
- + bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
- +
- + /*
- + * Dispose, Free all resources
- + */
- + void Dispose();
- +
- + /*
- + * returns one or a combination of VC_ messages
- + * pData and iSize can be NULL, this means we should flush the rest of the data.
- + */
- + int Decode(BYTE* pData, int iSize, double dts, double pts);
- +
- + /*
- + * Reset the decoder.
- + * Should be the same as calling Dispose and Open after each other
- + */
- + void Reset();
- +
- + /*
- + * returns true if successfull
- + * the data is valid until the next Decode call
- + */
- + bool GetPicture(DVDVideoPicture* pDvdVideoPicture);
- +
- +
- + /*
- + * returns true if successfull
- + * the data is cleared to zero
- + */
- + /*-->super
- + bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
- + */
- +
- + /*
- + * returns true if successfull
- + * the data is valid until the next Decode call
- + * userdata can be anything, for now we use it for closed captioning
- + */
- + /*-->super
- + bool GetUserData(DVDVideoUserData* pDvdVideoUserData);
- + */
- +
- + /*
- + * will be called by video player indicating if a frame will eventually be dropped
- + * codec can then skip actually decoding the data, just consume the data set picture headers
- + */
- + void SetDropState(bool bDrop);
- +
- + /*
- + * returns the number of demuxer bytes in any internal buffers
- + */
- + /*-->super
- + int GetDataSize(void);
- + */
- +
- + /*
- + * returns the time in seconds for demuxer bytes in any internal buffers
- + */
- + /*-->super
- + virtual double GetTimeSize(void);
- + */
- +
- + /*
- + * set the type of filters that should be applied at decoding stage if possible
- + */
- + /*-->super
- + unsigned int SetFilters(unsigned int filters);
- + */
- +
- + /*
- + *
- + * should return codecs name
- + */
- + const char* GetName();
- +
- + /*
- + *
- + * How many packets should player remember, so codec
- + * can recover should something cause it to flush
- + * outside of players control
- + */
- + /*-->super
- + virtual unsigned GetConvergeCount();
- + */
- +
- + void FreePicture(void *pictpriv, cedarv_picture_t &pict);
- +
- +private:
- +
- + bool DoOpen();
- +
- + //rendering
- + bool m_hwrender;
- +
- + //decoding
- + cedarv_stream_info_t m_info;
- + float m_aspect;
- + CDVDStreamInfo m_hints;
- + cedarv_decoder_t *m_hcedarv;
- + int m_hscaler;
- + u8 *m_yuvdata;
- + DVDVideoPicture m_picture;
- +
- +protected:
- +
- + // bitstream to bytestream (Annex B) conversion support.
- + bool bitstream_convert_init(void *in_extradata, int in_extrasize);
- + bool bitstream_convert(BYTE* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size);
- + void bitstream_alloc_and_copy( uint8_t **poutbuf, int *poutbuf_size,
- + const uint8_t *sps_pps, uint32_t sps_pps_size, const uint8_t *in, uint32_t in_size);
- +
- + typedef struct a10_bitstream_ctx {
- + uint8_t length_size;
- + uint8_t first_idr;
- + uint8_t *sps_pps_data;
- + uint32_t size;
- + } a10_bitstream_ctx;
- +
- + uint32_t m_sps_pps_size;
- + a10_bitstream_ctx m_sps_pps_context;
- + bool m_convert_bitstream;
- +};
- +
- +//////////////////////////////////////////////////////////////////////////
- +
- +static DllLibA10decoder g_libbdv;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h 2013-06-12 16:40:35.000000000 +0200
- @@ -38,6 +38,7 @@
- class COpenMax;
- class COpenMaxVideo;
- struct OpenMaxVideoBuffer;
- +struct A10VLQueueItem;
- // should be entirely filled by all codecs
- struct DVDVideoPicture
- @@ -69,6 +70,10 @@
- struct {
- struct __CVBuffer *cvBufferRef;
- };
- +
- + struct {
- + A10VLQueueItem *a10buffer;
- + };
- };
- unsigned int iFlags;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.c xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.c
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.c 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.c 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,467 @@
- +
- +#define LOG_NDEBUG 0
- +#define LOG_TAG "transform.c"
- +
- +#include "transform_color_format.h"
- +#include <unistd.h>
- +#include <stdlib.h>
- +#include <memory.h>
- +
- +enum FORMAT_CONVERT_COLORFORMAT
- +{
- + CONVERT_COLOR_FORMAT_NONE = 0,
- + CONVERT_COLOR_FORMAT_YUV420PLANNER,
- + CONVERT_COLOR_FORMAT_YUV422PLANNER,
- + CONVERT_COLOR_FORMAT_YUV420MB,
- + CONVERT_COLOR_FORMAT_YUV422MB,
- +};
- +
- +typedef struct ScalerParameter
- +{
- + int mode; //0: YV12 1:thumb yuv420p
- + int format_in;
- + int format_out;
- +
- + int width_in;
- + int height_in;
- +
- + int width_out;
- + int height_out;
- +
- + void *addr_y_in;
- + void *addr_c_in;
- + unsigned int addr_y_out;
- + unsigned int addr_u_out;
- + unsigned int addr_v_out;
- +}ScalerParameter;
- +
- +#if 0 //Don't HAVE_NEON
- +static void map32x32_to_yuv_Y(unsigned char* srcY, unsigned char* tarY, unsigned int coded_width, unsigned int coded_height)
- +{
- + unsigned int i,j,l,m,n;
- + unsigned int mb_width,mb_height,twomb_line,recon_width;
- + unsigned long offset;
- + unsigned char *ptr;
- +
- + ptr = srcY;
- + mb_width = (coded_width+15)>>4;
- + mb_height = (coded_height+15)>>4;
- + twomb_line = (mb_height+1)>>1;
- + recon_width = (mb_width+1)&0xfffffffe;
- +
- + for(i=0;i<twomb_line;i++)
- + {
- + for(j=0;j<recon_width;j+=2)
- + {
- + for(l=0;l<32;l++)
- + {
- + //first mb
- + m=i*32 + l;
- + n= j*16;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + memcpy(tarY+offset,ptr,16);
- + ptr += 16;
- + }
- + else
- + ptr += 16;
- +
- + //second mb
- + n= j*16+16;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + memcpy(tarY+offset,ptr,16);
- + ptr += 16;
- + }
- + else
- + ptr += 16;
- + }
- + }
- + }
- +}
- +
- +static void map32x32_to_yuv_C(int mode,unsigned char* srcC,unsigned char* tarCb,unsigned char* tarCr,unsigned int coded_width,unsigned int coded_height)
- +{
- + unsigned int i,j,l,m,n,k;
- + unsigned int mb_width,mb_height,fourmb_line,recon_width;
- + unsigned char line[16];
- + unsigned long offset;
- + unsigned char *ptr;
- +
- + ptr = srcC;
- + mb_width = (coded_width+7)>>3;
- + mb_height = (coded_height+7)>>3;
- + fourmb_line = (mb_height+3)>>2;
- + recon_width = (mb_width+1)&0xfffffffe;
- +
- + for(i=0;i<fourmb_line;i++)
- + {
- + for(j=0;j<recon_width;j+=2)
- + {
- + for(l=0;l<32;l++)
- + {
- + //first mb
- + m=i*32 + l;
- + n= j*8;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + memcpy(line,ptr,16);
- + for(k=0;k<8;k++)
- + {
- + *(tarCb + offset + k) = 0xaa;//line[2*k];
- + *(tarCr + offset + k) = 0x55; //line[2*k+1];
- + }
- + ptr += 16;
- + }
- + else
- + ptr += 16;
- +
- + //second mb
- + n= j*8+8;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + memcpy(line,ptr,16);
- + for(k=0;k<8;k++)
- + {
- + *(tarCb + offset + k) = 0xaa;//line[2*k];
- + *(tarCr + offset + k) = 0x55;//line[2*k+1];
- + }
- + ptr += 16;
- + }
- + else
- + ptr += 16;
- + }
- + }
- + }
- +}
- +
- +static void map32x32_to_yuv_C_422(int mode,unsigned char* srcC,unsigned char* tarCb,unsigned char* tarCr,unsigned int coded_width,unsigned int coded_height) {
- + ;
- +}
- +
- +#else
- +
- +
- +static void map32x32_to_yuv_Y(unsigned char* srcY,
- + unsigned char* tarY,
- + unsigned int coded_width,
- + unsigned int coded_height)
- +{
- + unsigned int i,j,l,m,n;
- + unsigned int mb_width,mb_height,twomb_line,recon_width;
- + unsigned long offset;
- + unsigned char *ptr;
- + unsigned char *dst_asm,*src_asm;
- +
- + ptr = srcY;
- + mb_width = (coded_width+15)>>4;
- + mb_height = (coded_height+15)>>4;
- + twomb_line = (mb_height+1)>>1;
- + recon_width = (mb_width+1)&0xfffffffe;
- +
- + for(i=0;i<twomb_line;i++)
- + {
- + for(j=0;j<mb_width/2;j++)
- + {
- + for(l=0;l<32;l++)
- + {
- + //first mb
- + m=i*32 + l;
- + n= j*32;
- + offset = m*coded_width + n;
- + //memcpy(tarY+offset,ptr,32);
- + dst_asm = tarY+offset;
- + src_asm = ptr;
- + asm volatile (
- + "vld1.8 {d0 - d3}, [%[src_asm]] \n\t"
- + "vst1.8 {d0 - d3}, [%[dst_asm]] \n\t"
- + : [dst_asm] "+r" (dst_asm), [src_asm] "+r" (src_asm)
- + : //[srcY] "r" (srcY)
- + : "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
- + );
- +
- + ptr += 32;
- + }
- + }
- +
- + //LOGV("mb_width:%d",mb_width);
- + if(mb_width & 1)
- + {
- + j = mb_width-1;
- + for(l=0;l<32;l++)
- + {
- + //first mb
- + m=i*32 + l;
- + n= j*16;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + //memcpy(tarY+offset,ptr,16);
- + dst_asm = tarY+offset;
- + src_asm = ptr;
- + asm volatile (
- + "vld1.8 {d0 - d1}, [%[src_asm]] \n\t"
- + "vst1.8 {d0 - d1}, [%[dst_asm]] \n\t"
- + : [dst_asm] "+r" (dst_asm), [src_asm] "+r" (src_asm)
- + : //[srcY] "r" (srcY)
- + : "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
- + );
- + }
- +
- + ptr += 16;
- + ptr += 16;
- + }
- + }
- + }
- +}
- +
- +static void map32x32_to_yuv_C(int mode,
- + unsigned char* srcC,
- + unsigned char* tarCb,
- + unsigned char* tarCr,
- + unsigned int coded_width,
- + unsigned int coded_height)
- +{
- + unsigned int i,j,l,m,n,k;
- + unsigned int mb_width,mb_height,fourmb_line,recon_width;
- + unsigned long offset;
- + unsigned char *ptr;
- + unsigned char *dst0_asm,*dst1_asm,*src_asm;
- + unsigned char line[16];
- + int dst_stride = mode==0 ? (coded_width + 15) & (~15) : coded_width;
- +
- + ptr = srcC;
- + mb_width = (coded_width+7)>>3;
- + mb_height = (coded_height+7)>>3;
- + fourmb_line = (mb_height+3)>>2;
- + recon_width = (mb_width+1)&0xfffffffe;
- +
- + for(i=0;i<fourmb_line;i++)
- + {
- + for(j=0;j<mb_width/2;j++)
- + {
- + for(l=0;l<32;l++)
- + {
- + //first mb
- + m=i*32 + l;
- + n= j*16;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*dst_stride + n;
- +
- + dst0_asm = tarCb + offset;
- + dst1_asm = tarCr+offset;
- + src_asm = ptr;
- +// for(k=0;k<16;k++)
- +// {
- +// dst0_asm[k] = src_asm[2*k];
- +// dst1_asm[k] = src_asm[2*k+1];
- +// }
- + asm volatile (
- + "vld1.8 {d0 - d3}, [%[src_asm]] \n\t"
- + "vuzp.8 d0, d1 \n\t"
- + "vuzp.8 d2, d3 \n\t"
- + "vst1.8 {d0}, [%[dst0_asm]]! \n\t"
- + "vst1.8 {d2}, [%[dst0_asm]]! \n\t"
- + "vst1.8 {d1}, [%[dst1_asm]]! \n\t"
- + "vst1.8 {d3}, [%[dst1_asm]]! \n\t"
- + : [dst0_asm] "+r" (dst0_asm), [dst1_asm] "+r" (dst1_asm), [src_asm] "+r" (src_asm)
- + : //[srcY] "r" (srcY)
- + : "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
- + );
- + }
- +
- + ptr += 32;
- + }
- + }
- +
- + if(mb_width & 1)
- + {
- + j= mb_width-1;
- + for(l=0;l<32;l++)
- + {
- + m=i*32 + l;
- + n= j*8;
- +
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*dst_stride + n;
- + memcpy(line,ptr,16);
- + for(k=0;k<8;k++)
- + {
- + *(tarCb + offset + k) = line[2*k];
- + *(tarCr + offset + k) = line[2*k+1];
- + }
- + }
- +
- + ptr += 16;
- + ptr += 16;
- + }
- + }
- + }
- +}
- +
- +static void map32x32_to_yuv_C_422(int mode,
- + unsigned char* srcC,
- + unsigned char* tarCb,
- + unsigned char* tarCr,
- + unsigned int coded_width,
- + unsigned int coded_height)
- +{
- + unsigned int i,j,l,m,n,k;
- + unsigned int mb_width,mb_height,twomb_line,recon_width;
- + unsigned long offset;
- + unsigned char *ptr;
- + unsigned char *dst0_asm,*dst1_asm,*src_asm;
- + unsigned char line[16];
- +
- + ptr = srcC;
- + mb_width = (coded_width+7)>>3;
- + mb_height = (coded_height+7)>>3;
- + twomb_line = (mb_height+1)>>1;
- + recon_width = (mb_width+1)&0xfffffffe;
- +
- + for(i=0;i<twomb_line;i++)
- + {
- + for(j=0;j<mb_width/2;j++)
- + {
- + for(l=0;l<16;l++)
- + {
- + //first mb
- + m=i*16 + l;
- + n= j*16;
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- +
- + dst0_asm = tarCb + offset;
- + dst1_asm = tarCr+offset;
- + src_asm = ptr;
- +// for(k=0;k<16;k++)
- +// {
- +// dst0_asm[k] = src_asm[2*k];
- +// dst1_asm[k] = src_asm[2*k+1];
- +// }
- + asm volatile (
- + "vld1.8 {d0 - d3}, [%[src_asm]] \n\t"
- + "vuzp.8 d0, d1 \n\t"
- + "vuzp.8 d2, d3 \n\t"
- + "vst1.8 {d0}, [%[dst0_asm]]! \n\t"
- + "vst1.8 {d2}, [%[dst0_asm]]! \n\t"
- + "vst1.8 {d1}, [%[dst1_asm]]! \n\t"
- + "vst1.8 {d3}, [%[dst1_asm]]! \n\t"
- + : [dst0_asm] "+r" (dst0_asm), [dst1_asm] "+r" (dst1_asm), [src_asm] "+r" (src_asm)
- + : //[srcY] "r" (srcY)
- + : "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
- + );
- + }
- +
- + ptr += 32;
- + ptr += 32;
- + }
- + }
- +
- + if(mb_width & 1)
- + {
- + j= mb_width-1;
- + for(l=0;l<16;l++)
- + {
- + m=i*32 + l;
- + n= j*8;
- +
- + if(m<coded_height && n<coded_width)
- + {
- + offset = m*coded_width + n;
- + memcpy(line,ptr,16);
- + for(k=0;k<8;k++)
- + {
- + *(tarCb + offset + k) = line[2*k];
- + *(tarCr + offset + k) = line[2*k+1];
- + }
- + }
- +
- + ptr += 32;
- + ptr += 32;
- + }
- + }
- + }
- +}
- +#endif
- +
- +
- +static void SoftwarePictureScaler(ScalerParameter *cdx_scaler_para)
- +{
- + map32x32_to_yuv_Y(cdx_scaler_para->addr_y_in,
- + (unsigned char*)cdx_scaler_para->addr_y_out,
- + cdx_scaler_para->width_out,
- + cdx_scaler_para->height_out);
- +
- + if (cdx_scaler_para->format_in == CONVERT_COLOR_FORMAT_YUV422MB)
- + map32x32_to_yuv_C_422(cdx_scaler_para->mode,
- + cdx_scaler_para->addr_c_in,
- + (unsigned char*)cdx_scaler_para->addr_u_out,
- + (unsigned char*)cdx_scaler_para->addr_v_out,
- + cdx_scaler_para->width_out / 2,
- + cdx_scaler_para->height_out / 2);
- + else
- + map32x32_to_yuv_C(cdx_scaler_para->mode,
- + cdx_scaler_para->addr_c_in,
- + (unsigned char*)cdx_scaler_para->addr_u_out,
- + (unsigned char*)cdx_scaler_para->addr_v_out,
- + cdx_scaler_para->width_out / 2,
- + cdx_scaler_para->height_out / 2);
- +
- + return;
- +}
- +
- +void TransformToYUVPlaner(cedarv_picture_t* pict, void* ybuf, int display_height_align, int display_width_align,
- +int dst_c_stride,
- +int dst_y_size, int dst_c_size)
- +{
- + ScalerParameter cdx_scaler_para;
- + //int display_height_align;
- + //int display_width_align;
- + //int dst_c_stride;
- + //int dst_y_size;
- + //int dst_c_size;
- + //int alloc_size;
- +
- + if(pict == NULL)
- + return;
- +
- + /*
- + pict->display_height = (pict->display_height + 7) & (~7);
- + display_height_align = (pict->display_height + 1) & (~1);
- + display_width_align = (pict->display_width + 15) & (~15);
- + dst_y_size = display_width_align * display_height_align;
- + dst_c_stride = (pict->display_width/2 + 15) & (~15);
- + dst_c_size = dst_c_stride * (display_height_align/2);
- + alloc_size = dst_y_size + dst_c_size * 2;
- +*/
- + cdx_scaler_para.mode = 0;
- + cdx_scaler_para.format_in = (pict->pixel_format == CEDARV_PIXEL_FORMAT_AW_YUV422) ? CONVERT_COLOR_FORMAT_YUV422MB : CONVERT_COLOR_FORMAT_YUV420MB;
- + cdx_scaler_para.format_out = CONVERT_COLOR_FORMAT_YUV420PLANNER;
- + cdx_scaler_para.width_in = pict->width;
- + cdx_scaler_para.height_in = pict->height;
- + cdx_scaler_para.addr_y_in = (void*)pict->y;
- + cdx_scaler_para.addr_c_in = (void*)pict->u;
- +#if 0
- + cedarx_cache_op(cdx_scaler_para.addr_y_in, cdx_scaler_para.addr_y_in+pict->size_y, CEDARX_DCACHE_FLUSH);
- + cedarx_cache_op(cdx_scaler_para.addr_c_in, cdx_scaler_para.addr_c_in+pict->size_u, CEDARX_DCACHE_FLUSH);
- +#endif
- + cdx_scaler_para.width_out = display_width_align;
- + cdx_scaler_para.height_out = display_height_align;
- +
- + cdx_scaler_para.addr_y_out = (unsigned int)ybuf;
- + cdx_scaler_para.addr_v_out = cdx_scaler_para.addr_y_out + dst_y_size;
- + cdx_scaler_para.addr_u_out = cdx_scaler_para.addr_v_out + dst_c_size;
- +
- + //* use neon accelarator instruction to transform the pixel format, slow if buffer is not cached(DMA mode).
- + SoftwarePictureScaler(&cdx_scaler_para);
- +
- + return;
- +}
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.h xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDCodecs/Video/transform_color_format.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,20 @@
- +
- +#ifndef TRANSFORM_COLOR_FORMAT_H
- +#define TRANSFORM_COLOR_FORMAT_H
- +
- +#include "cores/a10/libcedarv.h"
- +
- +#ifdef __cplusplus
- +extern "C" {
- +#endif
- +
- +void TransformToYUVPlaner(cedarv_picture_t* pict, void* ybuf, int display_height_align, int display_width_align,
- +int dst_c_stride,
- +int dst_y_size, int dst_c_size);
- +
- +#ifdef __cplusplus
- +}
- +#endif
- +
- +#endif
- +
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDPlayer.cpp xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayer.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -2892,7 +2892,12 @@
- hint.aspect = aspect;
- hint.forced_aspect = true;
- }
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + //DVD always using a10 codec
- + hint.software = false;
- +#else
- hint.software = true;
- +#endif
- }
- boost::shared_ptr<CPVRClient> client;
- @@ -4131,3 +4136,9 @@
- !g_PVRManager.IsPlayingRecording() &&
- g_advancedSettings.m_bPVRCacheInDvdPlayer;
- }
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +void CDVDPlayer::OnA10Created()
- +{
- + m_ready.Set();
- +}
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDPlayer.h xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayer.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDPlayer.h 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayer.h 2013-06-12 16:40:35.000000000 +0200
- @@ -267,6 +267,9 @@
- virtual int GetCacheLevel() const ;
- virtual int OnDVDNavResult(void* pData, int iMessage);
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + virtual void OnA10Created();
- +#endif
- protected:
- friend class CSelectionStreams;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -194,7 +194,24 @@
- formats = g_renderManager.SupportedFormats();
- #endif
- -
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + CDVDVideoCodec* codec = NULL;
- + if( m_messageQueue.IsInited() )
- + {
- + //the second to create codec, need free the previous codec and then create new codec
- + codec = NULL;
- + }
- + else
- + {
- + //the first time, create codec using old code
- + codec = CDVDFactoryCodec::CreateVideoCodec(hint, surfaces);
- + if(!codec)
- + {
- + CLog::Log(LOGERROR, "Unsupported video codec");
- + return false;
- + }
- + }
- +#else
- CLog::Log(LOGNOTICE, "Creating video codec with codec id: %i", hint.codec);
- CDVDVideoCodec* codec = CDVDFactoryCodec::CreateVideoCodec(hint, surfaces, formats);
- if(!codec)
- @@ -202,6 +219,7 @@
- CLog::Log(LOGERROR, "Unsupported video codec");
- return false;
- }
- +#endif
- if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && !g_VideoReferenceClock.IsRunning())
- {
- @@ -255,6 +273,22 @@
- if (m_pVideoCodec)
- delete m_pVideoCodec;
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + if( !codec )
- + {
- + unsigned int surfaces = 0;
- +
- + //need create codec here. the box must create codec success.
- + CLog::Log(LOGNOTICE, "Creating next video codec with codec id: %i", hint.codec);
- + codec = CDVDFactoryCodec::CreateVideoCodec(hint, surfaces);
- +
- + if(!codec)
- + {
- + CLog::Log(LOGERROR, "Creating next video codec failed");
- + return;
- + }
- + }
- +#endif
- m_pVideoCodec = codec;
- m_hints = hint;
- @@ -1137,6 +1171,11 @@
- case RENDER_FMT_CVBREF:
- formatstr = "BGRA";
- break;
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + case RENDER_FMT_A10BUF:
- + formatstr = "A10BUF";
- + break;
- +#endif
- case RENDER_FMT_BYPASS:
- formatstr = "BYPASS";
- break;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/IPlayer.h xbmc_vidonme/xbmc/cores/IPlayer.h
- --- xbmc_orig/xbmc/cores/IPlayer.h 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/IPlayer.h 2013-06-12 16:40:35.000000000 +0200
- @@ -229,6 +229,9 @@
- */
- virtual void GetSubtitleCapabilities(std::vector<int> &subCaps) { subCaps.assign(1,IPC_SUBS_ALL); };
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + virtual void OnA10Created(){return;}
- +#endif
- protected:
- IPlayerCallback& m_callback;
- };
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/LinuxRendererA10.cpp xbmc_vidonme/xbmc/cores/VideoRenderers/LinuxRendererA10.cpp
- --- xbmc_orig/xbmc/cores/VideoRenderers/LinuxRendererA10.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/VideoRenderers/LinuxRendererA10.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,2007 @@
- +/*
- + * Copyright (C) 2010-2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +
- +#include "system.h"
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#endif
- +
- +#if HAS_GLES == 2
- +#include "system_gl.h"
- +
- +#include <locale.h>
- +#include <sys/ioctl.h>
- +#include "guilib/MatrixGLES.h"
- +#include "LinuxRendererA10.h"
- +#include "utils/log.h"
- +#include "utils/fastmemcpy.h"
- +#include "utils/MathUtils.h"
- +#include "utils/GLUtils.h"
- +#include "settings/Settings.h"
- +#include "settings/AdvancedSettings.h"
- +#include "settings/GUISettings.h"
- +#include "guilib/FrameBufferObject.h"
- +#include "VideoShaders/YUV2RGBShader.h"
- +#include "VideoShaders/VideoFilterShader.h"
- +#include "windowing/WindowingFactory.h"
- +#include "dialogs/GUIDialogKaiToast.h"
- +#include "guilib/Texture.h"
- +#include "threads/SingleLock.h"
- +#include "RenderCapture.h"
- +#include "RenderFormats.h"
- +#include "xbmc/Application.h"
- +
- +#include "cores/a10/libcedarv.h"
- +#include "cores/a10/DllLibcedarv.h"
- +
- +extern DllLibA10decoder g_libbdv;
- +
- +using namespace Shaders;
- +
- +CLinuxRendererA10::CLinuxRendererA10()
- +{
- + m_textureTarget = GL_TEXTURE_2D;
- +
- + for (int i = 0; i < NUM_BUFFERS; i++)
- + {
- + m_eventTexturesDone[i] = new CEvent(false,true);
- + memset(&m_buffers, 0, sizeof(m_buffers));
- + }
- +
- + m_renderMethod = RENDER_GLSL;
- + m_oldRenderMethod = m_renderMethod;
- + m_renderQuality = RQ_SINGLEPASS;
- + m_iFlags = 0;
- + m_format = RENDER_FMT_NONE;
- +
- + m_iYV12RenderBuffer = 0;
- + m_flipindex = 0;
- + m_currentField = FIELD_FULL;
- + m_reloadShaders = 0;
- + m_pYUVShader = NULL;
- + m_pVideoFilterShader = NULL;
- + m_scalingMethod = VS_SCALINGMETHOD_LINEAR;
- + m_scalingMethodGui = (ESCALINGMETHOD)-1;
- +
- + // default texture handlers to YUV
- + m_textureUpload = &CLinuxRendererA10::UploadYV12Texture;
- + m_textureCreate = &CLinuxRendererA10::CreateYV12Texture;
- + m_textureDelete = &CLinuxRendererA10::DeleteYV12Texture;
- +
- + //check libbdv dll is loaded
- +
- + if( !g_libbdv.IsLoaded() )
- + {
- + g_libbdv.EnableDelayedUnload(false);
- + if( !g_libbdv.Load() )
- + CLog::Log(LOGERROR, "Load codec failed !");
- + }
- +
- +}
- +
- +CLinuxRendererA10::~CLinuxRendererA10()
- +{
- + UnInit();
- + for (int i = 0; i < NUM_BUFFERS; i++)
- + delete m_eventTexturesDone[i];
- +
- + if (m_pYUVShader)
- + {
- + m_pYUVShader->Free();
- + delete m_pYUVShader;
- + m_pYUVShader = NULL;
- + }
- +}
- +
- +void CLinuxRendererA10::ManageTextures()
- +{
- + //m_iYV12RenderBuffer = 0;
- + return;
- +}
- +
- +bool CLinuxRendererA10::ValidateRenderTarget()
- +{
- + if (!m_bValidated)
- + {
- + CLog::Log(LOGNOTICE,"Using GL_TEXTURE_2D");
- +
- + // create the yuv textures
- + LoadShaders();
- +
- + for (int i = 0 ; i < NUM_BUFFERS ; i++)
- + (this->*m_textureCreate)(i);
- +
- + m_bValidated = true;
- + return true;
- + }
- + return false;
- +}
- +
- +bool CLinuxRendererA10::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation)
- +{
- + m_sourceWidth = width;
- + m_sourceHeight = height;
- + m_renderOrientation = orientation;
- +
- + // Save the flags.
- + m_iFlags = flags;
- + m_format = format;
- +
- + // Calculate the input frame aspect ratio.
- + CalculateFrameAspectRatio(d_width, d_height);
- + ChooseBestResolution(fps);
- + SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode);
- + ManageDisplay();
- +
- + m_bConfigured = true;
- + m_bImageReady = false;
- + m_scalingMethodGui = (ESCALINGMETHOD)-1;
- +
- + m_bValidated = false;
- +
- + for (int i = 0 ; i< NUM_BUFFERS; i++)
- + m_buffers[i].image.flags = 0;
- +
- + m_iLastRenderBuffer = -1;
- +
- + m_RenderUpdateCallBackFn = NULL;
- + m_RenderUpdateCallBackCtx = NULL;
- + if ((m_format == RENDER_FMT_BYPASS) && g_application.GetCurrentPlayer())
- + {
- + //TODO
- + }
- +
- + return true;
- +}
- +
- +int CLinuxRendererA10::NextYV12Texture()
- +{
- + return (m_iYV12RenderBuffer + 1) % NUM_BUFFERS;
- +}
- +
- +int CLinuxRendererA10::GetImage(YV12Image *image, int source, bool readonly)
- +{
- + if (!image) return -1;
- + if (!m_bValidated) return -1;
- +
- + /* take next available buffer */
- + if( source == AUTOSOURCE )
- + source = NextYV12Texture();
- +
- + if (m_renderMethod & RENDER_A10BUF )
- + {
- + return source;
- + }
- +
- + YV12Image &im = m_buffers[source].image;
- +
- + if ((im.flags&(~IMAGE_FLAG_READY)) != 0)
- + {
- + CLog::Log(LOGDEBUG, "CLinuxRenderer::GetImage - request image but none to give");
- + return -1;
- + }
- +
- + if( readonly )
- + im.flags |= IMAGE_FLAG_READING;
- + else
- + {
- + if( !m_eventTexturesDone[source]->WaitMSec(500) )
- + CLog::Log(LOGWARNING, "%s - Timeout waiting for texture %d", __FUNCTION__, source);
- +
- + im.flags |= IMAGE_FLAG_WRITING;
- + }
- +
- + // copy the image - should be operator of YV12Image
- + for (int p=0;p<MAX_PLANES;p++)
- + {
- + image->plane[p] = im.plane[p];
- + image->stride[p] = im.stride[p];
- + }
- + image->width = im.width;
- + image->height = im.height;
- + image->flags = im.flags;
- + image->cshift_x = im.cshift_x;
- + image->cshift_y = im.cshift_y;
- + image->bpp = 1;
- +
- + return source;
- +
- + return -1;
- +}
- +
- +void CLinuxRendererA10::ReleaseImage(int source, bool preserve)
- +{
- + YV12Image &im = m_buffers[source].image;
- +
- + if( im.flags & IMAGE_FLAG_WRITING )
- + m_eventTexturesDone[source]->Set();
- +
- + im.flags &= ~IMAGE_FLAG_INUSE;
- + im.flags |= IMAGE_FLAG_READY;
- + /* if image should be preserved reserve it so it's not auto seleceted */
- +
- + if( preserve )
- + im.flags |= IMAGE_FLAG_RESERVED;
- +
- + m_bImageReady = true;
- +}
- +
- +void CLinuxRendererA10::CalculateTextureSourceRects(int source, int num_planes)
- +{
- + YUVBUFFER& buf = m_buffers[source];
- + YV12Image* im = &buf.image;
- + YUVFIELDS& fields = buf.fields;
- +
- + // calculate the source rectangle
- + for(int field = 0; field < 3; field++)
- + {
- + for(int plane = 0; plane < num_planes; plane++)
- + {
- + YUVPLANE& p = fields[field][plane];
- +
- + p.rect = m_sourceRect;
- + p.width = im->width;
- + p.height = im->height;
- +
- + if(field != FIELD_FULL)
- + {
- + /* correct for field offsets and chroma offsets */
- + float offset_y = 0.5;
- + if(plane != 0)
- + offset_y += 0.5;
- + if(field == FIELD_BOT)
- + offset_y *= -1;
- +
- + p.rect.y1 += offset_y;
- + p.rect.y2 += offset_y;
- +
- + /* half the height if this is a field */
- + p.height *= 0.5f;
- + p.rect.y1 *= 0.5f;
- + p.rect.y2 *= 0.5f;
- + }
- +
- + if(plane != 0)
- + {
- + p.width /= 1 << im->cshift_x;
- + p.height /= 1 << im->cshift_y;
- +
- + p.rect.x1 /= 1 << im->cshift_x;
- + p.rect.x2 /= 1 << im->cshift_x;
- + p.rect.y1 /= 1 << im->cshift_y;
- + p.rect.y2 /= 1 << im->cshift_y;
- + }
- +
- + if (m_textureTarget == GL_TEXTURE_2D)
- + {
- + p.height /= p.texheight;
- + p.rect.y1 /= p.texheight;
- + p.rect.y2 /= p.texheight;
- + p.width /= p.texwidth;
- + p.rect.x1 /= p.texwidth;
- + p.rect.x2 /= p.texwidth;
- + }
- + }
- + }
- +}
- +
- +void CLinuxRendererA10::LoadPlane( YUVPLANE& plane, int type, unsigned flipindex
- + , unsigned width, unsigned height
- + , int stride, void* data )
- +{
- + if(plane.flipindex == flipindex)
- + return;
- +
- + const GLvoid *pixelData = data;
- +
- + int bps = glFormatElementByteCount(type);
- +
- + glBindTexture(m_textureTarget, plane.id);
- +
- + // OpenGL ES does not support strided texture input.
- + if(stride != width * bps)
- + {
- + unsigned char* src = (unsigned char*)data;
- + for (int y = 0; y < height;++y, src += stride)
- + glTexSubImage2D(m_textureTarget, 0, 0, y, width, 1, type, GL_UNSIGNED_BYTE, src);
- + } else {
- + glTexSubImage2D(m_textureTarget, 0, 0, 0, width, height, type, GL_UNSIGNED_BYTE, pixelData);
- + }
- +
- + /* check if we need to load any border pixels */
- + if(height < plane.texheight)
- + glTexSubImage2D( m_textureTarget, 0
- + , 0, height, width, 1
- + , type, GL_UNSIGNED_BYTE
- + , (unsigned char*)pixelData + stride * (height-1));
- +
- + if(width < plane.texwidth)
- + glTexSubImage2D( m_textureTarget, 0
- + , width, 0, 1, height
- + , type, GL_UNSIGNED_BYTE
- + , (unsigned char*)pixelData + bps * (width-1));
- +
- + glBindTexture(m_textureTarget, 0);
- +
- + plane.flipindex = flipindex;
- +}
- +
- +void CLinuxRendererA10::Reset()
- +{
- + for(int i=0; i<NUM_BUFFERS; i++)
- + {
- + /* reset all image flags, this will cleanup textures later */
- + m_buffers[i].image.flags = 0;
- + /* reset texture locks, a bit ugly, could result in tearing */
- + m_eventTexturesDone[i]->Set();
- + }
- +}
- +
- +void CLinuxRendererA10::Update(bool bPauseDrawing)
- +{
- + if (!m_bConfigured) return;
- + ManageDisplay();
- + ManageTextures();
- +}
- +
- +void CLinuxRendererA10::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
- +{
- + if (!m_bConfigured) return;
- +
- + // if its first pass, just init textures and return
- + if (ValidateRenderTarget())
- + return;
- +
- + if (m_renderMethod & RENDER_BYPASS)
- + {
- + ManageDisplay();
- + ManageTextures();
- + // if running bypass, then the player might need the src/dst rects
- + // for sizing video playback on a layer other than the gles layer.
- + if (m_RenderUpdateCallBackFn)
- + (*m_RenderUpdateCallBackFn)(m_RenderUpdateCallBackCtx, m_sourceRect, m_destRect);
- +
- + g_graphicsContext.BeginPaint();
- +
- + glEnable(GL_BLEND);
- + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- + glClearColor(0, 0, 0, 0);
- + glClear(GL_COLOR_BUFFER_BIT);
- +
- + g_graphicsContext.EndPaint();
- + return;
- + }
- + else if (m_renderMethod & RENDER_A10BUF)
- + {
- + ManageDisplay();
- + ManageTextures();
- +
- + if (m_RenderUpdateCallBackFn)
- + (*m_RenderUpdateCallBackFn)(m_RenderUpdateCallBackCtx, m_sourceRect, m_destRect);
- +
- + g_graphicsContext.BeginPaint();
- +
- + glEnable(GL_BLEND);
- + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- + glClearColor(0.0/255, 0.0/255, 0.0/255, 0);
- + glClear(GL_COLOR_BUFFER_BIT);
- + glClearColor(0, 0, 0, 0);
- +
- + g_graphicsContext.EndPaint();
- + }
- +
- + // this needs to be checked after texture validation
- + if (!m_bImageReady) return;
- +
- + int index = m_iYV12RenderBuffer;
- + YUVBUFFER& buf = m_buffers[index];
- +
- + if (m_renderMethod & RENDER_A10BUF)
- + {
- + A10VLDisplayQueueItem(buf.a10buffer, m_sourceRect, m_destRect);
- + m_iLastRenderBuffer = index;
- + VerifyGLState();
- + return;
- + }
- +
- + if (!buf.fields[FIELD_FULL][0].id || !buf.image.flags) return;
- +
- + ManageDisplay();
- + ManageTextures();
- +
- + g_graphicsContext.BeginPaint();
- +
- + if( !m_eventTexturesDone[index]->WaitMSec(500))
- + {
- + CLog::Log(LOGWARNING, "%s - Timeout waiting for texture %d", __FUNCTION__, index);
- +
- + // render the previous frame if this one isn't ready yet
- + if (m_iLastRenderBuffer > -1)
- + {
- + m_iYV12RenderBuffer = m_iLastRenderBuffer;
- + index = m_iYV12RenderBuffer;
- + }
- + }
- + else
- + m_iLastRenderBuffer = index;
- +
- + if (clear)
- + {
- + glClearColor(m_clearColour, m_clearColour, m_clearColour, 0);
- + glClear(GL_COLOR_BUFFER_BIT);
- + glClearColor(0,0,0,0);
- + }
- +
- + if (alpha<255)
- + {
- + glEnable(GL_BLEND);
- + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- + if (m_pYUVShader)
- + m_pYUVShader->SetAlpha(alpha / 255.0f);
- + }
- + else
- + {
- + glDisable(GL_BLEND);
- + if (m_pYUVShader)
- + m_pYUVShader->SetAlpha(1.0f);
- + }
- +
- + if ((flags & RENDER_FLAG_TOP) && (flags & RENDER_FLAG_BOT))
- + CLog::Log(LOGERROR, "GLES: Cannot render stipple!");
- + else
- + Render(flags, index);
- +
- + VerifyGLState();
- + glEnable(GL_BLEND);
- +
- + g_graphicsContext.EndPaint();
- +}
- +
- +void CLinuxRendererA10::FlipPage(int source)
- +{
- + if( source >= 0 && source < NUM_BUFFERS )
- + m_iYV12RenderBuffer = source;
- + else
- + m_iYV12RenderBuffer = NextYV12Texture();
- +
- + m_buffers[m_iYV12RenderBuffer].flipindex = ++m_flipindex;
- +
- + return;
- +}
- +
- +unsigned int CLinuxRendererA10::PreInit()
- +{
- + CSingleLock lock(g_graphicsContext);
- + m_bConfigured = false;
- + m_bValidated = false;
- + UnInit();
- + m_resolution = g_guiSettings.m_LookAndFeelResolution;
- + if ( m_resolution == RES_WINDOW )
- + m_resolution = RES_DESKTOP;
- +
- + m_iYV12RenderBuffer = 0;
- +
- + m_formats.push_back(RENDER_FMT_YUV420P);
- + m_formats.push_back(RENDER_FMT_BYPASS);
- + m_formats.push_back(RENDER_FMT_A10BUF);
- +
- + // setup the background colour
- + m_clearColour = (float)(g_advancedSettings.m_videoBlackBarColour & 0xff) / 0xff;
- +
- + return true;
- +}
- +
- +void CLinuxRendererA10::UpdateVideoFilter()
- +{
- + if (m_scalingMethodGui == g_settings.m_currentVideoSettings.m_ScalingMethod)
- + return;
- + m_scalingMethodGui = g_settings.m_currentVideoSettings.m_ScalingMethod;
- + m_scalingMethod = m_scalingMethodGui;
- +
- + if(!Supports(m_scalingMethod))
- + {
- + CLog::Log(LOGWARNING, "CLinuxRendererA10::UpdateVideoFilter - choosen scaling method %d, is not supported by renderer", (int)m_scalingMethod);
- + m_scalingMethod = VS_SCALINGMETHOD_LINEAR;
- + }
- +
- + if (m_pVideoFilterShader)
- + {
- + m_pVideoFilterShader->Free();
- + delete m_pVideoFilterShader;
- + m_pVideoFilterShader = NULL;
- + }
- + m_fbo.Cleanup();
- +
- + VerifyGLState();
- +
- + switch (m_scalingMethod)
- + {
- + case VS_SCALINGMETHOD_NEAREST:
- + SetTextureFilter(GL_NEAREST);
- + m_renderQuality = RQ_SINGLEPASS;
- + return;
- +
- + case VS_SCALINGMETHOD_LINEAR:
- + SetTextureFilter(GL_LINEAR);
- + m_renderQuality = RQ_SINGLEPASS;
- + return;
- +
- + case VS_SCALINGMETHOD_CUBIC:
- + CLog::Log(LOGERROR, "GLES: CUBIC not supported!");
- + break;
- +
- + case VS_SCALINGMETHOD_LANCZOS2:
- + case VS_SCALINGMETHOD_LANCZOS3:
- + case VS_SCALINGMETHOD_SINC8:
- + case VS_SCALINGMETHOD_NEDI:
- + CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented");
- + break;
- +
- + default:
- + break;
- + }
- +
- + CGUIDialogKaiToast::QueueNotification("Video Renderering", "Failed to init video filters/scalers, falling back to bilinear scaling");
- + CLog::Log(LOGERROR, "GL: Falling back to bilinear due to failure to init scaler");
- + if (m_pVideoFilterShader)
- + {
- + m_pVideoFilterShader->Free();
- + delete m_pVideoFilterShader;
- + m_pVideoFilterShader = NULL;
- + }
- + m_fbo.Cleanup();
- +
- + SetTextureFilter(GL_LINEAR);
- + m_renderQuality = RQ_SINGLEPASS;
- +}
- +
- +void CLinuxRendererA10::LoadShaders(int field)
- +{
- + int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod");
- + CLog::Log(LOGDEBUG, "GL: Requested render method: %d", requestedMethod);
- +
- + if (m_pYUVShader)
- + {
- + m_pYUVShader->Free();
- + delete m_pYUVShader;
- + m_pYUVShader = NULL;
- + }
- +
- + switch(requestedMethod)
- + {
- + case RENDER_METHOD_AUTO:
- + case RENDER_METHOD_GLSL:
- + if (m_format == RENDER_FMT_A10BUF)
- + {
- + CLog::Log(LOGNOTICE, "using A10 render method");
- + m_renderMethod = RENDER_A10BUF;
- + break;
- + }
- + // Try GLSL shaders if supported and user requested auto or GLSL.
- + // create regular progressive scan shader
- + m_pYUVShader = new YUV2RGBProgressiveShader(false, m_iFlags, m_format);
- + CLog::Log(LOGNOTICE, "GL: Selecting Single Pass YUV 2 RGB shader");
- +
- + if (m_pYUVShader && m_pYUVShader->CompileAndLink())
- + {
- + m_renderMethod = RENDER_GLSL;
- + UpdateVideoFilter();
- + break;
- + }
- + else
- + {
- + m_pYUVShader->Free();
- + delete m_pYUVShader;
- + m_pYUVShader = NULL;
- + CLog::Log(LOGERROR, "GL: Error enabling YUV2RGB GLSL shader");
- + }
- + break;
- + default:
- + // Use software YUV 2 RGB conversion if user requested it or GLSL failed
- + CLog::Log(LOGERROR, "no software rendering.");
- + break;
- + }
- +
- + // Now that we now the render method, setup texture function handlers
- + if (m_format == RENDER_FMT_BYPASS || m_format == RENDER_FMT_A10BUF)
- + {
- + m_textureUpload = &CLinuxRendererA10::UploadBYPASSTexture;
- + m_textureCreate = &CLinuxRendererA10::CreateBYPASSTexture;
- + m_textureDelete = &CLinuxRendererA10::DeleteBYPASSTexture;
- + }
- + else
- + {
- + // default to YV12 texture handlers
- + m_textureUpload = &CLinuxRendererA10::UploadYV12Texture;
- + m_textureCreate = &CLinuxRendererA10::CreateYV12Texture;
- + m_textureDelete = &CLinuxRendererA10::DeleteYV12Texture;
- + }
- +
- + if (m_oldRenderMethod != m_renderMethod)
- + {
- + CLog::Log(LOGDEBUG, "CLinuxRendererA10: Reorder drawpoints due to method change from %i to %i", m_oldRenderMethod, m_renderMethod);
- + ReorderDrawPoints();
- + m_oldRenderMethod = m_renderMethod;
- + }
- +}
- +
- +void CLinuxRendererA10::UnInit()
- +{
- + CLog::Log(LOGDEBUG, "LinuxRendererGL: Cleaning up GL resources");
- + CSingleLock lock(g_graphicsContext);
- +
- + A10VLHide();
- +
- + // YV12 textures
- + for (int i = 0; i < NUM_BUFFERS; ++i)
- + (this->*m_textureDelete)(i);
- +
- + // cleanup framebuffer object if it was in use
- + m_fbo.Cleanup();
- + m_bValidated = false;
- + m_bImageReady = false;
- + m_bConfigured = false;
- + m_RenderUpdateCallBackFn = NULL;
- + m_RenderUpdateCallBackCtx = NULL;
- +}
- +
- +inline void CLinuxRendererA10::ReorderDrawPoints()
- +{
- +
- + CBaseRenderer::ReorderDrawPoints();//call base impl. for rotating the points
- +}
- +
- +void CLinuxRendererA10::Render(DWORD flags, int index)
- +{
- + // If rendered directly by the hardware
- + if (m_renderMethod & RENDER_BYPASS)
- + return;
- +
- + // obtain current field, if interlaced
- + if( flags & RENDER_FLAG_TOP)
- + m_currentField = FIELD_TOP;
- +
- + else if (flags & RENDER_FLAG_BOT)
- + m_currentField = FIELD_BOT;
- +
- + else
- + m_currentField = FIELD_FULL;
- +
- + (this->*m_textureUpload)(index);
- +
- + if (m_renderMethod & RENDER_GLSL)
- + {
- + UpdateVideoFilter();
- + switch(m_renderQuality)
- + {
- + case RQ_LOW:
- + case RQ_SINGLEPASS:
- + RenderSinglePass(index, m_currentField);
- + VerifyGLState();
- + break;
- +
- + case RQ_MULTIPASS:
- + RenderMultiPass(index, m_currentField);
- + VerifyGLState();
- + break;
- + }
- + }
- +}
- +
- +void CLinuxRendererA10::RenderSinglePass(int index, int field)
- +{
- + YV12Image &im = m_buffers[index].image;
- + YUVFIELDS &fields = m_buffers[index].fields;
- + YUVPLANES &planes = fields[field];
- +
- + if (m_reloadShaders)
- + {
- + m_reloadShaders = 0;
- + LoadShaders(field);
- + }
- +
- + glDisable(GL_DEPTH_TEST);
- +
- + // Y
- + glActiveTexture(GL_TEXTURE0);
- + glEnable(m_textureTarget);
- + glBindTexture(m_textureTarget, planes[0].id);
- +
- + // U
- + glActiveTexture(GL_TEXTURE1);
- + glEnable(m_textureTarget);
- + glBindTexture(m_textureTarget, planes[1].id);
- +
- + // V
- + glActiveTexture(GL_TEXTURE2);
- + glEnable(m_textureTarget);
- + glBindTexture(m_textureTarget, planes[2].id);
- +
- + glActiveTexture(GL_TEXTURE0);
- + VerifyGLState();
- +
- + m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f);
- + m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f);
- + m_pYUVShader->SetWidth(im.width);
- + m_pYUVShader->SetHeight(im.height);
- + if (field == FIELD_TOP)
- + m_pYUVShader->SetField(1);
- + else if(field == FIELD_BOT)
- + m_pYUVShader->SetField(0);
- +
- + m_pYUVShader->SetMatrices(g_matrices.GetMatrix(MM_PROJECTION), g_matrices.GetMatrix(MM_MODELVIEW));
- + m_pYUVShader->Enable();
- +
- + GLubyte idx[4] = {0, 1, 3, 2}; //determines order of triangle strip
- + GLfloat m_vert[4][3];
- + GLfloat m_tex[3][4][2];
- +
- + GLint vertLoc = m_pYUVShader->GetVertexLoc();
- + GLint Yloc = m_pYUVShader->GetYcoordLoc();
- + GLint Uloc = m_pYUVShader->GetUcoordLoc();
- + GLint Vloc = m_pYUVShader->GetVcoordLoc();
- +
- + glVertexAttribPointer(vertLoc, 3, GL_FLOAT, 0, 0, m_vert);
- + glVertexAttribPointer(Yloc, 2, GL_FLOAT, 0, 0, m_tex[0]);
- + glVertexAttribPointer(Uloc, 2, GL_FLOAT, 0, 0, m_tex[1]);
- + glVertexAttribPointer(Vloc, 2, GL_FLOAT, 0, 0, m_tex[2]);
- +
- + glEnableVertexAttribArray(vertLoc);
- + glEnableVertexAttribArray(Yloc);
- + glEnableVertexAttribArray(Uloc);
- + glEnableVertexAttribArray(Vloc);
- +
- + // Setup vertex position values
- + for(int i = 0; i < 4; i++)
- + {
- + m_vert[i][0] = m_rotatedDestCoords[i].x;
- + m_vert[i][1] = m_rotatedDestCoords[i].y;
- + m_vert[i][2] = 0.0f;// set z to 0
- + }
- +
- + // Setup texture coordinates
- + for (int i=0; i<3; i++)
- + {
- + m_tex[i][0][0] = m_tex[i][3][0] = planes[i].rect.x1;
- + m_tex[i][0][1] = m_tex[i][1][1] = planes[i].rect.y1;
- + m_tex[i][1][0] = m_tex[i][2][0] = planes[i].rect.x2;
- + m_tex[i][2][1] = m_tex[i][3][1] = planes[i].rect.y2;
- + }
- +
- + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, idx);
- +
- + VerifyGLState();
- +
- + m_pYUVShader->Disable();
- + VerifyGLState();
- +
- + glDisableVertexAttribArray(vertLoc);
- + glDisableVertexAttribArray(Yloc);
- + glDisableVertexAttribArray(Uloc);
- + glDisableVertexAttribArray(Vloc);
- +
- + glActiveTexture(GL_TEXTURE1);
- + glDisable(m_textureTarget);
- +
- + glActiveTexture(GL_TEXTURE2);
- + glDisable(m_textureTarget);
- +
- + glActiveTexture(GL_TEXTURE0);
- + glDisable(m_textureTarget);
- +
- + g_matrices.MatrixMode(MM_MODELVIEW);
- +
- + VerifyGLState();
- +}
- +
- +void CLinuxRendererA10::RenderMultiPass(int index, int field)
- +{
- + // TODO: Multipass rendering does not currently work! FIX!
- + CLog::Log(LOGERROR, "GLES: MULTIPASS rendering was called! But it doesnt work!!!");
- + return;
- +
- + YV12Image &im = m_buffers[index].image;
- + YUVPLANES &planes = m_buffers[index].fields[field];
- +
- + if (m_reloadShaders)
- + {
- + m_reloadShaders = 0;
- + LoadShaders(m_currentField);
- + }
- +
- + glDisable(GL_DEPTH_TEST);
- +
- + // Y
- + glEnable(m_textureTarget);
- + glActiveTexture(GL_TEXTURE0);
- + glBindTexture(m_textureTarget, planes[0].id);
- + VerifyGLState();
- +
- + // U
- + glActiveTexture(GL_TEXTURE1);
- + glEnable(m_textureTarget);
- + glBindTexture(m_textureTarget, planes[1].id);
- + VerifyGLState();
- +
- + // V
- + glActiveTexture(GL_TEXTURE2);
- + glEnable(m_textureTarget);
- + glBindTexture(m_textureTarget, planes[2].id);
- + VerifyGLState();
- +
- + glActiveTexture(GL_TEXTURE0);
- + VerifyGLState();
- +
- + // make sure the yuv shader is loaded and ready to go
- + if (!m_pYUVShader || (!m_pYUVShader->OK()))
- + {
- + CLog::Log(LOGERROR, "GL: YUV shader not active, cannot do multipass render");
- + return;
- + }
- +
- + m_fbo.BeginRender();
- + VerifyGLState();
- +
- + m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f);
- + m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f);
- + m_pYUVShader->SetWidth(im.width);
- + m_pYUVShader->SetHeight(im.height);
- + if (field == FIELD_TOP)
- + m_pYUVShader->SetField(1);
- + else if(field == FIELD_BOT)
- + m_pYUVShader->SetField(0);
- +
- + VerifyGLState();
- +//TODO
- +// glPushAttrib(GL_VIEWPORT_BIT);
- +// glPushAttrib(GL_SCISSOR_BIT);
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + g_matrices.PushMatrix();
- + g_matrices.LoadIdentity();
- + VerifyGLState();
- +
- + g_matrices.MatrixMode(MM_PROJECTION);
- + g_matrices.PushMatrix();
- + g_matrices.LoadIdentity();
- + VerifyGLState();
- + g_matrices.Ortho2D(0, m_sourceWidth, 0, m_sourceHeight);
- + glViewport(0, 0, m_sourceWidth, m_sourceHeight);
- + glScissor(0, 0, m_sourceWidth, m_sourceHeight);
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + VerifyGLState();
- +
- +
- + if (!m_pYUVShader->Enable())
- + {
- + CLog::Log(LOGERROR, "GL: Error enabling YUV shader");
- + }
- +
- + float imgwidth = planes[0].rect.x2 - planes[0].rect.x1;
- + float imgheight = planes[0].rect.y2 - planes[0].rect.y1;
- + if (m_textureTarget == GL_TEXTURE_2D)
- + {
- + imgwidth *= planes[0].texwidth;
- + imgheight *= planes[0].texheight;
- + }
- +
- + // 1st Pass to video frame size
- +//TODO
- +// glBegin(GL_QUADS);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, planes[0].rect.x1, planes[0].rect.y1);
- +// glMultiTexCoord2fARB(GL_TEXTURE1, planes[1].rect.x1, planes[1].rect.y1);
- +// glMultiTexCoord2fARB(GL_TEXTURE2, planes[2].rect.x1, planes[2].rect.y1);
- +// glVertex2f(0.0f , 0.0f);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, planes[0].rect.x2, planes[0].rect.y1);
- +// glMultiTexCoord2fARB(GL_TEXTURE1, planes[1].rect.x2, planes[1].rect.y1);
- +// glMultiTexCoord2fARB(GL_TEXTURE2, planes[2].rect.x2, planes[2].rect.y1);
- +// glVertex2f(imgwidth, 0.0f);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, planes[0].rect.x2, planes[0].rect.y2);
- +// glMultiTexCoord2fARB(GL_TEXTURE1, planes[1].rect.x2, planes[1].rect.y2);
- +// glMultiTexCoord2fARB(GL_TEXTURE2, planes[2].rect.x2, planes[2].rect.y2);
- +// glVertex2f(imgwidth, imgheight);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, planes[0].rect.x1, planes[0].rect.y2);
- +// glMultiTexCoord2fARB(GL_TEXTURE1, planes[1].rect.x1, planes[1].rect.y2);
- +// glMultiTexCoord2fARB(GL_TEXTURE2, planes[2].rect.x1, planes[2].rect.y2);
- +// glVertex2f(0.0f , imgheight);
- +//
- +// glEnd();
- +// VerifyGLState();
- +
- + m_pYUVShader->Disable();
- +
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + g_matrices.PopMatrix(); // pop modelview
- + g_matrices.MatrixMode(MM_PROJECTION);
- + g_matrices.PopMatrix(); // pop projection
- +//TODO
- +// glPopAttrib(); // pop scissor
- +// glPopAttrib(); // pop viewport
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + VerifyGLState();
- +
- + m_fbo.EndRender();
- +
- + glActiveTexture(GL_TEXTURE1);
- + glDisable(m_textureTarget);
- + glActiveTexture(GL_TEXTURE2);
- + glDisable(m_textureTarget);
- + glActiveTexture(GL_TEXTURE0);
- + glDisable(m_textureTarget);
- +
- + glEnable(GL_TEXTURE_2D);
- + glBindTexture(GL_TEXTURE_2D, m_fbo.Texture());
- + VerifyGLState();
- +
- + // Use regular normalized texture coordinates
- +
- + // 2nd Pass to screen size with optional video filter
- +
- + if (m_pVideoFilterShader)
- + {
- + m_fbo.SetFiltering(GL_TEXTURE_2D, GL_NEAREST);
- + m_pVideoFilterShader->SetSourceTexture(0);
- + m_pVideoFilterShader->SetWidth(m_sourceWidth);
- + m_pVideoFilterShader->SetHeight(m_sourceHeight);
- + m_pVideoFilterShader->Enable();
- + }
- + else
- + m_fbo.SetFiltering(GL_TEXTURE_2D, GL_LINEAR);
- +
- + VerifyGLState();
- +
- + imgwidth /= m_sourceWidth;
- + imgheight /= m_sourceHeight;
- +
- +//TODO
- +// glBegin(GL_QUADS);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, 0.0f , 0.0f);
- +// glVertex4f(m_destRect.x1, m_destRect.y1, 0, 1.0f );
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, imgwidth, 0.0f);
- +// glVertex4f(m_destRect.x2, m_destRect.y1, 0, 1.0f);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, imgwidth, imgheight);
- +// glVertex4f(m_destRect.x2, m_destRect.y2, 0, 1.0f);
- +//
- +// glMultiTexCoord2fARB(GL_TEXTURE0, 0.0f , imgheight);
- +// glVertex4f(m_destRect.x1, m_destRect.y2, 0, 1.0f);
- +//
- +// glEnd();
- +
- + VerifyGLState();
- +
- + if (m_pVideoFilterShader)
- + m_pVideoFilterShader->Disable();
- +
- + VerifyGLState();
- +
- + glDisable(m_textureTarget);
- + VerifyGLState();
- +}
- +
- +bool CLinuxRendererA10::RenderCapture(CRenderCapture* capture)
- +{
- + if (!m_bValidated)
- + return false;
- +
- + // save current video rect
- + CRect saveSize = m_destRect;
- + saveRotatedCoords();//backup current m_rotatedDestCoords
- +
- + // new video rect is thumbnail size
- + m_destRect.SetRect(0, 0, (float)capture->GetWidth(), (float)capture->GetHeight());
- + syncDestRectToRotatedPoints();//syncs the changed destRect to m_rotatedDestCoords
- + // clear framebuffer and invert Y axis to get non-inverted image
- + glDisable(GL_BLEND);
- +
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + g_matrices.PushMatrix();
- + g_matrices.Translatef(0.0f, capture->GetHeight(), 0.0f);
- + g_matrices.Scalef(1.0f, -1.0f, 1.0f);
- +
- + capture->BeginRender();
- +
- + Render(RENDER_FLAG_NOOSD, m_iYV12RenderBuffer);
- + // read pixels
- + glReadPixels(0, g_graphicsContext.GetHeight() - capture->GetHeight(), capture->GetWidth(), capture->GetHeight(),
- + GL_RGBA, GL_UNSIGNED_BYTE, capture->GetRenderBuffer());
- +
- + // OpenGLES returns in RGBA order but CRenderCapture needs BGRA order
- + // XOR Swap RGBA -> BGRA
- + unsigned char* pixels = (unsigned char*)capture->GetRenderBuffer();
- + for (int i = 0; i < capture->GetWidth() * capture->GetHeight(); i++, pixels+=4)
- + {
- + std::swap(pixels[0], pixels[2]);
- + }
- +
- + capture->EndRender();
- +
- + // revert model view matrix
- + g_matrices.MatrixMode(MM_MODELVIEW);
- + g_matrices.PopMatrix();
- +
- + // restore original video rect
- + m_destRect = saveSize;
- + restoreRotatedCoords();//restores the previous state of the rotated dest coords
- +
- + return true;
- +}
- +
- +//********************************************************************************************************
- +// YV12 Texture creation, deletion, copying + clearing
- +//********************************************************************************************************
- +void CLinuxRendererA10::UploadYV12Texture(int source)
- +{
- + YUVBUFFER& buf = m_buffers[source];
- + YV12Image* im = &buf.image;
- + YUVFIELDS& fields = buf.fields;
- +
- +
- + if (!(im->flags&IMAGE_FLAG_READY))
- + {
- + m_eventTexturesDone[source]->Set();
- + return;
- + }
- +
- + bool deinterlacing;
- + if (m_currentField == FIELD_FULL)
- + deinterlacing = false;
- + else
- + deinterlacing = true;
- +
- + glEnable(m_textureTarget);
- + VerifyGLState();
- +
- + glPixelStorei(GL_UNPACK_ALIGNMENT,1);
- +
- + if (deinterlacing)
- + {
- + // Load Y fields
- + LoadPlane( fields[FIELD_TOP][0] , GL_LUMINANCE, buf.flipindex
- + , im->width, im->height >> 1
- + , im->stride[0]*2, im->plane[0] );
- +
- + LoadPlane( fields[FIELD_BOT][0], GL_LUMINANCE, buf.flipindex
- + , im->width, im->height >> 1
- + , im->stride[0]*2, im->plane[0] + im->stride[0]) ;
- + }
- + else
- + {
- + // Load Y plane
- + LoadPlane( fields[FIELD_FULL][0], GL_LUMINANCE, buf.flipindex
- + , im->width, im->height
- + , im->stride[0], im->plane[0] );
- + }
- +
- + VerifyGLState();
- +
- + glPixelStorei(GL_UNPACK_ALIGNMENT,1);
- +
- + if (deinterlacing)
- + {
- + // Load Even U & V Fields
- + LoadPlane( fields[FIELD_TOP][1], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1)
- + , im->stride[1]*2, im->plane[1] );
- +
- + LoadPlane( fields[FIELD_TOP][2], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1)
- + , im->stride[2]*2, im->plane[2] );
- +
- + // Load Odd U & V Fields
- + LoadPlane( fields[FIELD_BOT][1], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1)
- + , im->stride[1]*2, im->plane[1] + im->stride[1] );
- +
- + LoadPlane( fields[FIELD_BOT][2], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1)
- + , im->stride[2]*2, im->plane[2] + im->stride[2] );
- +
- + }
- + else
- + {
- + LoadPlane( fields[FIELD_FULL][1], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> im->cshift_y
- + , im->stride[1], im->plane[1] );
- +
- + LoadPlane( fields[FIELD_FULL][2], GL_LUMINANCE, buf.flipindex
- + , im->width >> im->cshift_x, im->height >> im->cshift_y
- + , im->stride[2], im->plane[2] );
- + }
- +
- + m_eventTexturesDone[source]->Set();
- +
- + CalculateTextureSourceRects(source, 3);
- +
- + glDisable(m_textureTarget);
- +}
- +
- +void CLinuxRendererA10::DeleteYV12Texture(int index)
- +{
- + YV12Image &im = m_buffers[index].image;
- + YUVFIELDS &fields = m_buffers[index].fields;
- +
- + if( fields[FIELD_FULL][0].id == 0 ) return;
- +
- + /* finish up all textures, and delete them */
- + g_graphicsContext.BeginPaint(); //FIXME
- + for(int f = 0;f<MAX_FIELDS;f++)
- + {
- + for(int p = 0;p<MAX_PLANES;p++)
- + {
- + if( fields[f][p].id )
- + {
- + if (glIsTexture(fields[f][p].id))
- + glDeleteTextures(1, &fields[f][p].id);
- + fields[f][p].id = 0;
- + }
- + }
- + }
- + g_graphicsContext.EndPaint();
- +
- + for(int p = 0;p<MAX_PLANES;p++)
- + {
- + if (im.plane[p])
- + {
- + delete [] im.plane[p];
- + im.plane[p] = NULL;
- + }
- + }
- +}
- +
- +bool CLinuxRendererA10::CreateYV12Texture(int index)
- +{
- + /* since we also want the field textures, pitch must be texture aligned */
- + YV12Image &im = m_buffers[index].image;
- + YUVFIELDS &fields = m_buffers[index].fields;
- +
- + DeleteYV12Texture(index);
- +
- + im.height = m_sourceHeight;
- + im.width = m_sourceWidth;
- + im.cshift_x = 1;
- + im.cshift_y = 1;
- +
- + im.stride[0] = im.width;
- + im.stride[1] = im.width >> im.cshift_x;
- + im.stride[2] = im.width >> im.cshift_x;
- +
- + im.planesize[0] = im.stride[0] * im.height;
- + im.planesize[1] = im.stride[1] * ( im.height >> im.cshift_y );
- + im.planesize[2] = im.stride[2] * ( im.height >> im.cshift_y );
- +
- + for (int i = 0; i < MAX_PLANES; i++)
- + im.plane[i] = new BYTE[im.planesize[i]];
- +
- + glEnable(m_textureTarget);
- + for(int f = 0;f<MAX_FIELDS;f++)
- + {
- + for(int p = 0;p<MAX_PLANES;p++)
- + {
- + if (!glIsTexture(fields[f][p].id))
- + {
- + glGenTextures(1, &fields[f][p].id);
- + VerifyGLState();
- + }
- + }
- + }
- +
- + // YUV
- + for (int f = FIELD_FULL; f<=FIELD_BOT ; f++)
- + {
- + int fieldshift = (f==FIELD_FULL) ? 0 : 1;
- + YUVPLANES &planes = fields[f];
- +
- + planes[0].texwidth = im.width;
- + planes[0].texheight = im.height >> fieldshift;
- +
- + planes[1].texwidth = planes[0].texwidth >> im.cshift_x;
- + planes[1].texheight = planes[0].texheight >> im.cshift_y;
- + planes[2].texwidth = planes[0].texwidth >> im.cshift_x;
- + planes[2].texheight = planes[0].texheight >> im.cshift_y;
- +
- + for(int p = 0; p < 3; p++)
- + {
- + YUVPLANE &plane = planes[p];
- + if (plane.texwidth * plane.texheight == 0)
- + continue;
- +
- + glBindTexture(m_textureTarget, plane.id);
- + CLog::Log(LOGDEBUG, "GL: Creating YUV NPOT texture of size %d x %d", plane.texwidth, plane.texheight);
- +
- + glTexImage2D(m_textureTarget, 0, GL_LUMINANCE, plane.texwidth, plane.texheight, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
- +
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- + VerifyGLState();
- + }
- + }
- + glDisable(m_textureTarget);
- + m_eventTexturesDone[index]->Set();
- + return true;
- +}
- +
- +//********************************************************************************************************
- +// BYPASS creation, deletion, copying + clearing
- +//********************************************************************************************************
- +void CLinuxRendererA10::UploadBYPASSTexture(int index)
- +{
- + m_eventTexturesDone[index]->Set();
- +}
- +
- +void CLinuxRendererA10::DeleteBYPASSTexture(int index)
- +{
- +}
- +
- +bool CLinuxRendererA10::CreateBYPASSTexture(int index)
- +{
- + m_eventTexturesDone[index]->Set();
- + return true;
- +}
- +
- +void CLinuxRendererA10::SetTextureFilter(GLenum method)
- +{
- + for (int i = 0 ; i<NUM_BUFFERS ; i++)
- + {
- + YUVFIELDS &fields = m_buffers[i].fields;
- +
- + for (int f = FIELD_FULL; f<=FIELD_BOT ; f++)
- + {
- + glBindTexture(m_textureTarget, fields[f][0].id);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, method);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, method);
- + VerifyGLState();
- +
- + glBindTexture(m_textureTarget, fields[f][1].id);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, method);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, method);
- + VerifyGLState();
- +
- + glBindTexture(m_textureTarget, fields[f][2].id);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, method);
- + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, method);
- + VerifyGLState();
- + }
- + }
- +}
- +
- +bool CLinuxRendererA10::Supports(ERENDERFEATURE feature)
- +{
- + // Player controls render, let it dictate available render features
- + if((m_renderMethod & RENDER_BYPASS))
- + {
- + Features::iterator itr = std::find(m_renderFeatures.begin(),m_renderFeatures.end(), feature);
- + return itr != m_renderFeatures.end();
- + }
- +
- + if(feature == RENDERFEATURE_BRIGHTNESS)
- + return false;
- +
- + if(feature == RENDERFEATURE_CONTRAST)
- + return false;
- +
- + if(feature == RENDERFEATURE_GAMMA)
- + return false;
- +
- + if(feature == RENDERFEATURE_NOISE)
- + return false;
- +
- + if(feature == RENDERFEATURE_SHARPNESS)
- + return false;
- +
- + if (feature == RENDERFEATURE_NONLINSTRETCH)
- + return false;
- +
- + return false;
- +}
- +
- +bool CLinuxRendererA10::SupportsMultiPassRendering()
- +{
- + return false;
- +}
- +
- +bool CLinuxRendererA10::Supports(EDEINTERLACEMODE mode)
- +{
- + // Player controls render, let it dictate available deinterlace modes
- + if((m_renderMethod & RENDER_BYPASS))
- + {
- + Features::iterator itr = std::find(m_deinterlaceModes.begin(),m_deinterlaceModes.end(), mode);
- + return itr != m_deinterlaceModes.end();
- + }
- +
- + if (mode == VS_DEINTERLACEMODE_OFF)
- + return true;
- +
- + if(mode == VS_DEINTERLACEMODE_AUTO || mode == VS_DEINTERLACEMODE_FORCE)
- + return true;
- +
- + return false;
- +}
- +
- +bool CLinuxRendererA10::Supports(EINTERLACEMETHOD method)
- +{
- + // Player controls render, let it dictate available deinterlace methods
- + if((m_renderMethod & RENDER_BYPASS))
- + {
- + Features::iterator itr = std::find(m_deinterlaceMethods.begin(),m_deinterlaceMethods.end(), method);
- + return itr != m_deinterlaceMethods.end();
- + }
- +
- + if(method == VS_INTERLACEMETHOD_AUTO)
- + return true;
- +
- +#if defined(__i386__) || defined(__x86_64__)
- + if(method == VS_INTERLACEMETHOD_DEINTERLACE
- + || method == VS_INTERLACEMETHOD_DEINTERLACE_HALF
- + || method == VS_INTERLACEMETHOD_SW_BLEND)
- +#else
- + if(method == VS_INTERLACEMETHOD_SW_BLEND)
- +#endif
- + return true;
- +
- + return false;
- +}
- +
- +bool CLinuxRendererA10::Supports(ESCALINGMETHOD method)
- +{
- + // Player controls render, let it dictate available scaling methods
- + if((m_renderMethod & RENDER_BYPASS))
- + {
- + Features::iterator itr = std::find(m_scalingMethods.begin(),m_scalingMethods.end(), method);
- + return itr != m_scalingMethods.end();
- + }
- +
- + if(method == VS_SCALINGMETHOD_NEAREST
- + || method == VS_SCALINGMETHOD_LINEAR)
- + return true;
- +
- + return false;
- +}
- +
- +EINTERLACEMETHOD CLinuxRendererA10::AutoInterlaceMethod()
- +{
- + // Player controls render, let it pick the auto-deinterlace method
- + if((m_renderMethod & RENDER_BYPASS))
- + {
- + if (m_deinterlaceMethods.size())
- + return ((EINTERLACEMETHOD)m_deinterlaceMethods[0]);
- + else
- + return VS_INTERLACEMETHOD_NONE;
- + }
- +
- +#if defined(__i386__) || defined(__x86_64__)
- + return VS_INTERLACEMETHOD_DEINTERLACE_HALF;
- +#else
- + return VS_INTERLACEMETHOD_SW_BLEND;
- +#endif
- +}
- +
- +void CLinuxRendererA10::AddProcessor(struct A10VLQueueItem *buffer)
- +{
- + YUVBUFFER &buf = m_buffers[NextYV12Texture()];
- +
- + buf.a10buffer = buffer;
- +}
- +
- +/*
- + * Video layer functions
- + */
- +
- +static int g_hdisp = -1;
- +static int g_screenid = 0;
- +static int g_syslayer = 0x64;
- +static int g_hlayer = 0;
- +static int g_width;
- +static int g_height;
- +static CRect g_srcRect;
- +static CRect g_dstRect;
- +static int g_lastnr;
- +static int g_decnr;
- +static int g_wridx;
- +static int g_rdidx;
- +static A10VLQueueItem g_dispq[DISPQS];
- +static pthread_mutex_t g_dispq_mutex;
- +
- +static __disp_layer_info_t UIOLdLayerAttr;
- +
- +bool A10VLInit(int &width, int &height)
- +{
- + unsigned long args[4];
- + __disp_layer_info_t layera;
- + unsigned int i;
- +
- + if (g_hdisp != -1) return true;
- +
- + pthread_mutex_init(&g_dispq_mutex, NULL);
- +
- + g_hdisp = open("/dev/disp", O_RDWR);
- + if (g_hdisp == -1)
- + {
- + CLog::Log(LOGERROR, "A10: open /dev/disp failed. (%d)", errno);
- + return false;
- + }
- +
- + args[0] = g_screenid;
- + args[1] = 0;
- + args[2] = 0;
- + args[3] = 0;
- + width = g_width = ioctl(g_hdisp, DISP_CMD_SCN_GET_WIDTH , args);
- + height = g_height = ioctl(g_hdisp, DISP_CMD_SCN_GET_HEIGHT, args);
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&UIOLdLayerAttr);
- +
- + ioctl(g_hdisp, DISP_CMD_LAYER_GET_PARA, args);
- +
- + if (g_height > 720)
- + {
- + //set workmode scaler (system layer)
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&layera);
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_GET_PARA, args);
- + layera.mode = DISP_LAYER_WORK_MODE_SCALER;
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&layera);
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_SET_PARA, args);
- + }
- + else
- + {
- + //#### (1280-720), src(0/0/1280/720), scn(32/18/1216/684)
- + //set workmode normal (system layer)
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&layera);
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_GET_PARA, args);
- + //source window information
- + layera.src_win.x = 0;
- + layera.src_win.y = 0;
- + layera.src_win.width = g_width;
- + layera.src_win.height = g_height;
- + //screen window information
- + layera.scn_win.x = 0;
- + layera.scn_win.y = 0;
- + layera.scn_win.width = g_width;
- + layera.scn_win.height = g_height;
- + //layera.mode = DISP_LAYER_WORK_MODE_NORMAL;
- + layera.mode = DISP_LAYER_WORK_MODE_SCALER;
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&layera);
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_SET_PARA, args);
- +
- + }
- +
- + args[0] = g_screenid;
- + args[1] = DISP_LAYER_WORK_MODE_SCALER;
- + args[2] = 0;
- + args[3] = 0;
- + g_hlayer = ioctl(g_hdisp, DISP_CMD_LAYER_REQUEST, args);
- + if (g_hlayer <= 0)
- + {
- + g_hlayer = 0;
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_REQUEST failed.\n");
- + return false;
- + }
- +
- + memset(&g_srcRect, 0, sizeof(g_srcRect));
- + memset(&g_dstRect, 0, sizeof(g_dstRect));
- +
- + g_lastnr = -1;
- + g_decnr = 0;
- + g_rdidx = 0;
- + g_wridx = 0;
- +
- + for (i = 0; i < DISPQS; i++)
- + g_dispq[i].pict.id = -1;
- +
- + return true;
- +}
- +
- +static int _inited = 0;
- +static int _currentOSDLevel = 0;
- +
- +void A10VLShowOSD ()
- +{
- + unsigned long args[4];
- +
- + if (g_hlayer && _currentOSDLevel == 0)
- + {
- + _currentOSDLevel = 255;
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 255;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_SET_ALPHA_VALUE, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 128;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_SET_ALPHA_VALUE, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- + }
- +}
- +
- +void A10VLHideOSD ()
- +{
- + unsigned long args[4];
- +
- + if (g_hlayer && _currentOSDLevel == 255)
- + {
- + _currentOSDLevel = 0;
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_SET_ALPHA_VALUE, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 255;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_SET_ALPHA_VALUE, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- + }
- +}
- +
- +void A10VLExit()
- +{
- + unsigned long args[4];
- + _inited = 0;
- + _currentOSDLevel = 0;
- +
- + if (g_hlayer)
- + {
- + //stop video
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_VIDEO_STOP, args);
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_BOTTOM, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_BOTTOM failed.\n");
- +
- + //close layer
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_CLOSE, args);
- +
- + //release layer
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_RELEASE, args);
- + g_hlayer = 0;
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 255;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_SET_ALPHA_VALUE, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_ALPHA_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = (unsigned long) (&UIOLdLayerAttr);
- + ioctl(g_hdisp, DISP_CMD_LAYER_SET_PARA, args);
- + }
- +
- + if (g_hdisp != -1)
- + {
- + close(g_hdisp);
- + g_hdisp = -1;
- + }
- +}
- +void A10VLHide()
- +{
- + unsigned long args[4];
- +
- + if (g_hlayer)
- + {
- + //stop video
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_VIDEO_STOP, args);
- +
- + //close layer
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + ioctl(g_hdisp, DISP_CMD_LAYER_CLOSE, args);
- + }
- +
- + memset(&g_srcRect, 0, sizeof(g_srcRect));
- + memset(&g_dstRect, 0, sizeof(g_dstRect));
- +}
- +
- +A10VLQueueItem *A10VLPutQueue(A10VLCALLBACK callback,
- + void *callbackpriv,
- + void *pictpriv,
- + cedarv_picture_t &pict)
- +{
- + A10VLQueueItem *pRet;
- +
- + pthread_mutex_lock(&g_dispq_mutex);
- +
- + pRet = &g_dispq[g_wridx];
- +
- + pRet->decnr = g_decnr++;
- + pRet->callback = callback;
- + pRet->callbackpriv = callbackpriv;
- + pRet->pictpriv = pictpriv;
- + pRet->pict = pict;
- +
- + g_wridx++;
- + if (g_wridx >= DISPQS)
- + g_wridx = 0;
- +
- + pthread_mutex_unlock(&g_dispq_mutex);
- +
- + return pRet;
- +}
- +
- +static void A10VLFreeQueueItem(A10VLQueueItem *pItem)
- +{
- + if ((int)pItem->pict.id != -1)
- + {
- + if (pItem->callback)
- + pItem->callback(pItem->callbackpriv, pItem->pictpriv, pItem->pict);
- + pItem->pict.id = -1;
- + }
- +}
- +
- +void A10VLFreeQueue()
- +{
- + int i;
- +
- + pthread_mutex_lock(&g_dispq_mutex);
- +
- + for (i = 0; i < DISPQS; i++)
- + A10VLFreeQueueItem(&g_dispq[i]);
- +
- + pthread_mutex_unlock(&g_dispq_mutex);
- +}
- +
- +void A10VLDisplayQueueItem(A10VLQueueItem *pItem, CRect &srcRect, CRect &dstRect)
- +{
- + int i;
- + int curnr;
- +
- + pthread_mutex_lock(&g_dispq_mutex);
- +
- + if (!pItem || (pItem->pict.id == -1) || (g_lastnr == pItem->decnr))
- + {
- + pthread_mutex_unlock(&g_dispq_mutex);
- + return;
- + }
- +
- + curnr = A10VLDisplayPicture(pItem->pict, pItem->decnr, srcRect, dstRect);
- +
- + if (curnr != g_lastnr)
- + {
- + //free older frames, displayed or not
- + for (i = 0; i < DISPQS; i++)
- + {
- + if(g_dispq[g_rdidx].decnr < curnr)
- + {
- + A10VLFreeQueueItem(&g_dispq[g_rdidx]);
- +
- + g_rdidx++;
- + if (g_rdidx >= DISPQS)
- + g_rdidx = 0;
- +
- + } else break;
- + }
- +
- + }
- +
- + g_lastnr = curnr;
- +
- + pthread_mutex_unlock(&g_dispq_mutex);
- +}
- +
- +int A10VLDisplayPicture(cedarv_picture_t &picture,
- + int refnr,
- + CRect &srcRect,
- + CRect &dstRect)
- +{
- + unsigned long args[4];
- + __disp_layer_info_t layera;
- + __disp_video_fb_t frmbuf;
- + __disp_colorkey_t colorkey;
- +
- + memset(&frmbuf, 0, sizeof(__disp_video_fb_t));
- + frmbuf.id = refnr;
- + frmbuf.interlace = picture.is_progressive? 0 : 1;
- + frmbuf.top_field_first = picture.top_field_first;
- + //frmbuf.frame_rate = picture.frame_rate;
- + frmbuf.addr[0] = g_libbdv.mem_get_phy_addr((u32)picture.y);
- + frmbuf.addr[1] = g_libbdv.mem_get_phy_addr((u32)picture.u);
- +
- + //if (_inited == 0)
- + if ((g_srcRect != srcRect) || (g_dstRect != dstRect))
- + {
- + int screen_width, screen_height;
- +
- + _inited = 1;
- +
- + //query screen dimensions
- + args[0] = g_screenid;
- + args[1] = 0;
- + args[2] = 0;
- + args[3] = 0;
- + screen_width = ioctl(g_hdisp, DISP_CMD_SCN_GET_WIDTH, args);
- +
- + args[0] = g_screenid;
- + args[1] = 0;
- + args[2] = 0;
- + args[3] = 0;
- + screen_height = ioctl(g_hdisp, DISP_CMD_SCN_GET_HEIGHT, args);
- +
- + memset(&layera, 0, sizeof(layera));
- + //set video layer attribute
- + layera.mode = DISP_LAYER_WORK_MODE_SCALER;
- + layera.b_from_screen = 0; //what is this? if enabled all is black
- + layera.pipe = 1;
- + //use alpha blend
- + layera.alpha_en = 0;
- + layera.alpha_val = 0xff;
- + layera.ck_enable = 0;
- + layera.b_trd_out = 0;
- + layera.out_trd_mode = (__disp_3d_out_mode_t)0;
- + //frame buffer pst and size information
- + if (picture.display_height < 720)
- + {
- + layera.fb.cs_mode = DISP_BT601;
- + }
- + else
- + {
- + layera.fb.cs_mode = DISP_BT709;
- + }
- +
- + float w = (float)picture.width;
- + float h = (float)picture.height;
- + float h1 = g_width * h / w;
- +
- + layera.fb.mode = DISP_MOD_MB_UV_COMBINED;
- + layera.fb.format = picture.pixel_format == CEDARV_PIXEL_FORMAT_AW_YUV422 ? DISP_FORMAT_YUV422 : DISP_FORMAT_YUV420;
- + layera.fb.br_swap = 0;
- + layera.fb.seq = DISP_SEQ_UVUV;
- + layera.fb.addr[0] = frmbuf.addr[0];
- + layera.fb.addr[1] = frmbuf.addr[1];
- + layera.fb.b_trd_src = 0;
- + layera.fb.trd_mode = (__disp_3d_src_mode_t)0;
- + layera.fb.size.width = picture.display_width;
- + layera.fb.size.height = picture.display_height;
- + //source window information
- + layera.src_win.x = 0;
- + layera.src_win.y = 0;
- + layera.src_win.width = picture.width;
- + layera.src_win.height = picture.height;
- + //screen window information
- + layera.scn_win.x = 0;
- + layera.scn_win.y = 0;
- + layera.scn_win.width = g_width;
- + layera.scn_win.height = g_height;
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = (unsigned long)&layera;
- + args[3] = 0;
- + if(ioctl(g_hdisp, DISP_CMD_LAYER_SET_PARA, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_SET_PARA failed.\n");
- +
- + //open layer
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_OPEN, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_OPEN failed.\n");
- +
- + //put behind system layer
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_BOTTOM, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_BOTTOM failed.\n");
- +
- + //turn off colorkey (system layer)
- + args[0] = g_screenid;
- + args[1] = g_syslayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_CK_OFF, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_OFF failed.\n");
- +
- + colorkey.ck_min.alpha = 128;
- + colorkey.ck_min.red = 1;
- + colorkey.ck_min.green = 1;
- + colorkey.ck_min.blue = 1;
- + colorkey.ck_max = colorkey.ck_min;
- + colorkey.ck_max.alpha = 128;
- + colorkey.red_match_rule = 2;
- + colorkey.green_match_rule = 2;
- + colorkey.blue_match_rule = 2;
- +
- + colorkey.ck_min.alpha = 0xff;
- + colorkey.ck_min.red = 0x0; //0x01;
- + colorkey.ck_min.green = 0x0; //0x03;
- + colorkey.ck_min.blue = 0x0; //0x05;
- + colorkey.ck_max.alpha = 0xff;
- + colorkey.ck_max.red = 0x0; //0x01;
- + colorkey.ck_max.green = 0x0; //0x03;
- + colorkey.ck_max.blue = 0x0; //0x05;
- +
- + colorkey.red_match_rule = 2;
- + colorkey.green_match_rule = 2;
- + colorkey.blue_match_rule = 2;
- +
- +
- + args[0] = g_screenid;
- + args[1] = (unsigned long)&colorkey;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_SET_COLORKEY, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_SET_COLORKEY failed.\n");
- +
- + //turn on colorkey
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_LAYER_CK_ON, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_LAYER_CK_ON failed.\n");
- +
- +
- +
- + //start video
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_VIDEO_START, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_VIDEO_START failed.\n");
- +
- + g_srcRect = srcRect;
- + g_dstRect = dstRect;
- +
- + g_android_mouse_count = 0;
- + }
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = (unsigned long)&frmbuf;
- + args[3] = 0;
- + if (ioctl(g_hdisp, DISP_CMD_VIDEO_SET_FB, args))
- + CLog::Log(LOGERROR, "A10: DISP_CMD_VIDEO_SET_FB failed.\n");
- +
- + //CLog::Log(LOGDEBUG, "A10: render %d\n", buffer->picture.id);
- +
- + args[0] = g_screenid;
- + args[1] = g_hlayer;
- + args[2] = 0;
- + args[3] = 0;
- + return ioctl(g_hdisp, DISP_CMD_VIDEO_GET_FRAME_ID, args);
- +}
- +
- +#endif
- +
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/LinuxRendererA10.h xbmc_vidonme/xbmc/cores/VideoRenderers/LinuxRendererA10.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/LinuxRendererA10.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_vidonme/xbmc/cores/VideoRenderers/LinuxRendererA10.h 2013-06-12 16:40:35.000000000 +0200
- @@ -0,0 +1,317 @@
- +#ifndef LinuxRendererA10_RENDERER
- +#define LinuxRendererA10_RENDERER
- +
- +/*
- + * Copyright (C) 2010-2012 Team XBMC and others
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +
- +#if HAS_GLES == 2
- +
- +#include "system_gl.h"
- +
- +#include "xbmc/guilib/FrameBufferObject.h"
- +#include "xbmc/guilib/Shader.h"
- +#include "settings/VideoSettings.h"
- +#include "RenderFlags.h"
- +#include "guilib/GraphicContext.h"
- +#include "BaseRenderer.h"
- +#include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h"
- +#include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecA10.h"
- +
- +extern "C" {
- +#include "cores/a10/libcedarv.h"
- +}
- +
- +class CRenderCapture;
- +
- +class CBaseTexture;
- +namespace Shaders { class BaseYUV2RGBShader; }
- +namespace Shaders { class BaseVideoFilterShader; }
- +
- +typedef std::vector<int> Features;
- +
- +#define NUM_BUFFERS 6
- +
- +
- +#undef ALIGN
- +#define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1))
- +#define CLAMP(a, min, max) ((a) > (max) ? (max) : ( (a) < (min) ? (min) : a ))
- +
- +#define AUTOSOURCE -1
- +
- +#define IMAGE_FLAG_WRITING 0x01 /* image is in use after a call to GetImage, caller may be reading or writing */
- +#define IMAGE_FLAG_READING 0x02 /* image is in use after a call to GetImage, caller is only reading */
- +#define IMAGE_FLAG_DYNAMIC 0x04 /* image was allocated due to a call to GetImage */
- +#define IMAGE_FLAG_RESERVED 0x08 /* image is reserved, must be asked for specifically used to preserve images */
- +#define IMAGE_FLAG_READY 0x16 /* image is ready to be uploaded to texture memory */
- +#define IMAGE_FLAG_INUSE (IMAGE_FLAG_WRITING | IMAGE_FLAG_READING | IMAGE_FLAG_RESERVED)
- +
- +struct DRAWRECT
- +{
- + float left;
- + float top;
- + float right;
- + float bottom;
- +};
- +
- +struct YUVRANGE
- +{
- + int y_min, y_max;
- + int u_min, u_max;
- + int v_min, v_max;
- +};
- +
- +struct YUVCOEF
- +{
- + float r_up, r_vp;
- + float g_up, g_vp;
- + float b_up, b_vp;
- +};
- +
- +enum RenderMethod
- +{
- + RENDER_GLSL = 0x001,
- + RENDER_A10BUF = 0x100,
- + RENDER_BYPASS = 0x400
- +};
- +
- +enum RenderQuality
- +{
- + RQ_LOW=1,
- + RQ_SINGLEPASS,
- + RQ_MULTIPASS,
- +};
- +
- +#define PLANE_Y 0
- +#define PLANE_U 1
- +#define PLANE_V 2
- +
- +#define FIELD_FULL 0
- +#define FIELD_TOP 1
- +#define FIELD_BOT 2
- +
- +class CEvent;
- +
- +struct A10VLQueueItem;
- +
- +class CLinuxRendererA10 : public CBaseRenderer
- +{
- +public:
- + CLinuxRendererA10();
- + virtual ~CLinuxRendererA10();
- +
- + virtual void Update(bool bPauseDrawing);
- + virtual void SetupScreenshot() {};
- +
- + bool RenderCapture(CRenderCapture* capture);
- +
- + // Player functions
- + virtual bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_formatunsigned, unsigned int orientation);
- + virtual bool IsConfigured() { return m_bConfigured; }
- + virtual int GetImage(YV12Image *image, int source = AUTOSOURCE, bool readonly = false);
- + virtual void ReleaseImage(int source, bool preserve = false);
- + virtual void FlipPage(int source);
- + virtual unsigned int PreInit();
- + virtual void UnInit();
- + virtual void Reset(); /* resets renderer after seek for example */
- + virtual void ReorderDrawPoints();
- +
- + virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255);
- +
- + // Feature support
- + virtual bool SupportsMultiPassRendering();
- + virtual bool Supports(ERENDERFEATURE feature);
- + virtual bool Supports(EDEINTERLACEMODE mode);
- + virtual bool Supports(EINTERLACEMETHOD method);
- + virtual bool Supports(ESCALINGMETHOD method);
- +
- + virtual EINTERLACEMETHOD AutoInterlaceMethod();
- +
- + virtual std::vector<ERenderFormat> SupportedFormats() { return m_formats; }
- +
- + virtual void AddProcessor(struct A10VLQueueItem *pVidBuff);
- +
- +protected:
- + virtual void Render(DWORD flags, int index);
- +
- + virtual void ManageTextures();
- + int NextYV12Texture();
- + virtual bool ValidateRenderTarget();
- + virtual void LoadShaders(int field=FIELD_FULL);
- + void SetTextureFilter(GLenum method);
- + void UpdateVideoFilter();
- +
- + // textures
- + void (CLinuxRendererA10::*m_textureUpload)(int index);
- + void (CLinuxRendererA10::*m_textureDelete)(int index);
- + bool (CLinuxRendererA10::*m_textureCreate)(int index);
- +
- + void UploadYV12Texture(int index);
- + void DeleteYV12Texture(int index);
- + bool CreateYV12Texture(int index);
- +
- + void UploadBYPASSTexture(int index);
- + void DeleteBYPASSTexture(int index);
- + bool CreateBYPASSTexture(int index);
- +
- + void CalculateTextureSourceRects(int source, int num_planes);
- +
- + // renderers
- + void RenderMultiPass(int index, int field); // multi pass glsl renderer
- + void RenderSinglePass(int index, int field); // single pass glsl renderer
- +
- + CFrameBufferObject m_fbo;
- +
- + int m_iYV12RenderBuffer;
- + int m_iLastRenderBuffer;
- +
- + bool m_bConfigured;
- + bool m_bValidated;
- + std::vector<ERenderFormat> m_formats;
- + bool m_bImageReady;
- + ERenderFormat m_format;
- + GLenum m_textureTarget;
- + unsigned short m_renderMethod;
- + unsigned short m_oldRenderMethod;
- + RenderQuality m_renderQuality;
- + unsigned int m_flipindex; // just a counter to keep track of if a image has been uploaded
- + bool m_StrictBinding;
- +
- + // Raw data used by renderer
- + int m_currentField;
- + int m_reloadShaders;
- +
- + struct YUVPLANE
- + {
- + GLuint id;
- + CRect rect;
- +
- + float width;
- + float height;
- +
- + unsigned texwidth;
- + unsigned texheight;
- +
- + unsigned flipindex;
- + };
- +
- + typedef YUVPLANE YUVPLANES[MAX_PLANES];
- + typedef YUVPLANES YUVFIELDS[MAX_FIELDS];
- +
- + struct YUVBUFFER
- + {
- + YUVFIELDS fields;
- + YV12Image image;
- + unsigned flipindex; /* used to decide if this has been uploaded */
- +
- + A10VLQueueItem *a10buffer;
- + };
- +
- + // YV12 decoder textures
- + // field index 0 is full image, 1 is odd scanlines, 2 is even scanlines
- + YUVBUFFER m_buffers[NUM_BUFFERS];
- +
- + void LoadPlane( YUVPLANE& plane, int type, unsigned flipindex
- + , unsigned width, unsigned height
- + , int stride, void* data );
- +
- + Shaders::BaseYUV2RGBShader *m_pYUVShader;
- + Shaders::BaseVideoFilterShader *m_pVideoFilterShader;
- +
- + ESCALINGMETHOD m_scalingMethod;
- + ESCALINGMETHOD m_scalingMethodGui;
- +
- + Features m_renderFeatures;
- + Features m_deinterlaceMethods;
- + Features m_deinterlaceModes;
- + Features m_scalingMethods;
- +
- + // clear colour for "black" bars
- + float m_clearColour;
- +
- + CEvent* m_eventTexturesDone[NUM_BUFFERS];
- +
- +};
- +
- +
- +inline int NP2( unsigned x )
- +{
- + --x;
- + x |= x >> 1;
- + x |= x >> 2;
- + x |= x >> 4;
- + x |= x >> 8;
- + x |= x >> 16;
- + return ++x;
- +}
- +#endif
- +
- +/*
- + * Video layer functions
- + */
- +
- +extern "C" {
- +#include "cores/a10/libcedarv.h"
- +#include "cores/a10/drv_display_sun4i.h"
- +}
- +
- +#define DISPQS 20
- +
- +typedef void (*A10VLCALLBACK)(void *callbackpriv, void *pictpriv, cedarv_picture_t &pict); //cleanup function
- +
- +struct A10VLQueueItem
- +{
- + int decnr;
- + A10VLCALLBACK callback;
- + void *callbackpriv;
- + void *pictpriv;
- + cedarv_picture_t pict;
- +};
- +
- +typedef struct
- +{
- + int width_in;
- + int height_in;
- + int width_out;
- + int height_out;
- + u32 addr_y_in;
- + u32 addr_c_in;
- + u32 addr_y_out;
- + u32 addr_u_out;
- + u32 addr_v_out;
- +} A10VLScalerParameter;
- +
- +bool A10VLInit(int &width, int &height);
- +
- +void A10VLExit();
- +
- +void A10VLHide();
- +
- +A10VLQueueItem *A10VLPutQueue(A10VLCALLBACK callback,
- + void *callbackpriv,
- + void *pictpriv,
- + cedarv_picture_t &pict);
- +
- +void A10VLFreeQueue();
- +
- +void A10VLDisplayQueueItem(A10VLQueueItem *pItem, CRect &srcRect, CRect &dstRect);
- +
- +int A10VLDisplayPicture(cedarv_picture_t &pict, int refnr, CRect &srcRect, CRect &dstRect);
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderFormats.h xbmc_vidonme/xbmc/cores/VideoRenderers/RenderFormats.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderFormats.h 2013-06-12 16:21:05.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/VideoRenderers/RenderFormats.h 2013-06-12 16:40:35.000000000 +0200
- @@ -33,6 +33,9 @@
- RENDER_FMT_VAAPI,
- RENDER_FMT_OMXEGL,
- RENDER_FMT_CVBREF,
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + RENDER_FMT_A10BUF,
- +#endif
- RENDER_FMT_BYPASS,
- };
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.cpp xbmc_vidonme/xbmc/cores/VideoRenderers/RenderManager.cpp
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.cpp 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/VideoRenderers/RenderManager.cpp 2013-06-12 16:40:35.000000000 +0200
- @@ -38,7 +38,11 @@
- #if defined(HAS_GL)
- #include "LinuxRendererGL.h"
- #elif HAS_GLES == 2
- + #if defined(__DVDFAB_FUNC_A10CODEC__)
- + #include "LinuxRendererA10.h"
- + #else
- #include "LinuxRendererGLES.h"
- + #endif
- #elif defined(HAS_DX)
- #include "WinRenderer.h"
- #elif defined(HAS_SDL)
- @@ -328,7 +332,11 @@
- #if defined(HAS_GL)
- m_pRenderer = new CLinuxRendererGL();
- #elif HAS_GLES == 2
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + m_pRenderer = new CLinuxRendererA10();
- +#else
- m_pRenderer = new CLinuxRendererGLES();
- +#endif //__DVDFAB_FUNC_A10CODEC__
- #elif defined(HAS_DX)
- m_pRenderer = new CWinRenderer();
- #elif defined(HAS_SDL)
- @@ -844,6 +852,11 @@
- else if(pic.format == RENDER_FMT_VAAPI)
- m_pRenderer->AddProcessor(*pic.vaapi);
- #endif
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + else if (pic.format == RENDER_FMT_A10BUF)
- + m_pRenderer->AddProcessor(pic.a10buffer);
- +#endif
- +
- m_pRenderer->ReleaseImage(index, false);
- return index;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.h xbmc_vidonme/xbmc/cores/VideoRenderers/RenderManager.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.h 2013-06-12 16:46:43.000000000 +0200
- +++ xbmc_vidonme/xbmc/cores/VideoRenderers/RenderManager.h 2013-06-12 16:40:35.000000000 +0200
- @@ -30,6 +30,10 @@
- #include "settings/VideoSettings.h"
- #include "OverlayRenderer.h"
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- +#include "cores/a10/libcedarv.h"
- +#endif
- +
- class CRenderCapture;
- namespace DXVA { class CProcessor; }
- @@ -43,6 +47,7 @@
- class CLinuxRenderer;
- class CLinuxRendererGL;
- class CLinuxRendererGLES;
- +class CLinuxRendererA10;
- class CXBMCRenderManager
- {
- @@ -113,7 +118,11 @@
- #ifdef HAS_GL
- CLinuxRendererGL *m_pRenderer;
- #elif HAS_GLES == 2
- +#if defined(__DVDFAB_FUNC_A10CODEC__)
- + CLinuxRendererA10 *m_pRenderer;
- +#else
- CLinuxRendererGLES *m_pRenderer;
- +#endif //__DVDFAB_FUNC_A10CODEC__
- #elif defined(HAS_DX)
- CWinRenderer *m_pRenderer;
- #elif defined(HAS_SDL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement