github.com/cnotch/ipchub@v1.1.0/av/codec/hevc/shortcut.go (about)

     1  // Copyright (c) 2019,CAOHONGJU All rights reserved.
     2  // Use of this source code is governed by a MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package hevc
     6  
     7  import "github.com/cnotch/ipchub/av/codec"
     8  
     9  // MetadataIsReady .
    10  func MetadataIsReady(vm *codec.VideoMeta) bool {
    11  	vps := vm.Vps
    12  	sps := vm.Sps //ParameterSet(ParameterSetSps)
    13  	pps := vm.Pps //ParameterSet(ParameterSetPps)
    14  	if len(vps) == 0 || len(sps) == 0 || len(pps) == 0 {
    15  		return false
    16  	}
    17  
    18  	if vm.Width == 0 {
    19  		// decode
    20  		var rawsps H265RawSPS
    21  		if err := rawsps.Decode(sps); err != nil {
    22  			return false
    23  		}
    24  		vm.Width = rawsps.Width()
    25  		vm.Height = rawsps.Height()
    26  		vm.FixedFrameRate = rawsps.IsFixedFrameRate()
    27  		vm.FrameRate = rawsps.FrameRate()
    28  	}
    29  	return true
    30  }
    31  
    32  // NulType .
    33  func NulType(nt byte) byte {
    34  	return (nt >> 1) & 0x3f
    35  }