Commit Graph

748 Commits

Author SHA1 Message Date
Luca Barbato
ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Vittorio Giovara
3ee2c60cc2 utils: Use data buffers directly instead of an AVPicture
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-22 13:31:58 +02:00
Vittorio Giovara
a17a766190 lavc: Add data and linesize to AVSubtitleRect
Use the new fields directly instead of the ones from AVPicture.
This removes a layer of indirection which serves no pratical purpose
whatsoever, and will help in removing AVPicture structure completely
later.

Every subtitle encoder/decoder seamlessly points to the new arrays,
so it is possible to deprecate AVSubtitleRect.pict.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-21 12:02:29 +02:00
Derek Buitenhuis
17e41cf361 avcodec: Do not lock during init if there is no init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-13 13:43:29 +02:00
Derek Buitenhuis
eae58428bd avcodec: Do not lock during open for codecs marked as having threadsafe init
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-04 13:21:16 +02:00
wm4
a5d58fea68 lavc: reimplement avcodec_get_type() using codec descriptors
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-09-28 10:50:38 +02:00
wm4
87a051f976 lavc: allow asynchronous decoders to return correct pkt_dts values
The generic code in utils.c sets the AVFrame.pkt_dts field from the
packet it was supposedly decoded. This does not have to be true for a
fully asynchronous decoder like mmaldec. It could be overwritten with an
incorrect value. Even if the decoder doesn't determine the DTS (but sets
it to AV_NOPTS_VALUE), it's impossible to determine a correct value in
utils.c.

Decoders can now be marked with FF_CODEC_CAP_SETS_PKT_DTS, in which case
utils.c won't overwrite the field. The decoders are expected to set this
field (even if they only set it to AV_NOPTS_VALUE).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-09-12 12:27:19 +02:00
Vittorio Giovara
8f12ef9860 lavu: Drop deprecated duplicated AVFrame/AVCodecContext parameters
Deprecated in 10/2012.
2015-08-28 16:04:27 +02:00
Vittorio Giovara
9f90b24877 lavc: Drop deprecated get_buffer related functions
Deprecated in 11/2012.
2015-08-28 16:01:16 +02:00
Vittorio Giovara
01bcc2d5c2 lavc: Drop deprecated destruct_packet related functions
Deprecated in 10/2012.
2015-08-28 16:01:16 +02:00
Vittorio Giovara
059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara
7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara
40cf1bbacc Deprecate avctx.coded_frame
The rationale is that coded_frame was only used to communicate key_frame,
pict_type and quality to the caller, as well as a few other random fields,
in a non predictable, let alone consistent way.

There was agreement that there was no use case for coded_frame, as it is
a full-sized AVFrame container used for just 2-3 int-sized properties,
which shouldn't even belong into the AVCodecContext in the first place.

The appropriate AVPacket flag can be used instead of key_frame, while
quality is exported with the new AVPacketSideData quality factor.
There is no replacement for the other fields as they were unreliable,
mishandled or just not used at all.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-20 15:06:50 +01:00
Vittorio Giovara
d6604b29ef Gather all coded_frame allocations and free functions to a single place
Allocating coded_frame is what most encoders do anyway, so it makes
sense to always allocate and free it in a single place. Moreover a lot
of encoders freed the frame with av_freep() instead of the correct API
av_frame_free().

This bring uniformity to encoder behaviour and prevents applications
from erroneusly accessing this field when not allocated. Additionally
this helps isolating encoders that export information with coded_frame,
and heavily simplifies its deprecation.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-20 14:16:15 +01:00
Paul B Mahol
5a79bf0284 PCM signed 16-bit big-endian planar decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-06-24 14:45:00 +01:00
Luca Barbato
a78f5548d9 avcodec: Free the default avoptions on init failure 2015-04-22 12:27:13 +02:00
Luca Barbato
aef0be0875 avcodec: Unref the dummy buffer on the fail path 2015-04-22 12:27:13 +02:00
Vittorio Giovara
117b432748 lavc: Introduce AVCodec internal capabilities
This field is designed for marking codec properties useful to lavc internals.
Two internal capabilities are added:
 - FF_CODEC_CAP_INIT_THREADSAFE: codec can be opened without locks;
 - FF_CODEC_CAP_INIT_CLEANUP: codec frees memory if initialization fails.
2015-03-13 19:47:47 +00:00
Vittorio Giovara
9993a067f6 lavc: Improve thread locking error message 2015-03-13 19:47:34 +00:00
Andreas Cadhalpun
ea1d0b7ece avcodec/utils: use correct printf specifier in ff_set_sar
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-02-28 21:51:24 +01:00
Anton Khirnov
a536a4e4bc lavc: support extracting audio service type from side data 2015-01-27 09:22:33 +01:00
Anton Khirnov
728685f37a Add a side data type for audio service type.
Currently, audio service type is a field in AVCodecContext. However,
side data is more appropriate for this kind of information.
2015-01-27 09:17:48 +01:00
Paul B Mahol
9a4aaae3b2 lavc: add GBRAP to avcodec_align_dimensions2 2015-01-14 17:17:24 +01:00
Rémi Denis-Courmont
57b6704ecd avcodec: add AVCodecContext.sw_pix_fmt
This carries the pixel format that would be used if it were not for
hardware acceleration. This is equal to AVCodecContext.pix_fmt if
hardware acceleration is not in use.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-25 20:47:49 +01:00
Luca Barbato
e3e317e0c0 lavc: Compact the side-data passthrough 2014-11-09 12:29:59 +01:00
Rémi Denis-Courmont
4ff670d99b hwaccel: Deinitialize hardware acceleration early enough
The application will destroy the underlying hardware handles when
get_format() gets called again. Also this ensures the
deinitialization takes place if the get_format callback returns an
error.

Regression from 1c80c9d7ef.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-11-04 22:15:17 +01:00
Vittorio Giovara
bae557edce dump: display codec tags when available
For both audio and video.
2014-10-17 14:45:07 +01:00
Anton Khirnov
7ea1b3472a lavc: deprecate the use of AVCodecContext.time_base for decoding
When decoding, this field holds the inverse of the framerate that can be
written in the headers for some codecs. Using a field called 'time_base'
for this is very misleading, as there are no timestamps associated with
it. Furthermore, this field is used for a very different purpose during
encoding.

Add a new field, called 'framerate', to replace the use of time_base for
decoding.
2014-10-15 06:37:43 +00:00
Anton Khirnov
2df0c32ea1 lavc: use a separate field for exporting audio encoder padding
Currently, the amount of padding inserted at the beginning by some audio
encoders, is exported through AVCodecContext.delay. However
- the term 'delay' is heavily overloaded and can have multiple different
  meanings even in the case of audio encoding.
- this field has entirely different meanings, depending on whether the
  codec context is used for encoding or decoding (and has yet another
  different meaning for video), preventing generic handling of the codec
  context.

Therefore, add a new field -- AVCodecContext.initial_padding. It could
conceivably be used for decoding as well at a later point.
2014-10-13 19:09:01 +00:00
Vittorio Giovara
9f3a70c442 dump: print the original coded dimensions when available 2014-10-08 18:17:49 +01:00
Vittorio Giovara
41e86146e7 dump: print detailed color space information 2014-10-08 18:17:49 +01:00
Vittorio Giovara
20a5956b8d dump: split audio and video probing on multiple lines
Also always report pixel format.
2014-10-08 18:17:49 +01:00
Vittorio Giovara
147f2e91ee avcodec: make sure color_range is properly initialized 2014-10-08 18:17:49 +01:00
Rémi Denis-Courmont
153fadc390 ff_get_format: fix infinite loop
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-06 18:39:45 +00:00
Manfred Georg
577899a645 lavc: specify the behavior of av_lockmgr_register on failure.
The register function now specifies that the user callback should
leave things in the same state that it found them on failure but
that failure to destroy is ignored by the library.  The register
function is now explicit about its behavior on failure
(it unregisters the previous callback and destroys all mutex).

Signed-off-by: Manfred Georg <mgeorg@google.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-06 18:20:17 +00:00
Rémi Denis-Courmont
1c80c9d7ef hwaccel: Call ->get_format again if hwaccel init fails
This allows the application to fall back on another hwaccel or,
more likely, software decoding.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-26 21:28:36 +02:00
Vittorio Giovara
9301486408 avcodec: add stream-level stereo3d side data 2014-08-28 12:33:26 -04:00
Gabriel Dume
4b1f5e5090 cosmetics: Write NULL pointer inequality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 05:34:13 -07:00
Gabriel Dume
f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Anton Khirnov
d63443b968 lavc: drop the av_fast_{re,m}alloc compatibility wrappers
They were only needed until the bump.
2014-08-10 15:40:38 +00:00
Anton Khirnov
472f9ed312 Remove obsolete FF_API_AVFRAME_COLORSPACE cruft. 2014-08-09 16:59:13 +00:00
Diego Biurrun
53abe32409 avcodec: Mark argument in av_{parser|hwaccel|bitstream_filter}_next as const 2014-07-26 14:51:16 -07:00
Diego Biurrun
eba2233b58 build: Add define for SIMD extensions requiring 16-byte aligned buffers 2014-07-22 11:46:35 -07:00
Diego Biurrun
2d60444331 dsputil: Split motion estimation compare bits off into their own context 2014-07-17 09:07:10 -07:00
Diego Biurrun
3c650efb81 dsputil: Move draw_edges() to mpegvideoencdsp 2014-07-06 14:48:50 -07:00
Anton Khirnov
1b04eb20f7 lavc: do not allocate edges in the default get_buffer2() 2014-06-26 16:02:12 +02:00
Justin Ruggles
9e500efdbe Add av_image_check_sar() and use it to validate SAR 2014-06-20 10:39:33 -04:00
wm4
eb800f120d libavcodec: set AVFrame colorspace fields on decoding
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-01 08:23:05 +02:00
Vittorio Giovara
bddd8cbf68 Add transformation matrix API.
Add AV_PKT_DATA_DISPLAYMATRIX and AV_FRAME_DATA_DISPLAYMATRIX as stream and
frame side data (respectively) to describe a display transformation matrix
for linear transformation operations on the decoded video.

Add functions to easily extract a rotation angle from a matrix and
conversely to setup a matrix for a given rotation angle.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-05-19 13:13:10 +02:00