mirror of
https://github.com/aler9/gortsplib
synced 2025-10-29 01:33:00 +08:00
rename parameter in H264 SPS
This commit is contained in:
@@ -166,7 +166,7 @@ func findSEITimingInfo(nalus [][]byte, sps *SPS) (*seiTimingInfo, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
// DTSExtractor is a utility that allows to extract NALU DTS from PTS.
|
// DTSExtractor allows to extract DTS from PTS.
|
||||||
type DTSExtractor struct {
|
type DTSExtractor struct {
|
||||||
sps []byte
|
sps []byte
|
||||||
spsp *SPS
|
spsp *SPS
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ type SPS struct {
|
|||||||
MaxNumRefFrames uint32
|
MaxNumRefFrames uint32
|
||||||
GapsInFrameNumValueAllowedFlag bool
|
GapsInFrameNumValueAllowedFlag bool
|
||||||
PicWidthInMbsMinus1 uint32
|
PicWidthInMbsMinus1 uint32
|
||||||
PicHeightInMbsMinus1 uint32
|
PicHeightInMapUnitsMinus1 uint32
|
||||||
FrameMbsOnlyFlag bool
|
FrameMbsOnlyFlag bool
|
||||||
|
|
||||||
// FrameMbsOnlyFlag == false
|
// FrameMbsOnlyFlag == false
|
||||||
@@ -637,7 +637,7 @@ func (s *SPS) Unmarshal(buf []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.PicHeightInMbsMinus1, err = bits.ReadGolombUnsigned(buf, &pos)
|
s.PicHeightInMapUnitsMinus1, err = bits.ReadGolombUnsigned(buf, &pos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -711,10 +711,11 @@ func (s SPS) Height() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if s.FrameCropping != nil {
|
if s.FrameCropping != nil {
|
||||||
return int(((2 - f) * (s.PicHeightInMbsMinus1 + 1) * 16) - (s.FrameCropping.TopOffset+s.FrameCropping.BottomOffset)*2)
|
return int(((2 - f) * (s.PicHeightInMapUnitsMinus1 + 1) * 16) -
|
||||||
|
(s.FrameCropping.TopOffset+s.FrameCropping.BottomOffset)*2)
|
||||||
}
|
}
|
||||||
|
|
||||||
return int((2 - f) * (s.PicHeightInMbsMinus1 + 1) * 16)
|
return int((2 - f) * (s.PicHeightInMapUnitsMinus1 + 1) * 16)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FPS returns the frames per second of the video.
|
// FPS returns the frames per second of the video.
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
MaxNumRefFrames: 1,
|
MaxNumRefFrames: 1,
|
||||||
GapsInFrameNumValueAllowedFlag: true,
|
GapsInFrameNumValueAllowedFlag: true,
|
||||||
PicWidthInMbsMinus1: 21,
|
PicWidthInMbsMinus1: 21,
|
||||||
PicHeightInMbsMinus1: 17,
|
PicHeightInMapUnitsMinus1: 17,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
VUI: &SPS_VUI{
|
VUI: &SPS_VUI{
|
||||||
@@ -61,7 +61,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 2,
|
Log2MaxPicOrderCntLsbMinus4: 2,
|
||||||
MaxNumRefFrames: 4,
|
MaxNumRefFrames: 4,
|
||||||
PicWidthInMbsMinus1: 79,
|
PicWidthInMbsMinus1: 79,
|
||||||
PicHeightInMbsMinus1: 44,
|
PicHeightInMapUnitsMinus1: 44,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
VUI: &SPS_VUI{
|
VUI: &SPS_VUI{
|
||||||
@@ -95,16 +95,16 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
0x00, 0x00, 0x03, 0x00, 0xf0, 0x3c, 0x60, 0xc9, 0x20,
|
0x00, 0x00, 0x03, 0x00, 0xf0, 0x3c, 0x60, 0xc9, 0x20,
|
||||||
},
|
},
|
||||||
SPS{
|
SPS{
|
||||||
ProfileIdc: 66,
|
ProfileIdc: 66,
|
||||||
ConstraintSet0Flag: true,
|
ConstraintSet0Flag: true,
|
||||||
ConstraintSet1Flag: true,
|
ConstraintSet1Flag: true,
|
||||||
LevelIdc: 40,
|
LevelIdc: 40,
|
||||||
PicOrderCntType: 2,
|
PicOrderCntType: 2,
|
||||||
MaxNumRefFrames: 3,
|
MaxNumRefFrames: 3,
|
||||||
PicWidthInMbsMinus1: 119,
|
PicWidthInMbsMinus1: 119,
|
||||||
PicHeightInMbsMinus1: 67,
|
PicHeightInMapUnitsMinus1: 67,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
FrameCropping: &SPS_FrameCropping{
|
FrameCropping: &SPS_FrameCropping{
|
||||||
BottomOffset: 4,
|
BottomOffset: 4,
|
||||||
},
|
},
|
||||||
@@ -140,7 +140,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 2,
|
Log2MaxPicOrderCntLsbMinus4: 2,
|
||||||
MaxNumRefFrames: 4,
|
MaxNumRefFrames: 4,
|
||||||
PicWidthInMbsMinus1: 119,
|
PicWidthInMbsMinus1: 119,
|
||||||
PicHeightInMbsMinus1: 67,
|
PicHeightInMapUnitsMinus1: 67,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
FrameCropping: &SPS_FrameCropping{
|
FrameCropping: &SPS_FrameCropping{
|
||||||
@@ -180,7 +180,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 5,
|
Log2MaxPicOrderCntLsbMinus4: 5,
|
||||||
MaxNumRefFrames: 4,
|
MaxNumRefFrames: 4,
|
||||||
PicWidthInMbsMinus1: 119,
|
PicWidthInMbsMinus1: 119,
|
||||||
PicHeightInMbsMinus1: 33,
|
PicHeightInMapUnitsMinus1: 33,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
FrameCropping: &SPS_FrameCropping{
|
FrameCropping: &SPS_FrameCropping{
|
||||||
BottomOffset: 2,
|
BottomOffset: 2,
|
||||||
@@ -219,7 +219,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 4,
|
Log2MaxPicOrderCntLsbMinus4: 4,
|
||||||
MaxNumRefFrames: 1,
|
MaxNumRefFrames: 1,
|
||||||
PicWidthInMbsMinus1: 79,
|
PicWidthInMbsMinus1: 79,
|
||||||
PicHeightInMbsMinus1: 59,
|
PicHeightInMapUnitsMinus1: 59,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
Log2MaxFrameNumMinus4: 10,
|
Log2MaxFrameNumMinus4: 10,
|
||||||
@@ -280,7 +280,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
MaxNumRefFrames: 1,
|
MaxNumRefFrames: 1,
|
||||||
GapsInFrameNumValueAllowedFlag: true,
|
GapsInFrameNumValueAllowedFlag: true,
|
||||||
PicWidthInMbsMinus1: 159,
|
PicWidthInMbsMinus1: 159,
|
||||||
PicHeightInMbsMinus1: 89,
|
PicHeightInMapUnitsMinus1: 89,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
VUI: &SPS_VUI{
|
VUI: &SPS_VUI{
|
||||||
@@ -319,7 +319,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 4,
|
Log2MaxPicOrderCntLsbMinus4: 4,
|
||||||
MaxNumRefFrames: 2,
|
MaxNumRefFrames: 2,
|
||||||
PicWidthInMbsMinus1: 119,
|
PicWidthInMbsMinus1: 119,
|
||||||
PicHeightInMbsMinus1: 67,
|
PicHeightInMapUnitsMinus1: 67,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
FrameCropping: &SPS_FrameCropping{
|
FrameCropping: &SPS_FrameCropping{
|
||||||
@@ -373,7 +373,7 @@ func TestSPSUnmarshal(t *testing.T) {
|
|||||||
Log2MaxPicOrderCntLsbMinus4: 5,
|
Log2MaxPicOrderCntLsbMinus4: 5,
|
||||||
MaxNumRefFrames: 1,
|
MaxNumRefFrames: 1,
|
||||||
PicWidthInMbsMinus1: 119,
|
PicWidthInMbsMinus1: 119,
|
||||||
PicHeightInMbsMinus1: 67,
|
PicHeightInMapUnitsMinus1: 67,
|
||||||
FrameMbsOnlyFlag: true,
|
FrameMbsOnlyFlag: true,
|
||||||
Direct8x8InferenceFlag: true,
|
Direct8x8InferenceFlag: true,
|
||||||
FrameCropping: &SPS_FrameCropping{
|
FrameCropping: &SPS_FrameCropping{
|
||||||
|
|||||||
Reference in New Issue
Block a user