//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
import "dvrinterfaces.idl";

// ################# Interfaces #################

typedef struct VOBU_SRI_TABLE
{
    LONG	FWDIVideo;	// Should be the same as FWDINext since all of our VOBU's have video

    // These are the stream offsets of first NAV_PACK with a presentation time N / 2
    // seconds after the presentation time supplied to GetVOBUOffsets.
    // So, for example, FWDI240 is 120 seconds in the future.

    LONG	FWDI240, FWDI120, FWDI60, FWDI20, FWDI15, FWDI14, FWDI13, FWDI12, FWDI11, FWDI10,
            FWDI9,   FWDI8,   FWDI7,  FWDI6,  FWDI5,  FWDI4,  FWDI3,  FWDI2,  FWDI1,
            FWDINext;		// Next VOBU -- likely the same as FWDI1, but may not be

    // The backwards offsets are just the same as the forward offsets, but back in time
    // from the supplied presentation time.

    LONG	BWDIPrev;	// Previous VOBU
    LONG	BWDI1,  BWDI2,  BWDI3,  BWDI4,  BWDI5,  BWDI6,  BWDI7,  BWDI8,   BWDI9,
            BWDI10, BWDI11, BWDI12,	BWDI13, BWDI14, BWDI15, BWDI20, BWDI60, BWDI120, BWDI240;
    LONG	BWDIVideo;	// Should be the same as BWDIPrevt since all of our VOBU's have video
} VOBU_SRI_TABLE;


[
    object,
    uuid(943433ED-2510-4a38-AF44-DF629341C91D),
    pointer_default(unique)
]
interface ISourceVOBUInfo : IUnknown
{

    HRESULT GetVOBUOffsets(	[in] LONGLONG tPresentation,
                            [in] LONGLONG tSearchStart,
                            [in] LONGLONG tSearchEnd,
                            [out] VOBU_SRI_TABLE *pVobuTable);

    HRESULT GetRecordingSize(	[in] LONGLONG tStart,		// In 100 nano-sec units
                                [in] LONGLONG tEnd,			// In 100 nano-sec units
                                [out] ULONGLONG* pcbSize);

    HRESULT GetRecordingDurationMax(	[in] LONGLONG tStart,		        // In 100 nano-sec units
                                        [in] ULONGLONG cbSizeMax,
                                        [out] LONGLONG* ptDurationMax);		// In 100 nano-sec units

    HRESULT GetKeyFrameTime(	[in] LONGLONG tTime,		        // In 100 nano-sec units
                                [in] LONG nSkipCount,
                                [out] LONGLONG* ptKeyFrame);		// In 100 nano-sec units

    HRESULT GetRecordingData(	[in] LONGLONG tStart,		// In 100 nano-sec units
                                [in] BYTE* rgbBuffer,
                                [in] ULONG cbBuffer,
                                [out] ULONG* pcbRead,
                                [out] LONGLONG* ptEnd);		// In 100 nano-sec units
};


[
    object,
    uuid(dc61c293-4f18-44d2-a5ed-d4fdac777987),
    pointer_default(unique)
]
interface IContentRestrictionCapture : IUnknown
{
    // This interface is used to communicate policy related to
    // restrictions on the content's usage, including copy protection
    // and (later) parental control.

    // Method SetEncryptionEnabled() turns encryption of media samples
    // on or off. If the argument is TRUE, encryption is on. If false,
    // encryption is off. The result should normally be S_OK. If this
    // method is not supported, E_NOTIMPL will be returned.
    HRESULT SetEncryptionEnabled([in] BOOL fEncrypt);

    // Method SetEncryptionEnabled() reports whether encryption has
    // been turned on by setting the argument. The result S_OK is
    // returned when *pfEncrypt was set. E_POINTER is returned if
    // the argument is NULL. E_NOTIMPL is returned if this method
    // is not supported.
    HRESULT GetEncryptionEnabled([out] BOOL *pfEncrypt);

    // Method ExpireVBICopyProtection() tells the DVR engine that
    // the copy protection policy received earllier as VBI data has
    // expired. The DVR engine should revert to (VBI-based) unprotected content
    // until further instructions are received via VBI. If new information
    // has been received such that the given policy is no longer what
    // was reported by VBI, the error XACT_E_WRONGSTATE will be returned instead.
    HRESULT ExpireVBICopyProtection([in] ULONG uExpiredPolicy);
};



