[PATCH 01/10] staging: bcm2835-camera: Create struct mmal_es_format_local to mirror struct mmal_es_format

Michael Zoran mzoran at crowfest.net
Fri Mar 10 05:08:50 UTC 2017


The struct struct mmal_es_format is passed between the firmware which has
pointers.  A local version of mmal_es_format is also used.

Luckly, the two versions are always memberwise copied from each other
so simply have different structures for the local and msg versions.

Signed-off-by: Michael Zoran <mzoran at crowfest.net>
---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c  |  2 +-
 .../vc04_services/bcm2835-camera/mmal-msg-format.h | 29 ++++++++++++++++++----
 .../vc04_services/bcm2835-camera/mmal-vchiq.h      |  2 +-
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index 98198ff5419d..2302f4bc84df 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -1583,7 +1583,7 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
 static int __init mmal_init(struct bm2835_mmal_dev *dev)
 {
 	int ret;
-	struct mmal_es_format *format;
+	struct mmal_es_format_local *format;
 	u32 bool_true = 1;
 	u32 supported_encodings[MAX_SUPPORTED_ENCODINGS];
 	int param_size;
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h b/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h
index 993de442b0e6..24b002e8df0c 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h
@@ -53,7 +53,7 @@ union mmal_es_specific_format {
 };
 
 /** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */
-struct mmal_es_format {
+struct mmal_es_format_local {
 	u32 type;      /* enum mmal_es_type */
 
 	u32 encoding;  /* FourCC specifying encoding of the elementary stream.*/
@@ -62,10 +62,7 @@ struct mmal_es_format {
 			       * stream.
 			       */
 
-	union mmal_es_specific_format *es; /* TODO: pointers in
-					    * message serialisation?!?
-					    */
-					    /* Type specific
+	union mmal_es_specific_format *es;  /* Type specific
 					     * information for the
 					     * elementary stream
 					     */
@@ -77,4 +74,26 @@ struct mmal_es_format {
 	u8  *extradata;           /**< Codec specific data */
 };
 
+/** Remote definition of an elementary stream format (MMAL_ES_FORMAT_T) */
+struct mmal_es_format {
+	u32 type;      /* enum mmal_es_type */
+
+	u32 encoding;  /* FourCC specifying encoding of the elementary stream.*/
+	u32 encoding_variant; /* FourCC specifying the specific
+			       * encoding variant of the elementary
+			       * stream.
+			       */
+
+	u32 es; /* Type specific
+		 * information for the
+		 * elementary stream
+		 */
+
+	u32 bitrate;        /**< Bitrate in bits per second */
+	u32 flags; /**< Flags describing properties of the elementary stream. */
+
+	u32 extradata_size;       /**< Size of the codec specific data */
+	u32 extradata;           /**< Codec specific data */
+};
+
 #endif /* MMAL_MSG_FORMAT_H */
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
index 23079977a686..2842ac960c4a 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
@@ -74,7 +74,7 @@ struct vchiq_mmal_port {
 	struct vchiq_mmal_port_buffer current_buffer;
 
 	/* stream format */
-	struct mmal_es_format format;
+	struct mmal_es_format_local format;
 	/* elementry stream format */
 	union mmal_es_specific_format es;
 
-- 
2.11.0



More information about the devel mailing list