annotate libmpdemux/demux_avs.h @ 29325:21f61d4d5611

Add a missing check for a NULL return value.
author eugeni
date Tue, 16 Jun 2009 17:58:12 +0000
parents 0f1b5b68af32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
1 /*
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
2 * Demuxer for avisynth
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
3 * Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
4 *
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
5 * Avisynth C Interface Version 0.20
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
6 * Copyright 2003 Kevin Atkinson
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
7 *
27582
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
8 * This file is part of MPlayer.
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
9 *
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
10 * MPlayer is free software; you can redistribute it and/or
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
11 * modify it under the terms of the GNU Lesser General Public
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
12 * License as published by the Free Software Foundation; either
27582
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
13 * version 2.1 of the License, or (at your option) any later version.
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
14 *
27582
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27582
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
18 * Lesser General Public License for more details.
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
19 *
27582
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
20 * You should have received a copy of the GNU Lesser General Public License
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
21 * along with MPlayer; if not, write to the Free Software Foundation, Inc.,
34d3e0c8487a Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents: 26758
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
23 */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
24
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
25 #ifndef MPLAYER_DEMUX_AVS_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
26 #define MPLAYER_DEMUX_AVS_H
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 23915
diff changeset
27
26143
268ecf0e1ba4 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
28 #include <stdint.h>
268ecf0e1ba4 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
29 #include "loader/wine/windef.h"
268ecf0e1ba4 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
30
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
31 enum { AVISYNTH_INTERFACE_VERSION = 2 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
32
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
33 enum
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
34 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
35 AVS_SAMPLE_INT8 = 1<<0,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
36 AVS_SAMPLE_INT16 = 1<<1,
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
37 AVS_SAMPLE_INT24 = 1<<2,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
38 AVS_SAMPLE_INT32 = 1<<3,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
39 AVS_SAMPLE_FLOAT = 1<<4
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
40 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
41
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
42 enum
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
43 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
44 AVS_PLANAR_Y=1<<0,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
45 AVS_PLANAR_U=1<<1,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
46 AVS_PLANAR_V=1<<2,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
47 AVS_PLANAR_ALIGNED=1<<3,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
48 AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
49 AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
50 AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
51 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
52
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
53 // Colorspace properties.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
54 enum
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
55 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
56 AVS_CS_BGR = 1<<28,
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
57 AVS_CS_YUV = 1<<29,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
58 AVS_CS_INTERLEAVED = 1<<30,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
59 AVS_CS_PLANAR = 1<<31
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
60 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
61
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
62 // Specific colorformats
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
63 enum
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
64 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
65 AVS_CS_UNKNOWN = 0,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
66 AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
67 AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
68 AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
69 AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
70 AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
71 AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
72 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
73
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
74 typedef struct AVS_Clip AVS_Clip;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
75 typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
76
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
77 typedef struct AVS_Value AVS_Value;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
78 struct AVS_Value {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
79 short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
80 // for some function e'rror
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
81 short array_size;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
82 union {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
83 void * clip; // do not use directly, use avs_take_clip
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
84 char boolean;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
85 int integer;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
86 float floating_pt;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
87 const char * string;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
88 const AVS_Value * array;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
89 } d;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
90 };
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
91
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
92 // AVS_VideoInfo is layed out identicly to VideoInfo
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
93 typedef struct AVS_VideoInfo {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
94 int width, height; // width=0 means no video
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
95 unsigned fps_numerator, fps_denominator;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
96 int num_frames;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
97
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
98 int pixel_type;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
99
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
100 int audio_samples_per_second; // 0 means no audio
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
101 int sample_type;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
102 uint64_t num_audio_samples;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
103 int nchannels;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
104
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
105 // Imagetype properties
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
106
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
107 int image_type;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
108 } AVS_VideoInfo;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
109
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
110 typedef struct AVS_VideoFrameBuffer {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
111 BYTE * data;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
112 int data_size;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
113 // sequence_number is incremented every time the buffer is changed, so
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
114 // that stale views can tell they're no longer valid.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
115 long sequence_number;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
116
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
117 long refcount;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
118 } AVS_VideoFrameBuffer;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
119
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
120 typedef struct AVS_VideoFrame {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
121 int refcount;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
122 AVS_VideoFrameBuffer * vfb;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
123 int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
124 } AVS_VideoFrame;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
125
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
126 static inline AVS_Value avs_new_value_string(const char * v0)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
127 { AVS_Value v; v.type = 's'; v.d.string = v0; return v; }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
128
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
129 static inline AVS_Value avs_new_value_array(AVS_Value * v0, int size)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
130 { AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
131
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
132
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
133 static inline int avs_is_error(AVS_Value v) { return v.type == 'e'; }
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
134 static inline int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
135 static inline int avs_is_string(AVS_Value v) { return v.type == 's'; }
26758
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26143
diff changeset
136 static inline int avs_has_video(const AVS_VideoInfo * p) { return p->width != 0; }
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26143
diff changeset
137 static inline int avs_has_audio(const AVS_VideoInfo * p) { return p->audio_samples_per_second != 0; }
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
138
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
139 static inline const char * avs_as_string(AVS_Value v)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
140 { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
141
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
142 /* Color spaces */
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
143 static inline int avs_is_rgb(const AVS_VideoInfo * p)
26758
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26143
diff changeset
144 { return p->pixel_type & AVS_CS_BGR; }
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
145
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
146 static inline int avs_is_rgb24(const AVS_VideoInfo * p)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
147 { return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
148
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
149 static inline int avs_is_rgb32(const AVS_VideoInfo * p)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
150 { return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
151
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
152 static inline int avs_is_yuy(const AVS_VideoInfo * p)
26758
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26143
diff changeset
153 { return p->pixel_type & AVS_CS_YUV; }
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
154
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
155 static inline int avs_is_yuy2(const AVS_VideoInfo * p)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
156 { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
157
23915
4e501436bbef Use the standard inline instead of __inline
reimar
parents: 19614
diff changeset
158 static inline int avs_is_yv12(const AVS_VideoInfo * p)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
159 { return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); }
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
160
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
161 static inline int avs_bits_per_pixel(const AVS_VideoInfo * p)
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27582
diff changeset
162 {
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
163 switch (p->pixel_type) {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
164 case AVS_CS_BGR24: return 24;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
165 case AVS_CS_BGR32: return 32;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
166 case AVS_CS_YUY2: return 16;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
167 case AVS_CS_YV12:
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
168 case AVS_CS_I420: return 12;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
169 default: return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
170 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
171 }
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 23915
diff changeset
172
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
173 #endif /* MPLAYER_DEMUX_AVS_H */