Condividi tramite


Elenchi di formati di dati audio ACX e formato dati

In questo argomento viene descritto come i tipi di formato ACX vengono usati da un driver per tenere traccia, gestire e confrontare i formati di dati dei segnali. Per una panoramica generale di ACX e un elenco di termini ACX comuni, vedere Cenni preliminari sulle estensioni della classe audio ACX. Per informazioni generali sui formati di codifica audio, vedi Formati di dati audio.

Oggetti ACXDATAFORMAT e ACXDATAFORMATLIST

Due oggetti ACX vengono usati per lavorare con i formati di dati.

  • ACXDATAFORMAT che rappresenta un formato di dati supportato dal dispositivo audio.
  • ACXDATAFORMATLIST, che è un elenco di formati di dati audio disponibili per l'uso.

Per altre informazioni sull'uso degli oggetti ACX, vedere Riepilogo degli oggetti ACX.

ACX usa l'enumerazione ACX_DATAFORMAT_TYPE, che fa riferimento a una struttura KSDATAFORMAT per specificare un formato di dati.

ACXDATAFORMAT

ACXDATAFORMAT fornisce un handle a un oggetto formato dati. I driver creano questi oggetti usando la funzione AcxDataFormatCreate e possono confrontarli usando AcxDataFormatIsEqual.

ACXDATAFORMATLIST

ACXDATAFORMATLIST è un contenitore per gli oggetti formato dati. Quando il driver crea un ACXPIN, ACX crea automaticamente un elenco di formato dati vuoto per la modalità di elaborazione del segnale non elaborato. Un driver può accedere all'elenco usando AcxPinGetRawDataFormatList. Restituisce ACXDATAFORMATLIST per l'OGGETTO ACXPIN specificato.

Un driver può aggiungere un formato a un elenco specifico usando AcxDataFormatListAddDataFormat.

    // The raw processing mode list is associated with each single circuit
    // by ACX. A driver uses AcxPinGetRawDataFormatList to retrieve the built-in raw
    // data-format list.
    //
    RETURN_NTSTATUS_IF_TRUE(CodecCaptureHostPin >= CodecCapturePinCount, STATUS_INVALID_PARAMETER);
    formatList = AcxPinGetRawDataFormatList(Pin[CodecCaptureHostPin]);
    RETURN_NTSTATUS_IF_TRUE(formatList == nullptr, STATUS_INSUFFICIENT_RESOURCES);

    //
    // The driver uses AcxDataFormatListAddDataFormat to add data formats to the raw
    // processing mode list associated with the current circuit.
    //
    RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm44100c1));
    RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm48000c1));

Un driver può creare elenchi di formato dati aggiuntivi e associarli a una modalità di elaborazione del segnale specifica usando AcxDataFormatListCreate per un WDFDEVICE specifico, ad esempio ACXPIN.

NTSTATUS AcxDataFormatListCreate(device, attributes, <format cfg>, &ACXDATAFORMATLIST)

Un driver può recuperare un elenco di formati associato a un pin specifico usando AcxPinRetrieveModeDataFormatList.

Un driver può rimuovere un formato da un elenco specifico usando AcxDataFormatListRemoveDataFormat. Si noti che se questo formato è anche il formato predefinito, ACX seleziona il primo disponibile nell'elenco come predefinito (se presente).

Un driver può specificare un formato predefinito nell'elenco usando AcxDataFormatListAssignDefaultDataFormat. Il formato predefinito deve essere presente nell'elenco, altrimenti verrà aggiunto.

Un driver può recuperare un formato predefinito nell'elenco usando AcxDataFormatListRetrieveDefaultDataFormat.

Un driver può scorrere un elenco di formati e apportare modifiche come gruppo usando le DDI seguenti.

Si noti che le modifiche vengono applicate solo dopo che il driver termina l'iterazione.

VOID AcxDataFormatListBeginIteration(ACXDATAFORMATLIST, PACX_DATAFORMAT_LIST_ITERATOR)
NTSTATUS AcxDataFormatListRetrieveNextDataFormat(ACXDATAFORMATLIST,  PACX_DATAFORMAT_LIST_ITERATOR, &ACXFORMAT);
VOID AcxDataFormatListEndIteration(ACXDATAFORMATLIST, PACX_DATAFORMAT_LIST_ITERATOR)

Le DDI precedenti eliminano la necessità del driver di implementare i callback seguenti:

PFN_ACX_PIN_GET_SIGNALPROCESSING_MODES      	EvtAcxPinGetSignalProcessingModes;
PFN_ACX_PIN_GET_DATAFORMATS                     EvtAcxPinGetDataFormats;
PFN_ACX_PIN_GET_DEFAULT_DATAFORMAT              EvtAcxPinGetDefaultDataFormat;
PFN_ACX_PIN_PROPOSE_DATAFORMAT                  EvtAcxPinProposeDataFormat;

Le DDI precedenti rimuovono anche la necessità del driver di implementare gli eventi seguenti (ACX attiva automaticamente questo evento dopo la modifica dell'elenco):

// Clients enable this event to receive format change notifications. Drivers fire this even when it detects a dynamic format change on the specified pin (h/w pin).
//
    KSEVENT_PINCAPS_FORMATCHANGE(pin)

Le DDI precedenti eliminano anche la necessità del driver di gestire autonomamente le modalità e i formati di archiviazione.

Il driver deve comunque supportare l'DDI seguente se i formati in/out non sono uguali (circuito DSP). Questa DDI è indipendente dal flusso, specifica del pin del circuito e supportata solo nei pin di streaming non s/w.

PFN_ACX_PIN_SET_DATAFORMAT              EvtAcxPinSetDataFormat;

Vedi anche

Intestazione acxdataformat.h

Formati di dati audio

Struttura KSDATAFORMAT

Panoramica delle estensioni della classe audio ACX