Commit graph

27 commits

Author SHA1 Message Date
Alessandro Decina
7898bc5810 applemedia: changes to make GL memory mappable on CPU on iOS
This commit introduces IOSGLMemory which is a GLMemory that falls back to
GstAppleCoreVideoMemory for CPU access. This is a temporary solution until
IOSurface gets exposed as a public framework on iOS and so we can use
IOSurfaceMemory on both MacOS and iOS.

https://bugzilla.gnome.org/show_bug.cgi?id=769210
2016-08-26 17:44:48 +10:00
Sebastian Dröge
d00c458592 applemedia: GstCoreMediaMeta in the plugin using only public API has no ctx member 2016-04-13 13:09:05 +03:00
Sebastian Dröge
ccc068576a meta: Initialize all GstMeta fields
During allocation they are not initialized to all zeroes.

https://bugzilla.gnome.org/show_bug.cgi?id=764902
2016-04-13 10:17:24 +03:00
Alessandro Decina
f6154b4cc0 applemedia: always fill GstBuffers with GstMemory
Always fill buffers with our custom memory. The custom memory will avoid
mapping CV/CM buffers unless necessary.
2016-01-19 16:13:04 +11:00
Ilya Konstantinov
8577224c74 applemedia: implement copying of meta
Before this, buffers would lose their Core Video / Core Media meta
over intervideo* boundary.

https://bugzilla.gnome.org/show_bug.cgi?id=747216
2016-01-19 13:06:31 +11:00
Ilya Konstantinov
936b2fdfbc applemedia: implement GstAppleCoreVideoMemory
Implement a new memory type wrapping CVPixelBuffer.

There are two immediate advantages:
 a) Make the GstMemory itself retain the CVPixelBuffer. Previously,
    the containing GstBuffer was solely responsible for the lifetime of
    the backing CVPixelBuffer.

    With this change, we remove the GST_MEMORY_FLAG_NO_SHARE so that
    GstMemory objects be referenced by multiple GstBuffers (doing away
    with the need to copy.)

  b) Delay locking CVPixelBuffer into CPU memory until it's actually
     mapped -- possibly never.

The CVPixelBuffer object is shared among references, shares and
(in planar formats) planes, so a wrapper GstAppleCoreVideoPixelBuffer
structure was introduced to manage locking.

https://bugzilla.gnome.org/show_bug.cgi?id=747216
2016-01-19 12:58:43 +11:00
Ilya Konstantinov
ad8bf99f04 applemedia: enable sharing of CMBlockBuffer data
Instead of wrapping with GST_MEMORY_FLAG_NO_SHARE, we make the GstMemory
object retain the underlying CMBlockBuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=751072
2015-06-25 10:49:05 +02:00
Ilya Konstantinov
8cd65c3250 applemedia: CMBlockBuffer can be non-contiguous
CMBlockBufferGetDataLength would return the entire data length, while
size of individual blocks can be smaller. Iterate over the block buffer
and add the individual (possibly non-contiguous) memory blocks.

https://bugzilla.gnome.org/show_bug.cgi?id=751071
2015-06-25 10:33:54 +02:00
Alessandro Decina
8734abb1ce applemedia: don't call CVPixelBufferLockBaseAddress when doing texture sharing
When doing texture sharing we don't need to call CVPixelBufferLockBaseAddress to
map the buffer in CPU. This cuts about 10% relative cpu time from a vtdec !
glimagesink pipeline.
2015-01-30 00:34:08 +11:00
Alessandro Decina
cdfe90aaba avfvideosrc: implement the GL texture upload meta 2015-01-15 14:10:43 +11:00
Alessandro Decina
ad00f4a0e2 coremediabuffer: set ->pixel_buf for CVPixelBuffer buffers
Fix a bug for which we never actually set ->pixel_buf to non-NULL for
CVPixelBuffer buffers.
2014-11-12 15:40:30 +01:00
Sebastian Dröge
bee1477f08 applemedia: We need to map the coremedia buffers in non-readonly mode
Our buffers claim to be writable so other elements expect to be able
to write there without losing their changes.
2014-09-19 14:47:04 +03:00
Matthieu Bouron
e728ee8208 coremediabuffer: handle stride alignment
Handle stride alignment through the use of the video meta API. The
code is based on the corevideobuffer implementation.

If the video meta API is not supported and the underlying buffer
contains padding, the core media buffer is copied to a system memory
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=727885
2014-04-24 12:27:59 +02:00
Sebastian Dröge
1c13e513c9 atdec: Set correct number of frames for MP3 2014-03-11 15:33:25 +01:00
Andoni Morales Alastruey
31d7c42158 coremediabuffer: keep an extra ref to the image and data buffer 2013-11-07 21:37:29 +01:00
Matthieu Bouron
78f104aa61 applemedia: coremediabuffer: use correct retain/release functions on CMSampleBufferRef buffer
Fixes a crash while releasing the sample buffer after the image
buffer it contains.

Also fixes a minor coding style error.

https://bugzilla.gnome.org/show_bug.cgi?id=711606
2013-11-07 18:47:15 +01:00
Thiago Santos
eecc951070 applemedia: coremediabuffer: fix leaking of apple media structs
remember to release the apple's api buffers to avoid huge leaking
2013-06-18 13:17:52 +02:00
Andoni Morales Alastruey
97bb1edf6c applemedia: don't use the dynamic API for public frameworks
Public frameworks don't need to build the API dynamically, we instead
use the framework directly.
The exception is for VideoToolbox which went public in the 10.8 SDK,
but it's still private in older version of the SDK and iOS. This allow
building the plugin against SDK's where it's not a public framework.
2013-05-20 13:31:02 +02:00
Ole André Vadla Ravnås
519cefdeee applemedia: update contact information 2013-02-16 02:51:52 +01:00
Tim-Philipp Müller
9e1b75fda3 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Michael Smith
0c2159a220 meta info: register thread-safely. 2012-10-03 11:05:06 -07:00
Alessandro Decina
13334dfa8f applemedia: update coremediabuffer after buffer meta API change 2012-04-05 09:08:24 +02:00
Wim Taymans
48ba9063b0 update for buffer api change 2012-03-30 18:15:36 +02:00
Alessandro Decina
7a4a3833c3 applemedia: port qtkitvideosrc 2012-02-28 08:14:00 +01:00
Ole André Vadla Ravnås
b4654f537f applemedia: lock CVPixelBuffer read-only
As per Apple's docs, this may improve performance by avoiding redundant
invalidations of existing caches of the buffer contents.
2010-11-08 23:58:24 +01:00
Ole André Vadla Ravnås
2e349576eb applemedia: support public version of CoreMedia
Also rename the relevant API so we mirror the public API more closely, and
switch to CoreFoundation CFTypeRef style typedefs. We still support the old
private CoreMedia in order to not break OS X support.

This means that vtenc and vtdec are now compatible with iOS 4.x, and in
theory also future versions of OS X, where this API may turn public like
it has on iOS.
2010-11-02 23:14:26 +01:00
Ole André Vadla Ravnås
0e4e351b83 applemedia: New plugin for Apple multimedia APIs
Provides the following elements:

qtkitvideosrc: OS X video source relying on the QTKit API. Comes with
hard-coded caps as the API does not provide any way of querying for
formats supported by the hardware. Hasn't been tested a lot, but seems
to work.

miovideosrc: OS X video source which uses the undocumented/private
CoreMediaIOServices API, which is also the one used by iChat.
Present on latest version of Leopard and all versions of Snow Leopard.
Has been tested extensively with built-in cameras and TANDBERG's
PrecisionHD USB camera.

vtenc, vtdec: Generic codec wrappers which make use of the undocumented/
private VideoToolbox API on OS X and iOS. List of codecs are currently
hard-coded to H.264 for vtenc, and H.264 + JPEG for vtdec. Can easily be
expanded by adding new entries to the lists, but haven't yet had time to
do that. Should probably also implement probing as available codecs depend
on the OS and its version, and there doesn't seem to be any way to
enumerate the available codecs.

vth264decbin, vth264encbin: Wrapper bins to make it easier to use
vtdec_h264/vtenc_h264 in live scenarios.

iphonecamerasrc: iPhone camera source relying on the undocumented/private
Celestial API. Tested on iOS 3.1 running on an iPhone 3GS. Stops working
after a few minutes, presumably because of a resource leak. Needs some
love.

Note that the iOS parts haven't yet been ported to iOS 4.x.
2010-10-28 15:08:08 +02:00