annotate libmpdemux/nuppelvideo.h @ 25103:588a415dd65d

Media Format to fourcc conversion (from amol) Factorize out some if clauses
author lu_zero
date Wed, 21 Nov 2007 13:03:08 +0000
parents 2d5ad5048952
children 6ac1ece1f9fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3807
alex
parents:
diff changeset
1 /* nuppelvideo.h rh */
alex
parents:
diff changeset
2
21347
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
3 #include "libavutil/intfloat_readwrite.h"
2d5ad5048952 Use av_int2dbl to read doubles instead of our somewhat broken le2me_dbl
reimar
parents: 16164
diff changeset
4
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
5 typedef struct __attribute__((packed)) rtfileheader
3807
alex
parents:
diff changeset
6 {
alex
parents:
diff changeset
7 char finfo[12]; // "NuppelVideo" + \0
alex
parents:
diff changeset
8 char version[5]; // "0.05" + \0
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
9 char pad1[3];
3807
alex
parents:
diff changeset
10 int width;
alex
parents:
diff changeset
11 int height;
alex
parents:
diff changeset
12 int desiredwidth; // 0 .. as it is
alex
parents:
diff changeset
13 int desiredheight; // 0 .. as it is
alex
parents:
diff changeset
14 char pimode; // P .. progressive
alex
parents:
diff changeset
15 // I .. interlaced (2 half pics) [NI]
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
16 char pad2[3];
3807
alex
parents:
diff changeset
17 double aspect; // 1.0 .. square pixel (1.5 .. e.g. width=480: width*1.5=720
alex
parents:
diff changeset
18 // for capturing for svcd material
alex
parents:
diff changeset
19 double fps;
alex
parents:
diff changeset
20 int videoblocks; // count of video-blocks -1 .. unknown 0 .. no video
alex
parents:
diff changeset
21 int audioblocks; // count of audio-blocks -1 .. unknown 0 .. no audio
alex
parents:
diff changeset
22 int textsblocks; // count of text-blocks -1 .. unknown 0 .. no text
alex
parents:
diff changeset
23 int keyframedist;
alex
parents:
diff changeset
24 } rtfileheader;
alex
parents:
diff changeset
25
15568
6825cbde2df6 Specify the padding instead of expecting the compiler to align correctly
reimar
parents: 14896
diff changeset
26 typedef struct __attribute__((packed)) rtframeheader
3807
alex
parents:
diff changeset
27 {
alex
parents:
diff changeset
28 char frametype; // A .. Audio, V .. Video, S .. Sync, T .. Text
alex
parents:
diff changeset
29 // R .. Seekpoint: String RTjjjjjjjj (use full packet)
alex
parents:
diff changeset
30 // D .. Addition Data for Compressors
alex
parents:
diff changeset
31 // ct: R .. RTjpeg Tables
alex
parents:
diff changeset
32
alex
parents:
diff changeset
33 char comptype; // V: 0 .. Uncompressed [NI]
alex
parents:
diff changeset
34 // 1 .. RTJpeg
alex
parents:
diff changeset
35 // 2 .. RTJpeg with lzo afterwards
alex
parents:
diff changeset
36 // N .. black frame
alex
parents:
diff changeset
37 // L .. simply copy last frame (if lost frames)
alex
parents:
diff changeset
38 // A: 0 .. Uncompressed (44100/sec 16bit 2ch)
alex
parents:
diff changeset
39 // 1 .. lzo compression [NI]
alex
parents:
diff changeset
40 // 2 .. layer2 (packet) [NI]
alex
parents:
diff changeset
41 // 3 .. layer3 (packet) [NI]
alex
parents:
diff changeset
42 // F .. flac (lossless) [NI]
alex
parents:
diff changeset
43 // S .. shorten (lossless) [NI]
alex
parents:
diff changeset
44 // N .. null frame loudless
alex
parents:
diff changeset
45 // L .. simply copy last frame (may sound bad) NI
alex
parents:
diff changeset
46 // S: B .. Audio and Video sync point [NI]
alex
parents:
diff changeset
47 // A .. Audio Sync Information
alex
parents:
diff changeset
48 // timecode == effective dsp-frequency*100
alex
parents:
diff changeset
49 // when reaching this audio sync point
alex
parents:
diff changeset
50 // because many cheap soundcards are unexact
alex
parents:
diff changeset
51 // and have a range from 44000 to 44250
alex
parents:
diff changeset
52 // instead of the expected exact 44100 S./sec
alex
parents:
diff changeset
53 // V .. Next Video Sync
alex
parents:
diff changeset
54 // timecode == next video framenumber
alex
parents:
diff changeset
55 // S .. Audio,Video,Text Correlation [NI]
alex
parents:
diff changeset
56 char keyframe; // 0 .. keyframe
alex
parents:
diff changeset
57 // 1 .. nr of frame in gop => no keyframe
alex
parents:
diff changeset
58
alex
parents:
diff changeset
59 char filters; // Every bit stands for one type of filter
alex
parents:
diff changeset
60 // 1 .. Gauss 5 Pixel (8*m+2*l+2*r+2*a+2*b)/16 [NYI]
alex
parents:
diff changeset
61 // 2 .. Gauss 5 Pixel (8*m+1*l+1*r+1*a+1*b)/12 [NYI]
alex
parents:
diff changeset
62 // 4 .. Cartoon Filter [NI]
alex
parents:
diff changeset
63 // 8 .. Reserverd Filter [NI]
alex
parents:
diff changeset
64 // 16 .. Reserverd Filter [NI]
alex
parents:
diff changeset
65 // 32 .. Reserverd Filter [NI]
alex
parents:
diff changeset
66 // 64 .. Reserverd Filter [NI]
alex
parents:
diff changeset
67 // 128 .. Reserverd Filter [NI]
alex
parents:
diff changeset
68
alex
parents:
diff changeset
69 int timecode; // Timecodeinformation sec*1000 + msecs
alex
parents:
diff changeset
70
alex
parents:
diff changeset
71 int packetlength; // V,A,T: length of following data in stream
alex
parents:
diff changeset
72 // S: length of packet correl. information [NI]
alex
parents:
diff changeset
73 // R: do not use here! (fixed 'RTjjjjjjjjjjjjjj')
alex
parents:
diff changeset
74 } rtframeheader;
alex
parents:
diff changeset
75
16164
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
76 /* for MythTV */
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
77 typedef struct __attribute__((packed)) extendeddata
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
78 {
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
79 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
80 int video_fourcc; // video encoding method used
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
81 int audio_fourcc; // audio encoding method used
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
82 // generic data
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
83 int audio_sample_rate;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
84 int audio_bits_per_sample;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
85 int audio_channels;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
86 // codec specific
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
87 // mp3lame
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
88 int audio_compression_ratio;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
89 int audio_quality;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
90 // rtjpeg
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
91 int rtjpeg_quality;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
92 int rtjpeg_luma_filter;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
93 int rtjpeg_chroma_filter;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
94 // libavcodec
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
95 int lavc_bitrate;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
96 int lavc_qmin;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
97 int lavc_qmax;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
98 int lavc_maxqdiff;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
99 // unused for later -- total size of 128 integers.
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
100 // 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
101 int expansion[113];
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
102 } extendeddata;
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
103
3807
alex
parents:
diff changeset
104 #define FRAMEHEADERSIZE sizeof(rtframeheader)
alex
parents:
diff changeset
105 #define FILEHEADERSIZE sizeof(rtfileheader)
alex
parents:
diff changeset
106
alex
parents:
diff changeset
107 typedef struct vidbuffertype
alex
parents:
diff changeset
108 {
alex
parents:
diff changeset
109 int sample;
alex
parents:
diff changeset
110 int timecode;
alex
parents:
diff changeset
111 int freeToEncode;
alex
parents:
diff changeset
112 int freeToBuffer;
alex
parents:
diff changeset
113 unsigned char *buffer_offset;
alex
parents:
diff changeset
114 } vidbuffertyp;
alex
parents:
diff changeset
115
alex
parents:
diff changeset
116 typedef struct audbuffertype
alex
parents:
diff changeset
117 {
alex
parents:
diff changeset
118 int sample;
alex
parents:
diff changeset
119 int timecode;
alex
parents:
diff changeset
120 int freeToEncode;
alex
parents:
diff changeset
121 int freeToBuffer;
alex
parents:
diff changeset
122 unsigned char *buffer_offset;
alex
parents:
diff changeset
123 } audbuffertyp;
alex
parents:
diff changeset
124
14896
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
125 #define le2me_rtfileheader(h) { \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
126 (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
127 (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
128 (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
129 (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
130 (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
131 (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
132 (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
133 (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
134 (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
135 (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
136 }
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
137 #define le2me_rtframeheader(h) { \
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
138 (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
139 (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
140 }
16164
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
141 #define le2me_extendeddata(h) { \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
142 (h)->version = le2me_32((h)->version); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
143 (h)->video_fourcc = le2me_32((h)->video_fourcc); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
144 (h)->audio_fourcc = le2me_32((h)->audio_fourcc); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
145 (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
146 (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
147 (h)->audio_channels = le2me_32((h)->audio_channels); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
148 (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
149 (h)->audio_quality = le2me_32((h)->audio_quality); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
150 (h)->rtjpeg_quality = le2me_32((h)->rtjpeg_quality); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
151 (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
152 (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
153 (h)->lavc_bitrate = le2me_32((h)->lavc_bitrate); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
154 (h)->lavc_qmin = le2me_32((h)->lavc_qmin); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
155 (h)->lavc_qmax = le2me_32((h)->lavc_qmax); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
156 (h)->lavc_maxqdiff = le2me_32((h)->lavc_maxqdiff); \
ec76d55a25f1 Support more MythTV nuv files, based on Gentoo portage patch
reimar
parents: 15976
diff changeset
157 }
14896
9ddae5897422 Make nuv files work on bigendian (but old nuv files created with mencoder
reimar
parents: 3807
diff changeset
158