@@ -215,6 +215,48 @@ func TestDeletePresetH264(t *testing.T) {
215
215
}
216
216
}
217
217
218
+ func TestDeletePresetVP8 (t * testing.T ) {
219
+ testPresetID := "i_want_to_delete_this"
220
+ audioPresetID := "embedded_audio_id"
221
+ customData := make (map [string ]interface {})
222
+ customData ["audio" ] = audioPresetID
223
+ ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
224
+ switch r .URL .Path {
225
+ case "/encoding/configurations/video/vp8/" + testPresetID + "/customData" :
226
+ resp := models.VP8CodecConfigurationResponse {
227
+ Status : bitmovintypes .ResponseStatusSuccess ,
228
+ Data : models.VP8CodecConfigurationData {
229
+ Result : models.VP8CodecConfiguration {
230
+ CustomData : customData ,
231
+ },
232
+ },
233
+ }
234
+ json .NewEncoder (w ).Encode (resp )
235
+ case "/encoding/configurations/audio/vorbis/" + audioPresetID :
236
+ resp := models.VorbisCodecConfigurationResponse {
237
+ Status : bitmovintypes .ResponseStatusSuccess ,
238
+ }
239
+ json .NewEncoder (w ).Encode (resp )
240
+ case "/encoding/configurations/video/h264/" + testPresetID :
241
+ w .WriteHeader (http .StatusNotFound )
242
+ w .Write ([]byte ("404 - no API found with those values" ))
243
+ case "/encoding/configurations/video/vp8/" + testPresetID :
244
+ resp := models.VP8CodecConfigurationResponse {
245
+ Status : bitmovintypes .ResponseStatusSuccess ,
246
+ }
247
+ json .NewEncoder (w ).Encode (resp )
248
+ default :
249
+ t .Fatal (errors .New ("unexpected path hit" ))
250
+ }
251
+ }))
252
+ defer ts .Close ()
253
+ prov := getBitmovinProvider (ts .URL )
254
+ err := prov .DeletePreset (testPresetID )
255
+ if err != nil {
256
+ t .Fatal (err )
257
+ }
258
+ }
259
+
218
260
func TestDeletePresetFailsOnAPIError (t * testing.T ) {
219
261
testPresetID := "i_want_to_delete_this"
220
262
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
@@ -256,7 +298,7 @@ func TestDeletePresetFailsOnGenericErrors(t *testing.T) {
256
298
}
257
299
}
258
300
259
- func TestGetPreset (t * testing.T ) {
301
+ func TestGetPresetH264 (t * testing.T ) {
260
302
testPresetID := "this_is_a_video_preset_id"
261
303
audioPresetID := "this_is_a_audio_preset_id"
262
304
customData := make (map [string ]interface {})
@@ -302,6 +344,55 @@ func TestGetPreset(t *testing.T) {
302
344
}
303
345
}
304
346
347
+ func TestGetPresetVP8 (t * testing.T ) {
348
+ testPresetID := "this_is_a_video_preset_id"
349
+ audioPresetID := "this_is_a_audio_preset_id"
350
+ customData := make (map [string ]interface {})
351
+ customData ["audio" ] = audioPresetID
352
+ ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
353
+ switch r .URL .Path {
354
+ case "/encoding/configurations/video/h264/" + testPresetID :
355
+ w .WriteHeader (http .StatusNotFound )
356
+ w .Write ([]byte ("404 - no API found with those values" ))
357
+ case "/encoding/configurations/video/vp8/" + testPresetID :
358
+ resp := models.VP8CodecConfigurationResponse {
359
+ Status : bitmovintypes .ResponseStatusSuccess ,
360
+ }
361
+ json .NewEncoder (w ).Encode (resp )
362
+ case "/encoding/configurations/video/vp8/" + testPresetID + "/customData" :
363
+ resp := models.VP8CodecConfigurationResponse {
364
+ Status : bitmovintypes .ResponseStatusSuccess ,
365
+ Data : models.VP8CodecConfigurationData {
366
+ Result : models.VP8CodecConfiguration {
367
+ CustomData : customData ,
368
+ },
369
+ },
370
+ }
371
+ json .NewEncoder (w ).Encode (resp )
372
+ case "/encoding/configurations/audio/vorbis/" + audioPresetID :
373
+ resp := models.VorbisCodecConfigurationResponse {
374
+ Status : bitmovintypes .ResponseStatusSuccess ,
375
+ }
376
+ json .NewEncoder (w ).Encode (resp )
377
+ default :
378
+ t .Fatal (errors .New ("unexpected path hit" ))
379
+ }
380
+ }))
381
+ defer ts .Close ()
382
+ prov := getBitmovinProvider (ts .URL )
383
+ i , err := prov .GetPreset (testPresetID )
384
+ if err != nil {
385
+ t .Fatal (err )
386
+ }
387
+ expected := bitmovinVP8Preset {
388
+ Video : models.VP8CodecConfiguration {CustomData : customData },
389
+ Audio : models.VorbisCodecConfiguration {},
390
+ }
391
+ if ! reflect .DeepEqual (i , expected ) {
392
+ t .Errorf ("GetPreset: want %#v. Got %#v" , expected , i )
393
+ }
394
+ }
395
+
305
396
func TestGetPresetFailsOnAPIError (t * testing.T ) {
306
397
testPresetID := "this_is_a_video_preset_id"
307
398
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
@@ -415,6 +506,19 @@ func TestTranscodeWithS3Input(t *testing.T) {
415
506
},
416
507
}
417
508
json .NewEncoder (w ).Encode (resp )
509
+ case "/encoding/configurations/video/vp8/videoID4/customData" :
510
+ customData := make (map [string ]interface {})
511
+ customData ["audio" ] = "audioID4"
512
+ customData ["container" ] = "webm"
513
+ resp := models.VP8CodecConfigurationResponse {
514
+ Status : bitmovintypes .ResponseStatusSuccess ,
515
+ Data : models.VP8CodecConfigurationData {
516
+ Result : models.VP8CodecConfiguration {
517
+ CustomData : customData ,
518
+ },
519
+ },
520
+ }
521
+ json .NewEncoder (w ).Encode (resp )
418
522
case "/encoding/manifests/hls" :
419
523
resp := models.HLSManifestResponse {
420
524
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -442,6 +546,14 @@ func TestTranscodeWithS3Input(t *testing.T) {
442
546
Status : bitmovintypes .ResponseStatusSuccess ,
443
547
}
444
548
json .NewEncoder (w ).Encode (resp )
549
+ case "/encoding/configurations/video/h264/videoID4" :
550
+ w .WriteHeader (http .StatusNotFound )
551
+ w .Write ([]byte ("404 - no API found with those values" ))
552
+ case "/encoding/configurations/video/vp8/videoID4" :
553
+ resp := models.VP8CodecConfigurationResponse {
554
+ Status : bitmovintypes .ResponseStatusSuccess ,
555
+ }
556
+ json .NewEncoder (w ).Encode (resp )
445
557
case "/encoding/encodings/" + encodingID + "/streams" :
446
558
resp := models.StreamResponse {
447
559
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -467,6 +579,11 @@ func TestTranscodeWithS3Input(t *testing.T) {
467
579
},
468
580
}
469
581
json .NewEncoder (w ).Encode (resp )
582
+ case "/encoding/encodings/" + encodingID + "/muxings/progressive-webm" :
583
+ resp := models.MP4MuxingResponse {
584
+ Status : bitmovintypes .ResponseStatusSuccess ,
585
+ }
586
+ json .NewEncoder (w ).Encode (resp )
470
587
case "/encoding/manifests/hls/" + manifestID + "/media" :
471
588
resp := models.MediaInfoResponse {
472
589
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -568,6 +685,19 @@ func TestTranscodeWithHTTPInput(t *testing.T) {
568
685
},
569
686
}
570
687
json .NewEncoder (w ).Encode (resp )
688
+ case "/encoding/configurations/video/vp8/videoID4/customData" :
689
+ customData := make (map [string ]interface {})
690
+ customData ["audio" ] = "audioID4"
691
+ customData ["container" ] = "webm"
692
+ resp := models.VP8CodecConfigurationResponse {
693
+ Status : bitmovintypes .ResponseStatusSuccess ,
694
+ Data : models.VP8CodecConfigurationData {
695
+ Result : models.VP8CodecConfiguration {
696
+ CustomData : customData ,
697
+ },
698
+ },
699
+ }
700
+ json .NewEncoder (w ).Encode (resp )
571
701
case "/encoding/manifests/hls" :
572
702
resp := models.HLSManifestResponse {
573
703
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -595,6 +725,14 @@ func TestTranscodeWithHTTPInput(t *testing.T) {
595
725
Status : bitmovintypes .ResponseStatusSuccess ,
596
726
}
597
727
json .NewEncoder (w ).Encode (resp )
728
+ case "/encoding/configurations/video/h264/videoID4" :
729
+ w .WriteHeader (http .StatusNotFound )
730
+ w .Write ([]byte ("404 - no API found with those values" ))
731
+ case "/encoding/configurations/video/vp8/videoID4" :
732
+ resp := models.VP8CodecConfigurationResponse {
733
+ Status : bitmovintypes .ResponseStatusSuccess ,
734
+ }
735
+ json .NewEncoder (w ).Encode (resp )
598
736
case "/encoding/encodings/" + encodingID + "/streams" :
599
737
resp := models.StreamResponse {
600
738
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -620,6 +758,11 @@ func TestTranscodeWithHTTPInput(t *testing.T) {
620
758
},
621
759
}
622
760
json .NewEncoder (w ).Encode (resp )
761
+ case "/encoding/encodings/" + encodingID + "/muxings/progressive-webm" :
762
+ resp := models.MP4MuxingResponse {
763
+ Status : bitmovintypes .ResponseStatusSuccess ,
764
+ }
765
+ json .NewEncoder (w ).Encode (resp )
623
766
case "/encoding/manifests/hls/" + manifestID + "/media" :
624
767
resp := models.MediaInfoResponse {
625
768
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -721,6 +864,19 @@ func TestTranscodeWithHTTPSInput(t *testing.T) {
721
864
},
722
865
}
723
866
json .NewEncoder (w ).Encode (resp )
867
+ case "/encoding/configurations/video/vp8/videoID4/customData" :
868
+ customData := make (map [string ]interface {})
869
+ customData ["audio" ] = "audioID4"
870
+ customData ["container" ] = "webm"
871
+ resp := models.VP8CodecConfigurationResponse {
872
+ Status : bitmovintypes .ResponseStatusSuccess ,
873
+ Data : models.VP8CodecConfigurationData {
874
+ Result : models.VP8CodecConfiguration {
875
+ CustomData : customData ,
876
+ },
877
+ },
878
+ }
879
+ json .NewEncoder (w ).Encode (resp )
724
880
case "/encoding/manifests/hls" :
725
881
resp := models.HLSManifestResponse {
726
882
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -748,6 +904,14 @@ func TestTranscodeWithHTTPSInput(t *testing.T) {
748
904
Status : bitmovintypes .ResponseStatusSuccess ,
749
905
}
750
906
json .NewEncoder (w ).Encode (resp )
907
+ case "/encoding/configurations/video/h264/videoID4" :
908
+ w .WriteHeader (http .StatusNotFound )
909
+ w .Write ([]byte ("404 - no API found with those values" ))
910
+ case "/encoding/configurations/video/vp8/videoID4" :
911
+ resp := models.VP8CodecConfigurationResponse {
912
+ Status : bitmovintypes .ResponseStatusSuccess ,
913
+ }
914
+ json .NewEncoder (w ).Encode (resp )
751
915
case "/encoding/encodings/" + encodingID + "/streams" :
752
916
resp := models.StreamResponse {
753
917
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -773,6 +937,11 @@ func TestTranscodeWithHTTPSInput(t *testing.T) {
773
937
},
774
938
}
775
939
json .NewEncoder (w ).Encode (resp )
940
+ case "/encoding/encodings/" + encodingID + "/muxings/progressive-webm" :
941
+ resp := models.MP4MuxingResponse {
942
+ Status : bitmovintypes .ResponseStatusSuccess ,
943
+ }
944
+ json .NewEncoder (w ).Encode (resp )
776
945
case "/encoding/manifests/hls/" + manifestID + "/media" :
777
946
resp := models.MediaInfoResponse {
778
947
Status : bitmovintypes .ResponseStatusSuccess ,
@@ -1504,6 +1673,13 @@ func getJob(sourceMedia string) *db.Job {
1504
1673
},
1505
1674
OutputOpts : db.OutputOptions {Extension : "m3u8" },
1506
1675
},
1676
+ {
1677
+ Name : "webm_480p" ,
1678
+ ProviderMapping : map [string ]string {
1679
+ Name : "videoID4" ,
1680
+ },
1681
+ OutputOpts : db.OutputOptions {Extension : "webm" },
1682
+ },
1507
1683
}
1508
1684
outputs := make ([]db.TranscodeOutput , len (presets ))
1509
1685
for i , preset := range presets {
0 commit comments