static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, AVISTREAMINFOW *asi) { IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%p)\n", iface, avis, asi); /* check parameters */ if (avis == NULL || asi == NULL) return AVIERR_BADPARAM; *avis = NULL; /* We only support one audio stream */ if (This->fInfo.dwStreams != 0 || This->lpFormat != NULL) return AVIERR_UNSUPPORTED; if (asi->fccType != streamtypeAUDIO) return AVIERR_UNSUPPORTED; /* Does the user have write permission? */ if ((This->uMode & MMIO_RWMODE) == 0) return AVIERR_READONLY; This->cbFormat = 0; This->lpFormat = NULL; memcpy(&This->sInfo, asi, sizeof(This->sInfo)); /* make sure streaminfo if okay for us */ This->sInfo.fccHandler = 0; This->sInfo.dwFlags = 0; This->sInfo.dwCaps = AVIFILECAPS_CANREAD|AVIFILECAPS_CANWRITE; This->sInfo.dwStart = 0; This->sInfo.dwInitialFrames = 0; This->sInfo.dwFormatChangeCount = 0; memset(&This->sInfo.rcFrame, 0, sizeof(This->sInfo.rcFrame)); This->fInfo.dwStreams = 1; This->fInfo.dwScale = This->sInfo.dwScale; This->fInfo.dwRate = This->sInfo.dwRate; This->fInfo.dwLength = This->sInfo.dwLength; This->ckData.dwDataOffset = 0; This->ckData.cksize = 0; *avis = &This->IAVIStream_iface; IAVIFile_AddRef(*avis); return AVIERR_OK; }
static HRESULT WINAPI ITmpFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, LPVOID *obj) { ITmpFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj); if (IsEqualGUID(&IID_IUnknown, refiid) || IsEqualGUID(&IID_IAVIFile, refiid)) { *obj = iface; IAVIFile_AddRef(iface); return S_OK; } return OLE_E_ENUM_NOMORE; }
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, LONG lParam) { IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,0x%08X,%d)\n", iface, avis, fccType, lParam); /* check parameter */ if (avis == NULL) return AVIERR_BADPARAM; *avis = NULL; /* Does our stream exists? */ if (lParam != 0 || This->fInfo.dwStreams == 0) return AVIERR_NODATA; if (fccType != 0 && fccType != streamtypeAUDIO) return AVIERR_NODATA; *avis = &This->IAVIStream_iface; IAVIFile_AddRef(*avis); return AVIERR_OK; }