Example #1
0
/**
 * Get rotation of the Stream by
 * 1. MetaData
 * 2. Metrix
 */
func (s *Stream) GetRotation() int64 {
	dictionaryEntry := s.Metadata().Get("rotate")
	if dictionaryEntry != nil {
		value := dictionaryEntry.Value()
		strings.TrimRight(value, "%")

		rotation, err := strconv.ParseInt(value, 10, 64)
		if err == nil {
			return rotation
		}
	}

	var displaymatrix (*C.uint8_t) = C.av_stream_get_side_data((*C.struct_AVStream)(s), C.AV_PKT_DATA_DISPLAYMATRIX, nil)
	if displaymatrix != nil {
		return -int64(C.av_display_rotation_get((*C.int32_t)(unsafe.Pointer(displaymatrix))))
	}

	return 0
}
Example #2
0
File: avformat.go Project: ovr/goav
//Get side information from stream.
func (s *Stream) AvStreamGetSideData(t AvPacketSideDataType, z int) *uint8 {
	return (*uint8)(C.av_stream_get_side_data((*C.struct_AVStream)(s), (C.enum_AVPacketSideDataType)(t), (*C.int)(unsafe.Pointer(&z))))
}