1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 module ffmpeg.libavcodec.dv_profile;
19 
20 import ffmpeg.libavcodec;
21 import ffmpeg.libavutil;
22 
23 extern (C) @nogc nothrow:
24 
25 /* minimum number of bytes to read from a DV stream in order to
26  * determine the profile */
27 enum DV_PROFILE_BYTES = 6 * 80; /* 6 DIF blocks */
28 
29 /*
30  * AVDVProfile is used to express the differences between various
31  * DV flavors. For now it's primarily used for differentiating
32  * 525/60 and 625/50, but the plans are to use it for various
33  * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
34  */
35 struct AVDVProfile
36 {
37     int dsf; /* value of the dsf in the DV header */
38     int video_stype; /* stype for VAUX source pack */
39     int frame_size; /* total size of one frame in bytes */
40     int difseg_size; /* number of DIF segments per DIF channel */
41     int n_difchan; /* number of DIF channels per frame */
42     AVRational time_base; /* 1/framerate */
43     int ltc_divisor; /* FPS from the LTS standpoint */
44     int height; /* picture height in pixels */
45     int width; /* picture width in pixels */
46     AVRational[2] sar; /* sample aspect ratios for 4:3 and 16:9 */
47     AVPixelFormat pix_fmt; /* picture pixel format */
48     int bpm; /* blocks per macroblock */
49     const(ubyte)* block_sizes; /* AC block sizes, in bits */
50     int audio_stride; /* size of audio_shuffle table */
51     int[3] audio_min_samples; /* min amount of audio samples */
52     /* for 48kHz, 44.1kHz and 32kHz */
53     int[5] audio_samples_dist; /* how many samples are supposed to be */
54     /* in each frame in a 5 frames window */
55     const(ubyte)[9]* audio_shuffle; /* PCM shuffling table */
56 }
57 
58 /**
59  * Get a DV profile for the provided compressed frame.
60  *
61  * @param sys the profile used for the previous frame, may be NULL
62  * @param frame the compressed data buffer
63  * @param buf_size size of the buffer in bytes
64  * @return the DV profile for the supplied data or NULL on failure
65  */
66 const(AVDVProfile)* av_dv_frame_profile (
67     const(AVDVProfile)* sys,
68     const(ubyte)* frame,
69     uint buf_size);
70 
71 /**
72  * Get a DV profile for the provided stream parameters.
73  */
74 const(AVDVProfile)* av_dv_codec_profile (int width, int height, AVPixelFormat pix_fmt);
75 
76 /**
77  * Get a DV profile for the provided stream parameters.
78  * The frame rate is used as a best-effort parameter.
79  */
80 const(AVDVProfile)* av_dv_codec_profile2 (int width, int height, AVPixelFormat pix_fmt, AVRational frame_rate);
81 
82 /* AVCODEC_DV_PROFILE_H */