⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_file_reader.h

📁 audio-video-codecs.rar语音编解码器
💻 H
字号:
/*
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2003-2007 Intel Corporation. All Rights Reserved.
//
*/

#ifndef __UMC_FILE_READER_H__
#define __UMC_FILE_READER_H__

#include "umc_defs.h"

#if defined (UMC_ENABLE_FILE_READER) || defined(UMC_ENABLE_FIO_READER)

#include "vm_mmap.h"
#include "vm_types.h"
#include "ippdefs.h"
#include "umc_data_reader.h"

namespace UMC
{
    class FileReaderParams : public DataReaderParams
    {
        DYNAMIC_CAST_DECL(FileReaderParams, DataReaderParams)

    public:
        /** Default constructor
        Sets m_file_name to empty string and m_portion_size to 0
        */
        FileReaderParams():m_portion_size(0)
        {   memset(m_file_name, 0, sizeof(m_file_name));   }

        vm_char m_file_name[MAXIMUM_PATH]; ///< file name
        Ipp32u m_portion_size; ///< portion size
    };

    class FileReader : public DataReader
    {
        DYNAMIC_CAST_DECL(FileReader, DataReader)
    public:
        /**
        Create and map first portion from file
        \param InitParams Pointer to the init (for filereader it's vm_char file_name[255] and portion_size
        \retval UMC_OK
        \retval UMC_ERR_OPEN_FAILED       file was not open
        \retval UMC_ERR_ALLOC   mapping was not create
        \note default value of portion_size is 0. After open portion = 1
        */
        virtual Status      Init(DataReaderParams *InitParams);

        /**
        Close file
        \retval UMC_OK
        */
        virtual Status      Close();

        /**
        Reset all internal parameters
        \retval UMC_OK
        \retval UMC_ERR_NOT_INITIALIZED             object was not initialize
        \retval UMC_ERR_ALLOC   mapping was not create
        */
        virtual Status      Reset();

        /**
        Read nsize bytes and copy to data (return number bytes which was copy)
        Cache data in case of small nsize
        \param data          pointer to the data where copy nsize byte from stream
        \param nsize         integer - number bytes
        \retval UMC_OK
        \retval UMC_ERR_NOT_INITIALIZED object was not initialize
        \retval UMC_ERR_END_OF_STREAM   end of stream
        */
        virtual Status      ReadData(void *data, Ipp32u *nsize);

        /**
        Move position on npos bytes
        \param npos          integer (+/-) bytes
        \retval UMC_OK
        \retval UMC_ERR_NOT_INITIALIZED object was not initialize
        \retval UMC_ERR_END_OF_STREAM   end of stream
        */
        virtual Status      MovePosition(Ipp64u npos);

        virtual Status      CacheData(void *data, Ipp32u *nsize, Ipp32s how_far);

        /**
        Set position
        \param pos Ipp64f (0:1.0)
        \retval OK
        \retval ERR_MAP    Error map next portion
        \note set position in the stream (file size * pos)
        */
        virtual Status      SetPosition(Ipp64f pos);


        /// return position in the stream
        virtual Ipp64u      GetPosition();

        /// return file_size
        virtual Ipp64u      GetSize();

        FileReader();
        virtual ~FileReader();

    protected:
        vm_mmap             m_mmap;
        Ipp8u               *m_pbBuffer;

        Ipp64u              m_stCurPortionSize;     // size of  current portion of file
        Ipp32u              m_uiPortionSize;

        Ipp64u              m_stDoneSize;           // accumulative size of processed portions
        Ipp64u              m_stFileSize;           // file size
        Ipp32u              m_uiPageSize;
        bool                m_bBufferInit;
        bool                m_bLastPortion;

        virtual Status  MapCSize(Ipp64u csize);
    };

} // namespace UMC

#endif //(UMC_ENABLE_FILE_READER) || defined(UMC_ENABLE_FIO_READER)

#endif /* __UMC_FILE_READER_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -