]> git.sesse.net Git - ffmpeg/blob - libavcodec/dvdata.h
libvorbis: remove unneeded e_o_s check
[ffmpeg] / libavcodec / dvdata.h
1 /*
2  * Constants for DV codec
3  * Copyright (c) 2002 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 /**
23  * @file
24  * Constants for DV codec.
25  */
26
27 #ifndef AVCODEC_DVDATA_H
28 #define AVCODEC_DVDATA_H
29
30 #include "libavutil/rational.h"
31 #include "avcodec.h"
32
33 typedef struct DVwork_chunk {
34     uint16_t  buf_offset;
35     uint16_t  mb_coordinates[5];
36 } DVwork_chunk;
37
38 /*
39  * DVprofile is used to express the differences between various
40  * DV flavors. For now it's primarily used for differentiating
41  * 525/60 and 625/50, but the plans are to use it for various
42  * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
43  */
44 typedef struct DVprofile {
45     int              dsf;                   /* value of the dsf in the DV header */
46     int              video_stype;           /* stype for VAUX source pack */
47     int              frame_size;            /* total size of one frame in bytes */
48     int              difseg_size;           /* number of DIF segments per DIF channel */
49     int              n_difchan;             /* number of DIF channels per frame */
50     AVRational       time_base;             /* 1/framerate */
51     int              ltc_divisor;           /* FPS from the LTS standpoint */
52     int              height;                /* picture height in pixels */
53     int              width;                 /* picture width in pixels */
54     AVRational       sar[2];                /* sample aspect ratios for 4:3 and 16:9 */
55     DVwork_chunk    *work_chunks;           /* each thread gets its own chunk of frame to work on */
56     uint32_t        *idct_factor;           /* set of iDCT factor tables */
57     enum PixelFormat pix_fmt;               /* picture pixel format */
58     int              bpm;                   /* blocks per macroblock */
59     const uint8_t   *block_sizes;           /* AC block sizes, in bits */
60     int              audio_stride;          /* size of audio_shuffle table */
61     int              audio_min_samples[3];  /* min amount of audio samples */
62                                             /* for 48kHz, 44.1kHz and 32kHz */
63     int              audio_samples_dist[5]; /* how many samples are supposed to be */
64                                             /* in each frame in a 5 frames window */
65     const uint8_t  (*audio_shuffle)[9];     /* PCM shuffling table */
66 } DVprofile;
67
68 enum dv_section_type {
69      dv_sect_header  = 0x1f,
70      dv_sect_subcode = 0x3f,
71      dv_sect_vaux    = 0x56,
72      dv_sect_audio   = 0x76,
73      dv_sect_video   = 0x96,
74 };
75
76 enum dv_pack_type {
77      dv_header525     = 0x3f, /* see dv_write_pack for important details on */
78      dv_header625     = 0xbf, /* these two packs */
79      dv_timecode      = 0x13,
80      dv_audio_source  = 0x50,
81      dv_audio_control = 0x51,
82      dv_audio_recdate = 0x52,
83      dv_audio_rectime = 0x53,
84      dv_video_source  = 0x60,
85      dv_video_control = 0x61,
86      dv_video_recdate = 0x62,
87      dv_video_rectime = 0x63,
88      dv_unknown_pack  = 0xff,
89 };
90
91 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
92 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
93 #define DV_PROFILE_IS_720p50(p)  (((p)->video_stype == 0x18) && ((p)->dsf == 1))
94
95 /* minimum number of bytes to read from a DV stream in order to
96    determine the profile */
97 #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
98
99 /**
100  * largest possible DV frame, in bytes (1080i50)
101  */
102 #define DV_MAX_FRAME_SIZE 576000
103
104 /**
105  * maximum number of blocks per macroblock in any DV format
106  */
107 #define DV_MAX_BPM 8
108
109 const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
110                                          const uint8_t* frame, unsigned buf_size);
111 const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
112
113 #endif /* AVCODEC_DVDATA_H */