コード例 #1
0
static HRESULT WINAPI MediaSeekingPassThru_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent)
{
    PassThruImpl *This = impl_from_IMediaSeeking(iface);
    IMediaSeeking *seek;
    HRESULT hr = S_OK;
    TRACE("(%p/%p)->(%p)\n", iface, This, pCurrent);
    if (!pCurrent)
        return E_POINTER;
    EnterCriticalSection(&This->time_cs);
    if (This->timevalid)
        *pCurrent = This->time_earliest;
    else
        hr = E_FAIL;
    LeaveCriticalSection(&This->time_cs);
    if (SUCCEEDED(hr)) {
        hr = IMediaSeeking_ConvertTimeFormat(iface, pCurrent, NULL, *pCurrent, &TIME_FORMAT_MEDIA_TIME);
        return hr;
    }
    hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
    if (SUCCEEDED(hr)) {
        hr = IMediaSeeking_GetCurrentPosition(seek, pCurrent);
        IMediaSeeking_Release(seek);
    }
    else
        return E_NOTIMPL;
    return hr;
}
コード例 #2
0
ファイル: imseek.c プロジェクト: NVIDIA/winex_lgpl
static HRESULT WINAPI
IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
	CFilterGraph_THIS(iface,mediaseeking);
	HRESULT	hr = E_NOTIMPL;
	HRESULT	hrFilter;
	DWORD	n;

	TRACE("(%p)->()\n",This);

	EnterCriticalSection( &This->m_csFilters );

	for ( n = 0; n < This->m_cActiveFilters; n++ )
	{
		if ( This->m_pActiveFilters[n].pSeeking != NULL )
		{
			hrFilter = IMediaSeeking_GetCurrentPosition( This->m_pActiveFilters[n].pSeeking, pllPos );
			if ( hr == E_NOTIMPL )
			{
				hr = hrFilter;
			}
			else
			if ( hrFilter != E_NOTIMPL )
			{
				if ( SUCCEEDED(hr) )
					hr = hrFilter;
			}
		}
	}

	LeaveCriticalSection( &This->m_csFilters );

	return hr;
}
コード例 #3
0
ファイル: seeking.c プロジェクト: r6144/wine
HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop)
{
    SourceSeeking *This = (SourceSeeking *)iface;

    TRACE("(%p, %p)\n", pCurrent, pStop);

    EnterCriticalSection(This->crst);
    IMediaSeeking_GetCurrentPosition(iface, pCurrent);
    IMediaSeeking_GetStopPosition(iface, pStop);
    LeaveCriticalSection(This->crst);

    return S_OK;
}
コード例 #4
0
ファイル: mciqtz.c プロジェクト: Kelimion/wine
/***************************************************************************
 *                              MCIQTZ_mciStatus                [internal]
 */
static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
{
    WINE_MCIQTZ* wma;
    HRESULT hr;

    TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);

    if (!lpParms)
        return MCIERR_NULL_PARAMETER_BLOCK;

    wma = MCIQTZ_mciGetOpenDev(wDevID);
    if (!wma)
        return MCIERR_INVALID_DEVICE_ID;

    if (!(dwFlags & MCI_STATUS_ITEM)) {
        WARN("No status item specified\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    }

    switch (lpParms->dwItem) {
        case MCI_STATUS_LENGTH: {
            LONGLONG duration = -1;
            GUID format;
            switch (wma->time_format) {
                case MCI_FORMAT_MILLISECONDS: format = TIME_FORMAT_MEDIA_TIME; break;
                case MCI_FORMAT_FRAMES: format = TIME_FORMAT_FRAME; break;
                default: ERR("Unhandled format %x\n", wma->time_format); break;
            }
            hr = IMediaSeeking_SetTimeFormat(wma->seek, &format);
            if (FAILED(hr)) {
                FIXME("Cannot set time format (hr = %x)\n", hr);
                lpParms->dwReturn = 0;
                break;
            }
            hr = IMediaSeeking_GetDuration(wma->seek, &duration);
            if (FAILED(hr) || duration < 0) {
                FIXME("Cannot read duration (hr = %x)\n", hr);
                lpParms->dwReturn = 0;
            } else if (wma->time_format != MCI_FORMAT_MILLISECONDS)
                lpParms->dwReturn = duration;
            else
                lpParms->dwReturn = duration / 10000;
            break;
        }
        case MCI_STATUS_POSITION: {
            REFERENCE_TIME curpos;

            hr = IMediaSeeking_GetCurrentPosition(wma->seek, &curpos);
            if (FAILED(hr)) {
                FIXME("Cannot get position (hr = %x)\n", hr);
                return MCIERR_INTERNAL;
            }
            lpParms->dwReturn = curpos / 10000;
            break;
        }
        case MCI_STATUS_NUMBER_OF_TRACKS:
            FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
            return MCIERR_UNRECOGNIZED_COMMAND;
        case MCI_STATUS_MODE: {
            LONG state = State_Stopped;
            IMediaControl_GetState(wma->pmctrl, -1, &state);
            if (state == State_Stopped)
                lpParms->dwReturn = MCI_MODE_STOP;
            else if (state == State_Running) {
                LONG code;
                LONG_PTR p1, p2;

                lpParms->dwReturn = MCI_MODE_PLAY;

                do {
                    hr = IMediaEvent_GetEvent(wma->mevent, &code, &p1, &p2, 0);
                    if (hr == S_OK && code == EC_COMPLETE){
                        lpParms->dwReturn = MCI_MODE_STOP;
                        IMediaControl_Stop(wma->pmctrl);
                    }
                } while (hr == S_OK);

            } else if (state == State_Paused)
                lpParms->dwReturn = MCI_MODE_PAUSE;
            break;
        }
        case MCI_STATUS_MEDIA_PRESENT:
            FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
            return MCIERR_UNRECOGNIZED_COMMAND;
        case MCI_STATUS_TIME_FORMAT:
            lpParms->dwReturn = wma->time_format;
            break;
        case MCI_STATUS_READY:
            FIXME("MCI_STATUS_READY not implemented yet\n");
            return MCIERR_UNRECOGNIZED_COMMAND;
        case MCI_STATUS_CURRENT_TRACK:
            FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
            return MCIERR_UNRECOGNIZED_COMMAND;
        default:
            FIXME("Unknown command %08X\n", lpParms->dwItem);
            return MCIERR_UNRECOGNIZED_COMMAND;
    }

    if (dwFlags & MCI_NOTIFY)
        mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);

    return 0;
}
コード例 #5
0
ファイル: mciqtz.c プロジェクト: kholia/wine
/***************************************************************************
 *                              MCIQTZ_mciStatus                [internal]
 */
static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
{
    WINE_MCIQTZ* wma;
    HRESULT hr;
    DWORD ret = MCI_INTEGER_RETURNED;

    TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);

    wma = MCIQTZ_mciGetOpenDev(wDevID);
    if (!wma)
        return MCIERR_INVALID_DEVICE_ID;

    if (!(dwFlags & MCI_STATUS_ITEM)) {
        WARN("No status item specified\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    }

    switch (lpParms->dwItem) {
    case MCI_STATUS_LENGTH: {
        LONGLONG duration = -1;
        GUID format;
        switch (wma->time_format) {
        case MCI_FORMAT_MILLISECONDS:
            format = TIME_FORMAT_MEDIA_TIME;
            break;
        case MCI_FORMAT_FRAMES:
            format = TIME_FORMAT_FRAME;
            break;
        default:
            ERR("Unhandled format %x\n", wma->time_format);
            break;
        }
        hr = IMediaSeeking_SetTimeFormat(wma->seek, &format);
        if (FAILED(hr)) {
            FIXME("Cannot set time format (hr = %x)\n", hr);
            lpParms->dwReturn = 0;
            break;
        }
        hr = IMediaSeeking_GetDuration(wma->seek, &duration);
        if (FAILED(hr) || duration < 0) {
            FIXME("Cannot read duration (hr = %x)\n", hr);
            lpParms->dwReturn = 0;
        } else if (wma->time_format != MCI_FORMAT_MILLISECONDS)
            lpParms->dwReturn = duration;
        else
            lpParms->dwReturn = duration / 10000;
        break;
    }
    case MCI_STATUS_POSITION: {
        REFERENCE_TIME curpos;

        hr = IMediaSeeking_GetCurrentPosition(wma->seek, &curpos);
        if (FAILED(hr)) {
            FIXME("Cannot get position (hr = %x)\n", hr);
            return MCIERR_INTERNAL;
        }
        lpParms->dwReturn = curpos / 10000;
        break;
    }
    case MCI_STATUS_NUMBER_OF_TRACKS:
        FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    case MCI_STATUS_MODE: {
        LONG state = State_Stopped;
        IMediaControl_GetState(wma->pmctrl, -1, &state);
        if (state == State_Stopped)
            lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
        else if (state == State_Running) {
            lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PLAY, MCI_MODE_PLAY);
            if (!wma->thread || WaitForSingleObject(wma->thread, 0) == WAIT_OBJECT_0)
                lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
        } else if (state == State_Paused)
            lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PAUSE, MCI_MODE_PAUSE);
        ret = MCI_RESOURCE_RETURNED;
        break;
    }
    case MCI_STATUS_MEDIA_PRESENT:
        FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    case MCI_STATUS_TIME_FORMAT:
        lpParms->dwReturn = MAKEMCIRESOURCE(wma->time_format,
                                            MCI_FORMAT_RETURN_BASE + wma->time_format);
        ret = MCI_RESOURCE_RETURNED;
        break;
    case MCI_STATUS_READY:
        FIXME("MCI_STATUS_READY not implemented yet\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    case MCI_STATUS_CURRENT_TRACK:
        FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
        return MCIERR_UNRECOGNIZED_COMMAND;
    default:
        FIXME("Unknown command %08X\n", lpParms->dwItem);
        return MCIERR_UNRECOGNIZED_COMMAND;
    }

    if (dwFlags & MCI_NOTIFY)
        MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);

    return ret;
}