audiobookshelf/server/models/MediaStream.js

49 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2023-03-15 23:42:35 +01:00
const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class MediaStream extends Model { }
MediaStream.init({
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
index: DataTypes.INTEGER,
codecType: DataTypes.STRING,
codec: DataTypes.STRING,
channels: DataTypes.INTEGER,
channelLayout: DataTypes.STRING,
bitrate: DataTypes.INTEGER,
timeBase: DataTypes.STRING,
duration: DataTypes.FLOAT,
sampleRate: DataTypes.INTEGER,
language: DataTypes.STRING,
default: DataTypes.BOOLEAN,
// Video stream specific
profile: DataTypes.STRING,
width: DataTypes.INTEGER,
height: DataTypes.INTEGER,
codedWidth: DataTypes.INTEGER,
codedHeight: DataTypes.INTEGER,
pixFmt: DataTypes.STRING,
level: DataTypes.INTEGER,
frameRate: DataTypes.FLOAT,
colorSpace: DataTypes.STRING,
colorRange: DataTypes.STRING,
chromaLocation: DataTypes.STRING,
displayAspectRatio: DataTypes.FLOAT,
// Chapters JSON
chapters: DataTypes.JSON
}, {
sequelize,
2023-03-19 21:19:22 +01:00
modelName: 'mediaStream'
2023-03-15 23:42:35 +01:00
})
2023-03-19 21:19:22 +01:00
const { mediaFile } = sequelize.models
2023-03-15 23:42:35 +01:00
2023-03-19 21:19:22 +01:00
mediaFile.hasMany(MediaStream)
MediaStream.belongsTo(mediaFile)
2023-03-15 23:42:35 +01:00
return MediaStream
}