Commit Graph

154 Commits

Author SHA1 Message Date
Diego Biurrun fcbdd605b5 nut: Use correct function pointer casts instead of void*
Fixes several warnings of the type
libavformat/nut.c:207:42: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
2016-11-12 16:47:06 +01:00
Diego Biurrun 07eea5a5de nut: Drop pointless TRACE level debug code
The code has little usefulness and uses the __PRETTY_FUNCTION__ GNU extension.
2016-10-27 12:54:07 +02:00
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
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.
2016-09-30 16:54:33 +02:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
Andreas Cadhalpun 9cdddb93bb nutdec: only copy the header if it exists
Fixes runtime error: null pointer passed as argument 2, which is
declared to never be null

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-01-13 09:44:44 +01:00
Luca Barbato 0e2395293b nut: Mark non-fatal errors as warnings
And make one more informative.
2015-11-25 09:01:25 +01:00
Luca Barbato 62f72b40c0 nut: Provide more information on failure 2015-11-25 09:01:25 +01: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
Luca Barbato 254f3daba4 nut: Make sure to clean up on read_header failure
Based on Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> work.

CC: libav-stable@libav.org
2015-05-09 15:55:50 +02:00
Andreas Cadhalpun b34257eefd nut: Check chapter creation in decode_info_header
This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

CC: libav-stable@libav.org
2015-05-08 11:10:51 +02:00
Vittorio Giovara 5a2645cafe nutdec: Prevent leaks on memory error
Bug-Id: CID 205122 / CID 205123
2015-03-12 15:29:59 +00:00
Hugo Beauzée-Luyssen 3035d21b5a nutdec: Check memory allocations
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-02-17 12:16:43 -05:00
wm4 9deaec7828 lavf: move internal fields from public to internal context
This is not an API change; the fields were explicitly declared private
before.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-02-10 21:45:04 +01:00
Anton Khirnov 05e59135b3 nutdec: do not set has_b_frames
It is not supposed to be set by demuxers.
2014-11-06 09:05:37 +01:00
Vittorio Giovara af7ca6ea12 nutdec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 733713
2014-10-21 14:37:48 +01:00
Luca Barbato 96bfb67747 nutdec: Prevent a memory corruption
Chapters do not have an event_flags field.

Bug-Id: CID 1231990
2014-10-20 10:47:03 +01:00
Andrew Stone fa3a5dd4de nutdec: update AVFormatContext.event_flags with STREAM_/METADATA_UPDATED whenever metadata changes.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-13 16:23:36 +00:00
Luca Barbato 52a1c32c0a nut: Use nut->version in the version range check
It was wrongly left unchanged when the version field had been
introduced. (c94e2e85cb)
2014-07-08 19:04:09 +02:00
Luca Barbato c94e2e85cb nut: Support experimental NUT 4 features
Add the low overhead pipe mode and the extended broadcast mode.
Export the options as 'syncponts' since it impacts only that.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-05-28 22:04:56 +02:00
Derek Buitenhuis b1fcdc08ce nut: Fix unchecked allocations
CC: libav-stable@libav.org
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-10-22 17:09:56 +01:00
Luca Barbato e0c53c3408 nut: use meaningful error values
Fix the mispresented EINVAL for EOF on partial files, among the other.
2013-05-07 14:37:32 +02:00
Luca Barbato 46c1917350 nut: use a define for the nut version
Ease switching version in the future and make evident why that value.
2013-05-06 09:14:43 +02:00
Diego Biurrun d8c772de53 nutdec: Always return a value from nut_read_timestamp()
The function is a callback that is called by ff_gen_search with
a constant stream index.

Avoid a false positive on older gcc version.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-15 02:15:09 +01:00
Justin Ruggles bfe5454cd2 lavf: move ff_codec_get_tag() and ff_codec_get_id() definitions to internal.h 2012-11-28 11:18:49 -05:00
Luca Barbato d4bff9f1ab nut: support textual data
Plain text (utf8 encoded) data can be muxed and demuxed in nut.
2012-10-29 12:03:28 +01:00
Luca Barbato 92281850a2 nut: support pcm codecs not mapped in avi
The native tags will be used when available.
2012-10-13 12:33:18 +02:00
Luca Barbato 1bd442c276 nut: prioritize native tags
Use native tags instead of avi ones, simplifies a lot raw video codecs
handling.
2012-10-13 12:33:18 +02:00
Luca Barbato 72d30b2792 nut: add do {} while (0) to GET_V
Make it consistent with the other function-like macros.
2012-10-02 12:16:47 +02:00
Diego Biurrun 83655442fa nutdec: Remove unused and broken debug function stub 2012-09-27 12:02:33 +02:00
Diego Biurrun 93e81ee81c nutdec: const correctness for get_v_trace/get_s_trace function arguments 2012-09-26 19:10:13 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 6774247a9d avformat: Drop pointless "format" from container long names 2012-07-30 13:59:06 +02:00
Mans Rullgard 9d72c0527c nutdec: add malloc check and fix const to non-const conversion warnings
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-18 23:54:20 +01:00
Diego Biurrun 679481b3b6 Drop some pointless #ifdefs.
The files are only compiled if the #ifdef conditions are met.
2012-04-10 19:27:38 +02:00
Asen Lekov a559d65c07 nutdec: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-04-10 14:57:47 +02:00
Martin Storsjö 20234a4bd7 cosmetics: Align muxer/demuxer declarations
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 19:19:59 +03:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Anton Khirnov c3f9ebf743 lavf: make av_set_pts_info private.
It's supposed to be called only from (de)muxers.
2011-11-30 20:34:45 +01:00
Reimar Döffinger bb3244dee2 Replace all usage of strcasecmp/strncasecmp
All current usages of it are incompatible with localization.
For example strcasecmp("i", "I") != 0 is possible, but would
break many of the places where it is used.

Instead use our own implementations that always treat the data
as ASCII.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:57 +02:00
Anton Khirnov a2faa95151 lavf: make some seeking functions private
Specifically av_update_cur_dts(), av_seek_frame_binary() and
av_gen_search().

They are not supposed to be called outside lavf.
2011-10-28 09:23:24 +02:00
Anton Khirnov 1fa395e471 lavf: use avpriv_ prefix for ff_new_chapter().
It's used in libavdevice.
2011-10-20 20:57:23 +02:00
Anton Khirnov 84ad31ff18 lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit.

In many cases, the id is some constant made up number (e.g. 0 for video
and 1 for audio), which is then not used in the demuxer for anything.
Those ids are removed.
2011-10-19 17:02:11 +02:00
Anton Khirnov dfc2c4d900 lavf: use designated initialisers for all (de)muxers.
It's more readable and less prone to breakage.
2011-07-17 06:58:37 +02:00
Mans Rullgard 0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Anton Khirnov d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Mans Rullgard 14086341bf nutdec: remove unused variable 2011-06-02 20:06:18 +01:00
Anton Khirnov 761ad42968 lavf: remove FF_API_MAX_STREAMS cruft 2011-04-19 18:28:38 +02:00
Anton Khirnov 8978fedaee avio: introduce an AVIOContext.seekable field
Use it instead of url_is_streamed and AVIOContext.is_streamed.
2011-04-03 22:46:40 +02:00
Anton Khirnov b64030f26d avio: make get_checksum() internal. 2011-03-30 07:48:55 +02:00
Anton Khirnov 4c4427a75d avio: make init_checksum() internal. 2011-03-30 07:47:08 +02:00