Code refactoring for xiaomi source
This commit is contained in:
@@ -85,10 +85,7 @@ func xiaofangLogin(conn *tutk.Conn, password string) error {
|
||||
}
|
||||
|
||||
_, data, err = conn.ReadCommand()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@@ -110,14 +107,8 @@ func (c *Client) ReadPacket() (hdr, payload []byte, err error) {
|
||||
switch hdr[0] {
|
||||
case tutk.CodecH264, tutk.CodecH265:
|
||||
payload, err = DecodeVideo(payload, c.key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
case tutk.CodecAAC:
|
||||
payload, err = crypto.Decode(payload, c.key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@@ -62,7 +62,7 @@ func probe(client *Client) ([]*core.Media, error) {
|
||||
var vcodec, acodec *core.Codec
|
||||
|
||||
for {
|
||||
// 0 5000
|
||||
// 0 5000 codec
|
||||
// 2 0000 codec params
|
||||
// 4 01 active clients
|
||||
// 5 34 unknown const
|
||||
@@ -83,7 +83,6 @@ func probe(client *Client) ([]*core.Media, error) {
|
||||
if codec == tutk.CodecH264 {
|
||||
if h264.NALUType(avcc) == h264.NALUTypeSPS {
|
||||
vcodec = h264.AVCCToCodec(avcc)
|
||||
vcodec.FmtpLine = ""
|
||||
}
|
||||
} else {
|
||||
if h265.NALUType(avcc) == h265.NALUTypeVPS {
|
||||
|
||||
Reference in New Issue
Block a user