summaryrefslogtreecommitdiff
path: root/libavcodec/encode.c
Commit message (Collapse)AuthorAge
* avcodec/encode: unref the packet on AVCodec.receive_packet() failureJames Almer2020-09-01
| | | | | | | | | | | Fixes memleaks with some encoders that don't unref the packet before returning. This is consistent with the behavior of AVCodec.encode() implementations in encode_simple_internal(). Found-by: mkver Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: restructure the old encode APIJames Almer2020-06-18
| | | | | | | Following the same logic as 061a0c14bb, this commit turns the old encode API into a wrapper for the new one. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: restructure the core encoding codeJames Almer2020-06-18
| | | | | | | | | | | | | | | | This commit follows the same logic as 061a0c14bb, but for the encode API: The new public encoding API will no longer be a wrapper around the old deprecated one, and the internal API used by the encoders now consists of a single receive_packet() callback that pulls frames as required. amf encoders adapted by James Almer librav1e encoder adapted by James Almer nvidia encoders adapted by James Almer MediaFoundation encoders adapted by James Almer vaapi encoders adapted by Linjie Fu v4l2_m2m encoders adapted by Andriy Gelman Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: Remove ff_alloc_packetAndreas Rheinhardt2020-06-01
| | | | | | | It is no longer used anymore. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/frame_thread_encoder: remove usage of avcodec_encode_video2()James Almer2020-05-25
| | | | | | Call the encoder's internal AVCodec.encode2() function instead. Signed-off-by: James Almer <jamrial@gmail.com>
* Stop hardcoding align=32 in av_frame_get_buffer() calls.Anton Khirnov2020-05-22
| | | | Use 0, which selects the alignment automatically.
* avcodec/encode: add missing assert to avcodec_receive_packet()James Almer2019-11-14
| | | | | | | | | | Encoders must return reference counted packets. This was checked only for encoders using the AVCodec->encode2() API, while blindly accepting whatever encoders using the AVCodec->receive_packet() API were returning. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: only allow undersized audio frames if they are the lastMarton Balint2019-08-11
| | | | | | | | | | | | | | | Otherwise the user might get a silence padded frame in the beginning or in the middle of the encoding. Some other bug uncovered this: ./ffmpeg -loglevel verbose -y -f data -i /dev/zero \ -filter_complex "nullsrc=s=60x60:d=10[v0];sine=d=10[a]" \ -map '[v0]' -c:v:0 rawvideo \ -map '[a]' -c:a:0 mp2 \ -f mpegts out.ts Signed-off-by: Marton Balint <cus@passwd.hu>
* lavc/encode: fix frame_number double-countedZhong Li2018-08-27
| | | | | | | | | | Encoder frame_number may be double-counted if some frames are cached and then flushed. Take qsv encoder (some frames are cached firsty for asynchronism) as example, ./ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv -i in.mp4 -vframes 100 -c:v h264_qsv out.mp4 frame_number passed to encoder is double-counted and larger than the accurate value. Libx264 encoding with B frames can also reproduce it. Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/encode: remove redundant av_init_packet after av_packet_unref.Jun Zhao2018-08-23
| | | | | | | remove redundant av_init_packet after av_packet_unref. av_packet_unref have call av_init_packet and reset the packet size. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* avcodec/encode: use av_packet_make_refcounted to ensure packets are ref countedJames Almer2018-04-01
| | | | | | Simplifies code. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3'James Almer2017-10-23
|\ | | | | | | | | | | | | * commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3': lavc: Drop deprecated way of setting audio delay on encode Merged-by: James Almer <jamrial@gmail.com>
| * lavc: Drop deprecated way of setting audio delay on encodeVittorio Giovara2017-03-23
| | | | | | | | Deprecated in 08/2014.
* | avcodec/encode: do proper cleanup on failureJames Almer2017-10-03
| | | | | | | | | | | | Fixes the last remaining memleaks introduced by a22c6a4796ca1f2cbee6784262515da876fbec22. Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/encode: free non-referenced packets' side data in the old encode API ↵James Almer2017-10-02
| | | | | | | | | | | | functions Fixes memleaks introduced by a22c6a4796ca1f2cbee6784262515da876fbec22.
* | avcodec/encode: remove usage of av_dup_packet()James Almer2017-10-02
| | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* | Merge commit '328cd2b599bc2d0d38f3c12606fa2a66eeec016e'James Almer2017-04-07
|/ | | | | | | * commit '328cd2b599bc2d0d38f3c12606fa2a66eeec016e': lavc: move encoding-related code from utils.c to a new file Merged-by: James Almer <jamrial@gmail.com>
* lavc: move encoding-related code from utils.c to a new fileAnton Khirnov2016-11-29