[Mesa-dev] [PATCH 1/2] gallium: put video-related enums in separate header

Brian Paul brianp at vmware.com
Wed Jul 13 15:28:16 PDT 2011


The forward references to video enum types in p_context.h causes
a massive number of compiler warnings (ISO C forbids forward references
to ‘enum’ types).

By putting the new video enums in a separate header that can be included
by p_context.h and p_screen.h we can avoid this.
---
 src/gallium/auxiliary/util/u_video.h     |    1 +
 src/gallium/include/pipe/p_context.h     |   10 ++-
 src/gallium/include/pipe/p_defines.h     |   41 -----------
 src/gallium/include/pipe/p_screen.h      |    1 +
 src/gallium/include/pipe/p_video_enums.h |  112 ++++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_video_state.h |   39 +----------
 6 files changed, 121 insertions(+), 83 deletions(-)
 create mode 100644 src/gallium/include/pipe/p_video_enums.h

diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h
index 78cceb6..8b00e3e 100644
--- a/src/gallium/auxiliary/util/u_video.h
+++ b/src/gallium/auxiliary/util/u_video.h
@@ -33,6 +33,7 @@ extern "C" {
 #endif
 
 #include <pipe/p_defines.h>
+#include <pipe/p_video_enums.h>
 
 /* u_reduce_video_profile() needs these */
 #include <pipe/p_compiler.h>
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index ac29049..96dd6c7 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -30,6 +30,9 @@
 
 #include "p_compiler.h"
 
+#include "p_format.h"
+#include "p_video_enums.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -59,10 +62,9 @@ struct pipe_vertex_buffer;
 struct pipe_vertex_element;
 struct pipe_viewport_state;
 
-enum pipe_video_profile;
-enum pipe_video_entrypoint;
-enum pipe_video_chroma_format;
-enum pipe_format;
+struct pipe_video_decoder;
+struct pipe_video_buffer;
+
 
 /**
  * Gallium rendering context.  Basically:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 7f1bf0d..79b8969 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -493,47 +493,6 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */
 };
 
-/* Video caps, can be different for each codec/profile */
-enum pipe_video_cap
-{
-   PIPE_VIDEO_CAP_SUPPORTED = 0,
-   PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
-   PIPE_VIDEO_CAP_MAX_WIDTH = 2,
-   PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
-};
-
-enum pipe_video_codec
-{
-   PIPE_VIDEO_CODEC_UNKNOWN = 0,
-   PIPE_VIDEO_CODEC_MPEG12,   /**< MPEG1, MPEG2 */
-   PIPE_VIDEO_CODEC_MPEG4,    /**< DIVX, XVID */
-   PIPE_VIDEO_CODEC_VC1,      /**< WMV */
-   PIPE_VIDEO_CODEC_MPEG4_AVC /**< H.264 */
-};
-
-enum pipe_video_profile
-{
-   PIPE_VIDEO_PROFILE_UNKNOWN,
-   PIPE_VIDEO_PROFILE_MPEG1,
-   PIPE_VIDEO_PROFILE_MPEG2_SIMPLE,
-   PIPE_VIDEO_PROFILE_MPEG2_MAIN,
-   PIPE_VIDEO_PROFILE_MPEG4_SIMPLE,
-   PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE,
-   PIPE_VIDEO_PROFILE_VC1_SIMPLE,
-   PIPE_VIDEO_PROFILE_VC1_MAIN,
-   PIPE_VIDEO_PROFILE_VC1_ADVANCED,
-   PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE,
-   PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN,
-   PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
-};
-
-enum pipe_video_entrypoint
-{
-   PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
-   PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-   PIPE_VIDEO_ENTRYPOINT_IDCT,
-   PIPE_VIDEO_ENTRYPOINT_MC
-};
 
 /**
  * Composite query types
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 87fdb20..6821edd 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -41,6 +41,7 @@
 #include "pipe/p_compiler.h"
 #include "pipe/p_format.h"
 #include "pipe/p_defines.h"
+#include "pipe/p_video_enums.h"
 
 
 
diff --git a/src/gallium/include/pipe/p_video_enums.h b/src/gallium/include/pipe/p_video_enums.h
new file mode 100644
index 0000000..25a68cc
--- /dev/null
+++ b/src/gallium/include/pipe/p_video_enums.h
@@ -0,0 +1,112 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_VIDEO_ENUMS_H
+#define PIPE_VIDEO_ENUMS_H
+
+enum pipe_mpeg12_picture_type
+{
+   PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP,
+   PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM,
+   PIPE_MPEG12_PICTURE_TYPE_FRAME
+};
+
+enum pipe_mpeg12_dct_intra
+{
+   PIPE_MPEG12_DCT_DELTA = 0,
+   PIPE_MPEG12_DCT_INTRA = 1
+};
+
+enum pipe_mpeg12_dct_type
+{
+   PIPE_MPEG12_DCT_TYPE_FRAME = 0,
+   PIPE_MPEG12_DCT_TYPE_FIELD = 1
+};
+
+enum pipe_video_field_select
+{
+   PIPE_VIDEO_FRAME = 0,
+   PIPE_VIDEO_TOP_FIELD = 1,
+   PIPE_VIDEO_BOTTOM_FIELD = 3,
+
+   /* TODO
+   PIPE_VIDEO_DUALPRIME
+   PIPE_VIDEO_16x8
+   */
+};
+
+enum pipe_video_mv_weight
+{
+   PIPE_VIDEO_MV_WEIGHT_MIN = 0,
+   PIPE_VIDEO_MV_WEIGHT_HALF = 128,
+   PIPE_VIDEO_MV_WEIGHT_MAX = 256
+};
+
+enum pipe_video_profile
+{
+   PIPE_VIDEO_PROFILE_UNKNOWN,
+   PIPE_VIDEO_PROFILE_MPEG1,
+   PIPE_VIDEO_PROFILE_MPEG2_SIMPLE,
+   PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+   PIPE_VIDEO_PROFILE_MPEG4_SIMPLE,
+   PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE,
+   PIPE_VIDEO_PROFILE_VC1_SIMPLE,
+   PIPE_VIDEO_PROFILE_VC1_MAIN,
+   PIPE_VIDEO_PROFILE_VC1_ADVANCED,
+   PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE,
+   PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN,
+   PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
+};
+
+/* Video caps, can be different for each codec/profile */
+enum pipe_video_cap
+{
+   PIPE_VIDEO_CAP_SUPPORTED = 0,
+   PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
+   PIPE_VIDEO_CAP_MAX_WIDTH = 2,
+   PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
+};
+
+enum pipe_video_codec
+{
+   PIPE_VIDEO_CODEC_UNKNOWN = 0,
+   PIPE_VIDEO_CODEC_MPEG12,   /**< MPEG1, MPEG2 */
+   PIPE_VIDEO_CODEC_MPEG4,    /**< DIVX, XVID */
+   PIPE_VIDEO_CODEC_VC1,      /**< WMV */
+   PIPE_VIDEO_CODEC_MPEG4_AVC /**< H.264 */
+};
+
+enum pipe_video_entrypoint
+{
+   PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
+   PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+   PIPE_VIDEO_ENTRYPOINT_IDCT,
+   PIPE_VIDEO_ENTRYPOINT_MC
+};
+
+
+#endif /* PIPE_VIDEO_ENUMS_H */
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index 4d8a241..5b47b15 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -32,6 +32,7 @@
 #include <pipe/p_format.h>
 #include <pipe/p_state.h>
 #include <pipe/p_screen.h>
+#include <pipe/p_video_enums.h>
 #include <util/u_inlines.h>
 
 #ifdef __cplusplus
@@ -43,44 +44,6 @@ struct pipe_video_rect
    unsigned x, y, w, h;
 };
 
-enum pipe_mpeg12_picture_type
-{
-   PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP,
-   PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM,
-   PIPE_MPEG12_PICTURE_TYPE_FRAME
-};
-
-enum pipe_mpeg12_dct_intra
-{
-   PIPE_MPEG12_DCT_DELTA = 0,
-   PIPE_MPEG12_DCT_INTRA = 1
-};
-
-enum pipe_mpeg12_dct_type
-{
-   PIPE_MPEG12_DCT_TYPE_FRAME = 0,
-   PIPE_MPEG12_DCT_TYPE_FIELD = 1
-};
-
-enum pipe_video_field_select
-{
-   PIPE_VIDEO_FRAME = 0,
-   PIPE_VIDEO_TOP_FIELD = 1,
-   PIPE_VIDEO_BOTTOM_FIELD = 3,
-
-   /* TODO
-   PIPE_VIDEO_DUALPRIME
-   PIPE_VIDEO_16x8
-   */
-};
-
-enum pipe_video_mv_weight
-{
-   PIPE_VIDEO_MV_WEIGHT_MIN = 0,
-   PIPE_VIDEO_MV_WEIGHT_HALF = 128,
-   PIPE_VIDEO_MV_WEIGHT_MAX = 256
-};
-
 /* bitfields because this is used as a vertex buffer element */
 struct pipe_motionvector
 {
-- 
1.7.3.4



More information about the mesa-dev mailing list