コード例 #1
0
static DWORD WINAPI MPThreadProc(LPVOID lpParameter) 
{
    javacall_amms_media_processor_s* pMP = 
            (javacall_amms_media_processor_s*)lpParameter;

    if (lpParameter == NULL)
        return (DWORD)-1;

    {
        javacall_amms_media_processor_s* pMP = 
                (javacall_amms_media_processor_s*)lpParameter;
        javacall_amms_frame* cur = javacall_amms_addref_frame(pMP->inputData);
        int i;

        if (cur == NULL) {
            javanotify_on_amms_notification(
                JAVACALL_EVENT_AMMS_MEDIA_PROCESSOR_ERROR, 
                pMP->media_processor_id, NULL);
            closeThread(pMP);
            return 0;
        }

        pMP->outputData = javacall_amms_release_frame(pMP->outputData);

        for (i = 0; i < pMP->filtersCnt; i++) {
            javacall_amms_frame* out;
            javacall_image_filter_handle pIF = pMP->filters[i];
            javacall_result result = pIF->process(pIF, cur, &out);
            javacall_amms_release_frame(cur);

            if (!JAVACALL_SUCCEEDED(result)) {
                javanotify_on_amms_notification(
                    JAVACALL_EVENT_AMMS_MEDIA_PROCESSOR_ERROR, 
                    pMP->media_processor_id, NULL);
                closeThread(pMP);
                return 0;
            }
            cur = out;
        }
        
        /// If there was no filters, pMP->outputData will be the same as input
        pMP->outputData = cur;

        javanotify_on_amms_notification(
            JAVACALL_EVENT_AMMS_MEDIA_PROCESSOR_COMPLETED, 
            pMP->media_processor_id, NULL);
        closeThread(pMP);
        return 0;
    }
}
コード例 #2
0
static javacall_image_filter_handle clone(javacall_image_filter_handle filter_handle)
{
    javacall_image_filter_handle result;
    javacall_amms_image_filter_overlay_s* pIFo;
    if (filter_handle == NULL)
        return NULL;

    result = (javacall_image_filter_handle)
        javacall_malloc(filter_handle->sifSize);
    if (result)
        memcpy(result, filter_handle, filter_handle->sifSize);

    pIFo = (javacall_amms_image_filter_overlay_s*)result;
    pIFo->pPict = (javacall_amms_frame_RGB32*)
        javacall_amms_addref_frame(&pIFo->pPict->raw);
    return result;
}