diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-06-17 12:06:48 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-06-17 12:06:48 +0300 |
commit | a78756c63fac10597e78e93d81767f385b920e81 (patch) | |
tree | b0ce8ab94e751e7425c931cabc9bca31ec8add60 | |
parent | 198e31355f42bbbab7450a8fea42b725a3b890e4 (diff) |
omx: #define OMX_SKIP64BIT on the RPi as required by their API
Also add generic support for OMX_SKIP64BIT to gst-omx, in case other
implementations also #define that for whatever reason.
https://bugzilla.gnome.org/show_bug.cgi?id=766475
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | omx/gstomx.h | 13 | ||||
-rw-r--r-- | omx/gstomxaudiodec.c | 20 | ||||
-rw-r--r-- | omx/gstomxaudioenc.c | 15 | ||||
-rw-r--r-- | omx/gstomxvideo.c | 4 | ||||
-rw-r--r-- | omx/gstomxvideodec.c | 29 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 15 |
7 files changed, 59 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac index 4a3c5db..3679cfa 100644 --- a/configure.ac +++ b/configure.ac @@ -232,6 +232,7 @@ case "${ac_cv_omx_target}" in ;; rpi) AC_DEFINE(USE_OMX_TARGET_RPI, 1, [Use RPi OpenMAX IL target]) + AC_DEFINE(OMX_SKIP64BIT, 1, [Required by the RPi implementation]) ac_cv_omx_target_struct_packing=4 ;; bellagio) diff --git a/omx/gstomx.h b/omx/gstomx.h index 9ad8e2f..bc9bdd0 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -71,6 +71,19 @@ G_BEGIN_DECLS (st)->nVersion.s.nStep = OMX_VERSION_STEP; \ } G_STMT_END +#ifdef OMX_SKIP64BIT +#define GST_OMX_GET_TICKS(ticks) ((((guint64) (ticks).nHighPart) << 32) | ((ticks).nLowPart)) +#define GST_OMX_SET_TICKS(ticks, i) G_STMT_START { \ + ticks.nLowPart = ((guint64) (i)) & 0xffffffff; \ + ticks.nHighPart = ((guint64) (i)) >> 32; \ +} G_STMT_END +#else +#define GST_OMX_GET_TICKS(ticks) (ticks) +#define GST_OMX_SET_TICKS(ticks, i) G_STMT_START { \ + ticks = i; \ +} G_STMT_END +#endif + /* Different hacks that are required to work around * bugs in different OpenMAX implementations */ diff --git a/omx/gstomxaudiodec.c b/omx/gstomxaudiodec.c index b6fdf34..6e9d6df 100644 --- a/omx/gstomxaudiodec.c +++ b/omx/gstomxaudiodec.c @@ -492,7 +492,8 @@ gst_omx_audio_dec_loop (GstOMXAudioDec * self) } GST_DEBUG_OBJECT (self, "Handling buffer: 0x%08x %" G_GUINT64_FORMAT, - (guint) buf->omx_buf->nFlags, (guint64) buf->omx_buf->nTimeStamp); + (guint) buf->omx_buf->nFlags, + (guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp)); GST_AUDIO_DECODER_STREAM_LOCK (self); @@ -1168,10 +1169,11 @@ gst_omx_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) buf->omx_buf->nFilledLen); if (GST_CLOCK_TIME_IS_VALID (timestamp)) - buf->omx_buf->nTimeStamp = - gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND); + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, + gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, + GST_SECOND)); else - buf->omx_buf->nTimeStamp = 0; + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, G_GUINT64_CONSTANT (0)); buf->omx_buf->nTickCount = 0; self->started = TRUE; @@ -1196,11 +1198,11 @@ gst_omx_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) buf->omx_buf->nFilledLen); if (timestamp != GST_CLOCK_TIME_NONE) { - buf->omx_buf->nTimeStamp = - gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND); + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, + gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND)); self->last_upstream_ts = timestamp; } else { - buf->omx_buf->nTimeStamp = 0; + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, G_GUINT64_CONSTANT (0)); } if (duration != GST_CLOCK_TIME_NONE && offset == 0) { @@ -1351,9 +1353,9 @@ gst_omx_audio_dec_drain (GstOMXAudioDec * self) g_mutex_lock (&self->drain_lock); self->draining = TRUE; buf->omx_buf->nFilledLen = 0; - buf->omx_buf->nTimeStamp = + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, gst_util_uint64_scale (self->last_upstream_ts, OMX_TICKS_PER_SECOND, - GST_SECOND); + GST_SECOND)); buf->omx_buf->nTickCount = 0; buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS; err = gst_omx_port_release_buffer (self->dec_in_port, buf); diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index a6ba861..3791279 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -379,7 +379,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self) } GST_DEBUG_OBJECT (self, "Handling buffer: 0x%08x %" G_GUINT64_FORMAT, - (guint) buf->omx_buf->nFlags, (guint64) buf->omx_buf->nTimeStamp); + (guint) buf->omx_buf->nFlags, + (guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp)); /* This prevents a deadlock between the srcpad stream * lock and the videocodec stream lock, if ::reset() @@ -447,8 +448,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self) } GST_BUFFER_TIMESTAMP (outbuf) = - gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND, - OMX_TICKS_PER_SECOND); + gst_util_uint64_scale (GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp), + GST_SECOND, OMX_TICKS_PER_SECOND); if (buf->omx_buf->nTickCount != 0) GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale (buf->omx_buf->nTickCount, GST_SECOND, @@ -1036,9 +1037,9 @@ gst_omx_audio_enc_handle_frame (GstAudioEncoder * encoder, GstBuffer * inbuf) } if (timestamp != GST_CLOCK_TIME_NONE) { - buf->omx_buf->nTimeStamp = + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, gst_util_uint64_scale (timestamp + timestamp_offset, - OMX_TICKS_PER_SECOND, GST_SECOND); + OMX_TICKS_PER_SECOND, GST_SECOND)); self->last_upstream_ts = timestamp + timestamp_offset; } if (duration != GST_CLOCK_TIME_NONE) { @@ -1139,9 +1140,9 @@ gst_omx_audio_enc_drain (GstOMXAudioEnc * self) g_mutex_lock (&self->drain_lock); self->draining = TRUE; buf->omx_buf->nFilledLen = 0; - buf->omx_buf->nTimeStamp = + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, gst_util_uint64_scale (self->last_upstream_ts, OMX_TICKS_PER_SECOND, - GST_SECOND); + GST_SECOND)); buf->omx_buf->nTickCount = 0; buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS; err = gst_omx_port_release_buffer (self->enc_in_port, buf); diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c index f052788..314c488 100644 --- a/omx/gstomxvideo.c +++ b/omx/gstomxvideo.c @@ -172,8 +172,8 @@ gst_omx_video_find_nearest_frame (GstOMXBuffer * buf, GList * frames) GList *l; timestamp = - gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND, - OMX_TICKS_PER_SECOND); + gst_util_uint64_scale (GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp), + GST_SECOND, OMX_TICKS_PER_SECOND); for (l = frames; l; l = l->next) { GstVideoCodecFrame *tmp = l->data; diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index f2d51de..64a9754 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -531,8 +531,8 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self, done: if (ret) { GST_BUFFER_PTS (outbuf) = - gst_util_uint64_scale (inbuf->omx_buf->nTimeStamp, GST_SECOND, - OMX_TICKS_PER_SECOND); + gst_util_uint64_scale (GST_OMX_GET_TICKS (inbuf->omx_buf->nTimeStamp), + GST_SECOND, OMX_TICKS_PER_SECOND); if (inbuf->omx_buf->nTickCount != 0) GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale (inbuf->omx_buf->nTickCount, GST_SECOND, @@ -1178,8 +1178,9 @@ gst_omx_video_dec_clean_older_frames (GstOMXVideoDec * self, GList *l; GstClockTime timestamp; - timestamp = gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND, - OMX_TICKS_PER_SECOND); + timestamp = + gst_util_uint64_scale (GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp), + GST_SECOND, OMX_TICKS_PER_SECOND); if (GST_CLOCK_TIME_IS_VALID (timestamp)) { /* We could release all frames stored with pts < timestamp since the @@ -1365,7 +1366,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) } GST_DEBUG_OBJECT (self, "Handling buffer: 0x%08x %" G_GUINT64_FORMAT, - (guint) buf->omx_buf->nFlags, (guint64) buf->omx_buf->nTimeStamp); + (guint) buf->omx_buf->nFlags, + (guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp)); GST_VIDEO_DECODER_STREAM_LOCK (self); frame = gst_omx_video_find_nearest_frame (buf, @@ -2308,10 +2310,11 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder, buf->omx_buf->nFilledLen); if (GST_CLOCK_TIME_IS_VALID (timestamp)) - buf->omx_buf->nTimeStamp = - gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND); + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, + gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, + GST_SECOND)); else - buf->omx_buf->nTimeStamp = 0; + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, G_GUINT64_CONSTANT (0)); buf->omx_buf->nTickCount = 0; self->started = TRUE; @@ -2335,11 +2338,11 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder, buf->omx_buf->nFilledLen); if (timestamp != GST_CLOCK_TIME_NONE) { - buf->omx_buf->nTimeStamp = - gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND); + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, + gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND)); self->last_upstream_ts = timestamp; } else { - buf->omx_buf->nTimeStamp = 0; + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, G_GUINT64_CONSTANT (0)); } if (duration != GST_CLOCK_TIME_NONE && offset == 0) { @@ -2485,9 +2488,9 @@ gst_omx_video_dec_drain (GstVideoDecoder * decoder) g_mutex_lock (&self->drain_lock); self->draining = TRUE; buf->omx_buf->nFilledLen = 0; - buf->omx_buf->nTimeStamp = + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, gst_util_uint64_scale (self->last_upstream_ts, OMX_TICKS_PER_SECOND, - GST_SECOND); + GST_SECOND)); buf->omx_buf->nTickCount = 0; buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS; err = gst_omx_port_release_buffer (self->dec_in_port, buf); diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 8e6cde3..b2a1f8e 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -596,8 +596,8 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port, } GST_BUFFER_TIMESTAMP (outbuf) = - gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND, - OMX_TICKS_PER_SECOND); + gst_util_uint64_scale (GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp), + GST_SECOND, OMX_TICKS_PER_SECOND); if (buf->omx_buf->nTickCount != 0) GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale (buf->omx_buf->nTickCount, GST_SECOND, @@ -747,7 +747,8 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self) } GST_DEBUG_OBJECT (self, "Handling buffer: 0x%08x %" G_GUINT64_FORMAT, - (guint) buf->omx_buf->nFlags, (guint64) buf->omx_buf->nTimeStamp); + (guint) buf->omx_buf->nFlags, + (guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp)); GST_VIDEO_ENCODER_STREAM_LOCK (self); frame = gst_omx_video_find_nearest_frame (buf, @@ -1587,8 +1588,8 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder, timestamp = frame->pts; if (timestamp != GST_CLOCK_TIME_NONE) { - buf->omx_buf->nTimeStamp = - gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND); + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, + gst_util_uint64_scale (timestamp, OMX_TICKS_PER_SECOND, GST_SECOND)); self->last_upstream_ts = timestamp; } @@ -1720,9 +1721,9 @@ gst_omx_video_enc_drain (GstOMXVideoEnc * self) g_mutex_lock (&self->drain_lock); self->draining = TRUE; buf->omx_buf->nFilledLen = 0; - buf->omx_buf->nTimeStamp = + GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, gst_util_uint64_scale (self->last_upstream_ts, OMX_TICKS_PER_SECOND, - GST_SECOND); + GST_SECOND)); buf->omx_buf->nTickCount = 0; buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS; err = gst_omx_port_release_buffer (self->enc_in_port, buf); |