• 大小: 19KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: 其他
  • 标签: 音视频  

资源简介

linux环境,基于rtmp推流源代码,源文件可以下载参考学习

资源截图

代码片段和文件信息

#include “AACEncoder.h“

AACEncoder::AACEncoder(int sampleRate int channals int bitrate) {
    mEncoder = faacEncOpen(sampleRate channals &mMaxSample &mBufLength);

    if (mEncoder != NULL) {
        faacEncConfigurationPtr conf = faacEncGetCurrentConfiguration(mEncoder);
        conf->inputFormat = FAAC_INPUT_16BIT;
        conf->outputFormat = 1;
        conf->aacobjectType = LOW;
        conf->allowMidside = 0;
        conf->useLfe = 0;
        conf->bitRate = bitrate;
        conf->bandWidth = 0.5 * bitrate;
        faacEncSetConfiguration(mEncoder conf);  

        mDataBuf = new char[mBufLength];
    }
}

AACEncoder::~AACEncoder() {
    if (mEncoder != NULL) {
        faacEncClose(mEncoder);  
        delete[] mDataBuf;
    }
}
    
std::pair AACEncoder::encode(int sample char* data) {
    if (mEncoder == NULL || (int) mMaxSample < sample) {
        return std::make_pair(-1 NULL);
    }

    int size = faacEncEncode(mEncoder reinterpret_cast(data) sample reinterpret_cast(mDataBuf) mBufLength);

    if (size < 0) {
        return std::make_pair(-1 NULL);
    }

    return std::make_pair(size mDataBuf);
}

std::pair AACEncoder::getmetadata() {
    unsigned char *buf;
    unsigned long size;

    faacEncGetDecoderSpecificInfo(mEncoder &buf &size);
    memcpy(mDataBuf buf size);

    delete[] buf;

    return std::make_pair(size mDataBuf);
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......        97  2017-03-09 17:44  live-rtmp-publisher-master\CMakeLists.txt

    .......        26  2017-03-09 17:44  live-rtmp-publisher-master\config.h.in

    .......       307  2017-03-09 17:44  live-rtmp-publisher-master\README.md

    .......      1456  2017-03-09 17:44  live-rtmp-publisher-master\src\AACEncoder.cpp

    .......       998  2017-03-09 17:44  live-rtmp-publisher-master\src\AACRTMPPackager.cpp

    .......      1087  2017-03-09 17:44  live-rtmp-publisher-master\src\AACStream.cpp

    .......       767  2017-03-09 17:44  live-rtmp-publisher-master\src\CMakeLists.txt

    .......       550  2017-03-09 17:44  live-rtmp-publisher-master\src\cv\CvVideoSource.cpp

    .......       927  2017-03-09 17:44  live-rtmp-publisher-master\src\cv\MotionDetector.cpp

    .......       427  2017-03-09 17:44  live-rtmp-publisher-master\src\FilteredVideoSource.cpp

    .......      1680  2017-03-09 17:44  live-rtmp-publisher-master\src\H264Encoder.cpp

    .......      1716  2017-03-09 17:44  live-rtmp-publisher-master\src\H264RTMPPackager.cpp

    .......      1423  2017-03-09 17:44  live-rtmp-publisher-master\src\H264Stream.cpp

    .......       498  2017-03-09 17:44  live-rtmp-publisher-master\src\include\AACEncoder.h

    .......       423  2017-03-09 17:44  live-rtmp-publisher-master\src\include\AACRTMPPackager.h

    .......       452  2017-03-09 17:44  live-rtmp-publisher-master\src\include\AACStream.h

    .......       414  2017-03-09 17:44  live-rtmp-publisher-master\src\include\AudioSource.h

    .......       559  2017-03-09 17:44  live-rtmp-publisher-master\src\include\cv\CvVideoSource.h

    .......       806  2017-03-09 17:44  live-rtmp-publisher-master\src\include\cv\MotionDetector.h

    .......       615  2017-03-09 17:44  live-rtmp-publisher-master\src\include\FilteredVideoSource.h

    .......       502  2017-03-09 17:44  live-rtmp-publisher-master\src\include\H264Encoder.h

    .......       493  2017-03-09 17:44  live-rtmp-publisher-master\src\include\H264RTMPPackager.h

    .......       656  2017-03-09 17:44  live-rtmp-publisher-master\src\include\H264Stream.h

    .......       426  2017-03-09 17:44  live-rtmp-publisher-master\src\include\MemoryPool.h

    .......       643  2017-03-09 17:44  live-rtmp-publisher-master\src\include\PacketQueue.h

    .......       715  2017-03-09 17:44  live-rtmp-publisher-master\src\include\PCMSource.h

    .......       339  2017-03-09 17:44  live-rtmp-publisher-master\src\include\RTMPPackager.h

    .......       374  2017-03-09 17:44  live-rtmp-publisher-master\src\include\RTMPPublisher.h

    .......      1037  2017-03-09 17:44  live-rtmp-publisher-master\src\include\V4L2Source.h

    .......       225  2017-03-09 17:44  live-rtmp-publisher-master\src\include\VideoframeFilter.h

............此处省略17个文件信息

评论

共有 条评论