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