18045010223
2025-07-07 0d3a683a0c97154b1f2e6657398664537e4e3e82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package org.yzh.protocol.commons.transform.parameter;
 
import io.github.yezhihao.protostar.Schema;
import io.github.yezhihao.protostar.annotation.Field;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
 
/**
 * 音视频参数设置
 * @author yezhihao
 * https://gitee.com/yezhihao/jt808-server
 */
@ToString
@Data
@Accessors(chain = true)
public class ParamVideo {
 
    public static final Integer key = 0x0075;
 
    protected static final Schema<ParamVideo> SCHEMA_2 = new ParamVideoSchema2();
 
    @Field(desc = "实时流编码模式:0.CBR(固定码率) 1.VBR(可变码率) 2.ABR(平均码率) 100~ 127.自定义")
    private byte realtimeEncode;
    @Field(desc = "实时流分辨率:0.QCIF 1.CIF 2.WCIF 3.D1 4.WD1 5.720P 6.1080P 100~127.自定义")
    private byte realtimeResolution;
    @Field(desc = "实时流关键帧间隔(1~1000帧)")
    private short realtimeFrameInterval;
    @Field(desc = "实时流目标帧率(1~120帧)")
    private byte realtimeFrameRate;
    @Field(desc = "实时流目标码率(kbps)")
    private int realtimeBitRate;
 
    @Field(desc = "存储流编码模式:0.CBR(固定码率) 1.VBR(可变码率) 2.ABR(平均码率) 100~ 127.自定义")
    private byte storageEncode;
    @Field(desc = "存储流分辨率:0.QCIF 1.CIF 2.WCIF 3.D1 4.WD1 5.720P 6.1080P 100~127.自定义")
    private byte storageResolution;
    @Field(desc = "存储流关键帧间隔(1~1000帧)")
    private short storageFrameInterval;
    @Field(desc = "存储流目标帧率(1~120帧)")
    private byte storageFrameRate;
    @Field(desc = "存储流目标码率(kbps)")
    private int storageBitRate;
 
    @Field(desc = "OSD字幕叠加设置(按位,0.表示不叠加 1.表示叠加):" +
            " [0]日期和时间" +
            " [1]车牌号码" +
            " [2]逻辑通道号" +
            " [3]经纬度" +
            " [4]行驶记录速度" +
            " [5]卫星定位速度" +
            " [6]连续驾驶时间" +
            " [7~l0]保留" +
            " [11~l5]自定义")
    private short odsConfig;
    @Field(desc = "是否启用音频输出:0.不启用 1.启用")
    private byte audioEnabled;
 
    public static class ParamVideoSchema2 implements Schema<ParamVideo> {
 
        private ParamVideoSchema2() {
        }
 
        @Override
        public ParamVideo readFrom(ByteBuf input) {
            ParamVideo message = new ParamVideo();
            message.realtimeEncode = input.readByte();
            message.realtimeResolution = input.readByte();
            message.realtimeFrameInterval = input.readShort();
            message.realtimeFrameRate = input.readByte();
            message.realtimeBitRate = input.readInt();
 
            message.storageEncode = input.readByte();
            message.storageResolution = input.readByte();
            message.storageFrameInterval = input.readShort();
            message.storageFrameRate = input.readByte();
            message.storageBitRate = input.readInt();
 
            message.odsConfig = input.readShort();
            return message;
        }
 
        @Override
        public void writeTo(ByteBuf output, ParamVideo message) {
            output.writeByte(message.realtimeEncode);
            output.writeByte(message.realtimeResolution);
            output.writeShort(message.realtimeFrameInterval);
            output.writeByte(message.realtimeFrameRate);
            output.writeInt(message.realtimeBitRate);
 
            output.writeByte(message.storageEncode);
            output.writeByte(message.storageResolution);
            output.writeShort(message.storageFrameInterval);
            output.writeByte(message.storageFrameRate);
            output.writeInt(message.storageBitRate);
 
            output.writeShort(message.odsConfig);
        }
    }
}