@@ -912,6 +912,9 @@ func (p *bitmovinProvider) JobStatus(job *db.Job) (*provider.JobStatus, error) {
912
912
"message" : stringValue (statusResp .Data .Message ),
913
913
"originalStatus" : stringValue (statusResp .Data .Result .Status ),
914
914
},
915
+ Output : provider.JobOutput {
916
+ Destination : strings .TrimRight (p .config .Destination , "/" ) + "/" + job .ID + "/" ,
917
+ },
915
918
}
916
919
917
920
if jobStatus .Status == provider .StatusFinished {
@@ -921,11 +924,6 @@ func (p *bitmovinProvider) JobStatus(job *db.Job) (*provider.JobStatus, error) {
921
924
}
922
925
}
923
926
924
- err = p .addOutputStatusInfo (job , & jobStatus )
925
- if err != nil {
926
- return nil , err
927
- }
928
-
929
927
if jobStatus .Status == provider .StatusFinished {
930
928
err = p .addSourceInfo (job , & jobStatus )
931
929
if err != nil {
@@ -985,16 +983,19 @@ func (p *bitmovinProvider) addManifestStatusInfo(status *provider.JobStatus) err
985
983
return nil
986
984
}
987
985
988
- func (p * bitmovinProvider ) addOutputStatusInfo (job * db.Job , status * provider.JobStatus ) error {
989
- status .Output = provider.JobOutput {
990
- Destination : strings .TrimRight (p .config .Destination , "/" ) + "/" + job .ID + "/" ,
986
+ func (p * bitmovinProvider ) addOutputFilesInfo (job * db.Job , status * provider.JobStatus ) error {
987
+ err := p .addMP4OutputFilesInfo (job , status )
988
+ if err != nil {
989
+ return err
991
990
}
992
- return nil
991
+ err = p .addWebmOutputFilesInfo (job , status )
992
+ if err != nil {
993
+ return err
994
+ }
995
+ return p .addMOVOutputFilesInfo (job , status )
993
996
}
994
997
995
- func (p * bitmovinProvider ) addOutputFilesInfo (job * db.Job , status * provider.JobStatus ) error {
996
- // TODO: we only have info for MP4. Need to add for webm and mov.
997
-
998
+ func (p * bitmovinProvider ) addMP4OutputFilesInfo (job * db.Job , status * provider.JobStatus ) error {
998
999
muxings , err := p .listMP4Muxing (job .ProviderJobID )
999
1000
if err != nil {
1000
1001
return err
@@ -1044,6 +1045,100 @@ func (p *bitmovinProvider) listMP4Muxing(jobID string) ([]models.MP4Muxing, erro
1044
1045
return muxings , nil
1045
1046
}
1046
1047
1048
+ func (p * bitmovinProvider ) addWebmOutputFilesInfo (job * db.Job , status * provider.JobStatus ) error {
1049
+ muxings , err := p .listWebmMuxing (job .ProviderJobID )
1050
+ if err != nil {
1051
+ return err
1052
+ }
1053
+
1054
+ encodingS := services .NewEncodingService (p .client )
1055
+ for _ , muxing := range muxings {
1056
+ resp , err := encodingS .RetrieveProgressiveWebMMuxingInformation (job .ProviderJobID , stringValue (muxing .ID ))
1057
+ if err != nil {
1058
+ return err
1059
+ }
1060
+
1061
+ info := resp .Data .Result
1062
+ if len (info .VideoTracks ) == 0 {
1063
+ return fmt .Errorf ("no video track found for encodingID %s muxingID %s" , job .ProviderJobID , stringValue (muxing .ID ))
1064
+ }
1065
+
1066
+ status .Output .Files = append (status .Output .Files , provider.OutputFile {
1067
+ Path : status .Output .Destination + stringValue (muxing .Filename ),
1068
+ Container : stringValue (info .ContainerFormat ),
1069
+ FileSize : int64Value (info .FileSize ),
1070
+ VideoCodec : stringValue (info .VideoTracks [0 ].Codec ),
1071
+ Width : int64Value (info .VideoTracks [0 ].FrameWidth ),
1072
+ Height : int64Value (info .VideoTracks [0 ].FrameHeight ),
1073
+ })
1074
+ }
1075
+ return nil
1076
+ }
1077
+
1078
+ func (p * bitmovinProvider ) listWebmMuxing (jobID string ) ([]models.ProgressiveWebMMuxing , error ) {
1079
+ encodingS := services .NewEncodingService (p .client )
1080
+
1081
+ var totalCount int64 = 1
1082
+ var muxings []models.ProgressiveWebMMuxing
1083
+ for int64 (len (muxings )) < totalCount {
1084
+ resp , err := encodingS .ListProgressiveWebMMuxing (jobID , int64 (len (muxings )), 100 )
1085
+ if err != nil {
1086
+ return nil , err
1087
+ }
1088
+ totalCount = int64Value (resp .Data .Result .TotalCount )
1089
+ muxings = append (muxings , resp .Data .Result .Items ... )
1090
+ }
1091
+
1092
+ return muxings , nil
1093
+ }
1094
+
1095
+ func (p * bitmovinProvider ) addMOVOutputFilesInfo (job * db.Job , status * provider.JobStatus ) error {
1096
+ muxings , err := p .listMOVMuxing (job .ProviderJobID )
1097
+ if err != nil {
1098
+ return err
1099
+ }
1100
+
1101
+ encodingS := services .NewEncodingService (p .client )
1102
+ for _ , muxing := range muxings {
1103
+ resp , err := encodingS .RetrieveProgressiveMOVMuxingInformation (job .ProviderJobID , stringValue (muxing .ID ))
1104
+ if err != nil {
1105
+ return err
1106
+ }
1107
+
1108
+ info := resp .Data .Result
1109
+ if len (info .VideoTracks ) == 0 {
1110
+ return fmt .Errorf ("no video track found for encodingID %s muxingID %s" , job .ProviderJobID , stringValue (muxing .ID ))
1111
+ }
1112
+
1113
+ status .Output .Files = append (status .Output .Files , provider.OutputFile {
1114
+ Path : status .Output .Destination + stringValue (muxing .Filename ),
1115
+ Container : stringValue (info .ContainerFormat ),
1116
+ FileSize : int64Value (info .FileSize ),
1117
+ VideoCodec : stringValue (info .VideoTracks [0 ].Codec ),
1118
+ Width : int64Value (info .VideoTracks [0 ].FrameWidth ),
1119
+ Height : int64Value (info .VideoTracks [0 ].FrameHeight ),
1120
+ })
1121
+ }
1122
+ return nil
1123
+ }
1124
+
1125
+ func (p * bitmovinProvider ) listMOVMuxing (jobID string ) ([]models.ProgressiveMOVMuxing , error ) {
1126
+ encodingS := services .NewEncodingService (p .client )
1127
+
1128
+ var totalCount int64 = 1
1129
+ var muxings []models.ProgressiveMOVMuxing
1130
+ for int64 (len (muxings )) < totalCount {
1131
+ resp , err := encodingS .ListProgressiveMOVMuxing (jobID , int64 (len (muxings )), 100 )
1132
+ if err != nil {
1133
+ return nil , err
1134
+ }
1135
+ totalCount = int64Value (resp .Data .Result .TotalCount )
1136
+ muxings = append (muxings , resp .Data .Result .Items ... )
1137
+ }
1138
+
1139
+ return muxings , nil
1140
+ }
1141
+
1047
1142
func (p * bitmovinProvider ) addSourceInfo (job * db.Job , status * provider.JobStatus ) error {
1048
1143
encodingS := services .NewEncodingService (p .client )
1049
1144
resp , err := encodingS .ListStream (job .ProviderJobID , 0 , 1 )
0 commit comments