25
TWAIN •Open industry standard interface for the input devices to capture multimedia objects •More and more sophisticated devies are developed to cater to the needs of various applications

TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Embed Size (px)

Citation preview

Page 1: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

TWAIN

•Open industry standard interface for the input devices to capture multimedia objects

•More and more sophisticated devies are developed to cater to the needs of various applications

Page 2: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

HOW THESE DEVICES ARE USED?

• Applications were initially written for a single device

• Eg. OCR reads a text and imports the file as ASCII file to the application.

• Less flexible and so used different appl. Program for different devices.

• Time consuming

Page 3: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Contd.

• Later, device drivers were provided with all devices to provide an interface between program and the devices

• Appl. program became more complex.

• Complicated code for supporting multiple interfaces.

Page 4: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

USAGE OF TWAIN

• TWAIN working group created an open industry standard interface for input devices

• Single TWAIN interface can be used to interface different devices.

Page 5: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

BENEFITS OF TWAIN

• Application developers can code a single TWAIN interface

• Device manufacturers can write device drivers with TWAIN spec.

• Multiple devices can be used in appl. Using “Acquire” & “Select Source”

Page 6: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

OBJECTIVES

• Supports multiple platform

• Supports multiple devices

• Widespread acceptance with std. interface

• Extendibility & backward compatibility

• Multidata format

• Easy to use

Page 7: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

TWAIN ARCHITECTURE

Page 8: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

APPLICATION LAYER

• Sets up a logical connection with device

• No rules on the design

• User interface guideline to select sources

• Select source helps to select multiple sources

• Acquire helps to import data from the selected device.

Page 9: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

PROTOCOL LAYER

• Provides interface for appl. Layer

• Comm. between appl. and acquisition layer

• Specifies services provided by a source

• Does not specify physical connection, control & devices info.

• Source Manager – heart of protocol layer

Page 10: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

SOURCE MANAGER• Provide std. API for all sources

• Selection of sources

• Establish logical sessions b/w appl. and sources.

• Regulates traffic and validate transactions

• Load or unload sources

• Maintain default source

• Keep track of sessions and session identities

Page 11: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

ACQUISTION LAYER

• Contains virtual device driver

• Acts directly with device driver

Local

RemoteSOURCE

Page 12: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Functions of source

• Control of device

• Acquisition of data from device

• Transfer of data in agreed format

• Control of devices by user

DEVICE LAYER

Receives the s/w commands and controls the

device hardware accordingly

Page 13: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

New WAVE RIFF file format• Two mandatory subchunks fmt data

Four optional subchunks fact cue points playlist associated data list

RIFF STRUCTURE

RIFF( ‘WAVE’<‘fmt’-ck>[<fact-ck>][<cue-ck>][<playlist-ck>][<assoc-data-list>]<wave-data>

)

Page 14: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

FACT ,CUE POINT & Playlist• Fact chunk <fact-ck>->fact(<dwSampleLength:DWORD> )

Cue–point chunk

struct {DWORD dwName;DWORD dwposition;FOURCC fccChunk;DWORD dwChunkStart;DWORD dwBlockStart;DWORD dwSampleOffset;

Playlist chunk

Struct {DWORD dwName;DWORD dwLength;DWORD dwLoops;}

Page 15: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Associated &Inst Chunk

Associated data chunk:<assoc-data-list> ->LIST( ‘adtl’<label-ck><note-ck><ltxt-ck>)Inst chunk:<instrument-ck> -> inst(<bUnshiftedNote:BYTE><chFineTune:CHAR><chGain:CHAR><bLowNote:BYTE><bHighNote:BYTE><bLowVelocity:BYTE><bHighVelocity:BYTE>)

Page 16: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Setting up new WAVE types• Mandatory chunks

fact fmt

Extended waveform structure

typedef struct waveformat_extended_tag {WORD wFormatTag;WORD wChannels;DWORD nSamplesPerSec;DWORD nAvgBytesPerSec;WORD nBlockAlign;WORD wBitsPerSample;WORD cbSize;}

Page 17: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

TableITEM WAVE TYPE WAVE DEFINITION

1 Microsoft: unknown wave type WAVE_FORMAT_UNKNOWN

2 Microsoft ADPCM wave typ WAVE_FORMAT_ADPCM

3 Digispeech: CVSD wave type WAVE_FORMAT_IBM_CVSD

4 Microsoft, digispeech:CCITT std. WAVE_FORMAT_ALAW

5 Digispeech:OKI ADPCM wave type WAVE_FORMAT_OKI_ADPCM

6 Intel: ADPCM wave type DVI_ADPCM

7 digispeech wave type WAVE_FORMAT_DIGISTD

8 Yamaha ADPCM wave type WAVE_FORMAT_YAMAHA_ADPCM

9 Sound compreesion Sonarc type WAVE_FORMAT_SONARC

10 Creative labs ADPCM WAVE_FORMAT_CREATIVE_ADPCM

11 Dsp GROUP wave type WAVE_FORMAT_DSPGROUP

12 Echo Speech wave type WAVE_FORMAT_ECHOSCI

13 Audio File AF36 & AF10 WAVE_FORMAT_AUDIO_FILE_AF36

14 Audio Processing Tech. WAVE_FORMAT_APTX

15 Dolby Labs: Dolby-AC2 type WAVE_FORMAT_DOLBY_AC2

Page 18: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Microsoft ADPCM WAVE file

• Typedef struct adpcmoef_tag {

int iCoef1;

int iCoef2;

}

typedef struct adpcmwaveformat_tag

{

EXTWAVEFORMATEXT ewf;

WORD nSamplesPerBlock;

WORD nNumberCoef;

ADPCMCOEFSET aCoeff[nNumCoef];

}ADPCMWAVEFORMAT;

Page 19: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

WAVEFORMATEXT• wFormatTag WAVE_FORMAT_ADPCM

• nChannels No. of channels in wave

• nSamplesPerSec Frequency of the sample rate

• nAvgBytesPerSec Avg. data rate

• nBlockAlign block alignment of data in<data-ck>

• wbitsPerSample No. of bits per sample of ADPCM

• cbExtraSize size in bytes of WAVE format chunk

• nSamplesPerBlock no. of samples per block

• nNumCoef No. of coefficient sets in aCoef

• aCoef coefficients used by wave

Page 20: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

BLOCK• It has 3 parts Header, data & padding

typedef struct adpcmblockheader_tag {BYTE bpredictor[nChannels];Int iDelta[nChannels];Int iSamp1[nChannels];Int iSamp2[nChannels];}ADPBLOKHEADER;

CCITT Standard Companded WAVE types

Stores file-dependent info about the contents of Wave data

Two types OF wFormatTagWAVE_FORMAT_ALAM (0X0006) USED IN U.SWAVE_FORMAT_MULAW(OX0007) USED IN EUROPE

Note: Rest as in previous slide

Page 21: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

DVI ADPCM WAVE• DEFINED AS

WAVE_FORMAT_DVI_ADPCM(OXOO11)

• STRUCTURE

typedef struct dvi_adpcmwaveformat_tag{

WAVEFORMATEXT ewf;

WORD wSamplesPerBlock;

}DVIADPCMWAVEFORMAT;

• wFormatTag is WAVE_FORMAT_DVI_ADPCM.

Page 22: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

BLOCK

• Block has 2 parts– Header– Data

Header

Typedef struct dvi_adpcmblockheader_tag{

Int iSamp0;

BYTE bStepTableIndex;

BYTE bReserved;

}.DVI_ADPCMBLOCKHEADER;

Page 23: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Creative Labs ADPCM

• Supports compression & decompression in real time

• Fact Chunk : wFormatTag is

WAVE_FORMAT_CREATIVE_ADPCM(0X0200)

Typedef struct creative_adpcmwaveformat_tag

{

WAVEFORMATEXT ewf;

WORD wRevision;

}CREATIVEHEADPCMWAVEFORMAT;

wRevision - Revision of the algorithm

Page 24: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

Dolby Labs AC-2 Wave Type• Primarily used for music compression

• The wFormatType of the fact chunk is WAVE_FORMAT_DOLBY_AC2(0X0030)

WAVEFORMATEXT STRUCTURE:nAuxBitsCode – Auxillary bits code indicating no.

of aux bits per block code no. of bits/block

0 01 82 163 32

Page 25: TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to

THANK YOU