video.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package archive
  2. import (
  3. "sync"
  4. )
  5. const (
  6. //VideoUploadInfo 转码 创建上传
  7. VideoUploadInfo = 0
  8. //VideoXcodeSDFail 一转失败
  9. VideoXcodeSDFail = 1
  10. //VideoXcodeSDFinish 一转成功
  11. VideoXcodeSDFinish = 2
  12. //VideoXcodeHDFail 二转失败
  13. VideoXcodeHDFail = 3
  14. //VideoXcodeHDFinish 二转成功
  15. VideoXcodeHDFinish = 4
  16. //VideoDispatchRunning 分发中
  17. VideoDispatchRunning = 5
  18. //VideoDispatchFinish 分发成功
  19. VideoDispatchFinish = 6
  20. //XcodeFailZero fail zero
  21. XcodeFailZero = 0
  22. //VideoStatusOpen 开放浏览
  23. VideoStatusOpen = int16(0)
  24. //VideoStatusAccess 会员可见
  25. VideoStatusAccess = int16(10000)
  26. //VideoStatusWait 待审
  27. VideoStatusWait = int16(-1)
  28. //VideoStatusRecicle 打回
  29. VideoStatusRecicle = int16(-2)
  30. //VideoStatusLock 锁定
  31. VideoStatusLock = int16(-4)
  32. //VideoStatusXcodeFail 转码失败
  33. VideoStatusXcodeFail = int16(-16)
  34. //VideoStatusSubmit 创建提交
  35. VideoStatusSubmit = int16(-30)
  36. //VideoStatusDelete 删除
  37. VideoStatusDelete = int16(-100)
  38. // VideoStatusRecycle video status which be recycled
  39. VideoStatusRecycle = int16(-2)
  40. //VideoRelationBind video relation state
  41. VideoRelationBind = int16(0)
  42. )
  43. //VideoUpInfo info
  44. type VideoUpInfo struct {
  45. Nw *Video
  46. Old *Video
  47. }
  48. // Video struct
  49. type Video struct {
  50. ID int64 `json:"id"`
  51. Filename string `json:"filename"`
  52. Cid int64 `json:"cid"`
  53. Aid int64 `json:"aid"`
  54. Title string `json:"eptitle"`
  55. Desc string `json:"description"`
  56. SrcType string `json:"src_type"`
  57. Duration int64 `json:"duration"`
  58. Filesize int64 `json:"filesize"`
  59. Resolutions string `json:"resolutions"`
  60. Playurl string `json:"playurl"`
  61. FailCode int8 `json:"failinfo"`
  62. Index int `json:"index_order"`
  63. Attribute int32 `json:"attribute"`
  64. XcodeState int8 `json:"xcode_state"`
  65. State int8 `json:"state"`
  66. Status int16 `json:"status"`
  67. CTime string `json:"ctime"`
  68. MTime string `json:"mtime"`
  69. }
  70. // VideoAuditCache video audit count
  71. type VideoAuditCache struct {
  72. Data map[int16]map[string]int
  73. sync.Mutex
  74. }
  75. // XcodeTimeCache store video xcode time list
  76. type XcodeTimeCache struct {
  77. Data map[int8][]int
  78. sync.Mutex
  79. }
  80. // AttrVal get attribute value.
  81. func (v *Video) AttrVal(bit uint) int32 {
  82. return (v.Attribute >> bit) & int32(1)
  83. }