Commit Graph

55 Commits

Author SHA1 Message Date
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
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Anton Khirnov 84b5dcf275 asfenc: remove an unused variable 2016-03-05 08:45:01 +01:00
Anton Khirnov ff3db937ef asfenc: fix some possible integer overflows
Store the file duration in the same timebase it arrives (i.e.
milliseconds) and only convert it to the file duration units (100ns)
when it's actually written, thus simplifying some calculations. Also,
store the duration as unsigned, since it cannot be negative.

CC: libav-stable@libav.org
Bug-ID: CVE-2016-2326
2016-03-05 08:43:04 +01: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
Alexandra Hájková b08569a239 lavf: Replace the ASF demuxer
The old one is the result of the reverse engineering and guesswork.
The new one has been written following the now-available specification.

This work is part of Outreach Program for Women Summer 2014 activities
for the Libav project.

The fate references had to be changed because the old demuxer truncates
the last frame in some cases, the new one handles it properly.
The seek-test reference is changed because seeking works differently
in the new demuxer. When seeking, the packet is not read from the stream
directly, but it is rather constructed by the demuxer. That is why
position is -1 now in the reference.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-06-28 10:16:40 +02:00
Andreas Cadhalpun 72211a2af0 asfenc: fix leaking asf->index_ptr on error
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-03-11 20:24:59 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Anton Khirnov 6072184e70 asfenc: use codec descriptors instead of AVCodecs to write codec info
Also, stop using AVCodecContext.codec_name as fallback, since it will be
deprecated.

Changes the result of the lavf-asf test (and its associated seektest),
since 'msmpeg4v3' gets written instead of just 'msmpeg4'.
2014-05-01 09:26:20 +02:00
Vladimir Pantelic bb461370e3 asfenc: mux chapters in ASF files using an ASF "marker" section
ASF markers only have a start time, so we lose the chapter end times,
but that is ASF for you

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-19 19:51:49 +02:00
Vladimir Pantelic 09f3c937ed asfenc: remember send time and offset of the index entries
Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-19 19:37:59 +02:00
Vladimir Pantelic c53b5dda35 asfdec: replace magic constant with DATA_HEADER_SIZE
Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-19 19:37:37 +02:00
Alexandra Khirnova f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Anton Khirnov 3cd93cc7b8 Revert "asfenc: return error on negative timestamp"
This reverts commit d1bec33b46, it breaks
FATE.
2013-03-19 11:04:55 +01:00
Luca Barbato d1bec33b46 asfenc: return error on negative timestamp
According to the specification the timestamp is represented by a 32bit
unsigned.

CC: libav-stable@libav.org
2013-03-18 10:48:23 +01:00
Diego Biurrun 48a4ffa722 asf: K&R formatting cosmetics 2013-02-06 09:48:51 +01:00
Anton Khirnov 3b4bb19e63 lavf: flush the output AVIOContext in av_write_trailer().
This is consistent with stdio and is what we want to do in all cases.

Fixes a bug in the voc muxer which didn't flush in write_trailer()
previously. This is the cause of the change in the test results.
2012-09-15 18:25:07 +02:00
Mans Rullgard 987170cb9d dict: add av_dict_count()
This adds a function to retrieve the number of entries in a
dictionary and updates the places directly accessing what should
be an opaque struct to use this new function instead.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 15:15:00 +01:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 0177b7d23a Improve descriptiveness of a number of codec and container long names 2012-07-30 20:46:55 +02:00
Ronald S. Bultje fd48721849 lavf: use conditional notation for default codec in muxer declarations.
This removes the use of macro nesting in these code constructs, which
makes it easier to parse in pre-processors.
2012-07-22 16:10:21 -07: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 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
John Brooks 2c4e08d893 riff: always generate a proper WAVEFORMATEX structure in ff_put_wav_header
The cbSize field should be included in all cases, even with PCM where
its value is ignored.

Fixes encoding PCM audio in Matroska for some players which insist on
a full WAVEFORMATEX structure for A_MS/ACM audio.

Since fate uses wav files for the audio test a larger number of tests
has changed checksums or shifted positions due to the 2 byte longer
wave header.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-14 13:28:58 +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
Anton Khirnov d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Anton Khirnov 6dc7d80de7 avio: avio_ prefix for url_close_dyn_buf 2011-04-03 22:47:05 +02:00
Anton Khirnov b92c545282 avio: avio_ prefix for url_open_dyn_buf 2011-04-03 22:46:56 +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
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Anton Khirnov b7f2fdde74 avio: rename put_flush_packet -> avio_flush
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-16 22:59:39 -04:00
Anton Khirnov a2704c9712 avio: add avio_tell macro as a replacement for url_ftell
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-04 11:26:57 -05:00
Anton Khirnov 6b4aa5dac8 avio: avio_ prefix for url_fseek
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-01 12:12:33 -05:00
Anton Khirnov 77eb5504d3 avio: avio: avio_ prefixes for put_* functions
In the name of consistency:
put_byte           -> avio_w8
put_<type>         -> avio_w<type>
put_buffer         -> avio_write

put_nbyte will be made private
put_tag will be merged with avio_put_str

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-21 14:25:15 -05:00
Anton Khirnov e731b8d872 avio: move init_put_byte() to a new private header and rename it
init_put_byte should never be used outside of lavf, since
sizeof(AVIOContext) isn't part of public ABI.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:31 -05:00
Anton Khirnov ae628ec1fd avio: rename ByteIOContext to AVIOContext.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:15 -05:00
Anton Khirnov 4bc328a2bd asf: split ASFContext into muxer and demuxer parts.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-09 15:31:09 -05:00
Diego Elio Pettenò c6610a216e Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
2011-01-26 22:10:09 +00:00
Anton Khirnov dccbd97d72 lavf: move ff_put_str16_nolen from asf to avio and rename it
It will be useful in the mp3 muxer.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-21 20:21:51 +00:00
Anton Khirnov ad7768f4c4 add ff_ prefix to metadata_conv()
patch by Anton Khirnov  anton _at_ khirnov _dot_ net

Originally committed as revision 25505 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-16 13:20:41 +00:00
Anton Khirnov 03700d399b Export metadata in the generic format. Deprecate old conversion API.
patch by Anton Khirnov  anton _at_ khirnov _dot_ net

Originally committed as revision 25493 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-15 19:04:25 +00:00
Jean-Daniel Dupas cc947f04cc Replace all occurences of PKT_FLAG_KEY with AV_PKT_FLAG_KEY.
Patch by Jean-Daniel Dupas, devlists shadowlab org

Originally committed as revision 22744 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-31 12:29:58 +00:00
Stefano Sabatini 72415b2adb Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-30 23:30:55 +00:00
Zhentan Feng 852e0ca555 Move put_le16_nolen() to asf.c and give it a ff_ prefix. This way, it is easier
to share it with e.g. MMS.

Patch by Zhentan Feng <spyfeng gmail com>.

Originally committed as revision 22656 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-24 18:40:43 +00:00
Anton Khirnov cba2f6d51b asfenc: write tags in proper UTF-16.
Patch by Anton Khirnov wyskas gmail com

Originally committed as revision 22059 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-25 16:59:55 +00:00
Anton Khirnov a677078e14 asfenc: simplify writing of comment header.
Patch by Anton Khirnov wyskas gmail com

Originally committed as revision 22058 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-25 16:50:26 +00:00
Anton Khirnov a106d4112d Don't add WM prefixes to all written ASF tags.
Patch by Anton Khirnov <wyskas gmail com>.

Originally committed as revision 22033 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-24 18:17:32 +00:00
Anton Khirnov 531d8fa308 Eliminate put_str16().
Patch by Anton Khirnov <wyskas gmail com>.

Originally committed as revision 22031 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-24 18:09:49 +00:00
Anton Khirnov 83a6c1a69c Strings in extended content header are UTF16,
so terminating NULLs are 2 bytes long, not 1.

Patch by Anton Khirnov, wyskas gmail

Originally committed as revision 21841 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-15 21:19:40 +00:00
Ronald S. Bultje 91d19d471b Remove any reference to ASFContext.packet_size and replace it with
AVFormatContext.packet_size. See "[PATCH] asf*.c/h: use
AVFormatContext->packet_size instead of own copy" thread on ML.

Originally committed as revision 19270 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-06-24 23:04:05 +00:00