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

📄 sdla_render.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-2006 Intel Corporation. All Rights Reserved.
//
*/

#ifndef __SDLA_RENDER_H__
#define __SDLA_RENDER_H__

#if defined(SDL_ON) && (defined(LINUX32) || defined(WIN32))

#include <SDL/SDL.h>
#include "uimc_structures.h"
#include "uimc_audio_render.h"
#include "vm_semaphore.h"
#include "vm_time.h"

#define NUM_SND_BUFFER 32

class SDLAudioRender :public AudioRender
{
public:
    /* Initialize the audio device. The playback is paused */
    UMC_Status Init(AudioRenderParams* pInit);

    /* Write sound data to sound buffer */
    UMC_Status SendFrame(sMediaData* in);

    /* Send EOF to sound buffer */
    void SendEOF(void);

    /* Toggle pause mode. Return current pts */
    UMC_Status Pause(bool pause);

    /* Close the sound device */
    UMC_Status Close(void);

    Ipp32f SetVolume(Ipp32f volume) { return volume;};   /* 0-silence 1-max, return previous volume */
    Ipp32f GetVolume() { return 0.;};

    UMC_Status Reset(void) { return UMC_ERR_FAILED; };

    SDLAudioRender(void);
    ~SDLAudioRender(void);

    // Audio Reference Clock
    Ipp64f GetTime(void);
    // Estimated value of device latency
    Ipp64f GetDelay(void);

    // Estimated value of difference between independent ref clock and pts
    Ipp64f GetClockOffset(void);

    void   AudioThreadFunc(Uint8 *stream, Ipp32s nbytes);

protected:
    bool    m_bInitSemaphore;

    struct SndBuffer {
        Ipp8u *buffer;
        Ipp32s nbytes;
        Ipp64f pts;
    };

    SDL_AudioSpec spec;
    SndBuffer buffers[NUM_SND_BUFFER];
    Ipp32s read_index, read_position, write_index, nbuffer;
    vm_semaphore sm_read_buffer, sm_write_buffer;
    Ipp64f prev_rpts, prev_pts, offset;

    Ipp64f GetPTS(void);
};

#endif // defined(SDL_ON) && (defined(LINUX32) || defined(WIN32))

#endif // __SDLA_RENDER_H__

⌨️ 快捷键说明

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