//***************************************************************************** 
// 
// Microsoft Windows Media 
// Copyright (C) Microsoft Corporation. All rights reserved. 
//
// FileName:            datacontainer.idl
//
// Abstract:
//
//*****************************************************************************

cpp_quote("//*****************************************************************************") 
cpp_quote("//") 
cpp_quote("// Microsoft Windows Media") 
cpp_quote("// Copyright (C) Microsoft Corporation. All rights reserved.") 
cpp_quote("//")
cpp_quote("// Automatically generated by Midl from datacontainer.idl" )
cpp_quote("//")
cpp_quote("// DO NOT EDIT THIS FILE.")
cpp_quote("//")
cpp_quote("//*****************************************************************************") 

import "objidl.idl";

import "WMSBuffer.idl";
import "WMSContext.idl";
import "DataContainerVersion.idl";
import "wmsPacket.idl";


interface IWMSDataSourcePlugin;
interface IWMSDataSourcePluginCallback;
interface IWMSDataContainer;
interface IWMSDataContainerCallback;
interface IWMSDirectory;
interface IWMSPacketList;


cpp_quote( "#define WMS_DATA_CONTAINER_NONSEEKABLE 0xFFFFFFFFFFFFFFFF" )


cpp_quote( "EXTERN_GUID( IID_IWMSDataSourcePlugin, 0xE1CD3525,0x03D7,0x11d2,0x9E,0xED,0x00,0x60,0x97,0xD2,0xD7,0xCF );" )
cpp_quote( "EXTERN_GUID( IID_IWMSDataSourcePluginCallback, 0xE1CD3526,0x03D7,0x11d2,0x9E,0xED,0x00,0x60,0x97,0xD2,0xD7,0xCF );" )
cpp_quote( "EXTERN_GUID( IID_IWMSDataContainer, 0xE6EE9A13,0x0FCC,0x11d2,0x9E,0xEE,0x00,0x60,0x97,0xD2,0xD7,0xCF );" )
cpp_quote( "EXTERN_GUID( IID_IWMSDataContainerCallback, 0x2E34AB82,0x0D3D,0x11d2,0x9E,0xEE,0x00,0x60,0x97,0xD2,0xD7,0xCF );" )
cpp_quote( "EXTERN_GUID( IID_IWMSDirectory, 0x6fa365e7, 0xe8b9, 0x437a, 0x8c, 0x4b, 0x65, 0x52, 0xdf, 0xbb, 0xc, 0x57 );" )

// {9B6C9E51-4813-11d2-9EFF-006097D2D7CF}
cpp_quote( "EXTERN_GUID( IID_IWMSUnknownFormat, 0x9b6c9e51, 0x4813, 0x11d2, 0x9e, 0xff, 0x00, 0x60, 0x97, 0xd2, 0xd7, 0xcf );" )

// {7408CEB0-3A5A-41b6-A5EC-9A4E811C9673}
cpp_quote( "EXTERN_GUID( IID_IWMSDirectoryFormat, 0x7408ceb0, 0x3a5a, 0x41b6, 0xa5, 0xec, 0x9a, 0x4e, 0x81, 0x1c, 0x96, 0x73 );" )

// {c34294ea-e111-4fb2-be6b-ec686a1a9757}
cpp_quote( "EXTERN_GUID( IID_IWMSPlaylistSmilFormat, 0xc34294ea, 0xe111, 0x4fb2, 0xbe, 0x6b, 0xec, 0x68, 0x6a, 0x1a, 0x97, 0x57 );" )

// Flags for OpenDataContainer
typedef [public] enum WMS_DATA_CONTAINER_OPEN_FLAGS
{
    WMS_DATA_CONTAINER_READ_ACCESS                 = 0x0001,
    WMS_DATA_CONTAINER_WRITE_ACCESS                = 0x0002,
    WMS_DATA_CONTAINER_CREATE_NEW_CONTAINER        = 0x0004,
    WMS_DATA_CONTAINER_ALLOW_BUFFER_IO             = 0x0008,
    WMS_DATA_CONTAINER_SHARED_SOURCE               = 0x0010
} WMS_DATA_CONTAINER_OPEN_FLAGS;

// These are the flags set in each WMSDirectoryEntryInfo
typedef [public] enum WMS_DIRECTORY_ENTRY_FLAGS
{
    WMS_DIRECTORY_ENTRY_IS_DIRECTORY				= 0x0001
} WMS_DIRECTORY_ENTRY_FLAGS;

// These are the values requested from GetInfo.
typedef [public] enum WMS_DATA_CONTAINER_GETINFO_VALUES
{
    WMS_DATA_CONTAINER_SIZE                     = 1,
    WMS_DATA_CONTAINER_MAX_SUPPORTED_READ_SIZE  = 2
} WMS_DATA_CONTAINER_GETINFO_VALUES;

// These are the flags passed to OnGetInfo.
// This flag tells you whether the position parameter is 
// used in the read and write methods.
typedef [public] enum WMS_DATA_CONTAINER_GETINFO_FLAGS
{
    WMS_SEEKABLE_CONTAINER                      = 0x0001,
    WMS_LOCAL_DATA_CONTAINER                    = 0x0002
} WMS_DATA_CONTAINER_GETINFO_FLAGS;

// These are the flags returned by GetDataSourceAttributes.
typedef [public] enum WMS_DATA_CONTAINER_ATTRIBUTES
{
    WMS_DATA_CONTAINER_SUPPORTS_ENUMERATION     = 0x0001
} WMS_DATA_CONTAINER_ATTRIBUTES;


typedef unsigned __int64 QWORD;

//////////////////////////////////////////////////////////////////////////////
//
//                         STORAGE SYSTEM
//
// This manages the name space for a particular storage model, like
// a file system, a network, etc. 
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
[
    object,
    pointer_default(unique),
    uuid(E1CD3525-03D7-11d2-9EED-006097D2D7CF),
    version(9.0),
    helpstring("Provides methods to manage data containers and retrieve information about them.")
]
interface IWMSDataSourcePlugin : IUnknown
{                
    [helpstring("Retrieves the attribute flags associated with a data container.")] HRESULT 
    GetDataSourceAttributes( 
                [out] DWORD *pdwFlags
                );

    [helpstring("Retrieves the physical paths of the root directories associated with a data container.")] HRESULT 
    GetRootDirectories(
                [in] LPWSTR *pstrRootDirectoryList,
                [in] DWORD dwMaxRoots,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext  
                );

    [helpstring("Opens or creates a data container.")] HRESULT 
    OpenDataContainer(
                [in] IWMSCommandContext *pCommandContext,
                [in] IWMSContext *pUserContext,
                [in] IWMSContext *pPresentationContext,
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSBufferAllocator *pBufferAllocator,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );

    [helpstring("Opens a directory data container.")] HRESULT 
    OpenDirectory(
                [in] IWMSCommandContext *pCommandContext,
                [in] IWMSContext *pUserContext,
                [in] IWMSContext *pPresentationContext,
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSBufferAllocator *pBufferAllocator,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );
                
    [helpstring("Deletes a data container.")] HRESULT 
    DeleteDataContainer(
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );

    [helpstring("Retrieves version information about a data container.")] HRESULT 
    GetDataContainerVersion(
                [in] IWMSCommandContext *pCommandContext,
                [in] IWMSContext *pUserContext,
                [in] IWMSContext *pPresContext,
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );

    [helpstring("Creates a directory data container.")] HRESULT 
    CreateDataSourceDirectory(
                [in] IWMSCommandContext *pCommandContext,
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );

    [helpstring("Removes a directory data container.")] HRESULT 
    DeleteDirectory(
                [in] LPWSTR pszContainerName,
                [in] DWORD dwFlags,
                [in] IWMSDataSourcePluginCallback *pCallback,
                [in] QWORD qwContext    
                );
}; // IWMSDataSourcePlugin




//////////////////////////////////////////////////////////////////////////////
[
    object,
    pointer_default(unique),
    uuid(E1CD3526-03D7-11d2-9EED-006097D2D7CF),
    version(9.0),
    helpstring("Provides methods to return the results of IWMSDataContainer method calls.")
]
interface IWMSDataSourcePluginCallback : IUnknown
{
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::OpenDataContainer method call.")] HRESULT 
    OnOpenDataContainer(
                [in] HRESULT hr,
                [in] IWMSDataContainer *pDataContainer,
                [in] QWORD qwContext
                );
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::OpenDirectory method call.")] HRESULT 
    OnOpenDirectory(
                [in] HRESULT hr,
                [in] IWMSDirectory *pDirectory,
                [in] QWORD qwContext
                );
    [helpstring("Reserved for future use.")] HRESULT 
    OnOpenPacketStreamDataContainer(
                [in] HRESULT hr,
                [in] IUnknown *pLiveDataContainer,
                [in] QWORD qwContext
                );
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::DeleteDataContainer method call")] HRESULT 
    OnDeleteDataContainer(
                [in] HRESULT hr,
                [in] QWORD qwContext
                );
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::GetDataContainerVersion method call.")] HRESULT 
    OnGetDataContainerVersion(
                [in] HRESULT hr,
                [in] IWMSDataContainerVersion *pVersion,
                [in] QWORD qwContext    
                );  
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::GetRootDirectories method call.")] HRESULT 
    OnGetRootDirectories(
                [in] HRESULT hr,
                [in] DWORD dwNumReturnedRoots,
                [in] DWORD dwTotalNumRoots,
                [in] QWORD qwContext  
                );
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::CreateDirectory method call.")] HRESULT 
    OnCreateDirectory(
                [in] HRESULT hr,
                [in] QWORD qwContext    
                );
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::DeleteDirectory method call.")] HRESULT 
    OnDeleteDirectory(
                [in] HRESULT hr,
                [in] QWORD qwContext    
                );
};



//////////////////////////////////////////////////////////////////////////////
typedef struct
{
    LPOLESTR        pstrName;
    DWORD           dwFlags;
    QWORD           qwSize;
} WMSDirectoryEntryInfo;







//////////////////////////////////////////////////////////////////////////////
//
//                        DATA CONTAINER
//
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
[
    object,
    pointer_default(unique),
    uuid(E6EE9A13-0FCC-11d2-9EEE-006097D2D7CF),
    version(9.0),
    helpstring("Provides methods to manage a data container.")
]
interface IWMSDataContainer : IUnknown
{
    // Return IID_IWMSUnknownFormat if you don't know the format.
    [helpstring("Retrieves a GUID that identifies the format of the data container.")] HRESULT 
    GetContainerFormat( [out] GUID *pFormat );

    // Return a pointer to the data source plugin that controls this container.
    [helpstring("Retrieves a pointer to the data source plug-in that created the data container.")] HRESULT 
    GetDataSourcePlugin( [out] IWMSDataSourcePlugin **ppDataSource );

    [helpstring("Retrieves information about the data container.")] HRESULT 
    GetInfo(
                [in] DWORD dwInfoValueId,
                [in] IWMSDataContainerCallback *pCallback,
                [in] QWORD qwContext 
                );

    [helpstring("Reads data from the data container.")] HRESULT 
    Read(
                [in] BYTE *pbBuffer,
                [in] QWORD qwOffset, // Must be WMS_DATA_CONTAINER_NONSEEKABLE for a non-seekable device
                [in] DWORD dwMaxDataSize,
                [in] DWORD dwFlags,
                [in] IWMSDataContainerCallback *pCallback,
                [in] QWORD qwContext 
                );
       
    // Non-writeable devices may always return an error.
    [helpstring("Writes data from a buffer to the data container.")] HRESULT 
    Write(
                [in] BYTE *pbBuffer,
                [in] DWORD dwDataSize,
                [in] QWORD qwWritePosition, // Must be WMS_DATA_CONTAINER_NONSEEKABLE for a non-seekable device
                [in] IWMSDataContainerCallback *pCallback,
                [in] QWORD qwContext 
                );
                
    // There is no seek, Instead, the GetData methods specify the
    // position. 

    // Get a natural sized block (the transfer size between disk
    // and memory) that includes this position.
    // Will be called before every call to Read or Write
    [helpstring("Retrieves the optimal offset and buffer size, in bytes, to use for read and write access.")] HRESULT 
    GetTransferParameters(
                [in]  QWORD qwDesiredOffset,    
                [in]  DWORD dwDesiredMinSize,
                [in]  DWORD dwDesiredMaxSize,
                [out] QWORD *pqwOffset,     // Will return WMS_DATA_CONTAINER_NONSEEKABLE for a non-seekable device
                [out] DWORD *pdwSize,
                [out] DWORD *pdwBufferAlignment
                );

    [helpstring("Reserved for future use.")] HRESULT 
    DoDataContainerExtendedCommand(
                [in] LPWSTR szCommandName,
                [in] IWMSCommandContext *pCommand,
                [in] DWORD dwCallFlags,
                [in] IWMSDataContainerCallback *pCallback,
                [in] QWORD qwContext 
                );

    [helpstring("Modifies data that is sent to a media parser after the media parser has converted it into one or more packet lists.")] HRESULT 
    FinishParsingPacketlist(
                [in] IWMSPacketList *pPacketList
                );
}; // IWMSDataContainer





//////////////////////////////////////////////////////////////////////////////
[
    object,
    pointer_default(unique),
    uuid(2E34AB82-0D3D-11d2-9EEE-006097D2D7CF),
    version(9.0),
    helpstring("Provides methods to return the results of IWMSDataContainer method calls.")
]
interface IWMSDataContainerCallback : IUnknown
{
    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::GetInfo method call to the server.")] HRESULT 
    OnGetInfo( 
                [in] HRESULT hr,
                [in] DWORD dwFlags,
                [in] QWORD qwInfoValue,
                [in] QWORD qwContext
                );

    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::Read method call.")] HRESULT 
    OnRead( 
                [in] HRESULT hr,
                [in] DWORD dwActualBytesTransferred,
                [in] DWORD dwChangeType,
                [in] QWORD qwChangeParameter,
                [in] QWORD qwContext
                );

    [helpstring("Called by a data source plug-in to return the result of the IWMSDataContainer::Write method call.")] HRESULT 
    OnWrite( 
                [in] HRESULT hr,
                [in] DWORD dwActualBytesTransferred,
                [in] QWORD qwContext
                );

    [helpstring("Reserved for future use.")] HRESULT 
    OnDoDataContainerExtendedCommand(
                [in] HRESULT hr,
                [in] QWORD qwContext
                );
}; // IWMSDataContainerCallback





//////////////////////////////////////////////////////////////////////////////
//
//                          DIRECTORIES
//
// This is a snapshot of the current state of the directory, like a collection.
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
[
    object,
    pointer_default(unique),
    uuid(6FA365E7-E8B9-437a-8C4B-6552DFBB0C57),
    version(9.0),
    helpstring("Provides methods for navigating the structure of a directory data container.") 
]
interface IWMSDirectory : IUnknown
{
    // Return a pointer to the data source plugin that controls this directory.
    [helpstring("Retrieves a pointer to the data source plug-in that created the directory data container.")] HRESULT 
    GetDataSourcePlugin( [out] IWMSDataSourcePlugin **ppDataSource );

    // Return the full path of this directory including the URL scheme
    [helpstring("Retrieves the full path of the directory, including the URL scheme.")] HRESULT 
    GetName( [out] LPOLESTR *pstrValue );

    // Enumerate children. First child index is 0, and this returns
    // S_FALSE if dwIndex is too large.
    [helpstring("Retrieves information about a specific child in a directory data container.")] HRESULT 
    GetChildInfo(
                [in] DWORD dwIndex,
                [out] WMSDirectoryEntryInfo *pInfo
                );
};







