Commit graph

430 commits

Author SHA1 Message Date
Matthew Waters
f02425c4af vtdec: disable the texture cache on OSX
This a workaround until the incompatibility with CVOpenGLTextureCache
and opengl3 contexts is fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=754786
2015-09-18 21:31:15 +10:00
Matthew Waters
578b8432b6 vtdec: gst-indent file 2015-09-18 16:58:21 +10:00
Matthew Waters
3772c8ece6 applemedia/vtdec: fix negotiation errors when resizing glimagesink
GstVideoDecoder has its own logic for detecting when to reconfigure
which ultimately calls decide_allocation and results in a new
texture cache that has not been configured from our reconfigure check.

https://bugzilla.gnome.org/show_bug.cgi?id=755156
2015-09-17 21:14:24 +10:00
Jan Schmidt
9f890c5935 vtdec: Use R/RG textures for NV12 when the context provides them
Fixes playback to GL memory on iOS, where the colours are messed
up by passing Luminance/LuminanceAlpha textures where
color convert expects R/RG textures.

https://bugzilla.gnome.org/show_bug.cgi?id=754504
2015-09-12 04:33:34 +10:00
Jan Schmidt
0d7d7f6c92 vtdec: Prefer GL output caps.
Prefer GL caps by putting them first in the pad template and
intersecting using GST_CAPS_INTERSECT_FIRST.
2015-09-12 04:33:34 +10:00
Heinrich Fink
0cc6d16c94 applemedia/avsample: Fix racy cleanup of CA layer
The block that is dispatched async to the main thread assumed the
wrapping GstAvSampleVideoSink to be alive. However, at the time of
the block execution the GstObject instance that is deferenced to access
the CA layer might already be freed, which caused occasional crashes.
Instead, we now only pass the CoreAnimation layer that needs to be
released to the block. We use __block to make sure the block is not
increasing the refcount of the CA layer again on its own.

https://bugzilla.gnome.org/show_bug.cgi?id=753081
2015-07-31 12:59:00 +10:00
Ilya Konstantinov
bfa054a733 vtdec: handle non-consecutive GstBuffer input without copying
CMBlockBuffer offers a model similar to GstBuffer, as it can
consist of multiple non-consecutive memory blocks.

Prior to this change, what we were doing was:

 1) Incorrect:

   CMBlockBufferCreateWithMemoryBlock does not copy the data,
   but we gst_buffer_unmap'd right away.

 2) Inefficient:

   If the GstBuffer consisted of non-contiguous memory blocks,
   gst_buffer_map resulted in malloc / memcpy.

With this change, we construct a CMBlockBuffer out of individual mapped
GstMemory objects. CMBlockBuffer is made to retain the GstMemory
objects (through the use of CMBlockBufferCustomBlockSource), so the
original GstBuffer can be unref'd.

https://bugzilla.gnome.org/show_bug.cgi?id=751241
2015-07-13 11:11:04 -04:00
Matthew Waters
c1906f1cfe applemedia/avsample: fix unconditional use of OSX 10.10 API
We can just not use the error/status properties

https://bugzilla.gnome.org/show_bug.cgi?id=746631
2015-07-13 23:26:14 +10:00
Ilya Konstantinov
cc3d79f7cc vtdec: fix refcount error in error handling
https://bugzilla.gnome.org/show_bug.cgi?id=751641
2015-07-07 20:18:50 +03:00
Luis de Bethencourt
bf2f4f5c8c docs: decodebin2 -> decodebin 2015-06-25 11:02:45 +01: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
Ilya Konstantinov
58ce6d50a0 avfvideosrc: add frame rate range to caps
When AVFoundation indicates a supported frame rate range, add it to
the caps. This is important for devices such as the iPhone 6, which
indicate a single AVFrameRateRange of 2fps - 60fps.

https://bugzilla.gnome.org/show_bug.cgi?id=751048
2015-06-22 18:22:57 +02:00
Ilya Konstantinov
29c79d7595 vtenc: always enqueue frames, even on error
Even when we fail to encode frame, we should still enqueue it so
it could be passed into handle_frame (with output_buffer == NULL).
Otherwise, we risk GstVideoEncoder's queue of frames growing unbounded.

Note: We're slightly changing the renegotiation code to accommodate for
frames without output buffers, but this commit takes no ownership over
the way negotiation is being done.

https://bugzilla.gnome.org/show_bug.cgi?id=750669
2015-06-10 22:23:06 +02:00
Ilya Konstantinov
6101fc57b8 vtenc: free input buffer ASAP
VTCompressionSessionEncodeFrame retains the CVPixelBuffer during
encoding, and will release it as soon as it can (e.g. before it even
calls our callback). This means we can safely release input buffer
at this point, possibly allowing the system to reuse it sooner.

https://bugzilla.gnome.org/show_bug.cgi?id=750671
2015-06-10 10:30:23 +02:00
Ilya Konstantinov
f5c29c7379 vtenc: Add missing gst_vtenc_frame_free() in error path
https://bugzilla.gnome.org/show_bug.cgi?id=750668
2015-06-10 10:26:28 +02:00
Ilya Konstantinov
5db08a8b89 vtenc: add alignment=au to sink caps
VT compression callback gets a CMSampleBuffer per frame, so vtenc_h264
should set 'alignment=au' in sink caps to indicate this.

https://bugzilla.gnome.org/show_bug.cgi?id=750635
2015-06-10 10:20:44 +02:00
Ilya Konstantinov
05cc418ca2 avfassetsrc: fix huge memory leak
CMSampleBuffers were retained -> huge memory leak.

https://bugzilla.gnome.org/show_bug.cgi?id=750638
2015-06-09 16:36:41 +02:00
Ilya Konstantinov
faf903720a vtenc: no need for queue_length with try_pop 2015-06-09 16:20:06 +02:00
Ilya Konstantinov
1f7681dd0a vtdec: don't copy meta from input to output
Copying arbitrary metas is going to cause problems and this should really be
handled by the base class. It overrides most other things already anyway,
including timestamp and duration. Those are just set here now so we can
insert the frame sorted into the queue.

https://bugzilla.gnome.org/show_bug.cgi?id=748922
2015-06-09 16:20:06 +02:00
Thiago Santos
045bfa10fe Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2015-06-05 09:43:35 -03:00
Nicolas Dufresne
4cca6efda8 vtdec: Require width and height field for H264
This decoder does not work if width and height field are not set
in the sinkpad caps. Let's make this explicit by adding them to
the template caps.

https://bugzilla.gnome.org/show_bug.cgi?id=749655
2015-06-01 11:23:41 -04:00
Ilya Konstantinov
94e7ed1323 vtenc: fix keyframe request race condition
It is incorrect to modify the frame properties after passing them, since
VTCompressionSessionEncodeFrame takes reference and we have no control
over when it's being used.

In fact, the code can be simplified. We just preallocate the frame
properties for keyframe requests, and pass NULL otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=748467
2015-06-01 13:32:03 +02:00
Ilya Konstantinov
c948484c7f avfvideosrc: fix unconditional buffer queue unlock
Unless stopRequest is set, we should unlock conditionally -- otherwise,
the 'create:' method can wake up to an empty buffer queue
and pull a nil buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=748054
2015-05-11 21:11:30 +10:00
Sebastian Dröge
7020154f1c vtdec: We shouldn't manually check reconfigure flag on pads but instead implement ::negotiate()
Add FIXME comment related to that.
2015-05-08 15:08:18 +02:00
Ilya Konstantinov
528871f571 avfvideosrc: drop frames we get before we have a clock
https://bugzilla.gnome.org/show_bug.cgi?id=748054
2015-04-26 20:37:11 +02:00
Yujin Lee
a8ea7a9cfb vtdec: fix build error with clang
This commit fixes a simple build error by clang with
by clang with [-Werror,-Wtautological-pointer-compare] options.

https://bugzilla.gnome.org/show_bug.cgi?id=748110
2015-04-26 19:23:06 +02:00
Alessandro Decina
edf9035d02 applemedia: avoid implicit color conversions
Rework the GL texture code a little to avoid implicit color conversion inside
AVF/VT on both iOS and OSX.
2015-04-20 17:09:58 +10:00
Ilya Konstantinov
c98eb6f2f5 corevideotexturecache: free texture cache on iOS
https://bugzilla.gnome.org/show_bug.cgi?id=748122
2015-04-19 14:48:43 +02:00
Ilya Konstantinov
472d1959a2 avfvideosrc: check for failure to create buffer
gst_core_media_buffer_new and gst_core_video_texture_cache_get_gl_buffer
can fail for various platform reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=748122
2015-04-19 14:48:11 +02:00
Yujin Lee
4a88951c52 avfvideosrc: fix build failure with clang
Use fabs for floating point input.

https://bugzilla.gnome.org/show_bug.cgi?id=748128
2015-04-19 12:54:32 +01:00
Ilya Konstantinov
a02a948a5d avfvideosrc: get connection and input clock early 2015-04-18 00:33:42 +10:00
Ilya Konstantinov
d1120c591c avfvideosrc: remove unused variables
Complement commit 5496fd3e75 by removing
the involved variables.
2015-04-15 10:16:17 +10:00
Alessandro Decina
a10232f7da applemedia: vtdec: fix GL negotiation 2015-04-14 20:33:25 +10:00
Alessandro Decina
3e0391a1f1 avfvideosrc: log timestamps 2015-04-14 18:05:58 +10:00
Ilya Konstantinov
5bc17dac29 avfvideosrc: subtract time spent in AVF queues
The time spent in AVF queues was being incorrectly added to running time
rather than subtracted.
2015-04-14 18:05:58 +10:00
Ilya Konstantinov
1b27538648 avfvideosrc: fix GL texture negotiation
GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE should no longer be used.
Instead, just get the GL context.

https://bugzilla.gnome.org/show_bug.cgi?id=747352
2015-04-14 18:05:57 +10:00
Ilya Konstantinov
4fd0f7277a avfvideosrc: fix setting of buffer offset end
Don't set offset end to random values off the stack.

https://bugzilla.gnome.org/show_bug.cgi?id=747352
2015-04-07 12:57:44 +01:00
ijsf
f62dda74cc Restricted activeVideoMaxFrameDuration to fix frame rate 2015-03-13 14:43:14 +00:00
Sebastian Dröge
160df421ea vtdec: Register a hardware-only vtdec_hw on OSX and give it a higher rank
while having the default vtdec at secondary rank. This allows decodebin/playbin
to prefer the hardware based decoders, and if that fails to initialize because
hardware resources are busy to fall back to e.g. the libav based h264 decoder
instead of the software based vtdec (which is slower), and only fall back to
the software based vtdec if there is no higher ranked decoder available.
2015-03-07 10:31:26 +01:00
Florian Zwoch
a8ae57480c avfvideosrc: allow "capture-screen" mode to select which screen to capture via the "device-index" option
https://bugzilla.gnome.org/show_bug.cgi?id=745161
2015-03-06 10:37:37 +01:00
Matthew Waters
0593480381 applemedia/avsamplesink: utilise a pull based approach of displaying video frames
Using requestMediaDataWhenReadyOnQueue the layer will execute a block
when it would like more frames. Using this we can provide the current
frame and avoid needlessly filling the layer's buffer queue causing
older frames to be displayed when under resource pressure.
2015-03-04 14:48:03 +11:00
Matthew Waters
c873c57430 vtdec: only attempt use of the texture cache with GLMemory caps features
Otherwise we send rectangle textures to glimagesink
2015-02-25 00:03:34 +11:00
Matthew Waters
e505f6257c applemedia: new AVSampleBufferLayerSink
Renders buffers using the CALayer subclass AVSampleBufferDisplayLayer
which can be placed inside a Core Animation render tree.
2015-02-24 19:12:10 +11:00
Sebastian Dröge
84ab11afdb avfvideosrc: Only set latency if we already know our caps
Otherwise we might set bogus values or GST_CLOCK_TIME_NONE.

Also make sure to reset the caps field to NULL after unreffing
the caps to prevent accidential use afterwards, and unref any
old caps before we remember new caps.
2015-02-19 01:03:35 +02:00
Sebastian Dröge
0c9f35653f vtenc: Check if VTSessionCopyProperty() succeeds before using the result
https://bugzilla.gnome.org/show_bug.cgi?id=744585
2015-02-16 12:35:09 +02:00
Alessandro Decina
6e325be516 applemedia: avfvideosrc: fix crash when non-GL memory is used 2015-02-13 19:12:54 +11:00
Sebastian Dröge
31f59cb344 avfvideosrc: Only use the duration of the sample if it is valid 2015-02-12 11:12:09 +02:00
Alessandro Decina
052e4804eb vtdec: fix texture sharing on iOS
Move GLES calls to the context thread. Fix
CVOpenGLESTextureCacheCreateTextureFromImage usage on iOS.
2015-02-09 21:18:24 +11:00
Sebastian Dröge
d4d02c6f9d corevideotexturecache: Add some assertions instead of just dereferencing NULL 2015-02-03 17:32:24 +01:00
Sebastian Dröge
b51254395a corevideotexturecache: Don't unconditionally use the CoreMedia meta on iOS
We might instead have a CoreVideo meta.
2015-02-03 17:32:24 +01:00
Sebastian Dröge
dac3e4ca06 vtdec: Don't dereference NULL frames when draining/flushing 2015-02-03 15:38:40 +01:00
Alessandro Decina
f577b52e5d applemedia: rework GL texture sharing
Use YUV instead of RGB textures, then convert using the new apple specific
shader in GstGLColorConvert. Also use GLMemory directly instead of using the
GL upload meta, avoiding an extra texture copy we used to have before.
2015-01-30 00:34:08 +11:00
Alessandro Decina
77d48abfab applemedia: vtdec: fix CMBlockBufferRef leak
Fix huge leak that went unnoticed for too long. Oops.
2015-01-30 00:34:08 +11: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
e91989136a applemedia: corevideobuffer: make mapping the CVPixelBuffer in CPU optional
Mapping is not necessary and impacts performance when doing texture sharing with
downstream
2015-01-30 00:34:08 +11:00
Matthew Waters
c6056b0dd5 applemedia: update for gstgl cocoa -> cgl change 2015-01-23 16:12:24 +11:00
Alessandro Decina
d95a12e185 vtdec: implement the GL texture upload meta 2015-01-15 14:10:43 +11:00
Alessandro Decina
cdfe90aaba avfvideosrc: implement the GL texture upload meta 2015-01-15 14:10:43 +11:00
Florian Zwoch
7d318a572c vtenc: Unlock the stream lock while waiting for pending frames to be completed in finish()
We might otherwise deadlock because gst_vtenc_enqueue_buffer() can be
called again and will take the stream lock again from another thread.

https://bugzilla.gnome.org/show_bug.cgi?id=742174
2015-01-08 14:48:20 +01:00
Alessandro Decina
5496fd3e75 avfvideosrc: improve timestamp code
Use a combination of the running time and CMClockGetTime from AVF to compute
timestamps.
2014-12-27 12:43:45 +11:00
Sebastian Dröge
568da160cb vtenc: Instead of crashing if no corresponding frame is found, ignore this
... and hope that everything will be fine. This shouldn't really happen but
previously happened during shutdown. It should be fixed in videoencoder now,
but better be on the safe side here.
2014-12-22 11:49:08 +01:00
Alessandro Decina
0156725480 avfvideosrc: improve timestamping and latency reporting
Use AVF provided timings to timestamp output buffers. Use the running time at
the time the first buffer is produced to base timestamps on. Report 1-frame
latency based on the negotiated framerate instead of hardcoding 4ms latency.
2014-12-17 12:24:05 +11:00
Alessandro Decina
4d89d7116b vtenc: bump rank to PRIMARY 2014-12-11 00:02:26 +11:00
Alessandro Decina
21f8c96d75 vtenc: negotiate profile and level with downstream 2014-12-10 22:36:53 +11:00
Alessandro Decina
8166487a00 vtenc: report latency 2014-12-10 19:44:51 +11:00
Sebastian Dröge
b88e4304f1 vtenc: Add properties to specify the maximum keyframe interval in frames and seconds 2014-12-05 16:33:54 +01:00
Sebastian Dröge
1a2362eb2b vtenc: Fix conversion of the bitrate property and our internal bitrate storage
The property is in kbit/s and we store it in bit/s, so just multiply and
divide by 1000. No need to put a factor of 8 in there.

kVTCompressionPropertyKey_AverageBitRate is also in bit/s according to
its documentation.
2014-12-05 16:17:16 +01:00
Alessandro Decina
d25813c9bc vtenc: add quality property 2014-11-27 18:41:21 +01:00
Alessandro Decina
6a4270d5cc vtenc: set profile and level in caps 2014-11-27 18:41:21 +01:00
Alessandro Decina
d45a2f0480 vtenc: let VT pick the bitrate by default 2014-11-21 15:48:08 +01:00
Alessandro Decina
d800ac023b vtenc: set H264_Baseline_AutoLevel on OSX as well 2014-11-20 16:06:46 +01:00
Alessandro Decina
d0ce9a6f7c vtdec: disable the reorder queue for baseline streams 2014-11-20 16:06:46 +01:00
Sebastian Dröge
6e2e8ec0ac vtdec: Fix divide by zero in the picture buffer length calculation 2014-11-20 09:42:24 +01:00
Alessandro Decina
5977ef5552 vtenc: fix build on iOS 2014-11-12 16:45:12 +01: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
Alessandro Decina
a1cc1b34e1 vtenc: fix compilation on < 10.9 2014-11-12 10:00:11 +01:00
Alessandro Decina
bc7dbd7b51 vtenc: enable the hw encoder on OSX 2014-11-11 18:01:54 +01:00
Sebastian Dröge
98b856d630 avfvideosrc: Don't pretend to support reconfiguration
We will run into an assertion in set_caps() if we try to change
caps while the source is already running. Don't try to find new
caps in GstBaseSrc::negotiate() to prevent caps changes.
2014-11-09 10:41:52 +01:00
Alessandro Decina
1d97516731 vtenc: add realtime and allow-frame-reordering properties 2014-11-07 00:22:08 +01:00
Sebastian Dröge
68c067e3c9 vtenc: Fix locking
The object lock only protects the session, as we modify
the session from other threads when the bitrate property
is changed. Don't hold it much longer than for session
related things.

And we need to release the video decoder stream lock before
enqueueing a frames. It might wait for our callback to dequeue
a frame from another thread, which will then take the stream
lock too and deadlock.
2014-10-21 16:22:06 +02:00
Sebastian Dröge
ad649138aa vtenc: Use kVTProfileLevel_H264_Baseline_AutoLevel only on iOS
It is not required on OSX apparently and was only added in 10.9.6 there.
Calculating the correct level from the configuration is not trivial, so let's
just not set a level at all here.
2014-10-19 14:57:43 +02:00
Sebastian Dröge
b57f255f26 vtenc: VTCompressionSessionPrepareToEncodeFrames only exists since 10.9.6
Check with configure for it instead of using one of the availability macros
as those wouldn't work as expected with minor versions.
2014-10-19 14:51:40 +02:00
Sebastian Dröge
e79355078e vtenc: Remove unused #define 2014-10-19 14:32:31 +02:00
Sebastian Dröge
3cead041f6 vtdec: Set reorder length to 0 if we can't calculate it
Instead of leaving it at whatever value it had before.
2014-10-14 09:19:59 +02:00
Sebastian Dröge
3c1ccb64eb vtenc: Fix encoder to work on iOS
iOS has special stride requirements that we don't know yet, so copy
input buffers into buffers allocated by iOS for now.

Later we should check the stride and probably provide a buffer pool for these
buffers so upstream can directly write in there.
2014-09-19 14:47:05 +03: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
Sebastian Dröge
9380f6282d vtenc: Let the encoder automatically choose a h264 level
We should negotiate these things via caps...
2014-09-18 17:49:46 +03:00
Sebastian Dröge
31476a3c46 vtenc: Use 0 instead of G_MAXDOUBLE as the max keyframe interval
0 means no limit, which was meant here with G_MAXDOUBLE probably.
2014-09-18 13:45:33 +03:00
Sebastian Dröge
8c1e84ff71 vtenc: Expected duration is supposed to be the duration of the stream, not a frame
Just don't set it for now, it isn't really needed.
2014-09-18 13:42:24 +03:00
Sebastian Dröge
61c40523df vtenc: Properly handle keyframes
Especially set the SYNC_POINT flag on keyframes.
2014-09-18 13:11:05 +03:00
Sebastian Dröge
de9b0be86d vtdec: Fix compilation 2014-09-18 10:30:04 +03:00
Sebastian Dröge
e653068bc2 vtdec: Handle 0/1 framerates correctly by not calculating their frame duration 2014-09-18 09:47:06 +03:00
Sebastian Dröge
916155da2b atdec: Fix some compiler warnings with newer clang 2014-09-17 17:37:12 +03:00
Sebastian Dröge
ddea2e4498 vtenc: Prepare encoder after setup
This will allow encoding to happen faster on the first frame.
2014-09-17 17:10:58 +03:00
Sebastian Dröge
c6f17d6013 vtenc: Only drain the encoder in ::finish(), not on every frame
Otherwise quality and bitrate will be bad.
2014-09-17 17:08:57 +03:00
Sebastian Dröge
0390398e39 vtenc: Error out if encoding returned an error
Otherwise we will just continue consuming frames until all memory is filled
up and the app crashes.
2014-09-17 15:39:26 +03:00
Sebastian Dröge
e3bc32fb58 vtenc: Check for errors from VTCompressionSessionCompleteFrames() 2014-09-17 14:56:05 +03:00
Sebastian Dröge
b93e0f5f99 vtenc: Properly scale timestamps for the API and set invalid values 2014-09-17 14:55:24 +03:00
Sebastian Dröge
e4563ce6cf vtdec: Properly scale timestamps for the API and set invalid values 2014-09-17 14:54:39 +03:00
Sebastian Dröge
d789246077 applemedia: Remove old code that is of no use anymore 2014-09-17 13:19:04 +03:00
Sebastian Dröge
82aae4df74 applemedia: Do weak linking with the VideoToolbox framework
It does not exist on older OSX and iOS but we still want to
be able to use it when it's available.
2014-09-17 10:38:20 +03:00
Sebastian Dröge
7fa9bbc3b0 vtenc: Port to GstVideoEncoder base class 2014-09-16 17:04:31 +03:00
Sebastian Dröge
4e1f8285c2 vtenc: Use correct instance struct size 2014-09-16 16:13:16 +03:00
Sebastian Dröge
3a52f6b757 vtdec: Fix compiler warnings
values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
2014-09-16 15:48:11 +03:00
Sebastian Dröge
f2eedb9cee vtenc: Port to the real VideoToolbox API instead of using our dlopen() wrapper
It's a public framework since a long time.
2014-09-16 15:47:29 +03:00
Sebastian Dröge
0f0a50c119 vtdec: No need to set kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder on iOS 2014-09-15 15:42:41 +03:00
Sebastian Dröge
c82fa4f845 applemedia: Don't include VideoToolbox on iOS < 8.0
It's private API and does not work without a jailbroken device.
2014-09-15 15:12:31 +03:00
Sebastian Dröge
0b34cde46e vtdec: Fix compilation on iOS 8.0 2014-09-13 20:49:16 +03:00
Tim-Philipp Müller
ffe59820d8 avfvideosrc: fix bogus BGRA caps
Remove 0.10-style endianness/*_mask/bpp/depth fields.
2014-09-10 16:38:52 +01:00
Sebastian Rasmussen
b323fba934 vtenc: Avoid leaking caps object and its copy
gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
so creating a copy using gst_caps_copy() results in a reference leak. Also
the caps are pushed as an event downstream, but this doesn't consume the
caps so it must still be unreferenced.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734534
2014-08-10 12:13:48 +01:00
Sebastian Dröge
2b63783c94 atdec: Change rank to MARGINAL until it can properly handle multichannel audio
https://bugzilla.gnome.org/show_bug.cgi?id=727757
2014-07-11 09:43:44 +02:00
Alessandro Decina
0258ec0273 applemedia: enable vtdec and vtenc only on >= 10.8 where VideoToolbox is public
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=723670
2014-07-02 12:56:06 +02:00
Thiago Santos
92dbcf2bf9 vtdec: avoid segfault when output isn't configured
This can help when the callback is called during/after videodecoder
base class shut down

https://bugzilla.gnome.org/show_bug.cgi?id=728435
2014-07-02 06:19:58 -03:00
Thiago Santos
f75f860ff3 vtdec: ignore the dropped flag if buffer was received
Apparently there is some issue with VT that makes it mark the dropped
flag even though the buffer was decoded.

https://bugzilla.gnome.org/show_bug.cgi?id=728435
2014-07-02 05:48:32 -03:00
Matthieu Bouron
e1601406a5 vtenc: fix memory leak
The pixel buffer release callback is called if the void *
dataPtr given to the CVPixelBufferCreateWithPlanarBytes
is not NULL.

According to the documentation dataPtr is supposed to be a
"plane description block" but no specific type is given.

https://bugzilla.gnome.org/show_bug.cgi?id=711847
2014-06-30 13:09:28 +02:00
Andoni Morales Alastruey
fc02ec2087 avfassetsrc: downgrade rank to SECONDARY in OS X 2014-04-24 12:28:17 +02:00
Andoni Morales Alastruey
d234bee52f avfassetsrc: rename references to iOS 2014-04-24 12:28:17 +02:00
Matthieu Bouron
2f0aad7158 iosavassetsrc: rename element to avfassetsrc
https://bugzilla.gnome.org/show_bug.cgi?id=728249
2014-04-24 12:28:17 +02:00
Matthieu Bouron
ecf765635b iosavassetsrc: Port to 1.0
Also enables this element on OSX >= 10.7.

https://bugzilla.gnome.org/show_bug.cgi?id=728249
2014-04-24 12:28:17 +02:00
Andoni Morales Alastruey
9fec222b5a applemedia: add new source/decoder element for iOS assets
https://bugzilla.gnome.org/show_bug.cgi?id=728249
2014-04-24 12:28:16 +02: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
Matthieu Bouron
c6572df9ff avfvideosrc: check if downstream supports the video meta API
Check if downstream supports the video meta API, so we can use it later
with the core media buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=727953
2014-04-24 10:46:51 +01:00
Andoni Morales Alastruey
110c21a136 vtenc: fix complier error using fixed lenght arrays 2014-04-18 20:17:00 +02:00
Sebastian Dröge
cba13ef301 atdec: Add some more debug output 2014-03-11 15:33:26 +01:00
Sebastian Dröge
fa8a7d7659 atdec: Implement draining properly 2014-03-11 15:33:26 +01:00
Sebastian Dröge
53ab9c6613 atdec: First dequeue a buffer before enqueueing anything from the queue
Required for offline rendering according to the docs. wtf.
2014-03-11 15:33:26 +01:00
Sebastian Dröge
f331d3159f atdec: Keep track of the current position
It's required to set a valid sample time for decoding on iOS.
2014-03-11 15:33:26 +01:00
Sebastian Dröge
8d8b3c0401 atdec: Always try to pull one decoded frame out of the queue
... instead of doing magic calculations with the buffer duration.
2014-03-11 15:33:25 +01:00
Sebastian Dröge
41b2cca8fc atdec: Handle errors in handle_frame() properly 2014-03-11 15:33:25 +01:00
Sebastian Dröge
dfe476c444 atdec: Call AudioQueueReset() for flushing
AudioQueueFlush() is for draining all remaining data.
2014-03-11 15:33:25 +01:00
Sebastian Dröge
1c13e513c9 atdec: Set correct number of frames for MP3 2014-03-11 15:33:25 +01:00
Sebastian Dröge
2d8b195911 atdec: Initialize the audio description with zeroes 2014-03-11 15:33:25 +01:00
Sebastian Dröge
a43db678c1 atdec: Set the correct layer depending on the MP3 caps 2014-03-11 15:33:25 +01:00
Edward Hervey
72127a85f5 applemedia: Fix libtool usage
--tag=CC is needed for static build
2014-02-06 16:17:39 +01:00
Sebastian Dröge
0d794993fb applemedia: Actually the enc/decbins are not used anywhere currently
Code is commented out.
2014-01-20 10:38:16 +01:00
Sebastian Dröge
1107e158f7 applemedia: Fix build on iOS and probably also on OSX
The video toolbox is not available on iOS, and also on OSX
we should probably build all source files that are used for
it.

https://bugzilla.gnome.org/show_bug.cgi?id=722590
2014-01-20 10:34:57 +01:00
Alessandro Decina
cd90748c5b applemedia: vtdec: set the correct stride in the video meta 2013-12-22 17:48:25 +01:00
Alessandro Decina
7a8d918472 applemedia: atdec: fix aac decoding on Mavericks 2013-12-22 17:48:25 +01:00
Alessandro Decina
cf2cf20cc3 applemedia: corevideobuffer: fix for planar formats 2013-12-19 08:59:39 +01:00
Alessandro Decina
a75ddf446b applemedia: vtdec: remove silly stride requirement
This is legacy from the 0.10 times, and it isn't clear how it was useful back
then also.'
2013-12-19 08:59:39 +01:00
Davide Bertola
72e989f2da applemedia: vtdec: Enable hardware accelerated decoding on 10.9 2013-12-18 10:28:17 +01:00
Alessandro Decina
d5eccb2285 applemedia: vtdec: handle level 3 in get_dpb_max_mb_s_from_level. oops. 2013-12-14 19:18:41 +01:00
Alessandro Decina
44e62613db applemedia: atdec: fix mp3 caps 2013-12-14 19:18:41 +01:00
Alessandro Decina
f387bd0342 applemedia: always include <Foundation/Foundation.h>
Fixes compilation with newest xcode.
2013-12-14 13:30:01 +01:00
Alessandro Decina
de60453a33 applemedia: vtdec: fix compiler warning (uninitialized variable) 2013-12-11 18:52:53 +01:00
Alessandro Decina
00392a6d16 applemedia: vtdec: rename reorder_queue_frame_delay to reorder_queue_length 2013-12-11 08:12:37 +01:00
Alessandro Decina
596aa8e05a applemedia: vtdec: report latency 2013-12-11 08:12:36 +01:00
Alessandro Decina
733a780e9d applemedia: vtdec: set reorder queue length to the max DPB length
Set reorder_queue_frame_delay from the DPB size (in frames). Still not optimal,
as the DPB size is larger than the max bframe forward prediction length, but I
don't know how to compute the latter without parsing every group of pictures.
2013-12-11 08:12:36 +01:00
Alessandro Decina
7dffa2e1f2 applemedia: vtdec: set the correct video format in the video meta
Fixes all kinds of weird bugs when videoconvert is used with the decoder.
2013-12-10 11:12:56 +01:00
Alessandro Decina
ffeb719d4c applemedia: corevideobuffer: set the correct stride for packed formats 2013-12-08 16:46:58 +01:00
Alessandro Decina
839970e07c applemedia: vtdec: fix mpeg2 video support 2013-12-08 15:31:09 +01:00
Alessandro Decina
938ce6a23d applemedia: vtdec: make jpeg decoding actually work 2013-12-08 15:25:27 +01:00
Alessandro Decina
1cd62000f5 applemedia: vtdec: fail gracefully when not negotiated 2013-12-08 15:24:58 +01:00
Alessandro Decina
b1a756fda7 applemedia: rewrite VideoToolbox decoder based on GstVideoDecoder 2013-12-08 15:13:26 +01:00
Matthieu Bouron
58be5ce16d avfvideosrc: declare missing instance variables
Fixes build on 32-bit system.

https://bugzilla.gnome.org/show_bug.cgi?id=711844
2013-11-11 14:36:19 +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
Matthieu Bouron
c9a8224553 qtkitvideosrc: lower rank to GST_RANK_SECONDARY
Makes avfvideosrc be prefered over qtkitvideosrc since it is deprecated
with OS X 10.9.

https://bugzilla.gnome.org/show_bug.cgi?id=711614
2013-11-07 18:44:39 +01:00
Matthieu Bouron
314e01e83f avfvideosrc: set rank to GST_RANK_PRIMARY
Makes avfvideosrc to be used with autodetection.

https://bugzilla.gnome.org/show_bug.cgi?id=711614
2013-11-07 18:44:27 +01:00
Andoni Morales Alastruey
7e195cdcdc avfvideosrc: fix compiler warning in iOS 2013-11-07 15:24:29 +01:00
Andoni Morales Alastruey
98e849a092 avfvideosrc: fix build in iOS with isEqualTo doesn't exists 2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
a2b90eeb8c avfvideosrc: fix build with older SDK not supporting AVDeviceFormat
AVDeviceFormat and AVFrameRateRange are available in iOS since 7.0
so we need a more dynamic approach to support compilation with older
SDK's. We use a NSObject to avoid referencing those types and key-value
coding or preformSelector to access properties.
2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
46a61ea036 avfvideosrc: fix checks for HAVE_IOS 2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
81cb13be64 avfvideosrc: include config.h 2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
ef7f6e4654 avfvideosrc: add more debug 2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
606a50e550 avfvideosrc: fix compilation with gcc
The synthesize block needs to be moved to fix a compiler error
2013-11-07 15:24:28 +01:00
Andoni Morales Alastruey
94d77829a4 avfvideosrc: sort caps with the highest resolution first
When started without any caps filter we prefer the highest
supported resolution.
2013-11-07 15:24:28 +01:00
Matthieu Bouron
66334591cc avfvideosrc: support screen capture on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=711432
2013-11-07 15:24:28 +01:00
Matthieu Bouron
88b5ff76f6 avfvideosrc: minor cosmetic 2013-11-07 15:24:28 +01:00
Matthieu Bouron
752d74b31f avfvideosrc: use input device formats to set/get caps if available
https://bugzilla.gnome.org/show_bug.cgi?id=711211
2013-11-07 15:24:28 +01:00
Matthieu Bouron
35587efdc9 avfvideosrc: update caps if frame size has changed
On OSX, setting the pixel format on the output reset the capture device
to its native resolution, so we need to update the caps if the output
frame size has changed before a proper solution is found.
2013-11-07 15:24:28 +01:00
Matthieu Bouron
fae79751ad avfvideosrc: check if low preset is available 2013-11-07 15:24:28 +01:00
Matthieu Bouron
7f807270fa avfvideosrc: use a dedicated queue for AVFoundation calls
Replace the main queue with a dedicated queue for AVFoundation calls
so the execution on this queue won't block if the main queue
is not running.
2013-11-07 15:24:28 +01:00
Matthieu Bouron
5d612768a4 avfvideosrc: remove trailing space 2013-11-07 15:24:28 +01:00
Matthieu Bouron
19844fab47 avfvideosrc: dispatch AVFoundation calls synchronously in the main queue 2013-11-07 15:24:27 +01:00
Matthieu Bouron
0d74dc802a applemedia: enable avfvideosrc if AVFoundation is present 2013-11-07 15:24:27 +01:00
Matthieu Bouron
b6925d5c56 avfvideosrc: only enable 1920x1080 preset on iOS 2013-11-07 15:24:27 +01:00
Matthieu Bouron
06d59e7829 applemedia: port avfvideosrc to 1.0 2013-11-07 15:24:27 +01:00
Sebastian Dröge
831c67c07b applemedia: Link with gmodule for g_module_open() and others 2013-11-04 10:05:40 +01:00
Matthieu Bouron
1b2b879bf4 vtenc: use proper release callback type in CVPixelBufferCreateWithPlanarBytes
https://bugzilla.gnome.org/show_bug.cgi?id=711140
2013-10-30 16:27:58 +00:00
Matthieu Bouron
22eaf39c1a avfvideosrc: fix truncated line
https://bugzilla.gnome.org/show_bug.cgi?id=710657
2013-10-30 16:27:58 +00:00
Dominik Röttsches
b002490ab2 vtenc: Add support for I420
https://bugzilla.gnome.org/show_bug.cgi?id=709241
2013-10-02 13:18:04 +02:00
Dominik Röttsches
24c79af394 vtenc: Use correct strides, etc from the GstVideoFrame
https://bugzilla.gnome.org/show_bug.cgi?id=706211
2013-10-02 13:14:32 +02:00
Sebastian Dröge
4bed01aff9 iosassetsrc: Port to 1.0 and fix some bugs on the way 2013-09-28 20:36:21 +02:00
Andoni Morales Alastruey
e5d5faa67e iosassetsrc: Add new element from the GStreamer SDK project 2013-09-28 20:36:21 +02:00
Sebastian Dröge
dd19715961 applemedia: avfvideosrc is not ported to 1.0 yet 2013-09-28 20:36:21 +02:00
Alessandro Decina
95d5a8055b applemedia: atdec: destroy the queue if set_format fails 2013-07-24 09:18:43 +02:00
Alessandro Decina
10d02e381b applemedia: atdec: remove c++ style comments 2013-07-24 09:15:49 +02:00
Alessandro Decina
d71aaec486 applemedia: atdec: 1st round of fixes 2013-07-24 09:11:59 +02:00
Alessandro Decina
92bcdd9c4b applemedia: add AudioToolbox based audio decoder 2013-07-23 10:36:47 +02:00
Andoni Morales Alastruey
bab2bf3f11 applemedia: fix release of null pointer 2013-06-18 13:33:14 +02: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
22be93cd04 applemedia: move defines to CPPFLAGS for obj-c files 2013-06-18 13:02:42 +02:00
Andoni Morales Alastruey
0690238c59 applemedia: fix duplicated symbols with applemedia 2013-05-24 09:39:10 +02:00
Andoni Morales Alastruey
5f4ac8c58f vtdec: simplify caps setting 2013-05-20 13:31:02 +02:00
Andoni Morales Alastruey
2f36ffb7d0 applemedia: fix H264 streams with b-frames
The decoder output frames in DTS order, even with the flag
kVTDecodeFrame_EnableTemporalProcessing. We store a internal
queue of the decoded frames and push them PTS order.
2013-05-20 13:31:02 +02:00
Andoni Morales Alastruey
3b249f6761 applemedia: fix segfault with dropped frames 2013-05-20 13:31:02 +02:00
Andoni Morales Alastruey
d9db0c2d4a applemedia: improve usage of the VT API
Add timing information to CV samples and pass the GstBuffer
as extra data in the decode function
2013-05-20 13:31:02 +02:00
Andoni Morales Alastruey
db49a77682 applemedia: add support for MPEG-1 too 2013-05-20 13:31:02 +02:00