Commit graph

45 commits

Author SHA1 Message Date
Sebastian Dröge
151cd32a10 avaudenc: Set all required fields in the AVFrame
Various functions in libavcodec need them, like the format, sample rate, etc.
and just having them in the context is not enough.

This fixes draining for codecs like MP2 that require a fixed frame size and
require libav to pad the last frame if required.
2016-04-28 18:43:37 +03:00
Sebastian Dröge
3f41aaff30 avaudenc: Also use av_free() instead of g_free() 2016-01-25 20:13:10 +01:00
Sebastian Dröge
a7d9d448bd avaudenc: Use av_malloc() instead of GLib malloc() wrappers for memory freed by ffmpeg
It has its own allocator that is not necessarily doing the same as malloc and
will then usually crash. E.g. on Windows or when memalign() is available.
2016-01-25 20:08:11 +01:00
Sebastian Dröge
46fb2e9f11 libav: Bitrate field changed from int to int64_t, fix compiler warnings
Cast it to a gint64 for now though, as otherwise we will fail compilation
with ffmpeg 2.8.

https://bugzilla.gnome.org/show_bug.cgi?id=757498
2016-01-16 17:23:37 +02: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
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
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
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
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
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
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
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
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
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
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
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
068be939cb CODEC_ID_* -> AV_CODEC_ID_* 2013-05-06 23:56:22 +01:00
Tim-Philipp Müller
ed6561bee6 avenc_aac: downgrade to RANK_NONE until it gets fixed
Currently just fails to initialize.

https://bugzilla.gnome.org/show_bug.cgi?id=691617
2013-01-22 12:57:41 +00:00
Sebastian Dröge
022ab84288 av: Fix some memory leaks and misuse of libav API 2012-12-17 16:35:36 +01:00
Sebastian Dröge
faf985e8fb avcodecmap: Only set "formats" field on raw audio/video caps 2012-12-17 13:42:13 +01:00
Wim Taymans
b333e1204e avaudenc: init frame with defaults
Init the AVFrame with the right method. This sets the extended_data field
correctly that is needed for some formats (G726 for example).
2012-12-12 16:47:19 +01:00
Sebastian Dröge
cb9e40ff4c avaudenc: Properly handle planar audio formats with more than AV_NUM_DATA_POINTERS channels 2012-12-12 13:04:54 +00:00
Sebastian Dröge
86361bf6df avvidenc: Simplify color formats in the raw video caps 2012-12-11 18:48:34 +00:00
Sebastian Dröge
fbe1221d70 avaudenc: Reorder audio channels if necessary and add proper support for channel layouts 2012-12-11 18:07:34 +00:00
Sebastian Dröge
cab519f370 avaudenc: Add support for planar audio formats 2012-12-05 19:28:33 +01:00
Sebastian Dröge
2d7ebf9514 av: Correctly populate the codec context with the defaults 2012-12-05 19:25:37 +01:00
Sebastian Dröge
d840211412 av: Use av_codec_is_{en,de}coder() API instead of private struct fields 2012-12-05 10:52:34 +01:00
Sebastian Dröge
f5c112990f av: Port remaining simple bits 2012-12-04 18:36:56 +01:00
Luca Barbato
5f03a7d869 av: update to use AVOption variants. 2012-12-04 18:36:30 +01:00
Tim-Philipp Müller
5a823a5fbf avaudenc: log error string as well in debug output 2012-12-02 12:31:43 +00:00
Tim-Philipp Müller
a3d930afbe avaudenc: use sample rate as ticks per second fallback
The 25/1 value presumably came from the video encoder class.
2012-12-01 23:21:41 +00:00
Tim-Philipp Müller
819d4d2a04 avaudenc: fix output timestamping
We need to pass the number of samples encode in the output buffer
to gst_audio_encoder_finish_frame(), not the number of frames.
Fixes output timestamps being way too small, and transcoding
problems.

https://bugzilla.gnome.org/show_bug.cgi?id=689398
2012-12-01 23:05:23 +00:00
Sebastian Dröge
4132a73f0e avvidenc: Implement reset vfunc 2012-11-20 11:56:57 +01:00
Sebastian Dröge
5ffd21f1ee avaudenc: Implement draining 2012-11-20 11:51:13 +01:00
Sebastian Dröge
e281493f29 avaudenc: Implement flush vfunc properly 2012-11-20 11:45:34 +01:00
Sebastian Dröge
f4acd40767 avaudenc: Some minor cleanup 2012-11-20 10:55:55 +01:00
Sebastian Dröge
3ffbb6ff94 avaudenc: Use non-deprecated avcodec_encode_audio2() API
This also allows us to always get an output buffer of the required size
instead of risking that it is too small.
2012-11-20 10:53:01 +01:00
Sebastian Dröge
7a29cffc50 avaudenc: Port to audio encoder base class 2012-11-20 10:36:29 +01:00
Sebastian Dröge
6895df72d6 av: Use PROP_ instead of ARG_ 2012-11-20 10:31:49 +01:00
Sebastian Dröge
c784ec9fa5 av: Put declarations in header files and rename audio codec files 2012-11-19 10:30:37 +01:00
Renamed from ext/libav/gstavenc.c (Browse further)