Commit graph

64 commits

Author SHA1 Message Date
Mathieu Duponchelle
e4bf6147a0 av_codec_next (deprecated) -> av_codec_iterate
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle
1e4529ced2 Refactor avcfg / avvidenc
We were previously installing hardcoded properties for all
video encoders, refactor to instead use FFmpeg's AVOption API.

avvidenc still exposes a few properties related to the pass
mechanism: while the AVOption API allows specifying both passes
as flags at the same time, this is not practical in GStreamer's
context, where passes need to be run separately using a stats file.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne
aa724e2f14 Use AV_ namespace for all CODEC_ macro
The remaining use of CODEC_ are codec flags that has been moved into the
new codec private properties or have been deperated. Will be fixed in
later patches.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Edward Hervey
04b3867cb8 libav: Switch to common include 2018-05-11 14:24:03 +02:00
Edward Hervey
79bc255fa2 avvid*: Don't expose V4L2 mem-to-mem decoder and encoders
It's not going to work without special handling. Mask for now.
2018-02-10 15:18:11 +01:00
Arun Raghavan
a3b7aebf6b avvidenc: Fix compiler errors in the previous commit
The declaration of 'const char *klass' was shadowing a function
argument.
2017-03-22 12:55:40 +05:30
Arun Raghavan
2e25f166fc avvidenc: Classify image encoders with "Image" instead of "Video"
This allows gst_video_convert_sample*() to work with codecs for which we
have libav encoders (such as BMP).

https://bugzilla.gnome.org/show_bug.cgi?id=780317
2017-03-21 09:49:45 +05:30
Jan Schmidt
bcbe3aff83 avvidenc: Add Stereo3D mapping
Add mapping between GStreamer multiview modes/flags and
libav Stereo3D frame packings when encoding video.

https://bugzilla.gnome.org/show_bug.cgi?id=767938
2017-03-16 15:23:01 +11:00
Garima Gaur
14dc964f0e Fix some caps leaks when creating pad templates
https://bugzilla.gnome.org/show_bug.cgi?id=776700
2017-01-02 12:41:20 +00:00
leigh123linux@googlemail.com
3c3be3125f avvidenc/dec: Disable more hardware encoder/decoders
Important when using a system ffmpeg/libav.

https://bugzilla.gnome.org/show_bug.cgi?id=774278
2016-11-12 10:33:51 +02:00
Sebastian Dröge
8443af343e av: Cast AVContext::bit_rate to a guint before passing to varargs functions
We expect it to be a int or uint, however it changed the type to a
int64_t in later versions of ffmpeg. As such it would be passed as a 64
bit value to varargs functions, while the consumer of the arguments
assumes only 32 bits. This causes crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=771092
2016-09-14 11:20:48 +02:00
Iain Lane
f5f32986b6 Only use AV_CODEC_ID_WRAPPED_AVFRAME on new enough libavcodecs
https://bugzilla.gnome.org/show_bug.cgi?id=770753
2016-09-03 14:20:26 +03:00
Sebastian Dröge
3e93ad1bcd libav: Ignore more quasi-codecs 2016-07-22 14:54:21 +03:00
Sebastian Dröge
5f4bd291c1 libav: Ignore VAAPI decoders and VAAPI/nvenc encoders
These can show up when having a build against a system version of ffmpeg.
2016-07-22 14:42:59 +03:00
Sebastian Dröge
a5ac55c4a0 avvidenc: Create caps from the codec context after it is opened
We won't get codec_data and various other information otherwise.
2016-07-05 20:15:28 +03:00
Sebastian Dröge
55fd9e3623 avvidenc: Set width/height and format in the AVFrame we pass to the encoder API 2016-02-16 09:13:23 +02:00
Sebastian Dröge
1d7d7033bc avvidenc: Use AVPacket.flags for detecting keyframes
AVCodec.coded_frame is deprecated and will disappear at some point
in the future.
2016-01-19 09:36:01 +02:00
Andreas Cadhalpun
6235a04ef3 libav: Remove usage of deprecated API
https://bugzilla.gnome.org/show_bug.cgi?id=757498
2016-01-16 16:47:40 +02:00
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
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
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
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
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
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
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
d6b5fc4f34 av{aud,vid}enc: Stop using deprecated AVFrame APIs 2015-06-28 15:37:23 +02: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
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
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
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
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
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
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
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
f86fd7e29e avvidenc: avoid busy-looping when flushing frames
... such as when receiving EOS event.
2014-02-01 14:40:45 +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
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
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
Mark Nauwelaerts
1aa253cd3b avvidenc: plug input_state leak 2013-12-07 12:11: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
Sebastian Dröge
6571196fb8 libav: avcodec_close() also resets fields like the AVCodec
We need to reload the defaults for the codec after closing it,
otherwise we can't access codec information like the supported
sample rates and can crash.

https://bugzilla.gnome.org/show_bug.cgi?id=707040
2013-08-29 16:53:28 +02:00
Tim-Philipp Müller
ffe85cb0ef avvidenc: propagate flow return values upstream in finish() 2013-08-21 13:47:15 +01:00
Sebastian Dröge
ae946bab1c libav: Use new flush vfunc of video codec base classes and remove reset implementations 2013-08-15 15:51:52 +02:00
Tim-Philipp Müller
068be939cb CODEC_ID_* -> AV_CODEC_ID_* 2013-05-06 23:56:22 +01:00