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