Esempio n. 1
0
STDMETHODIMP_(LRESULT) TffdshowEnc::end(void)
{
    if (working && (outputdebug || outputdebugfile) && encStats.count > 0) {
        if (int(encStats.sumQuants) > 0) {
            dbgWrite(_l("Average quantizer: %-5.2f\n"), float(encStats.sumQuants) / encStats.count);
        }
        if (coSettings->mode != ENC_MODE::VBR_QUANT) {
            dbgWrite(_l("Quantizer distribution:"));
            for (int i = 1; i < countof(encStats.quantCount); i++)
                if (encStats.quantCount[i]) {
                    dbgWrite(_l("Q:%i:%i"), i, encStats.quantCount[i]);
                }
        }
        dbgWrite(_l("Bitrate: %i kbps"), int((8ULL * encStats.sumFramesize * fpsRate) / (1000ULL * encStats.count * fpsScale)));
        if (globalSettings->psnr) {
            double psnrY, psnrU, psnrV;
            encStats.calcPSNR(&psnrY, &psnrU, &psnrV);
            if (psnrY != -1) {
                dbgWrite(_l("Average PSNR: %6.2f,%6.2f,%6.2f\n"), psnrY, psnrU, psnrV);
            }
        }
    }
    working = false;
    if (h_graph) {
        PostMessage(h_graph, TencStats::MSG_FF_CLEAR, 0, 0);
    }
    hideTrayIcon();
    if (coSettings->isProc && ffproc) {
        ffproc->end();
    }
    if (enc) {
        enc->end();
    }
    if (mux) {
        delete mux;
    }
    mux = NULL;
    if (convert) {
        delete convert;
    }
    convert = NULL;
    if (ownpictbuf.size()) {
        ownpictbuf.clear();
        memset(&ownpict, 0, sizeof(ownpict));
    }
    enccsps.clear();
    dbgDone();
    return ICERR_OK;
}
Esempio n. 2
0
static LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
    switch(msg) {
        case WM_MYTRAYICON: {
            switch (LOWORD(lParam)) {
                case WM_LBUTTONDOWN: {
                    toggleHook();
                    break;
                }

                case WM_RBUTTONUP: {
                        POINT cursor = { 0 };
                        ::GetCursorPos(&cursor);
                        ::SetForegroundWindow(mainWindow);
                        TrackPopupMenuEx(trayMenu, 0, cursor.x, cursor.y, hwnd, nullptr);
                        PostMessage(mainWindow, WM_NULL, 0, 0);
                    }
                    break;
            }
            return 0;
        }

        case WM_DESTROY: {
            stopHook();
            hideTrayIcon();
            break;
        }

        case WM_COMMAND: {
            if (HIWORD(wParam) == 0) {
                switch (LOWORD(wParam)) {
                case MENU_ITEM_EXIT:
                    PostQuitMessage(0);
                    return 1;

                case MENU_ITEM_TOGGLE:
                    toggleHook();
                    return 1;
                }
            }
            break;
        }
    }

    return DefWindowProc(hwnd, msg, wParam, lParam);
}