-
Notifications
You must be signed in to change notification settings - Fork 0
/
libavcodec_dv_profile.go
113 lines (89 loc) · 3.39 KB
/
libavcodec_dv_profile.go
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
102
103
104
105
106
107
108
109
110
111
112
113
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package ffmpeg
//#cgo pkg-config: libavcodec libavutil
//#include <stdint.h>
//#include "libavutil/pixfmt.h"
//#include "libavutil/rational.h"
//#include "libavcodec/avcodec.h"
//#include "libavcodec/dv_profile.h"
import "C"
import (
"unsafe"
)
const DV_PROFILE_BYTES = 480
/* minimum number of bytes to read from a DV stream in order to
* determine the profile */
/* 6 DIF blocks */
/*
* AVDVProfile is used to express the differences between various
* DV flavors. For now it's primarily used for differentiating
* 525/60 and 625/50, but the plans are to use it for various
* DV specs as well (e.g. SMPTE314M vs. IEC 61834).
*/
type AVDVProfile struct {
Dsf int32
Video_stype int32
Frame_size int32
Difseg_size int32
N_difchan int32
Time_base AVRational
Ltc_divisor int32
Height int32
Width int32
Sar [2]AVRational
Pix_fmt AVPixelFormat
Bpm int32
Block_sizes *uint8
Audio_stride int32
Audio_min_samples [3]int32
Audio_samples_dist [5]int32
Audio_shuffle* [9]uint8
}
/**
* Get a DV profile for the provided compressed frame.
*
* @param sys the profile used for the previous frame, may be NULL
* @param frame the compressed data buffer
* @param buf_size size of the buffer in bytes
* @return the DV profile for the supplied data or NULL on failure
*/
func Av_dv_frame_profile(sys *AVDVProfile,
frame *uint8, buf_size uint32) *AVDVProfile {
return (*AVDVProfile)(unsafe.Pointer(C.av_dv_frame_profile(
(*C.struct_AVDVProfile)(unsafe.Pointer(sys)),
(*C.uchar)(unsafe.Pointer(frame)), C.unsigned(buf_size))))
}
/**
* Get a DV profile for the provided stream parameters.
*/
func Av_dv_codec_profile(width int32, height int32, pix_fmt AVPixelFormat) *AVDVProfile {
return (*AVDVProfile)(unsafe.Pointer(C.av_dv_codec_profile(C.int(width),
C.int(height), C.enum_AVPixelFormat(pix_fmt))))
}
/**
* Get a DV profile for the provided stream parameters.
* The frame rate is used as a best-effort parameter.
*/
func Av_dv_codec_profile2(width int32, height int32, pix_fmt AVPixelFormat, frame_rate AVRational) *AVDVProfile {
return (*AVDVProfile)(unsafe.Pointer(C.av_dv_codec_profile2(C.int(width),
C.int(height), C.enum_AVPixelFormat(pix_fmt),
*(*C.struct_AVRational)(unsafe.Pointer(&frame_rate)))))
}