Moved rendering code from mvdstdProcessVideoFrame() into a seperate function.

This commit is contained in:
yellows8 2016-04-22 12:12:32 -04:00
parent 19175f7de3
commit 570f46f281
2 changed files with 38 additions and 15 deletions

View File

@ -36,7 +36,11 @@ typedef struct {
u32 inwidth; ///< Input width. u32 inwidth; ///< Input width.
u32 inheight; ///< Input height. u32 inheight; ///< Input height.
u32 physaddr_colorconv_indata; ///< Physical address of color conversion input data. u32 physaddr_colorconv_indata; ///< Physical address of color conversion input data.
u32 unk_x18[0x28>>2]; ///< Unknown. u32 physaddr_colorconv_unk0; ///< Physical address used with color conversion.
u32 physaddr_colorconv_unk1; ///< Physical address used with color conversion.
u32 physaddr_colorconv_unk2; ///< Physical address used with color conversion.
u32 physaddr_colorconv_unk3; ///< Physical address used with color conversion.
u32 unk_x28[0x18>>2]; ///< Unknown.
u32 flag_x40; ///< Unknown. 0x0 for colorconv, 0x1 for H.264 u32 flag_x40; ///< Unknown. 0x0 for colorconv, 0x1 for H.264
u32 unk_x44; ///< Unknown. u32 unk_x44; ///< Unknown.
u32 unk_x48; ///< Unknown. u32 unk_x48; ///< Unknown.
@ -87,12 +91,17 @@ Result mvdstdConvertImage(MVDSTD_Config* config);
/** /**
* @brief Processes a video frame(specifically a NAL-unit). * @brief Processes a video frame(specifically a NAL-unit).
* @param config Pointer to the configuration to use.
* @parameter_set Must be true for the initial NAL-unit parameter sets("Sequence Parameter Set" and "Picture Parameter Set"), false otherwise.
* @param inbuf_vaddr Input NAL-unit starting with the 3-byte "00 00 01" prefix. Must be located in linearmem. * @param inbuf_vaddr Input NAL-unit starting with the 3-byte "00 00 01" prefix. Must be located in linearmem.
* @param size Size of the input buffer. * @param size Size of the input buffer.
*/ */
Result mvdstdProcessVideoFrame(MVDSTD_Config* config, bool parameter_set, void* inbuf_vaddr, size_t size); Result mvdstdProcessVideoFrame(void* inbuf_vaddr, size_t size);
/**
* @brief Renders the video frame.
* @param config Optional pointer to the configuration to use. When NULL, MVDSTD_SetConfig() should have been used previously for this video.
* @param wait When true, wait for rendering to finish. When false, you can manually call this function repeatedly until it stops returning MVD_STATUS_BUSY.
*/
Result mvdstdRenderVideoFrame(MVDSTD_Config* config, bool wait);
/** /**
* @brief Sets the current configuration of MVDSTD. * @brief Sets the current configuration of MVDSTD.

View File

@ -319,7 +319,21 @@ Result mvdstdConvertImage(MVDSTD_Config* config)
return MVDSTD_cmd1a(); return MVDSTD_cmd1a();
} }
Result mvdstdProcessVideoFrame(MVDSTD_Config* config, bool parameter_set, void* inbuf_vaddr, size_t size) Result mvdstdProcessVideoFrame(void* inbuf_vaddr, size_t size)
{
Result ret;
if(mvdstdRefCount==0)return -3;
if(mvdstd_mode!=MVDMODE_VIDEOPROCESSING)return -2;
ret = MVDSTD_ProcessNALUnit((u32)inbuf_vaddr, (u32)osConvertVirtToPhys(inbuf_vaddr), size, mvdstd_videoproc_frameid);
mvdstd_videoproc_frameid++;
if(mvdstd_videoproc_frameid>=0x12)mvdstd_videoproc_frameid = 0;
return ret;
}
Result mvdstdRenderVideoFrame(MVDSTD_Config* config, bool wait)
{ {
Result ret; Result ret;
@ -327,18 +341,18 @@ Result mvdstdProcessVideoFrame(MVDSTD_Config* config, bool parameter_set, void*
if(config==NULL)return -1; if(config==NULL)return -1;
if(mvdstd_mode!=MVDMODE_VIDEOPROCESSING)return -2; if(mvdstd_mode!=MVDMODE_VIDEOPROCESSING)return -2;
ret = MVDSTD_ProcessNALUnit((u32)inbuf_vaddr, (u32)osConvertVirtToPhys(inbuf_vaddr), size, mvdstd_videoproc_frameid); if(config)
mvdstd_videoproc_frameid++; {
if(mvdstd_videoproc_frameid>=0x12)mvdstd_videoproc_frameid = 0; ret = MVDSTD_SetConfig(config);
//if(ret!=MVD_STATUS_OK)return ret; if(ret!=MVD_STATUS_OK)return ret;
}
if(parameter_set)return ret;
ret = MVDSTD_SetConfig(config);
if(ret!=MVD_STATUS_OK)return ret;
ret = MVD_STATUS_BUSY; ret = MVD_STATUS_BUSY;
while(ret==MVD_STATUS_BUSY)ret = MVDSTD_ControlFrameRendering(0); while(ret==MVD_STATUS_BUSY)
{
ret = MVDSTD_ControlFrameRendering(0);
if(!wait)break;
}
return ret; return ret;
} }