Go Home Page
The Go Programming Language

Package av

import "exp/nacl/av"

Package av implements audio and video access for Native Client binaries running standalone or embedded in a web browser window.

The C version of the API is documented at http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/scons-out/doc/html/group__audio__video.html

Package files

av.go event.go image.go

Constants

Subsystem values for Init.

const (
    SubsystemVideo = 1 << iota
    SubsystemAudio
    SubsystemEmbed
)

Audio formats.

const (
    AudioFormatStereo44K = iota
    AudioFormatStereo48K
)

Variables

ColorModel is the color model corresponding to the Native Client Color.

var ColorModel = image.ColorModelFunc(toColor)

func AudioStream

func AudioStream(data []uint16) (nextSize int, err os.Error)

AudioStream provides access to the audio device. Each call to AudioStream writes the given data, which should be a slice of 16-bit stereo PCM audio samples, and returns the number of samples required by the next call to AudioStream.

To find out the initial number of samples to write, call AudioStream(nil).

type Color

A Color represents a Native Client color value, a 32-bit R, G, B, A value packed as 0xAARRGGBB.

type Color uint32

func (Color) RGBA

func (p Color) RGBA() (r, g, b, a uint32)

type Image

An Image represents a Native Client frame buffer. The pixels in the image can be accessed as a single linear slice or as a two-dimensional slice of slices. Image implements image.Image.

type Image struct {
    Linear []Color
    Pixel  [][]Color
}

func (*Image) At

func (m *Image) At(x, y int) image.Color

func (*Image) ColorModel

func (m *Image) ColorModel() image.ColorModel

func (*Image) Height

func (m *Image) Height() int

func (*Image) Set

func (m *Image) Set(x, y int, color image.Color)

func (*Image) Width

func (m *Image) Width() int

type Window

A Window represents a connection to the Native Client window. It implements draw.Context.

type Window struct {
    Embedded bool // running as part of a web page?
    *Image        // screen image
    // contains unexported fields
}

func Init

func Init(subsys int, dx, dy int) (*Window, os.Error)

Init initializes the Native Client subsystems specified by subsys. Init must be called before using any of the other functions in this package, and it must be called only once.

If the SubsystemVideo flag is set, Init requests a window of size dx×dy. When embedded in a web page, the web page's window specification overrides the parameters to Init, so the returned Window may have a different size than requested.

If the SubsystemAudio flag is set, Init requests a connection to the audio device carrying 44 kHz 16-bit stereo PCM audio samples.

func (*Window) FlushImage

func (w *Window) FlushImage()

func (*Window) KeyboardChan

func (w *Window) KeyboardChan() <-chan int

func (*Window) MouseChan

func (w *Window) MouseChan() <-chan draw.Mouse

func (*Window) QuitChan

func (w *Window) QuitChan() <-chan bool

func (*Window) ResizeChan

func (w *Window) ResizeChan() <-chan bool

func (*Window) Screen

func (w *Window) Screen() draw.Image