码迷,mamicode.com
首页 > 移动开发 > 详细

android4.2 WifiDisplay远程显示修改为保存文件

时间:2016-06-01 22:58:28      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:

media\libstagefright\wifi-display\source\

编码那一块

\pizza\frameworks\av\media\libstagefright\wifi-display\source\Converter.h

// Utility class that receives media access units and converts them into
// media access unit of a different format.
// Right now this‘ll convert raw video into H.264 and raw audio into AAC.
struct Converter : public AHandler {
    Converter(
            const sp<AMessage> &notify,
            const sp<ALooper> &codecLooper,
            const sp<AMessage> &format,
            bool usePCMAudio,
            bool isRecordingScreen);

bool mIsRecordingScreen;

 

pizza\frameworks\av\media\libstagefright\wifi-display\source\Converter.cpp

 

 

Converter::Converter(
        const sp<AMessage> &notify,
        const sp<ALooper> &codecLooper,
        const sp<AMessage> &format,
        bool usePCMAudio,
        bool isRecordingScreen)
    : mInitCheck(NO_INIT),
      mNotify(notify),
      mCodecLooper(codecLooper),
      mInputFormat(format),
      mIsVideo(false),
      mIsPCMAudio(usePCMAudio),
      mNeedToManuallyPrependSPSPPS(false),
      mDoMoreWorkPending(false)
#if ENABLE_SILENCE_DETECTION
      ,mFirstSilentFrameUs(-1ll)
      ,mInSilentMode(false)
#endif
    {
    AString mime;
    CHECK(mInputFormat->findString("mime", &mime));
    mIsRecordingScreen = isRecordingScreen;
    if (!strncasecmp("video/", mime.c_str(), 6)) {
        mIsVideo = true;
    }

    CHECK(!usePCMAudio || !mIsVideo);

    mInitCheck = initEncoder();

    if (mInitCheck != OK) {
        if (mEncoder != NULL) {
            mEncoder->release();
            mEncoder.clear();
        }
    }
}

void Converter::shutdownAsync() {
    ALOGV("shutdown");
    if(!mIsRecordingScreen)
    {
         (new AMessage(kWhatShutdown, id()))->post();
         return;
    }

#if 1 //{     
    if (mEncoder != NULL) {
          mEncoder->release();
          mEncoder.clear();
    }
#endif //}
       
}

pizza\frameworks\av\media\libstagefright\wifi-display\source\MediaPuller.cpp

void MediaPuller::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatStart:
        {
            status_t err;
            if (mIsAudio) {
                // This atrocity causes AudioSource to deliver absolute
                // systemTime() based timestamps (off by 1 us).
                sp<MetaData> params = new MetaData;
                params->setInt64(kKeyTime, 1ll);
                err = mSource->start(params.get());
            } else {
                sp<MetaData> params = new MetaData;

// 是不是将关键帧设置了只有三个
                 params->setInt32(kKeyNumBuffers,3 );
                err = mSource->start(params.get());
            }

pizza\frameworks\av\media\libstagefright\wifi-display\source\PlaybackSession.h

android4.2 WifiDisplay远程显示修改为保存文件

标签:

原文地址:http://www.cnblogs.com/pengxinglove/p/5551156.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!