Commit graph

1376 commits

Author SHA1 Message Date
Reynaldo H. Verdejo Pinochet
598f71d12c Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe

(Includes unrelated formatting change to go through
indent checker commit hook)
2015-11-20 10:48:47 -08:00
Nicolas Dufresne
2a7aaeb3da avviddec: Don't fallback on allocation failure
Allocation should keep working, falling back causes the stride to
change which is not supported in direct rendering.

https://bugzilla.gnome.org/show_bug.cgi?id=756028
2015-11-07 12:12:46 -05:00
Vineeth TM
2d94a1cbcc avvidenc: Fix frame memory leak
The frame being passed to handle_frame should be unref'ed in all cases

https://bugzilla.gnome.org/show_bug.cgi?id=757453
2015-11-02 09:25:34 +02:00
Vineeth TM
e5b9e11383 avdemux: Fix string memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=757454
2015-11-02 09:22:37 +02:00
Mark Nauwelaerts
67e55e47e2 avviddec: _drain and _finish need slightly different handling
... since they handle separate cases in video decoder with different requirements.
Consider e.g. x264enc ! rtph264pay ! identity drop-probability=0.1 ! rtph264depay
to illustrate a need for such separation.
2015-10-26 19:54:10 +01:00
Sebastian Dröge
dc4b9ef7e6 avviddec: Fix bufferpool config double free by taking a copy as needed
Also free the config in two code paths where we leaked it before.
2015-10-16 18:52:57 +03:00
Thiago Santos
1356ff84b3 avcodecmap: add jpeg2000 decoder mapping
Map the 3 possible jpeg2000 caps to JPEG2000 codec id
2015-10-11 05:27:57 -03:00
Sebastian Dröge
eedefc9f6b avcodecmap: Don't allocate dummy codec data anymore, it causes crashes nowadays
Multithreaded encoders are going to free this dummy codec data twice, e.g.
with this pipeline
  gst-launch-1.0 videotestsrc num-buffers=40 ! \
    videoconvert ! avenc_mjpeg ! fakesink
2015-10-03 18:25:35 +01:00
Sebastian Dröge
e5e78379ad avvidenc: Pass the correct user_data to gst_buffer_new_wrapped_full()
Fixes crash with e.g.

  gst-launch-1.0 videotestsrc num-buffers=40 ! \
    videoconvert ! avenc_huffyuv ! fakesink
2015-10-03 18:14:05 +01:00
Sebastian Dröge
fcdb9c08c5 libav: G_CONST_RETURN is deprecated since GLib 2.30 2015-10-02 23:02:01 +03:00
Luis de Bethencourt
3999a29748 avviddec: only free config when pool doesn't take ownership
Since gst_buffer_pool_set_config() takes ownership of the config structure,
it is only necessary to free the structure before using it when the true
branch of if (gst_buffer_pool_config_validate_params) hasn't run.

gst_buffer_pool_set_config() always takes ownership of the structure
regardless of success or failure. Which means the return, checked with
if (!working_pool), has no relation to the state of the structure.
2015-10-02 11:49:39 +01:00
Luis de Bethencourt
074a128f0f avviddec: fix memory leak
Free config before overwriting.

CID #1320708
2015-09-29 16:44:47 +01:00
Tim-Philipp Müller
6fadf448de avvidec: increase default alignment to 32 bytes
Change default alignment from 16 to 32 bytes, which fixes crashes
when decoding H.265 using AVX2-based decoder code paths and when
using ximagesink/glimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:36:49 +01:00
Tim-Philipp Müller
a0ebef9637 avvideodec: ensure required mem alignment fixing avdec_h265 crashes with ximagesink/glimagesink
Make sure the alignment requirement in GstAllocationParams
matches the GstVideoAlignment requirements. This fixes
issues with avdec_h265 crashing in the avx2 code path when
used with playbin and ximagesink/glimagesink as videosink.

The internal video pool would allocate buffers with an
alignment of 15 even though GstVideoAlignment specified
a stride_align requirement of 31 (which comes from ffmpeg).

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:36:30 +01:00
Jan Schmidt
30a406591a avvid/audenc: Set some tags in the output for downstream's info
Add the codec name and bitrate into the output for informational
purposes. Bitrate in particular is now used by flvmux to set
videodatarate and audiodatarate in the resulting stream
2015-08-24 00:01:40 +10:00
Nicolas Dufresne
6e590fe498 avviddec: Fix pool reallocation logic
Some check where incorect and also unsafe. The only reliable information
in get_buffer2 is the picture width/height really. The side effect is
that the width/height of the internal pool endup padded, so when we
switch we also need to switch to the a new width/height, hence we save
the pool info.

https://bugzilla.gnome.org/show_bug.cgi?id=753869
2015-08-20 16:23:23 -07:00
Nicolas Dufresne
e3bdfb5608 aviddec: Re-enable direct rendering
This is achieved by using a tempory internal pool. We can then switch to a
downstream pool if the downstream pool buffer have matching strides.

https://bugzilla.gnome.org/show_bug.cgi?id=752802
2015-08-17 10:47:53 +02:00
Thiago Santos
fa29036836 avvidenc: use template subset check for accept-caps
It is faster than doing a query that propagates downstream and
should be enough
2015-08-17 04:36:39 -03:00
Thiago Santos
ad215706ec avaudenc: use pad template caps for accept-caps
use template subset check for accept-caps

It is faster than doing a query that propagates downstream and
should be enough
2015-08-17 04:35:41 -03:00
Thiago Santos
15ef18c3e1 avaudenc: remove useless getcaps method
It just calls the exact same function as the default handler
2015-08-16 14:14:27 -03:00
Thiago Santos
427db7f484 avvidenc: remove useless getcaps method
It just calls the exact same function as the default handler
2015-08-16 14:13:05 -03:00
Thiago Santos
5c56635e97 avauddec: let audiodecoder call the default pad query handler
Avoids repeating the same handling in many decoders
2015-08-15 13:51:35 -03:00
Thiago Santos
8cc2e1a76b avviddec: let videodecoder call the default pad query handler
Avoids repeating the same handling in many decoders
2015-08-15 13:51:35 -03:00
Thiago Santos
1a098de5eb avviddec: use template caps intersection for accept-caps
Avoid doing downstream caps queries when accept-caps should just
do a shallow caps check on the element itself

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 09:14:11 -03:00
Thiago Santos
2b387ba827 avauddec: use template caps intersection for accept-caps
Avoid doing downstream caps queries when accept-caps should just
do a shallow caps check on the element itself

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 09:14:11 -03:00
Jan Schmidt
51896af52b Map ffmpeg metadata to GStreamer tags
Update to the metadata API ffmpeg has had in
place for a long time now, and reenable output
of GStreamer tags from the demuxer.

https://bugzilla.gnome.org/show_bug.cgi?id=566605
2015-08-05 16:53:28 -04:00
Olivier Crête
c1333df059 avviddec: Remove unused force parameter
This parameter has been always false for a long time.
2015-08-03 21:45:07 -04:00
Olivier Crête
1c70fb229a avviddec: Use caps-like size in get_buffer2()
The size in the AVFrame in get_buffer2 don't match the output size,
instead they match ffmpeg's memory requirements, so we can't compare
them from the values of the output AVFrame. Those are comparable to
the values in the passed AVCodecContext.
2015-08-03 21:40:12 -04:00
Olivier Crête
e7ece560d6 avviddec: Reset current_dr on close and when not chosing it
https://bugzilla.gnome.org/show_bug.cgi?id=753189
2015-08-03 21:03:05 -04:00
Olivier Crête
0a0ee42752 avviddec: Disable direct rendering before a frame has been produces
ffmpeg doesn't provide the final's image width & height in the get_buffer2()
callback, so it's not possible to create an output state for GstVideoDecoder
at this stage. So only try to do direct rendering if the buffer pool has already
been negotiated based on the final decoded size.

This partially reverts the effects of 2e621f8db

https://bugzilla.gnome.org/show_bug.cgi?id=752802
2015-07-28 16:16:10 -04:00
Olivier Crête
1a127d19bb avviddec: Get code out of loop
Code was executed only on the first iteration, so just pull it out
of the loop entirely. This makes it clear it has nothing to do with the loop.
2015-07-27 18:49:49 -04:00
Olivier Crête
431f3e0e6f avviddec: Only create the AVBuffer once the stride is validated
If it is created earlier and the stride is invalid, then the frame
will be freed and it won't be possible to use it in the fallback path.
Not doing this causes a segfault because it will try to use
already freed memory.
2015-07-27 18:46:17 -04:00
Olivier Crête
2e621f8dbf avviddec: Re-enable direct rendering 2015-07-27 15:29:49 -04:00
Olivier Crete
3b6c656e25 avauddec: Read channels from the channels field
If there is no layout, just read the channel count from the
channels field.

https://bugzilla.gnome.org/show_bug.cgi?id=752186
2015-07-27 14:18:32 -04:00
Olivier Crête
6bfe79d903 avviddec: Ignore negotiation error on shutdown
https://bugzilla.gnome.org/show_bug.cgi?id=752800
2015-07-27 13:58:43 -04:00
Olivier Crête
7afaf5c020 avauddec: Access field using accessors
Those fields are documented to only be safe to access using
accessors as their position is not part of the ABI.
2015-07-25 03:06:10 -04:00
James Smith
f92bf2618c Add support for musepack (mpc) sv8 audio
https://bugzilla.gnome.org/show_bug.cgi?id=732682
2015-07-22 09:44:27 +01:00
Vineeth T M
7d3c7109ac avviddec: fix slice_offset memory leak
In case of real videos, slice_offset is being allocated,
but the same is not being freed.

https://bugzilla.gnome.org/show_bug.cgi?id=752404
2015-07-21 11:20:07 +01:00
Sebastian Dröge
5d2e9b7b80 Make the LGPL build the default and require --enable-gpl to build a GPL licensed version 2015-07-01 22:40:02 +02:00
Sebastian Dröge
b526816cfe avmux: Blacklist some subtitle and adaptive streaming muxers 2015-07-01 22:11:52 +02:00
Sebastian Dröge
97f58baecd Switch from libav v11.4 to ffmpeg n2.7.1
ffmpeg seems to be the one of the two forks, which is most widely used by
Linux distributions and in general. Also Google is using it for e.g. Chrome
and has engineers working on finding and fixing security issues in it.

https://bugzilla.gnome.org/show_bug.cgi?id=751607
2015-07-01 21:40:00 +02:00
Sebastian Dröge
1dcdeb977c avaudenc: Remember how many samples the codec consumed for telling the base class 2015-06-30 20:01:46 +02:00
Thomas Bluemel
30a4a28793 avauddec: Ensure input buffers have FF_INPUT_BUFFER_PADDING_SIZE padding, which is required by avcodec_decode_audio4 () 2015-06-30 19:19:42 +02:00
Sebastian Dröge
626152dd6f avmux: Ignore stream_segment,ssegment muxer that is provided by ffmpeg
The comma confuses our code, e.g. it's not a valid element name or structure
name.
2015-06-29 13:29:05 +02:00
Sebastian Dröge
8271b2755a avvidenc: Fix compiler warning
gstavvidenc.c: In function 'gst_ffmpegvidenc_flush_buffers':
gstavvidenc.c:733:7: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       GstFFMpegVidEncClass *oclass =
       ^
cc1: all warnings being treated as errors
2015-06-28 16:54:35 +02:00
Sebastian Dröge
e964dcdb02 avvidenc: Set AVFrame flags for interlacing per frame and not in set_format()
They will get overridden by av_frame_unref() with the defaults.
2015-06-28 16:35:46 +02:00
Sebastian Dröge
45ab256e54 av{aud,vid}enc: Create wrapped output buffers with GST_MEMORY_FLAG_READONLY
libav might still have references to the buffers itself and uses a writability
system similar to ours based on reference counts.
2015-06-28 16:32:02 +02:00
Sebastian Dröge
6998d982c7 avvidenc: Properly wrap and free the output AVPackets generated during draining 2015-06-28 16:30:54 +02:00
Sebastian Dröge
3943cdf18a avvidenc: Make sure to keep input data alive until libav is done with it 2015-06-28 16:27:52 +02:00
Sebastian Dröge
3ca7c041b1 avaudenc: Make sure to keep input data alive until libav is done with it 2015-06-28 16:21:33 +02:00
Sebastian Dröge
d6b5fc4f34 av{aud,vid}enc: Stop using deprecated AVFrame APIs 2015-06-28 15:37:23 +02:00
Sebastian Dröge
2a445cb5f2 avauddec: Remove custom buffer allocation function
libav always uses planar audio formats nowadays, not much use in
us trying to allocate anything here until we add support for planar
aka non-interleaved audio formats at least in audioconvert.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
4240ff2bfc avauddec: Use undeprecated AVFrame API 2015-06-28 12:41:55 +02:00
Sebastian Dröge
3d9816ce7f avviddec: Free frame before the codec is freed
Who knows, maybe freeing the frame calls cleanup inside the codec.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
982f5262d4 avviddec: Use undeprecated AVFrame API and unref frame once we're done with it 2015-06-28 12:41:55 +02:00
Sebastian Dröge
0767bdda5f avauddec: Negotiate based on the AVFrame instead of just the AVCodecContext 2015-06-28 12:41:55 +02:00
Sebastian Dröge
523ddb5346 avviddec: Use the new get_buffer2() API instead of the deprecated APIs
And do the frame reference counting by adding AVBufferRefs to the frame.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
ad7613be0d avviddec: Also proxy the data/size pointers for our wrapper AVBufferRef 2015-06-28 12:41:55 +02:00
Wim Taymans
8da0a61dc0 codecmap: add vp9 mapping 2015-06-26 17:30:25 +02:00
Sebastian Dröge
8cb8461f7e avviddec: Wrap the original AVBufferRef in our own buffer for the destroy function
Just adding a dummy buffer at the very end might not be enough as there
already might be too many buffers.
2015-06-26 16:58:55 +02:00
Sebastian Dröge
9b2c0c2dbc avviddec: libav will already copy the reordered_opaque pointer for us
If we do it ourselves, it might get the wrong value if our assumptions are
broken by libav at a later time.
2015-06-26 16:58:55 +02:00
Sebastian Dröge
5b6c8ee8c9 avviddec: Negotiate based on the AVFrame information, not the context information
The context contains the information from the latest input frame, we're
however interested in the information from the latest output frame. As we have
to negotiate for the buffer that is about to come next.

This should fix some crashes that happened when both information got out of
sync. If that happens now, we will do fallback allocation until the output
is renegotiated too.

https://bugzilla.gnome.org/show_bug.cgi?id=750865
2015-06-26 16:58:55 +02:00
Nicolas Dufresne
a33a1bf6e4 avcodec: Check against codec format list
There exist few formats (deprecated though) used by mjpeg decoder
and encoder that maps to the same GStreamer format. To properly
pick the right format, also lookup each Codec list before accepting
the format. This fixes error when trying to use mjpeg encoder.

Note that this may results in faded colors. In fact, these special
format are meant to specify that this is full range YUV. Colorimetry
in gst-libav is not yet implemented, hence is ignored in general. So
I think it's fine to first fix the issue before addressing the missing
feature.

https://bugzilla.gnome.org/show_bug.cgi?id=750398
2015-06-11 10:23:33 -04:00
Jan Schmidt
1f1e24f63f viddec: Replicate any 3D/multiview info from input caps onto output 2015-06-11 12:25:45 +10:00
Sebastian Dröge
b81cb99d9f avviddec: Release stream lock while calling avcodec_decode_video2()
It might call back into us from another thread and try to take the stream lock
again, e.g. to allocate a buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=726020
2015-06-05 11:57:37 +02:00
Olivier Crête
172f9c9823 avviddec: Post error message before returning a flow error
This is required.
2015-06-02 20:48:33 -04:00
Aurélien Zanelli
00ff477f29 avcodecmap: Use video/x-cavs mime type instead of video/x-gst-av-cavs
More generic mime-type which can be used by other decoders than libav.

https://bugzilla.gnome.org/show_bug.cgi?id=727731
2015-06-02 08:54:46 +01:00
Sebastian Dröge
c6cc7b385a avauddev: Unref decoded AVFrame after we're done with it
Otherwise we might leak some memory, like all compressed data when using
avdec_ac3.
2015-06-02 09:09:09 +02:00
Mark Nauwelaerts
2270026d82 avdemux: resurrect some flow return handling
https://bugzilla.gnome.org/show_bug.cgi?id=744572
2015-03-29 14:01:50 +02:00
Tim-Philipp Müller
55f98c5b9a avdemux: fix double semicolon 2015-03-10 09:37:19 +00:00
Sebastian Dröge
4f7d873c4c libav: Add support for 10 bit planar AYUV formats 2015-03-10 10:18:53 +01:00
Sebastian Dröge
d3a2a9a951 libav: Change from deprecated PIX_FMT_* to AV_PIX_FMT_* 2015-03-10 10:17:45 +01:00
Sebastian Dröge
4459d706c8 avviddec: Don't copy padding if handling a frame failed
We will return an error right afterwards anyway.
2015-03-09 22:02:38 +01:00
Sebastian Dröge
099ea5f2d1 avviddec: If a flow return during draining is not OK, don't drain any further 2015-03-09 22:02:19 +01:00
Sebastian Dröge
af91ba1620 avviddec: Error out if we try to allocate a buffer without being negotiated
Otherwise we just run into assertions because we should've errored out
already.
2015-03-09 22:01:43 +01:00
Luis de Bethencourt
18667c5698 avdemux: remove duplicate goto block 2015-03-05 14:27:52 +00:00
Luis de Bethencourt
e3b8a4fe23 avdemux: check AVIO Context has been allocated 2015-03-05 14:23:44 +00:00
Jan Schmidt
904b53ab0d Add drain() vfunc implementation that does the same as finish()
finish() is called at EOS, drain() is called at all other times
when the decoder should be drained out. gst-libav decoder behaviour
is the same in both cases, so use the same implementation

See https://bugzilla.gnome.org/show_bug.cgi?id=734617
2015-02-24 01:50:11 +11:00
Jan Schmidt
5758e82eaf avviddec: Implement SKIP and new SKIP_KEY_UNITS_ONLY flags
Respect any skip flags set in the incoming segment.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-01-27 04:35:08 +11:00
Aurélien Zanelli
728444168a av: use GMutex instead of deprecated GStaticMutex
https://bugzilla.gnome.org/show_bug.cgi?id=740822
2014-11-28 00:32:28 +00:00
Nicolas Dufresne
9919c274b9 videodec: Ensure update_pool is initialized
This was probably not causing any issues, but we would randomly
and needlessly update the pool in the query due to uninitialized
variable.
2014-11-16 16:11:53 -05:00
Aleix Conchillo Flaqué
24780708be avauddec: drain samples until libav doesn't have more data
We use have_data (that comes from libav), instead of only trying 10
times, to know if there are more samples available. The old code was
machine dependent as different amount of samples could be decoded by
different type of (more powerful) machines, and 10 times was not always
sufficient.

https://bugzilla.gnome.org/show_bug.cgi?id=737144
2014-09-23 19:14:06 +03:00
IBM Thinklab
25ab0036c0 avviddec: drain frames until libav doesn't have more data
We use have_data (that comes from libav), instead of only trying 10 times,
to know if there are more frames available. The old code was machine
dependant as different amount of frames could be decoded by different
type of (more powerful) machines, and 10 times was not always sufficient.

https://bugzilla.gnome.org/show_bug.cgi?id=736515
2014-09-12 16:26:21 +03:00
Sebastian Dröge
9efc92a3a1 libav: Minor changes to build properly with v11alpha1 2014-08-12 16:17:38 +03:00
Jan Schmidt
8c00a359d0 avviddec: After draining frames, flush the libav decoder
Makes sure that there's really nothing stale left in the decoder
after draining.

https://bugzilla.gnome.org/show_bug.cgi?id=734661
2014-08-12 22:48:59 +10:00
Aleix Conchillo Flaqué
1307b31e1c avviddec: Don't lose frames on EOS
have_data is not propagated from gst_ffmpegviddec_video_frame to
gst_ffmpegviddec_frame. have_data is only set to 1 in
gst_ffmpegviddec_frame if a frame pointer is passed. However, this is
not true while draining, which means that have_data from libav will be
ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=734608
2014-08-11 18:06:33 +03:00
Thibault Saunier
dc1e69dbea avauddec: Bump the rank of avdec_aac so it is used by default
https://bugzilla.gnome.org/show_bug.cgi?id=676131
2014-08-06 13:26:37 +02:00
Sebastian Dröge
e42cc96566 avvidenc: Make sure to fixate caps before setting them on the pad
After the recent addition of negotiation support for MPEG4 part 2
profiles via caps it can happen that the generated caps at this
point still contain multiple profiles. For example if downstream
does not care. Just fixate anything here and use those caps.
2014-06-21 18:29:32 +02:00
Wim Taymans
57b1970395 avcodecmap: place supported profiles in mpeg4 caps
Place the supported profiles in the srcpad caps of the mpeg4 encoder.
2014-06-06 16:54:06 +02:00
Wim Taymans
9d0e1ecedc avcodecmap: remove deprecated media types
Remove x-xvid and x-3ivx. The last place where they were used are
in the srcpad caps of the decoder but since the decoder will never
actually output those caps we can safely remove them.
2014-06-06 16:54:06 +02:00
Wim Taymans
df8674f6c3 codecmap: don't expose more deprecated media types
x-xvid is deprecated, we don't want to expose it on the encoder, just
leave it only exposed on the decoder.
2014-06-06 16:54:06 +02:00
Wim Taymans
fd7ba73304 Revert "avcodecmap: do more reverse mapping of MPEG4"
This reverts commit e066785ad0.

x-xvid and x-3ivx are removed, we don't want to expose them again.
2014-06-06 16:54:06 +02:00
Vincent Penquerc'h
10e0606491 avaudenc: add a comment about using -1 in _finish_frame
See https://bugzilla.gnome.org/show_bug.cgi?id=729268
2014-06-06 12:40:57 +01:00
Vincent Penquerc'h
17e2e9acd9 avaudenc: avoid using wrong number of samples
If audio_in is NULL, we'll send a NULL frame to libav, to flush
the codec. In that case, we won't know how many samples the codec
will have used, so we use -1 (for don't know) when letting the
base class know about the buffer.

Coverity 1195177
2014-06-06 12:29:54 +01:00
Sebastian Dröge
406d5ba04a avvidenc: Fix indention and "bracketing" of goto labels
Should fix CID 1219865, which looks like the code analysis
algorithm was just confused.
2014-06-02 09:27:17 +02:00
Wim Taymans
2ef3c94b82 avcodecmap: handle simple and advanced-simple profile in MPEG4
Always enable 4MV flag for MPEG4
Pare the profile property and enable more features for advanced-simple
profile.
video/x-xvid is advanced-simple profile so enable more features.
We now also support encoding of video/x-xvid so add this to the caps.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=651320
2014-05-29 18:24:20 +02:00
Wim Taymans
3dda75f493 avvidenc: do all negotiation before opening the decoder
We first want to complete negotiation before opening the encoder.
Negotiation might configure flags and other things that might be needed
when opening the encoder.
2014-05-29 18:16:42 +02:00
Wim Taymans
e066785ad0 avcodecmap: do more reverse mapping of MPEG4
We previously mapped some caps to MPEG4 and codec_tag so we can use the
codec_tag again to map to the original caps.
2014-05-29 17:00:23 +02:00
Thiago Santos
66588ae60d avdemux: use GstFlowCombiner
To remove replicated code from all demuxers to a single standard way
of aggregating flow returns
2014-05-26 16:04:50 -03:00
Thiago Santos
5872891711 avdemux: remove legacy check from pad-alloc times
The 'no_buffer' error case is from the 0.10 era when a pad_alloc was
made before decoding the data and avdemuxer could check again the
flow returns for a not-linked. This isn't a valid use case anymore in
1.0
2014-05-26 16:02:11 -03:00
Gavin Hurlbut
38fc56e207 avvidenc: Add thread-count parameter for libav encoders
As some libav encoders (such as MPEG2) use a thread_count parameter to control
how many threads to use, and since it was always being set to 0 (which uses
the default), suboptimal threading can sometimes be chosen.  This extends the
libav encoders to allow for a max-threads parameter which is passed into
the internal structure to control this knob if applicable to the encoder.

https://bugzilla.gnome.org/show_bug.cgi?id=726612
2014-05-19 15:07:02 +01:00
Mathieu Duponchelle
7bb4f93de9 gstavviddec: Sanitize and fix qos handling.
gst_video_decoder_get_max_decding_time doesn't return a GstClockTime
but a GstClockTimeDiff, and thus one needs to compare it against
G_MAXINT_64.

The returning of a boolean and the extra subsequent code in _video_frame
was uselessly complicated.

The previous behaviour led to artefacts when the decoder tried to
hurry up.

https://bugzilla.gnome.org/show_bug.cgi?id=730075
2014-05-16 13:51:50 +02:00
Nicolas Dufresne
62a4d065ed videodec: Don't use non-growable pool
As we don't know how many output buffers we need to operate, we need to
avoid pool that can't grow. Otherwise the pipeline may stall, waiting
for buffers. For now, we require it to be able to grow to at least
32 buffers, which I think is a fair amount of buffers for decoders.

https://bugzilla.gnome.org/show_bug.cgi?id=726299
2014-05-08 15:33:39 -04:00
Vincent Penquerc'h
4f1fd2687d libav: avoid dividing by zero on insane fps/par
While there, fix mixup in num/den with par (copied from fps,
apparently, and fps inverts fps to time base).

Coverity 1139696
2014-04-30 18:18:50 +01:00
Vincent Penquerc'h
3529de1784 avvidenc: guard against division by zero
and other nonsensical time base values while we're at it.

Coverity 1139699
2014-04-30 18:18:50 +01:00
Sebastian Dröge
6d92f18d1b avaudenc: Fix leak of AVBufferRef
AVPacket contains AVBufferRef which may leak unless unreffed properly.

https://bugzilla.gnome.org/show_bug.cgi?id=726814
2014-04-29 09:13:44 +02:00
Stian Selnes
245be56510 avvidenc: Fix leak of AVBufferRef
AVPacket contains AVBufferRef which may leak unless unreffed properly.

https://bugzilla.gnome.org/show_bug.cgi?id=726814
2014-04-29 09:07:33 +02:00
Edward Hervey
3a81f604fe avaudenc: Fix compile without gst debug
We can just re-use the encoder variable
2014-04-14 13:37:02 +02:00
Edward Hervey
f70f904210 avdemux: Remove unused variable
CID #1139943
2014-04-08 08:05:24 +02:00
Edward Hervey
e513fad054 codecmap: Add missing break
CID #1139752
2014-04-08 08:00:55 +02:00
Sebastian Dröge
99ca91f3a3 avcodecmap: Add mapping for Apple Intermediate Codec
https://bugzilla.gnome.org/show_bug.cgi?id=727673
2014-04-06 09:05:43 +02:00
Mark Nauwelaerts
6daa80bbbe avvidenc: discard input frame upon encoding error 2014-03-25 21:06:01 +01:00
Mark Nauwelaerts
7a8eae6ea9 avvidenc: make all properties work again
... as previously broken due to additional compliance property
(see 13ffed87b1).
2014-02-23 11:40:14 +01:00
Mark Nauwelaerts
fef710efc3 avmux: stream-start and segment event before data-flow 2014-02-22 21:54:08 +01:00
Thijs Vermeir
9a1c9096dc avviddec: rename hevc decoder element to h265 for consistency
We use h265 for the parser, typefinder, caps, etc. everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=724823
2014-02-22 16:10:49 +01:00
Tim-Philipp Müller
74b769751d avvidec: don't crash on EOS when no buffers have been received
Fixes crash on EOS when no buffers have been received for some
reason, e.g. because the parser didn't output any.

fakesrc num-buffers=0 format=time ! avdec_h264 ! fakesink
2014-02-21 13:18:47 +00:00
Thiago Santos
845b874575 avaudenc: fix audio encoder flushing according to libav docs
* @param[in] frame AVFrame containing the raw audio data to be encoded.
 *                  May be NULL when flushing an encoder that has the
 *                  CODEC_CAP_DELAY capability set.

The AVFrame itself should be null, not the frame.data pointer

https://bugzilla.gnome.org/show_bug.cgi?id=724536
2014-02-20 17:32:12 -03:00
Dmitry Melnichenko
fe224775cf avmux: Fix invalid address passing to av_opt_set_int()
https://bugzilla.gnome.org/show_bug.cgi?id=723615
2014-02-04 17:28:36 +01:00
Mark Nauwelaerts
f86fd7e29e avvidenc: avoid busy-looping when flushing frames
... such as when receiving EOS event.
2014-02-01 14:40:45 +01:00
Sjoerd Simons
1b5895c936 avdemux: Don't go into pull mode when the sequential flag is set
When the scheduling query results has GST_SCHEDULING_FLAG_SEQUENTIAL set
in its flags don't go into pull mode to prevent over-eager seeking.

https://bugzilla.gnome.org/show_bug.cgi?id=722935
2014-01-24 22:22:48 +01:00
Tim 'mithro' Ansell
520221c47a avmux: Force DV audio input format to 48kHz, 2 channels
libavformat only supports muxing 16bit, 48kHz stereo into DV containers.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=722672
2014-01-21 13:22:40 +01:00
Aleix Conchillo Flaqué
60f7b00db3 avviddec: Add output-corrupt property
The output-corrupt property will set the CODEC_FLAG_OUTPUT_CORRUPT flag
in the codec context. The user can now decide whether libav outputs
corrupt frames or not.

Previous libav versions had this flag always set.

https://bugzilla.gnome.org/show_bug.cgi?id=722453
2014-01-17 22:08:33 +01:00
Sebastian Dröge
d494f6f983 avauddec: Mark frames as corrupted if libav tells us they are
This is currently only implemented by the h264 codec and no audio codec.

https://bugzilla.gnome.org/show_bug.cgi?id=722290
2014-01-16 13:46:26 +01:00
Sebastian Dröge
b278ca55be avviddec: Mark frames as corrupted if libav tells us they are
This is currently only implemented by the h264 codec.

https://bugzilla.gnome.org/show_bug.cgi?id=722290
2014-01-16 13:46:26 +01:00
Vincent Penquerc'h
ca1b5d8576 gst-libav: fix context leaks
A AVCodecContext needs cleaning up before being freed.
Go through all of the allocations/setups to ensure none of them
can leak a context or its contents.
2014-01-15 09:02:33 +00:00
Wim Taymans
ead14945aa avviddec: set output chroma-site
Use libav provided chroma-site and place it on the output caps.
2014-01-13 16:31:05 +01:00
Wim Taymans
81cef109e2 avviddec: release buffers when not direct rendering
New libav will not call the release_buffer callback anymore when
avcodec_default_get_buffer() is called from get_buffer. Releasing of the
memory in a picture should now be done by registering a callback to the
avbuffer objects in the picture. There is some compatibility code to
wrap the memory we provide in get_buffer in avbuffer with a callback to
release_buffer but that is not done when avcodec_default_get_buffer()
is called.

Work around this by adding a dummy avbuffer object to the picture that
will release the frame.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=721077
2014-01-10 17:28:22 +01:00
Sebastian Dröge
1e65aac1a4 avauddec: Give MP3 decoder a MARGINAL rank too
There's no reason why this decoder should not be autoplugged
2014-01-10 13:17:02 +01:00
Sebastian Dröge
9887521a32 av: Enable HEVC / h265 support 2014-01-06 13:39:32 +01:00
Tim-Philipp Müller
8770f22735 avcodecmap: fix regression with wmv3 video in WMVA format
The VC-1 decoder should handle that. Before avdec_wmv3 handled
it, but then we added format=WMV3 to its sink pad template
caps, at which point nothing handled WMVA any longer.

https://bugzilla.gnome.org/show_bug.cgi?id=697665
2014-01-03 16:00:41 +00:00
Sebastian Dröge
1409e1692b av: Update for CodecID -> AVCodecID related changes 2014-01-03 16:28:44 +01:00
Sebastian Dröge
fc57f7fb1b avcfg: Update config parameters a bit to fix compilation
This needs a major rework and should use the new configuration
interface where useful.
2014-01-03 16:28:02 +01:00
Sebastian Dröge
0a819702c0 avenc: Stop using the removed inter_threshold field 2014-01-03 16:27:34 +01:00
Sebastian Dröge
0400f7cc28 avviddec rebase 2014-01-03 16:27:11 +01:00
Sebastian Dröge
8fc3da62c1 avauddec: Stop using AVCODEC_MAX_AUDIO_FRAME_SIZE
And properly use the have_data variable. It's a boolean.
2014-01-03 16:26:10 +01:00
Sebastian Dröge
28d1c135bb avdemux: Stop using r_frame_rate field
It was removed and quite meaningless anyway.
Use the average framerate instead.
2014-01-03 16:25:39 +01:00
Sebastian Dröge
53966ee304 avvidenc: Port to av_encode_video2()
av_encode_video() is deprecated and an ugly API anyway.
2014-01-03 16:24:28 +01:00
Todd Agulnick
4cc981de37 Some compiler warning fixes to satisfy XCode compiler
https://bugzilla.gnome.org/show_bug.cgi?id=720513
2013-12-16 16:54:21 +01:00
Mark Nauwelaerts
47d5c2b6d6 avviddec: improve buffer handling and semantics
... so as to focus on providing *a* buffer rather than one (too) tied
to a frame, in particular allowing multiple allocations related to a frame.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=697806
2013-12-07 12:11:34 +01:00
Mark Nauwelaerts
1aa253cd3b avvidenc: plug input_state leak 2013-12-07 12:11:03 +01:00
Sebastian Dröge
423d9dcd71 avviddec: Use new gst_video_decoder_set_needs_format() API 2013-12-05 11:51:27 +01:00
Mark Nauwelaerts
039b608b24 avviddec: only use upstream framerate if really specified
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=704161
2013-12-02 20:21:34 +01:00
Mark Nauwelaerts
fa5865c0cd avviddec: discard unused input frames
... to avoid these piling up in list of pending frames.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=693772
2013-11-26 20:57:37 +01:00
Mark Nauwelaerts
2ec4008ea5 avviddec: really release frame at proper time
... by also removing it from the pending list of frames,
where it may still be in if it has never been submitted to _finish.
This could happen if is a decode-only frame, or in skipped decoding
situation, ...

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=693772
2013-11-26 20:55:43 +01:00
Tim-Philipp Müller
4072c40b8e avaudec: don't put bogus 0 channel-mask on output caps for mono audio 2013-11-04 23:20:17 +00:00
Tim-Philipp Müller
e9e31ebada avaudenc: post better error message if experimental codecs don't work
https://bugzilla.gnome.org/show_bug.cgi?id=691617
2013-10-26 09:34:30 +01:00
Tim-Philipp Müller
49d0c480ae codecmap: use TRUE for boolean fields in caps 2013-10-26 09:10:03 +01:00
Greg Rutz
13ffed87b1 avenc: Add compliance property
Add a new property to GstFFMpegVidEnc and GstFFMpegAudEnc to supply
the "strict compliance" value to AVCodecContext

https://bugzilla.gnome.org/show_bug.cgi?id=691617
2013-10-15 09:27:03 +02:00
Matthieu Bouron
4c93bffb21 avcodecmap: Make avdec_mjpeg requires a parsed input
Actually avdec_mjpeg does not deal well with incomplete buffers and try
to decode incomplete frames. A parser which will also acts as
an accumulator needs to be inserted before it.

https://bugzilla.gnome.org/show_bug.cgi?id=709352
2013-10-04 10:34:25 +02:00
Sebastian Dröge
5b76550168 avcodecmap: gst_value_can_intersect() does not do what you would think
Check for uniqueness differently now.
2013-10-02 13:59:04 +02:00