summaryrefslogtreecommitdiffstats
path: root/libavformat/nutdec.c
Commit message (Collapse)AuthorAgeFilesLines
* lavf/nutdec: Fix an impossible condition, regression since e0c53c34.Carl Eugen Hoyos2017-05-021-1/+1
| | | | Fixes ticket #6362.
* Merge commit '07eea5a5ded1141632aefecfa59dcdc26de2d7ea'Clément Bœsch2017-03-241-36/+0
|\ | | | | | | | | | | | | * commit '07eea5a5ded1141632aefecfa59dcdc26de2d7ea': nut: Drop pointless TRACE level debug code Merged-by: Clément Bœsch <[email protected]>
| * nut: Drop pointless TRACE level debug codeDiego Biurrun2016-10-271-26/+0
| | | | | | | | The code has little usefulness and uses the __PRETTY_FUNCTION__ GNU extension.
* | Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-211-1/+1
|\| | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <[email protected]>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-301-1/+1
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
* | avformat: add AVFormatContext to ff_get_extradata()Paul B Mahol2016-04-141-1/+1
| | | | | | | | | | | | Needed for av_log() inside that function. Signed-off-by: Paul B Mahol <[email protected]>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-23/+23
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <[email protected]> - Hendrik Leppkes <[email protected]> - wm4 <[email protected]> - Clément Bœsch <[email protected]> - James Almer <[email protected]> - Michael Niedermayer <[email protected]> - Rostislav Pehlivanov <[email protected]> Merged-by: Derek Buitenhuis <[email protected]>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
| * nutdec: only copy the header if it existsAndreas Cadhalpun2016-01-131-1/+2
| | | | | | | | | | | | | | | | Fixes runtime error: null pointer passed as argument 2, which is declared to never be null Signed-off-by: Andreas Cadhalpun <[email protected]> Signed-off-by: Anton Khirnov <[email protected]>
* | nutdec: reject negative value_len in read_sm_dataAndreas Cadhalpun2015-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | If it is negative, it can cause the byte position to move backwards in avio_skip, which in turn makes sm_size negative and thus size larger than the size of the packet buffer, causing invalid writes in avio_read. Also fix potential overflow of avio_tell(bc) + value_len. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | nutdec: only copy the header if it existsAndreas Cadhalpun2015-12-191-1/+2
| | | | | | | | | | | | | | | | Fixes ubsan runtime error: null pointer passed as argument 2, which is declared to never be null Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | Merge commit '0e2395293bff089536b97131b32fea8b58bca0ba'Hendrik Leppkes2015-11-291-2/+4
|\| | | | | | | | | | | | | * commit '0e2395293bff089536b97131b32fea8b58bca0ba': nut: Mark non-fatal errors as warnings Merged-by: Hendrik Leppkes <[email protected]>
| * nut: Mark non-fatal errors as warningsLuca Barbato2015-11-251-2/+4
| | | | | | | | And make one more informative.
* | Merge commit '62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d'Hendrik Leppkes2015-11-291-5/+10
|\| | | | | | | | | | | | | * commit '62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d': nut: Provide more information on failure Merged-by: Hendrik Leppkes <[email protected]>
| * nut: Provide more information on failureLuca Barbato2015-11-251-5/+10
| |
| * lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-271-1/+1
| | | | | | | | Signed-off-by: Vittorio Giovara <[email protected]>
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-271-1/+1
| |
* | avutil/tree: add additional const qualifier to the comparatorGanesh Ajjanagadde2015-10-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | libc's qsort comparator has a const qualifier on both arguments. This adds a missing const qualifier to exactly match the comparator API. Existing usages of av_tree_find, av_tree_insert are appropriately modified: type signature changes of the comparators, and removal of unnecessary void * casts of function pointers. Reviewed-by: Henrik Gramner <[email protected]> Reviewed-by: wm4 <[email protected]> Signed-off-by: Ganesh Ajjanagadde <[email protected]>
* | avformat/nutdec: Check ff_gen_search() for failureMichael Niedermayer2015-07-011-0/+2
| | | | | | | | | | | | | | Fixes assertion failure Found-by: durandal_1707 Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: check maxpos in read_sm_data before returning successAndreas Cadhalpun2015-06-271-0/+3
| | | | | | | | | | | | | | | | Otherwise sm_size can be larger than size, which results in a negative packet size. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | nutdec: fix various memleaks on failureAndreas Cadhalpun2015-05-231-26/+62
| | | | | | | | | | Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | nutdec: always check the get_str return valueAndreas Cadhalpun2015-05-231-5/+22
| | | | | | | | | | | | | | | | | | | | If it fails, the buffers can be (partially) uninitialized. This fixes 'Conditional jump or move depends on uninitialised value(s)' valgrind warnings. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | avformat/nutdec: Check X in 2nd branch of index readingMichael Niedermayer2015-05-231-0/+4
| | | | | | | | | | | | | | Prevents read of uninitialized variable Based on patch by: Andreas Cadhalpun <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: abort if EOF is reached in decode_info_header/read_sm_dataAndreas Cadhalpun2015-05-201-4/+12
| | | | | | | | | | | | | | These loops can take a lot of time if count is very large. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | nutdec: stop skipping bytes at EOFAndreas Cadhalpun2015-05-201-3/+18
| | | | | | | | | | | | | | This can unnecessarily waste a lot of time. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | nutdec: fix infinite resync loopsAndreas Cadhalpun2015-05-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nut->last_syncpoint_pos doesn't necessarily change between resync attempts, so find_any_startcode can return the same startcode again. Thus remember where the last resync happened and don't try to resync before that. This can't be done locally in nut_read_packet, because this wouldn't prevent infinite resync loops, where after the resync a packet is returned and while reading a following packet the resync happens again. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | avformat/nutdec: Fix recovery when immedeately after seeking a failure happensMichael Niedermayer2015-05-201-0/+1
| | | | | | | | | | Found-by: Andreas Cadhalpun <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | avformat/nutdec: Return error on EOF from get_str()Michael Niedermayer2015-05-201-0/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <[email protected]>
* | avformat/nutdec: Remove unused variableMichael Niedermayer2015-05-141-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: Remove unused labelTimothy Gu2015-05-141-4/+2
| | | | | | | | | | | | | | | | Added in 361702660d2c37a63b7d6381d39e1e1de8405260. Modified version that doesn't use this label merged in 55231323b0fdc84a529418d673148cf1f3157229, thus obsoleting this label. Signed-off-by: Michael Niedermayer <[email protected]>
* | avformat/nutdec: Fix use of uinitialized valueMichael Niedermayer2015-05-121-0/+2
| | | | | | | | | | | | Fixes CID1041175 Signed-off-by: Michael Niedermayer <[email protected]>
* | Merge commit '254f3daba4271c1918d9a7ad155b1442ef93ed29'Michael Niedermayer2015-05-101-21/+20
|\| | | | | | | | | | | | | | | | | | | | | * commit '254f3daba4271c1918d9a7ad155b1442ef93ed29': nut: Make sure to clean up on read_header failure Conflicts: libavformat/nutdec.c See: 361702660d2c37a63b7d6381d39e1e1de8405260 Merged-by: Michael Niedermayer <[email protected]>
| * nut: Make sure to clean up on read_header failureLuca Barbato2015-05-091-17/+22
| | | | | | | | | | | | Based on Andreas Cadhalpun <[email protected]> work. CC: [email protected]
* | Merge commit 'b34257eefd98cb768ea2f53a390b8684d51e689a'Michael Niedermayer2015-05-101-1/+1
|\| | | | | | | | | | | | | | | | | | | | | * commit 'b34257eefd98cb768ea2f53a390b8684d51e689a': nut: Check chapter creation in decode_info_header Conflicts: libavformat/nutdec.c See: 3ff1af2b0db7132d5717be6395227a94c8abab07 Merged-by: Michael Niedermayer <[email protected]>
| * nut: Check chapter creation in decode_info_headerAndreas Cadhalpun2015-05-081-0/+4
| | | | | | | | | | | | | | | | This fixes a segmentation fault when accessing the metadata. Signed-off-by: Luca Barbato <[email protected]> CC: [email protected]
| * nutdec: Prevent leaks on memory errorVittorio Giovara2015-03-121-2/+4
| | | | | | | | Bug-Id: CID 205122 / CID 205123
| * nutdec: Check memory allocationsHugo Beauzée-Luyssen2015-02-171-0/+8
| | | | | | | | Signed-off-by: Vittorio Giovara <[email protected]>
* | nutdec: fix illegal count check in decode_main_headerAndreas Cadhalpun2015-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The existing check has two problems: 1) i + count can overflow, so that the check '< 256' returns true. 2) In the (i == 'N') case occurs a j-- so that the loop runs once more. This can trigger the assertion 'nut->header_len[0] == 0' or cause segmentation faults or infinite hangs. Signed-off-by: Andreas Cadhalpun <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: fix memleaks on error in nut_read_headerAndreas Cadhalpun2015-04-281-5/+13
| | | | | | | | | | Signed-off-by: Andreas Cadhalpun <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: check chapter creation in decode_info_headerAndreas Cadhalpun2015-04-281-0/+4
| | | | | | | | | | | | This fixes a segmentation fault when accessing the metadata. Signed-off-by: Michael Niedermayer <[email protected]>
* | nutdec: check for negative frame rate in decode_info_headerAndreas Cadhalpun2015-04-281-1/+2
| | | | | | | | | | | | | | A negative frame rate triggers an av_assert2 in av_rescale_rnd. Signed-off-by: Andreas Cadhalpun <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | avformat/nutdec: Use av_malloc_array()Michael Niedermayer2015-03-301-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <[email protected]>
* | Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'Michael Niedermayer2015-02-111-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '9deaec782810d098bca11c9332fab2d2f4c5fb78': lavf: move internal fields from public to internal context Conflicts: libavformat/avformat.h libavformat/internal.h libavformat/mux.c libavformat/utils.c Merged-by: Michael Niedermayer <[email protected]>
| * lavf: move internal fields from public to internal contextwm42015-02-101-1/+1
| | | | | | | | | | | | | | This is not an API change; the fields were explicitly declared private before. Signed-off-by: Anton Khirnov <[email protected]>
| * nutdec: do not set has_b_framesAnton Khirnov2014-11-061-1/+0
| | | | | | | | It is not supposed to be set by demuxers.
* | Merge commit 'af7ca6ea124b82b337a6b96e10963e88eba57ebe'Michael Niedermayer2014-10-221-4/+4
|\| | | | | | | | | | | | | | | | | | | | | * commit 'af7ca6ea124b82b337a6b96e10963e88eba57ebe': nutdec: check av_new_packet return value Conflicts: libavformat/nutdec.c See: bb502411ddb9fe1928d4a999693a3a49b83f8698 Merged-by: Michael Niedermayer <[email protected]>
| * nutdec: check av_new_packet return valueVittorio Giovara2014-10-211-2/+4
| | | | | | | | | | CC: [email protected] Bug-Id: CID 733713
* | Merge commit '96bfb677478514db73d1b63b4213c97ad4269e8f'Michael Niedermayer2014-10-201-1/+1
|\| | | | | | | | | | | | | | | | | | | | | * commit '96bfb677478514db73d1b63b4213c97ad4269e8f': nutdec: Prevent a memory corruption Conflicts: libavformat/nutdec.c See: 05dd5368a92718f3a25f97f4697acffbabc7458f Merged-by: Michael Niedermayer <[email protected]>
| * nutdec: Prevent a memory corruptionLuca Barbato2014-10-201-2/+3
| | | | | | | | | | | | Chapters do not have an event_flags field. Bug-Id: CID 1231990
* | avformat/nutdec: always initialize event_flagsMichael Niedermayer2014-08-201-2/+3
| | | | | | | | | | | | Fixes: CID1231990 Signed-off-by: Michael Niedermayer <[email protected]>