// --------------------------------------------------------
// EncDecTag.idl
//
//
//		Encrypter-Tagger/DeCrypter-Detagger filter definitions
//
//
//  Copyright (c) Microsoft, 2002
// ---------------------------------------------------------
//
// Guide to CLSIDS:
//
// -- 8x Enc/dec Properties
// -- 9x Tag Properties
// -- Ax 
// -- Bx IFilter
// -- Cx IFilterEvents
// -- Dx IFilterConfig
// -- Ex 
// -- Fx CFilter (coclass)
//
//	x = 1 - Encrypter-Tagger
//  x = 2 - Decrypter-Detagger

cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright (C) Microsoft Corporation, 2002.")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")
cpp_quote("#pragma once")

import "oaidl.idl";
import "ocidl.idl";

import "TvRatings.idl";

// -----------------
//   filter ClassID's

cpp_quote ("// {C4C4C481-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_ETFilterEncProperties,")
cpp_quote ("0xC4C4C481, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

cpp_quote ("// {C4C4C491-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_ETFilterTagProperties,")
cpp_quote ("0xC4C4C491, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

/* CLSID defined in coclass below
cpp_quote ("// {C4C4C4F1-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_ETFilter,")
cpp_quote ("0xC4C4C4F1, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
*/ 



cpp_quote ("// {C4C4C482-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_DTFilterEncProperties,")
cpp_quote ("0xC4C4C482, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

cpp_quote ("// {C4C4C492-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_DTFilterTagProperties,")
cpp_quote ("0xC4C4C492, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

/*
cpp_quote ("// {C4C4C4F2-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_DTFilter,")
cpp_quote ("0xC4C4C4F2, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
*/

cpp_quote ("// {C4C4C482-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_XDSCodecProperties,")
cpp_quote ("0xC4C4C483, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

cpp_quote ("// {C4C4C492-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_XDSCodecTagProperties,")
cpp_quote ("0xC4C4C493, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

/*
cpp_quote ("// {C4C4C4F3-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_XDSCodec,")
cpp_quote ("0xC4C4C4F3, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
*/

cpp_quote ("// {C4C4C4FC-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(CLSID_CPCAFiltersCategory,")
cpp_quote ("0xC4C4C4FC, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")


// broadcast eventID's
				// sent by XDSCodec when get a new rating
cpp_quote ("// {C4C4C4E0-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_XDSCodecNewXDSRating,")
cpp_quote ("0xC4C4C4E0, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by XDSCodec when get a duplicate to a current non DontKnow rating
cpp_quote ("// {C4C4C4DF-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_XDSCodecDuplicateXDSRating,")
cpp_quote ("0xC4C4C4DF, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by XDS Codec when get some other XDS packet
cpp_quote ("// {C4C4C4E1-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_XDSCodecNewXDSPacket,")
cpp_quote ("0xC4C4C4E1, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Decrypter/Detagger when rating changes
cpp_quote ("// {C4C4C4E2-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterRatingChange,")
cpp_quote ("0xC4C4C4E2, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Decrypter/DeTagger when show rating exceeds max allowable
cpp_quote ("// {C4C4C4E3-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterRatingsBlock,")
cpp_quote ("0xC4C4C4E3, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Decrypter/DeTagger when show rating drops below max allowable
cpp_quote ("// {C4C4C4E4-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterRatingsUnblock,")
cpp_quote ("0xC4C4C4E4, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Decrypter/DeTagger when get new XDS packet
cpp_quote ("// {C4C4C4E5-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterXDSPacket,")
cpp_quote ("0xC4C4C4E5, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Decrypter when data format is OK again (only after a failure)...
cpp_quote ("// {C4C4C4EC-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterDataFormatOK,")
cpp_quote ("0xC4C4C4ED, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
//cpp_quote ("0xC4C4C4EC, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
	
		// for now, Format errors act like License errors...

				// sent by Decrypter when data format is corrupt (old file?)
cpp_quote ("// {C4C4C4ED-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_DTFilterDataFormatFailure,")
cpp_quote ("0xC4C4C4EF, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")
//cpp_quote ("0xC4C4C4ED, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Encrypter or Decrypter when DRM license is OK again (only after a failure)...
cpp_quote ("// {C4C4C4EE-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_ETDTFilterLicenseOK,")
cpp_quote ("0xC4C4C4EE, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// sent by Encrypter or Decrypter when fail to get DRM license
cpp_quote ("// {C4C4C4EF-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(EVENTID_ETDTFilterLicenseFailure,")
cpp_quote ("0xC4C4C4EF, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

	// Other Guids
				// media subtype sent out of encrypter filter
cpp_quote ("// {C4C4C4D0-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(MEDIASUBTYPE_ETDTFilter_Tagged,")
cpp_quote ("0xC4C4C4D0, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

				// format block type sent out of encrypter filter 
				//  only used if no format block currently avaiable
cpp_quote ("// {C4C4C4D1-0049-4E2B-98FB-9537F6CE516D}")
cpp_quote ("DEFINE_GUID(FORMATTYPE_ETDTFilter_Tagged,")
cpp_quote ("0xC4C4C4D1, 0x0049, 0x4E2B, 0x98, 0xFB, 0x95, 0x37, 0xF6, 0xCE, 0x51, 0x6D);")

//------------------------------------------------------

#ifndef REFERENCE_TIME
typedef LONGLONG REFERENCE_TIME;
#endif

typedef LONG	PackedTvRating;					// internal storage format for 3-part TvRatings

//------------------------------------------------------

typedef enum EnTag_Mode                          // flags to turn various processing bits off
{                                                                       //   (see d:\nt\public\sd
        EnTag_Remove = 0x0,
        EnTag_Once   = 0x1,
        EnTag_Repeat = 0x2,
} EnTag_Mode;


[
    restricted,
    object,
    uuid (C4C4C4D1-0049-4E2B-98FB-9537F6CE516D),
//	dual
    helpstring("IETFilterConfig Interface"),
    pointer_default(unique)
]
interface IETFilterConfig : IUnknown
{
        [   id(10), helpstring("method InitLicense")]
        HRESULT InitLicense(
                                [in]	int	LicenseId	// which license (0-N to use) 
                              );
        [    id(11), helpstring("method GetSecureChannelObject")]
        HRESULT GetSecureChannelObject(
                                [out]	IUnknown **ppUnkDRMSecureChannel	// an IDRMSecureChannel 
                              );
};

[
    restricted,
    object,
    uuid (C4C4C4D2-0049-4E2B-98FB-9537F6CE516D),
//	dual
    helpstring("IDTFilterConfig Interface"),
    pointer_default(unique)
]
interface IDTFilterConfig : IUnknown
{
        [    id(11), helpstring("method GetSecureChannelObject")]
        HRESULT GetSecureChannelObject(
                                [out]	IUnknown **ppUnkDRMSecureChannel	// an IDRMSecureChannel 
                              );
};

[
    object,
    uuid (C4C4C4D3-0049-4E2B-98FB-9537F6CE516D),
//	dual
    helpstring("IXDSCodecConfig Interface"),
    pointer_default(unique)
]
interface IXDSCodecConfig : IUnknown
{
		// [propget, id(1),  helpstring("property CCMode")]  HRESULT CCMode([out, retval] int *pCCMode);
};




	// --------------------------------

[
		uuid(C4C4C400-0049-4E2B-98FB-9537F6CE516D),         
        version(1.0),
        helpstring("Microsoft Encypter-Tagger/Decrypter-Detagger Filters")
]
library EncDec
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");
 //   importlib("TvRatings.tlb");


    [
        object,
        uuid (C4C4C4B1-0049-4E2B-98FB-9537F6CE516D),
    //	dual
        helpstring("IETFilter Interface"),
        pointer_default(unique)
    ]
    interface IETFilter : IUnknown
    {
        [propget, id(1),  helpstring("property EvalRatObjOK")]	 
            HRESULT EvalRatObjOK([out, retval] HRESULT *pHrCoCreateRetVal);

        [		  id(2), helpstring("method GetCurrRating")]
            HRESULT GetCurrRating(
                [out] EnTvRat_System        *pEnSystem, 
                [out] EnTvRat_GenericLevel  *pEnRating,
                [out] LONG                  *plbfEnAttr      // bitfield of BfEnTvRat_GenericAttributes
            );

    };

    [
        uuid(C4C4C4C1-0049-4E2B-98FB-9537F6CE516D),
        helpstring("IETFilterEvents")
    ]
    dispinterface IETFilterEvents
    {
        properties:
        methods:
    };

    [
        uuid(C4C4C4F1-0049-4E2B-98FB-9537F6CE516D),
        helpstring("ETFilter Class")
    ]
    coclass ETFilter
    {
        [default] interface IETFilter;
        interface IETFilterConfig;

        [default, source] dispinterface IETFilterEvents;
    };

	// ---------------------------------------------------

    [
        object,
        uuid (C4C4C4B2-0049-4E2B-98FB-9537F6CE516D),
	//	dual
        helpstring("IDTFilter Interface"),
        pointer_default(unique)
    ]
    interface IDTFilter : IUnknown
    {
        [propget, id(1),  helpstring("property EvalRatObjOK")]	 
            HRESULT EvalRatObjOK([out, retval] HRESULT *pHrCoCreateRetVal);

        [       id(2), helpstring("method GetCurrRating")]
            HRESULT GetCurrRating(
                [out] EnTvRat_System        *pEnSystem, 
                [out] EnTvRat_GenericLevel  *pEnRating,
                [out] LONG                  *plbfEnAttr      // bitfield of BfEnTvRat_GenericAttributes
            );

        [propget, id(3), helpstring("property BlockedRatingAttributes")] 
            HRESULT BlockedRatingAttributes(
                [in] EnTvRat_System         enSystem, 
                [in] EnTvRat_GenericLevel   enLevel,
                [out, retval] LONG         *plbfEnAttr 
            );

        [propput, id(3), helpstring("property BlockedRatingAttributes")] 
            HRESULT BlockedRatingAttributes(
                [in] EnTvRat_System         enSystem, 
                [in] EnTvRat_GenericLevel   enLevel,
                [in] LONG                   lbfAttrs       // bitfield of BfEnTvRat_GenericAttributes
            );

        [propget, id(4), helpstring("property BlockUnRated")] 
            HRESULT BlockUnRated(
                [out, retval] BOOL          *pfBlockUnRatedShows
            );

        [propput, id(4), helpstring("property BlockUnRated")] 
            HRESULT BlockUnRated(
                [in] BOOL                   fBlockUnRatedShows
			);

        [propget, id(5), helpstring("property BlockUnRatedDelay")] 
            HRESULT BlockUnRatedDelay(
                [out, retval] LONG			*pmsecsDelayBeforeBlock
            );

        [propput, id(5), helpstring("property BlockUnRatedDelay")] 
            HRESULT BlockUnRatedDelay(
                [in] LONG					msecsDelayBeforeBlock
            );
    };

    [
		uuid(C4C4C4C2-0049-4E2B-98FB-9537F6CE516D),
		helpstring("IDTFilterEvents")
	]
    dispinterface IDTFilterEvents
    {
                properties:
                methods:
    };

    [
		uuid(C4C4C4F2-0049-4E2B-98FB-9537F6CE516D),
		helpstring("CDTFilter Class")
    ]
    coclass DTFilter
    {
		[default] interface IDTFilter;
		interface IDTFilterConfig;

		[default, source] dispinterface IDTFilterEvents;
    };

	// ---------------------------------------------------
    [
		object,
		uuid (C4C4C4B3-0049-4E2B-98FB-9537F6CE516D),
	//	dual
		helpstring("IXDSCodec Interface"),
		pointer_default(unique)
    ]
    interface IXDSCodec : IUnknown
    {
        [propget, id(1),  helpstring("property XDSToRatObjOK")]	 
                HRESULT XDSToRatObjOK([out, retval] HRESULT *pHrCoCreateRetVal);

        [propput, id(2),  helpstring("property CCSubstreamService")] 
                HRESULT CCSubstreamService([in] long SubstreamMask);

        [propget, id(2),  helpstring("property CCSubstreamService")] 
                HRESULT CCSubstreamService([out, retval] long *pSubstreamMask);

        [       id(3),  helpstring("method GetContentAdvisoryRating")	]
                HRESULT GetContentAdvisoryRating(
                [out] PackedTvRating	*pRat,		// TvRating
                [out] long				*pPktSeqID, 
                [out] long				*pCallSeqID,
                [out] REFERENCE_TIME	*pTimeStart,	// time this sample started
                [out] REFERENCE_TIME	*pTimeEnd 
                );

        [       id(4),  helpstring("method GetXDSPacket")	]
            HRESULT GetXDSPacket(
                [out] long				*pXDSClassPkt, // ENUM EnXDSClass
                [out] long				*pXDSTypePkt, 
                [out] BSTR				*pBstrXDSPkt, 
                [out] long				*pPktSeqID, 
                [out] long				*pCallSeqID,
                [out] REFERENCE_TIME	*pTimeStart,	// time this sample started
                [out] REFERENCE_TIME	*pTimeEnd 
                );	
    };

    [
		uuid(C4C4C4C3-0049-4E2B-98FB-9537F6CE516D),
		helpstring("IXDSCodecEvents")
    ]
    dispinterface IXDSCodecEvents
    {
                properties:
                methods:
    };

    [
		uuid(C4C4C4F3-0049-4E2B-98FB-9537F6CE516D),
		helpstring("CXDSCodec Class")
    ]
    coclass XDSCodec
    {
		[default] interface IXDSCodec;
		interface IXDSCodecConfig;

		[default, source] dispinterface IXDSCodecEvents;
    };
};
