Mercurial > libavformat.hg
annotate dvcore.h @ 228:542e6d639bb9 libavformat
fixed endianness dependancies (untested)
author | bellard |
---|---|
date | Mon, 08 Sep 2003 20:00:13 +0000 |
parents | 184d22d04c84 |
children | 3d92f793fd67 |
rev | line source |
---|---|
203
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
1 /* |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
2 * DV format muxer/demuxer |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
3 * Copyright (c) 2003 Roman Shaposhnik |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
4 * |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
5 * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
6 * of DV technical info, and SMPTE 314M specification. |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
7 * |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
8 * This library is free software; you can redistribute it and/or |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
11 * version 2 of the License, or (at your option) any later version. |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
12 * |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
13 * This library is distributed in the hope that it will be useful, |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
17 * |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
19 * License along with this library; if not, write to the Free Software |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
21 */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
22 #include <time.h> |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
23 #include "avformat.h" |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
24 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
25 /* |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
26 * DVprofile is used to express the differences between various |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
27 * DV flavors. For now it's primarily used for differentiating |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
28 * 525/60 and 625/50, but the plans are to use it for various |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
29 * DV specs as well (e.g. SMPTE314M vs. IEC 61834). |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
30 */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
31 typedef struct DVprofile { |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
32 int dsf; /* value of the dsf in the DV header */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
33 int frame_size; /* total size of one frame in bytes */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
34 int difseg_size; /* number of DIF segments */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
35 int frame_rate; |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
36 int frame_rate_base; |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
37 int ltc_divisor; /* FPS from the LTS standpoint */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
38 int height; /* picture height in pixels */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
39 uint16_t *video_place; /* positions of all DV macro blocks */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
40 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
41 int audio_stride; /* size of audio_shuffle table */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
42 int audio_min_samples[3]; /* min ammount of audio samples */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
43 /* for 48Khz, 44.1Khz and 32Khz */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
44 int audio_samples_dist[5];/* how many samples are supposed to be */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
45 /* in each frame in a 5 frames window */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
46 const uint16_t (*audio_shuffle)[9]; /* PCM shuffling table */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
47 } DVprofile; |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
48 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
49 typedef struct DVMuxContext { |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
50 const DVprofile* sys; /* Current DV profile. E.g.: 525/60, 625/50 */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
51 uint8_t frame_buf[144000]; /* frame under contruction */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
52 FifoBuffer audio_data; /* Fifo for storing excessive amounts of PCM */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
53 int frames; /* Number of a current frame */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
54 time_t start_time; /* Start time of recording */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
55 uint8_t aspect; /* Aspect ID 0 - 4:3, 7 - 16:9 */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
56 int ast, vst; /* Audio and Video stream indecies */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
57 int has_audio; /* frame under contruction has audio */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
58 int has_video; /* frame under contruction has video */ |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
59 } DVMuxContext; |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
60 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
61 void dv_format_frame(DVMuxContext *, uint8_t*); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
62 void dv_inject_audio(DVMuxContext *, uint8_t*, uint8_t*); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
63 void dv_inject_video(DVMuxContext *, uint8_t*, uint8_t*); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
64 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
65 int dv_extract_audio(uint8_t*, uint8_t*, AVCodecContext*); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
66 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
67 int dv_audio_frame_size(const DVprofile*, int); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
68 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
69 void dv_assemble_frame(DVMuxContext *, uint8_t*, uint8_t*, int); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
70 int dv_core_init(DVMuxContext *, AVStream*[]); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
71 void dv_core_delete(DVMuxContext *); |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
72 |
184d22d04c84
* Phase 1 for DV encoding support. Muxing/demuxing of DV streams is now
romansh
parents:
diff
changeset
|
73 const DVprofile* dv_frame_profile(uint8_t*); |