]> git.sesse.net Git - vlc/blobdiff - modules/codec/omxil/omxil.h
nativewindowpriv: add is_hw arg in setup
[vlc] / modules / codec / omxil / omxil.h
index 649ba65a8d62b0c8c1e19fe20e25a3fb4cef690d..3f793b50fa5adfe3649f8c1ccaf2276322bbb4a6 100644 (file)
@@ -1,26 +1,30 @@
 /*****************************************************************************
  * omxil.h: helper functions
  *****************************************************************************
- * Copyright (C) 2010 the VideoLAN team
+ * Copyright (C) 2010 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef RPI_OMX
+#define OMX_SKIP64BIT
+#endif
+
 /*****************************************************************************
  * Includes
  *****************************************************************************/
 #include "OMX_Video.h"
 
 #include "omxil_utils.h"
+#include "omxil_core.h"
 
-/*****************************************************************************
- * defines
- *****************************************************************************/
-#define MAX_COMPONENTS_LIST_SIZE 32
+#if defined(USE_IOMX)
+#include "../../video_output/android/utils.h"
+#endif
+
+enum
+{
+    BUF_STATE_NOT_OWNED = 0,
+    BUF_STATE_OWNED,
+};
 
 /*****************************************************************************
  * decoder_sys_t : omxil decoder descriptor
  *****************************************************************************/
+typedef struct OmxFifo
+{
+    vlc_mutex_t lock;
+    vlc_cond_t  wait;
+
+    OMX_BUFFERHEADERTYPE *p_first;
+    OMX_BUFFERHEADERTYPE **pp_last;
+
+    int offset;
+
+} OmxFifo;
+
+typedef struct HwBuffer
+{
+    vlc_thread_t    dequeue_thread;
+    bool            b_run;
+    vlc_cond_t      wait;
+    picture_t**     inflight_picture; /**< stores the inflight picture for each output buffer or NULL */
+
+    unsigned int    i_buffers;
+    void            **pp_handles;
+    int             *i_states;
+    unsigned int    i_max_owned;
+    unsigned int    i_owned;
+
+    void            *p_library;
+    void            *window;
+    video_format_t  fmt_out;
+#if defined(USE_IOMX)
+    native_window_api_t native_window;
+    native_window_priv_api_t anwpriv;
+    native_window_priv *window_priv;
+#endif
+
+} HwBuffer;
+
 typedef struct OmxPort
 {
     bool b_valid;
@@ -54,17 +100,7 @@ typedef struct OmxPort
     unsigned int i_buffers;
     OMX_BUFFERHEADERTYPE **pp_buffers;
 
-    struct fifo_t
-    {
-      vlc_mutex_t         lock;
-      vlc_cond_t          wait;
-
-      OMX_BUFFERHEADERTYPE *p_first;
-      OMX_BUFFERHEADERTYPE **pp_last;
-
-      int offset;
-
-    } fifo;
+    OmxFifo fifo;
 
     OmxFormatParam format_param;
 
@@ -73,6 +109,8 @@ typedef struct OmxPort
     OMX_BOOL b_direct;
     OMX_BOOL b_flushed;
 
+    HwBuffer *p_hwbuf;
+
 } OmxPort;
 
 struct decoder_sys_t
@@ -80,18 +118,12 @@ struct decoder_sys_t
     OMX_HANDLETYPE omx_handle;
 
     bool b_enc;
-    bool b_init;
-    vlc_mutex_t lock;
 
     char psz_component[OMX_MAX_STRINGNAME_SIZE];
     char ppsz_components[MAX_COMPONENTS_LIST_SIZE][OMX_MAX_STRINGNAME_SIZE];
     unsigned int components;
 
-    struct OmxEvent *p_events;
-    struct OmxEvent **pp_last_event;
-
-    vlc_mutex_t mutex;
-    vlc_cond_t cond;
+    OmxEventQueue event_queue;
 
     OmxPort *p_ports;
     unsigned int ports;
@@ -100,10 +132,11 @@ struct decoder_sys_t
 
     bool b_error;
 
+    bool b_aspect_ratio_handled;
+
     date_t end_date;
 
-    int i_nal_size_length; /* Length of the NAL size field for H264 */
+    size_t i_nal_size_length; /* Length of the NAL size field for H264 */
     int b_use_pts;
 
-    OMX_BUFFERHEADERTYPE sentinel_buffer;
 };