Documentation

Overview

    Package videobox provides a client for accessing Videobox services.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type CheckOptions

    type CheckOptions struct {
    	// contains filtered or unexported fields
    }

      CheckOptions are additional options that control the behaviour of Videobox when processing videos.

      func NewCheckOptions

      func NewCheckOptions() *CheckOptions

        NewCheckOptions makes a new CheckOptions object.

        func (*CheckOptions) FaceboxThreshold

        func (o *CheckOptions) FaceboxThreshold(v float64)

          FaceboxThreshold sets the minimum confidence threshold of Facebox matches required for it to be included in the results.

          func (*CheckOptions) FrameConcurrency

          func (o *CheckOptions) FrameConcurrency(concurrent int)

            FrameConcurrency sets the number of frames to process concurrently.

            func (*CheckOptions) FrameHeight

            func (o *CheckOptions) FrameHeight(height int)

              FrameHeight sets the height of the frame to extract.

              func (*CheckOptions) FrameWidth

              func (o *CheckOptions) FrameWidth(width int)

                FrameWidth sets the width of the frame to extract.

                func (*CheckOptions) NudeboxThreshold

                func (o *CheckOptions) NudeboxThreshold(v float64)

                  NudeboxThreshold sets the minimum confidence threshold of Nudebox matches required for it to be included in the results.

                  func (*CheckOptions) ResultsDuration

                  func (o *CheckOptions) ResultsDuration(duration time.Duration)

                    ResultsDuration sets the duration results should be kept in Videobox before being garbage collected.

                    func (*CheckOptions) SkipFrames

                    func (o *CheckOptions) SkipFrames(frames int)

                      SkipFrames sets the number of frames to skip between extractions.

                      func (*CheckOptions) SkipSeconds

                      func (o *CheckOptions) SkipSeconds(seconds int)

                        SkipSeconds sets the number of seconds to skip between frame extractions.

                        func (*CheckOptions) TagboxIncludeAll

                        func (o *CheckOptions) TagboxIncludeAll()

                          TagboxIncludeAll includes all tags in the results.

                          func (*CheckOptions) TagboxIncludeCustom

                          func (o *CheckOptions) TagboxIncludeCustom()

                            TagboxIncludeCustom includes only custom tags in the results.

                            func (*CheckOptions) TagboxThreshold

                            func (o *CheckOptions) TagboxThreshold(v float64)

                              TagboxThreshold sets the minimum confidence threshold of Tagbox matches required for it to be included in the results.

                              type Client

                              type Client struct {
                              
                              	// HTTPClient is the http.Client that will be used to
                              	// make requests.
                              	HTTPClient *http.Client
                              	// contains filtered or unexported fields
                              }

                                Client is an HTTP client that can make requests to the box.

                                func New

                                func New(addr string) *Client

                                  New makes a new Client.

                                  func (*Client) Check

                                  func (c *Client) Check(video io.Reader, options *CheckOptions) (*Video, error)

                                    Check starts processing the video in the Reader. Videobox is asynchronous, you must use Status to check when a video processing operation has completed before using Results to get the results.

                                    func (*Client) CheckBase64

                                    func (c *Client) CheckBase64(data string, options *CheckOptions) (*Video, error)

                                      CheckBase64 starts processing the video from the base64 encoded data string. See Check for more information.

                                      func (*Client) CheckURL

                                      func (c *Client) CheckURL(videoURL *url.URL, options *CheckOptions) (*Video, error)

                                        CheckURL starts processing the video at the specified URL. See Check for more information.

                                        func (*Client) Delete

                                        func (c *Client) Delete(id string) error

                                          Delete removes the results for a video.

                                          func (*Client) Info

                                          func (c *Client) Info() (*boxutil.Info, error)

                                            Info gets the details about the box.

                                            func (*Client) Results

                                            func (c *Client) Results(id string) (*VideoAnalysis, error)

                                              Results gets the results of a video processing operation. This should be called after the Video.Status is StatusCompleted.

                                              func (*Client) Status

                                              func (c *Client) Status(id string) (*Video, error)

                                                Status gets the status of a video operation.

                                                type Facebox

                                                type Facebox struct {
                                                	Faces      []Item `json:"faces"`
                                                	ErrorCount int    `json:"errorsCount"`
                                                	LastErr    string `json:"lastError,omitempty"`
                                                }

                                                  Facebox holds box specific results.

                                                  type Item

                                                  type Item struct {
                                                  	// Key is a string describing the item.
                                                  	// For Facebox it will be the name.
                                                  	// For Tagbox it will be the tag.
                                                  	// For Nudebox it will be a description of the nudity detected.
                                                  	Key string `json:"key"`
                                                  	// Instances holds the time and frame ranges where this Item
                                                  	// appears in the video.
                                                  	Instances []Range `json:"instances"`
                                                  }

                                                    Item describes a single entity that was discovered at one or many instances throughout the video.

                                                    type Nudebox

                                                    type Nudebox struct {
                                                    	Nudity     []Item `json:"nudity"`
                                                    	ErrorCount int    `json:"errorsCount"`
                                                    	LastErr    string `json:"lastError,omitempty"`
                                                    }

                                                      Nudebox holds box specific results.

                                                      type Range

                                                      type Range struct {
                                                      	// Start is the start frame.
                                                      	Start int `json:"start"`
                                                      	// End is the end frame.
                                                      	End int `json:"end"`
                                                      	// StartMS is the start time in milliseconds.
                                                      	StartMS int `json:"start_ms"`
                                                      	// EndMS is the end time in milliseconds.
                                                      	EndMS int `json:"end_ms"`
                                                      	// Confidence is the maximum confidence of any instance in this
                                                      	// range.
                                                      	Confidence float64 `json:"confidence,omitempty"`
                                                      }

                                                        Range describes a period of time within the video.

                                                        type Tagbox

                                                        type Tagbox struct {
                                                        	Tags       []Item `json:"tags"`
                                                        	ErrorCount int    `json:"errorsCount"`
                                                        	LastErr    string `json:"lastError,omitempty"`
                                                        }

                                                          Tagbox holds box specific results.

                                                          type Video

                                                          type Video struct {
                                                          	ID                          string      `json:"id"`
                                                          	Status                      VideoStatus `json:"status"`
                                                          	Error                       string      `json:"error"`
                                                          	DownloadTotal               int64       `json:"downloadTotal,omitempty"`
                                                          	DownloadComplete            int64       `json:"downloadComplete,omitempty"`
                                                          	DownloadEstimatedCompletion *time.Time  `json:"downloadCompleteEstimate,omitempty"`
                                                          	FramesCount                 int         `json:"framesCount,omitempty"`
                                                          	FramesComplete              int         `json:"framesComplete"`
                                                          	LastFrameBase64             string      `json:"lastFrameBase64,omitempty"`
                                                          	MillisecondsComplete        int         `json:"millisecondsComplete"`
                                                          	Expires                     *time.Time  `json:"expires,omitempty"`
                                                          }

                                                            Video represents a video.

                                                            type VideoAnalysis

                                                            type VideoAnalysis struct {
                                                            	// Ready indicates whether the results are ready or not.
                                                            	Ready   bool     `json:"ready"`
                                                            	Facebox *Facebox `json:"facebox,omitempty"`
                                                            	Tagbox  *Tagbox  `json:"tagbox,omitempty"`
                                                            	Nudebox *Nudebox `json:"nudebox,omitempty"`
                                                            }

                                                              VideoAnalysis describes the results of a video processing operation.

                                                              type VideoStatus

                                                              type VideoStatus string

                                                                VideoStatus holds the status of a video processing operation.

                                                                const (
                                                                	// StatusPending indicates that a video operation is pending.
                                                                	StatusPending VideoStatus = "pending"
                                                                	// StatusDownloading indicates that a video file is being downloaded.
                                                                	StatusDownloading VideoStatus = "downloading"
                                                                	// StatusProcessing indicates that a video is being processed.
                                                                	StatusProcessing VideoStatus = "processing"
                                                                	// StatusComplete indicates that a video operation has finished.
                                                                	StatusComplete VideoStatus = "complete"
                                                                	// StatusFailed indicates that a video operation has failed.
                                                                	StatusFailed VideoStatus = "failed"
                                                                )