ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dmort.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003 Michael Günnewig
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include <stdarg.h>
00020 
00021 #define COBJMACROS
00022 
00023 #include "windef.h"
00024 #include "winbase.h"
00025 #include "objbase.h"
00026 #include "mediaobj.h"
00027 #include "dmort.h"
00028 
00029 #include "wine/debug.h"
00030 
00031 WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
00032 
00033 /***********************************************************************
00034  *        MoCreateMediaType    (MSDMO.@)
00035  *
00036  * Allocate a new media type structure
00037  */
00038 HRESULT WINAPI MoCreateMediaType(DMO_MEDIA_TYPE** ppmedia, DWORD cbFormat)
00039 {
00040     HRESULT r;
00041 
00042     TRACE("%p %u\n", ppmedia, cbFormat);
00043 
00044     if (!ppmedia)
00045         return E_POINTER;
00046 
00047     *ppmedia = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
00048     if (!*ppmedia)
00049         return E_OUTOFMEMORY;
00050 
00051     r = MoInitMediaType(*ppmedia, cbFormat);
00052     if (FAILED(r))
00053     {
00054         CoTaskMemFree(*ppmedia);
00055         *ppmedia = NULL;
00056     }
00057 
00058     return r;
00059 }
00060 
00061 /***********************************************************************
00062  *        MoInitMediaType        (MSDMO.@)
00063  *
00064  * Initialize media type structure
00065  */
00066 HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE* pmedia, DWORD cbFormat)
00067 {
00068     TRACE("%p %u\n", pmedia, cbFormat);
00069 
00070     if (!pmedia)
00071         return E_POINTER;
00072 
00073     memset(pmedia, 0, sizeof(DMO_MEDIA_TYPE));
00074 
00075     if (cbFormat > 0)
00076     {
00077         pmedia->pbFormat = CoTaskMemAlloc(cbFormat);
00078         if (!pmedia->pbFormat)
00079             return E_OUTOFMEMORY;
00080 
00081         pmedia->cbFormat = cbFormat;
00082     }
00083 
00084     return S_OK;
00085 }
00086 
00087 /***********************************************************************
00088  *        MoDeleteMediaType    (MSDMO.@)
00089  *
00090  * Delete a media type structure
00091  */
00092 HRESULT WINAPI MoDeleteMediaType(DMO_MEDIA_TYPE* pmedia)
00093 {
00094     TRACE("%p\n", pmedia);
00095 
00096     if (!pmedia)
00097         return E_POINTER;
00098 
00099     MoFreeMediaType(pmedia);
00100     CoTaskMemFree(pmedia);
00101 
00102     return S_OK;
00103 }
00104 
00105 /***********************************************************************
00106  *        MoFreeMediaType        (MSDMO.@)
00107  *
00108  * Free allocated members of a media type structure
00109  */
00110 HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia)
00111 {
00112     TRACE("%p\n", pmedia);
00113 
00114     if (!pmedia)
00115         return E_POINTER;
00116 
00117     if (pmedia->pUnk)
00118     {
00119         IUnknown_Release(pmedia->pUnk);
00120         pmedia->pUnk = NULL;
00121     }
00122 
00123     CoTaskMemFree(pmedia->pbFormat);
00124     pmedia->pbFormat = NULL;
00125 
00126     return S_OK;
00127 }
00128 
00129 /***********************************************************************
00130  *        MoDuplicateMediaType    (MSDMO.@)
00131  *
00132  * Duplicates a media type structure
00133  */
00134 HRESULT WINAPI MoDuplicateMediaType(DMO_MEDIA_TYPE** ppdst,
00135                                     const DMO_MEDIA_TYPE* psrc)
00136 {
00137     HRESULT r;
00138 
00139     TRACE("%p %p\n", ppdst, psrc);
00140 
00141     if (!ppdst || !psrc)
00142         return E_POINTER;
00143 
00144     *ppdst = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
00145     if (!*ppdst)
00146         return E_OUTOFMEMORY;
00147 
00148     r = MoCopyMediaType(*ppdst, psrc);
00149     if (FAILED(r))
00150     {
00151         MoFreeMediaType(*ppdst);
00152         *ppdst = NULL;
00153     }
00154 
00155     return r;
00156 }
00157 
00158 /***********************************************************************
00159  *        MoCopyMediaType        (MSDMO.@)
00160  *
00161  * Copy a new media type structure
00162  */
00163 HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE* pdst,
00164                                const DMO_MEDIA_TYPE* psrc)
00165 {
00166     TRACE("%p %p\n", pdst, psrc);
00167 
00168     if (!pdst || !psrc)
00169         return E_POINTER;
00170 
00171     pdst->majortype = psrc->majortype;
00172     pdst->subtype = psrc->subtype;
00173     pdst->formattype = psrc->formattype;
00174 
00175     pdst->bFixedSizeSamples    = psrc->bFixedSizeSamples;
00176     pdst->bTemporalCompression = psrc->bTemporalCompression;
00177     pdst->lSampleSize          = psrc->lSampleSize;
00178     pdst->cbFormat             = psrc->cbFormat;
00179 
00180     if (psrc->pbFormat && psrc->cbFormat > 0)
00181     {
00182         pdst->pbFormat = CoTaskMemAlloc(psrc->cbFormat);
00183         if (!pdst->pbFormat)
00184             return E_OUTOFMEMORY;
00185 
00186         memcpy(pdst->pbFormat, psrc->pbFormat, psrc->cbFormat);
00187     }
00188     else
00189         pdst->pbFormat = NULL;
00190 
00191     if (psrc->pUnk)
00192     {
00193         pdst->pUnk = psrc->pUnk;
00194         IUnknown_AddRef(pdst->pUnk);
00195     }
00196     else
00197         pdst->pUnk = NULL;
00198 
00199     return S_OK;
00200 }

Generated on Fri May 25 2012 04:19:45 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.