annotate libmpdemux/nuppelvideo.h @ 27864:ab92ea15c414

sync w/r27895
author gpoirier
date Thu, 06 Nov 2008 12:41:23 +0000
parents e67b783d7289
children 4edc04d82a47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27192
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
1 /*
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
2 nuppelvideo.h taken from NuppelVideo, by
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
3 (c) Roman Hochleitner roman@mars.tuwien.ac.at
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
4
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
5 This program is free software; you can redistribute it and/or modify
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
6 it under the terms of the GNU General Public License as published by
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
7 the Free Software Foundation; either version 2 of the License, or
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
8 (at your option) any later version.
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
9
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
10 This program is distributed in the hope that it will be useful,
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
13 GNU General Public License for more details.
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
14
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
15 You should have received a copy of the GNU General Public License
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
16 along with this program; if not, write to the Free Software
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
e67b783d7289 Add standard license header for NuppelVideo, i.e. GPL v2+.
diego
parents: 26029
diff changeset
18 */
3807
alex
parents:
diff changeset
19
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
20 #ifndef MPLAYER_NUPPELVIDEO_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
21 #define MPLAYER_NUPPELVIDEO_H
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 21347
diff changeset
22
21347
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
23 #include "libavutil/intfloat_readwrite.h"
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
24
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
25 typedef struct __attribute__((packed)) rtfileheader
3807
alex
parents:
diff changeset
26 {
alex
parents:
diff changeset
27 char finfo[12]; // "NuppelVideo" + \0
alex
parents:
diff changeset
28 char version[5]; // "0.05" + \0
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
29 char pad1[3];
3807
alex
parents:
diff changeset
30 int width;
alex
parents:
diff changeset
31 int height;
alex
parents:
diff changeset
32 int desiredwidth; // 0 .. as it is
alex
parents:
diff changeset
33 int desiredheight; // 0 .. as it is
alex
parents:
diff changeset
34 char pimode; // P .. progressive
alex
parents:
diff changeset
35 // I .. interlaced (2 half pics) [NI]
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
36 char pad2[3];
3807
alex
parents:
diff changeset
37 double aspect; // 1.0 .. square pixel (1.5 .. e.g. width=480: width*1.5=720
alex
parents:
diff changeset
38 // for capturing for svcd material
alex
parents:
diff changeset
39 double fps;
alex
parents:
diff changeset
40 int videoblocks; // count of video-blocks -1 .. unknown 0 .. no video
alex
parents:
diff changeset
41 int audioblocks; // count of audio-blocks -1 .. unknown 0 .. no audio
alex
parents:
diff changeset
42 int textsblocks; // count of text-blocks -1 .. unknown 0 .. no text
alex
parents:
diff changeset
43 int keyframedist;
alex
parents:
diff changeset
44 } rtfileheader;
alex
parents:
diff changeset
45
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
46 typedef struct __attribute__((packed)) rtframeheader
3807
alex
parents:
diff changeset
47 {
alex
parents:
diff changeset
48 char frametype; // A .. Audio, V .. Video, S .. Sync, T .. Text
alex
parents:
diff changeset
49 // R .. Seekpoint: String RTjjjjjjjj (use full packet)
alex
parents:
diff changeset
50 // D .. Addition Data for Compressors
alex
parents:
diff changeset
51 // ct: R .. RTjpeg Tables
alex
parents:
diff changeset
52
alex
parents:
diff changeset
53 char comptype; // V: 0 .. Uncompressed [NI]
alex
parents:
diff changeset
54 // 1 .. RTJpeg
alex
parents:
diff changeset
55 // 2 .. RTJpeg with lzo afterwards
alex
parents:
diff changeset
56 // N .. black frame
alex
parents:
diff changeset
57 // L .. simply copy last frame (if lost frames)
alex
parents:
diff changeset
58 // A: 0 .. Uncompressed (44100/sec 16bit 2ch)
alex
parents:
diff changeset
59 // 1 .. lzo compression [NI]
alex
parents:
diff changeset
60 // 2 .. layer2 (packet) [NI]
alex
parents:
diff changeset
61 // 3 .. layer3 (packet) [NI]
alex
parents:
diff changeset
62 // F .. flac (lossless) [NI]
alex
parents:
diff changeset
63 // S .. shorten (lossless) [NI]
alex
parents:
diff changeset
64 // N .. null frame loudless
alex
parents:
diff changeset
65 // L .. simply copy last frame (may sound bad) NI
alex
parents:
diff changeset
66 // S: B .. Audio and Video sync point [NI]
alex
parents:
diff changeset
67 // A .. Audio Sync Information
alex
parents:
diff changeset
68 // timecode == effective dsp-frequency*100
alex
parents:
diff changeset
69 // when reaching this audio sync point
alex
parents:
diff changeset
70 // because many cheap soundcards are unexact
alex
parents:
diff changeset
71 // and have a range from 44000 to 44250
alex
parents:
diff changeset
72 // instead of the expected exact 44100 S./sec
alex
parents:
diff changeset
73 // V .. Next Video Sync
alex
parents:
diff changeset
74 // timecode == next video framenumber
alex
parents:
diff changeset
75 // S .. Audio,Video,Text Correlation [NI]
alex
parents:
diff changeset
76 char keyframe; // 0 .. keyframe
alex
parents:
diff changeset
77 // 1 .. nr of frame in gop => no keyframe
alex
parents:
diff changeset
78
alex
parents:
diff changeset
79 char filters; // Every bit stands for one type of filter
alex
parents:
diff changeset
80 // 1 .. Gauss 5 Pixel (8*m+2*l+2*r+2*a+2*b)/16 [NYI]
alex
parents:
diff changeset
81 // 2 .. Gauss 5 Pixel (8*m+1*l+1*r+1*a+1*b)/12 [NYI]
alex
parents:
diff changeset
82 // 4 .. Cartoon Filter [NI]
alex
parents:
diff changeset
83 // 8 .. Reserverd Filter [NI]
alex
parents:
diff changeset
84 // 16 .. Reserverd Filter [NI]
alex
parents:
diff changeset
85 // 32 .. Reserverd Filter [NI]
alex
parents:
diff changeset
86 // 64 .. Reserverd Filter [NI]
alex
parents:
diff changeset
87 // 128 .. Reserverd Filter [NI]
alex
parents:
diff changeset
88
alex
parents:
diff changeset
89 int timecode; // Timecodeinformation sec*1000 + msecs
alex
parents:
diff changeset
90
alex
parents:
diff changeset
91 int packetlength; // V,A,T: length of following data in stream
alex
parents:
diff changeset
92 // S: length of packet correl. information [NI]
alex
parents:
diff changeset
93 // R: do not use here! (fixed 'RTjjjjjjjjjjjjjj')
alex
parents:
diff changeset
94 } rtframeheader;
alex
parents:
diff changeset
95
16164
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
96 /* for MythTV */
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
97 typedef struct __attribute__((packed)) extendeddata
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
98 {
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
99 int version; // yes, this is repeated from the file header
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
100 int video_fourcc; // video encoding method used
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
101 int audio_fourcc; // audio encoding method used
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
102 // generic data
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
103 int audio_sample_rate;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
104 int audio_bits_per_sample;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
105 int audio_channels;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
106 // codec specific
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
107 // mp3lame
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
108 int audio_compression_ratio;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
109 int audio_quality;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
110 // rtjpeg
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
111 int rtjpeg_quality;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
112 int rtjpeg_luma_filter;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
113 int rtjpeg_chroma_filter;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
114 // libavcodec
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
115 int lavc_bitrate;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
116 int lavc_qmin;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
117 int lavc_qmax;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
118 int lavc_maxqdiff;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
119 // unused for later -- total size of 128 integers.
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
120 // new fields must be added at the end, above this comment.
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
121 int expansion[113];
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
122 } extendeddata;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
123
3807
alex
parents:
diff changeset
124 #define FRAMEHEADERSIZE sizeof(rtframeheader)
alex
parents:
diff changeset
125 #define FILEHEADERSIZE sizeof(rtfileheader)
alex
parents:
diff changeset
126
alex
parents:
diff changeset
127 typedef struct vidbuffertype
alex
parents:
diff changeset
128 {
alex
parents:
diff changeset
129 int sample;
alex
parents:
diff changeset
130 int timecode;
alex
parents:
diff changeset
131 int freeToEncode;
alex
parents:
diff changeset
132 int freeToBuffer;
alex
parents:
diff changeset
133 unsigned char *buffer_offset;
alex
parents:
diff changeset
134 } vidbuffertyp;
alex
parents:
diff changeset
135
alex
parents:
diff changeset
136 typedef struct audbuffertype
alex
parents:
diff changeset
137 {
alex
parents:
diff changeset
138 int sample;
alex
parents:
diff changeset
139 int timecode;
alex
parents:
diff changeset
140 int freeToEncode;
alex
parents:
diff changeset
141 int freeToBuffer;
alex
parents:
diff changeset
142 unsigned char *buffer_offset;
alex
parents:
diff changeset
143 } audbuffertyp;
alex
parents:
diff changeset
144
14896
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
145 #define le2me_rtfileheader(h) { \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
146 (h)->width = le2me_32((h)->width); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
147 (h)->height = le2me_32((h)->height); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
148 (h)->desiredwidth = le2me_32((h)->desiredwidth); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
149 (h)->desiredheight = le2me_32((h)->desiredheight); \
21347
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
150 (h)->aspect = av_int2dbl(le2me_64(*(uint64_t *)&(h)->aspect));\
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
151 (h)->fps = av_int2dbl(le2me_64(*(uint64_t *)&(h)->fps)); \
14896
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
152 (h)->videoblocks = le2me_32((h)->videoblocks); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
153 (h)->audioblocks = le2me_32((h)->audioblocks); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
154 (h)->textsblocks = le2me_32((h)->textsblocks); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
155 (h)->keyframedist = le2me_32((h)->keyframedist); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
156 }
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
157 #define le2me_rtframeheader(h) { \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
158 (h)->timecode = le2me_32((h)->timecode); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
159 (h)->packetlength = le2me_32((h)->packetlength); \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
160 }
16164
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
161 #define le2me_extendeddata(h) { \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
162 (h)->version = le2me_32((h)->version); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
163 (h)->video_fourcc = le2me_32((h)->video_fourcc); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
164 (h)->audio_fourcc = le2me_32((h)->audio_fourcc); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
165 (h)->audio_sample_rate = le2me_32((h)->audio_sample_rate); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
166 (h)->audio_bits_per_sample = le2me_32((h)->audio_bits_per_sample);\
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
167 (h)->audio_channels = le2me_32((h)->audio_channels); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
168 (h)->audio_compression_ratio = le2me_32((h)->audio_compression_ratio);\
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
169 (h)->audio_quality = le2me_32((h)->audio_quality); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
170 (h)->rtjpeg_quality = le2me_32((h)->rtjpeg_quality); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
171 (h)->rtjpeg_luma_filter = le2me_32((h)->rtjpeg_luma_filter); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
172 (h)->rtjpeg_chroma_filter = le2me_32((h)->rtjpeg_chroma_filter);\
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
173 (h)->lavc_bitrate = le2me_32((h)->lavc_bitrate); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
174 (h)->lavc_qmin = le2me_32((h)->lavc_qmin); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
175 (h)->lavc_qmax = le2me_32((h)->lavc_qmax); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
176 (h)->lavc_maxqdiff = le2me_32((h)->lavc_maxqdiff); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
177 }
14896
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
178
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
179 #endif /* MPLAYER_NUPPELVIDEO_H */