Skip to content

Commit

Permalink
need to register bitmovin
Browse files Browse the repository at this point in the history
  • Loading branch information
James Yeh committed Jan 19, 2017
1 parent 2900b79 commit 7a0a658
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
_ "github.com/NYTimes/video-transcoding-api/provider/encodingcom"
_ "github.com/NYTimes/video-transcoding-api/provider/zencoder"
"github.com/NYTimes/video-transcoding-api/service"
_ "github.com/bitmovin/video-transcoding-api/provider/bitmovin"
"github.com/google/gops/agent"
"github.com/knq/sdhook"
"github.com/marzagao/logrus-env"
Expand Down
18 changes: 17 additions & 1 deletion provider/bitmovin/bitmovin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ import (
"strings"
"time"

"github.com/NYTimes/video-transcoding-api/config"
"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/provider"
"github.com/bitmovin/bitmovin-go/bitmovin"
"github.com/bitmovin/bitmovin-go/bitmovintypes"
"github.com/bitmovin/bitmovin-go/models"
"github.com/bitmovin/bitmovin-go/services"
"github.com/bitmovin/video-transcoding-api/config"
)

// Name is the name used for registering the bitmovin provider in the
// registry of providers.
const Name = "bitmovin"

// Just to double check the interface is properly implemented
var _ provider.TranscodingProvider = (*bitmovinProvider)(nil)

func init() {
provider.Register(Name, bitmovinConductorFactory)
}

var h264Levels = []bitmovintypes.H264Level{
bitmovintypes.H264Level1,
bitmovintypes.H264Level1b,
Expand Down Expand Up @@ -823,6 +830,15 @@ func parseS3URL(input string) (bucketName string, path string, fileName string,
return "", "", "", bitmovintypes.AWSCloudRegion(""), errors.New("")
}

func bitmovinConductorFactory(cfg *config.Config) (provider.TranscodingProvider, error) {
if cfg.Bitmovin.APIKey == "" || cfg.Bitmovin.AccessKeyID == "" || cfg.Bitmovin.SecretAccessKey == "" {
return nil, errors.New("")
}
client := bitmovin.NewBitmovin(cfg.Bitmovin.APIKey, cfg.Bitmovin.Endpoint, int64(cfg.Bitmovin.Timeout))

return &bitmovinProvider{client: client, config: cfg.Bitmovin}, nil
}

func stringToPtr(s string) *string {
return &s
}
Expand Down

0 comments on commit 7a0a658

Please sign in to comment.