Commit Graph

81 Commits

Author SHA1 Message Date
Hendrik Leppkes 3ec049b85d Merge commit 'a9a60106370f862e191dea58e748626da6a8fe97'
* commit 'a9a60106370f862e191dea58e748626da6a8fe97':
  avpacket: Provide an alloc and a free function for the struct

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-29 14:18:03 +01:00
Hendrik Leppkes 87a6f532b4 Merge commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6'
* commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6':
  avpacket: Deprecate av_dup_packet

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-29 14:16:44 +01:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Hendrik Leppkes 7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
Luca Barbato a9a6010637 avpacket: Provide an alloc and a free function for the struct
Pave the way for having the size of the AVPacket struct not part
of the ABI.
2015-10-26 18:00:55 +01:00
Luca Barbato 9b56d5c114 avpacket: Deprecate av_dup_packet
As documented, `av_dup_packet` is broken by design, `av_packet_ref`
matches the AVFrame ref-counted API and can be safely used instead.
2015-10-26 18:00:55 +01:00
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
Hendrik Leppkes b01891a9f0 Merge commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d'
* commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d':
  lavc: Make AVPacket.duration int64, and deprecate convergence_duration

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-29 15:22:52 +02:00
wm4 948f3c19a8 lavc: Make AVPacket.duration int64, and deprecate convergence_duration
Note that convergence_duration had another meaning, one which was in
practice never used. The only real use for it was a 64 bit replacement
for the duration field. It's better just to make duration 64 bits, and
to get rid of it.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-29 14:33:00 +02:00
Hendrik Leppkes 83a5df54ea Remove left-over FF_API_DESTRUCT_PACKET cruft 2015-09-05 16:51:53 +02:00
Hendrik Leppkes 87c8812270 Merge commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8'
* commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8':
  lavc: Drop deprecated destruct_packet related functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 16:50:09 +02:00
Vittorio Giovara 01bcc2d5c2 lavc: Drop deprecated destruct_packet related functions
Deprecated in 10/2012.
2015-08-28 16:01:16 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +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
Michael Niedermayer c40ecffd31 Replace AV_PKT_DATA_QUALITY_FACTOR by AV_PKT_DATA_QUALITY_STATS
The stats are a superset of the quality factor, also allowing the picture type and encoder "PSNR" stats to be exported
This also replaces the native by fixed little endian order for the affected side data

AV_PKT_DATA_QUALITY_FACTOR is left as a synonym of AV_PKT_DATA_QUALITY_STATS

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 19:31:52 +02:00
Michael Niedermayer a7dd933b81 avcodec: Add av_packet_side_data_name()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-07 21:01:37 +02:00
Michael Niedermayer 62aec0c2d5 Merge commit 'fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc'
* commit 'fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc':
  avpacket: Check buffer reference

Conflicts:
	libavcodec/avpacket.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 22:47:36 +01:00
Vittorio Giovara fe0f4e5657 avpacket: Check buffer reference
CC: libav-stable@libav.org
Bug-Id: CID 1267889
2015-02-17 12:16:43 -05:00
wm4 ce35a61399 lavc/avpacket: check for malloc failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-12 19:31:29 +01:00
Michael Niedermayer c9eac8062e avcodec/avpacket: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 03:40:57 +02:00
Michael Niedermayer b60938e4fd avcodec/avpacket: simplify freeing pkt->data
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 03:40:15 +02:00
Michael Niedermayer 4a99333581 Merge commit '874390e163427c1fe7682ab27924a7843780dbb3'
* commit '874390e163427c1fe7682ab27924a7843780dbb3':
  lavc: add a convenience function for rescaling timestamps in a packet

Conflicts:
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 16:40:04 +02:00
Anton Khirnov 874390e163 lavc: add a convenience function for rescaling timestamps in a packet 2014-06-20 14:14:11 +02:00
Michael Niedermayer 4a2fd251f4 Merge commit 'cdf58f0599c39852ee3beafe5f64af7d57d4215b'
* commit 'cdf58f0599c39852ee3beafe5f64af7d57d4215b':
  avpacket: fix copying side data in av_packet_copy_props()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-19 18:51:34 +02:00
Anton Khirnov cdf58f0599 avpacket: fix copying side data in av_packet_copy_props()
Side data count is incremented by by calling av_packet_new_side_data()
in the following loop, setting it explicitly results in the resulting
value being twice what it should be.

CC: libav-stable@libav.org
2014-05-19 13:12:40 +02:00
Michael Niedermayer 33c9bb943b avcodec/avpacket: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-08 16:17:40 +02:00
Roman Fietze 5bb3f88255 avcodec.h, avpacket.c: use const AVPacket pointers in copy functions
Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-04 18:36:48 +02:00
Michael Niedermayer 01923bab98 avcodec: move end zeroing code from av_packet_split_side_data() to avcodec_decode_subtitle2()
This code changes the input packet, which is read only and can in
rare circumstances lead to decoder errors. (i run into one of these in
the audio decoder, which corrupted the packet during av_find_stream_info()
so that actual decoding that single packet failed later)
Until a better fix is implemented, this commit limits the problem.
A better fix might be to make the subtitle decoders not depend on
data[size] = 0 or to copy their input when this is not the case.
2013-11-21 03:13:26 +01:00
Michael Niedermayer e50278348a avcodec/avpacket: fix order of operations in case of too large allocation
Found-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-20 19:44:21 +01:00
Michael Niedermayer fcb1b0078d avcodec/avpacket: use size_t, fix potential integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-20 17:35:48 +01:00
Ben Boeckel 51a84a6bca avpacket: add pack/unpack functions for AVDictionary
These functions are intended for use with side_data which comes in an
AVPacket.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Reviewed-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-20 16:48:51 +01:00
Michael Niedermayer 05493c6e72 avcodec/avpacket: correctly set the number of side data elements in av_copy_packet_side_data()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-20 00:23:23 +01:00
Michael Niedermayer 240fd8c96f avcodec/avpacket/av_packet_split_side_data: ensure that side data padding is initialized
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-19 17:58:47 +02:00
Michael Niedermayer 7283d2bb90 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avpacket: Fix error checking in packet_alloc

Conflicts:
	libavcodec/avpacket.c

See: b905a7137a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-16 14:22:26 +02:00
Martin Storsjö 85e8192b85 avpacket: Fix error checking in packet_alloc
Previously the wrong buffer pointer was checked, when buf
instead of *buf was checked. But checking the return value
instead is even better.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 11:22:42 +03:00
Michael Niedermayer 9cbb3fce59 avcodec/avpacket: zero memory in av_packet_new_side_data()
This ensures that no uninitialized bytes cause non-deterministic behavior.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-04 21:00:24 +02:00
Vignesh Venkatasubramanian fdd1aaf87a avpacket: Fixing side data copy when src == dst
Fixing av_packet_copy_side_data to work correctly when source and
destination are the same. This makes sure that there is no memory
leak and double frees.

Signed-off by: Vignesh Venkatasubramanian <vigneshv@google.com>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-02 21:40:15 +02:00
Michael Niedermayer 6e1b1a27a4 avcodec/avpacket: Use av_free_packet() in error cleanups
This prevents memleaks on errors
reproduceable with fate when error pathes are forced

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-30 21:43:35 +02:00
Michael Niedermayer 98fd8a7848 avcodec: Remove ff_packet_free_side_data, use av_packet_free_side_data
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-12 00:13:21 +02:00
Michael Niedermayer b905a7137a avcodec/avpacket: Fix memory allocation failure check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-11 10:56:07 +02:00
Michael Niedermayer 67a580f423 Merge commit '5a9a9d4a2abefa63d9a898ce26715453c569e89d'
* commit '5a9a9d4a2abefa63d9a898ce26715453c569e89d':
  lavc: Add refcounted api to AVPacket

Conflicts:
	libavcodec/avpacket.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-11 10:45:13 +02:00
Luca Barbato 5a9a9d4a2a lavc: Add refcounted api to AVPacket
Provide a clean way to manipulate packets.
2013-08-10 13:41:35 +02:00
Michael Niedermayer 20be5e0a0e Merge commit '7950e519bb094897f957b9a9531cc60ba46cbc91'
* commit '7950e519bb094897f957b9a9531cc60ba46cbc91':
  Disable deprecation warnings for cases where a replacement is available

Conflicts:
	libavcodec/avpacket.c
	libavcodec/pthread.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavfilter/avfiltergraph.c
	libavfilter/buffersrc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-03 10:08:30 +02:00
Diego Biurrun 7950e519bb Disable deprecation warnings for cases where a replacement is available 2013-08-02 19:19:02 +02:00
Clément Bœsch 151b4947e5 lavc/avpacket: fill padding area on side data split.
The padding data is assumed to be 0 in several places, notably in
subtitles. This problem was not detected with fate-sub-srt test because
the first element of the side data (x1) is 0 in the test, so the
trailing side data present in the packet wasn't read by the decoder. The
issue can be observed with a large enough x1.

It is also noted in FF_INPUT_BUFFER_PADDING_SIZE doxy that MPEG
bitstreams require that padding with 0, so it might fix other issues.
2013-06-01 15:12:49 +02:00
Vignesh Venkatasubramanian 48de04f4ec avcodec/avpacket: Refactoring copy_side_data into a separate function
Refactoring copy_side_data into a separate function so that it can be called
in cases where side data needs to be duplicated.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-14 22:51:12 +02:00
Michael Niedermayer b691bc424f copy_packet_data: fix memleak
This should fix gif fate memleaks

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-29 03:08:50 +02:00
Janne Grunau 91d4823f70 avpacket: copy side data type and size in av_dup_packet 2013-03-13 11:34:47 +01:00
Clément Bœsch 02a6b06d9e avpacket: do not copy data when buf ref is available.
This at least fixes issues with lavf/subtitles. The behaviour of
av_dup_packet() is unchanged, only av_copy_packet() is affected.
2013-03-13 01:30:20 +01:00
Michael Niedermayer 2653e12520 Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
  avpacket: use AVBuffer to allow refcounting the packets.

Conflicts:
	libavcodec/avpacket.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavformat/avidec.c
	libavformat/flacdec.c
	libavformat/id3v2.c
	libavformat/matroskaenc.c
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:12:03 +01:00