Commit Graph

1063 Commits

Author SHA1 Message Date
Andreas Rheinhardt 9dd8f7312a avformat/avformat: Remove redundant "NOT PART OF PUBLIC API"
AVStream.request_probe as well as AVStream.mux_ts_offset are below the
separator of public and private fields, so that a further "NOT PART OF
PUBLIC API" is redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 01:40:05 +02:00
Andreas Rheinhardt afa5e3809d avformat/avformat.h: Correct some comments
1. When set_parameters was removed from AVOutputFormat in 2fb75019, it
was forgotten to remove the comment pertaining to it. Said comment now
appeared to apply to interleave_packet(); it is of course nonsense and
has been replaced by an accurate description.
2. The description of av_write_uncoded_frame() suggested
av_interleaved_write_frame() as a replacement if the input is not
already correctly interleaved; it also referred to said function for
details. Given that said function can't write AVFrames and that the
specifics of writing uncoded frames are explained in the description
of av_interleaved_write_uncoded_frame(), both references have been fixed.
3. Removed an outdated comment about avformat_seek_file().

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-01 05:48:31 +02:00
Andreas Rheinhardt 4cb0dda555 avformat/avformat: Update av_read_frame() documentation
This commit updates the documentation of av_read_frame() to match its
actual behaviour in several ways:

1. On success, av_read_frame() always returns refcounted packets.
2. It can handle uninitialized packets.
3. On error, it always returns blank packets.

This will allow callers to not initialize or unref unnecessarily.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-29 03:58:30 +02:00
Andreas Rheinhardt b55c6b8c40 avformat/avformat: Update AVInputFormat.read_packet documentation
Since bae8844e35, the packet is automatically unreferenced in
ff_read_packet() when an error is returned; but the documentation of
this of AVInputFormat.read_packet has not been updated accordingly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 23:00:35 +01:00
Andriy Gelman 5e3229df4c avformat: Add max_probe_packets option
Allows user to set maximum number of buffered packets when
probing a codec. It was a hard-coded parameter before this commit.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-03 11:52:32 +01:00
Andreas Rheinhardt a2572e3c67 avformat: Don't suggest deprecated function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-07-13 14:07:59 -03:00
Jun Zhao e9c9514ce3 avformat/avformat.h: Update the comment for AVInputFormat.flags
AVFMT_NOTIMESTAMPS may be using in AVInputFormat.flags for demuxing

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-03-26 20:58:19 +08:00
Steven Liu 2cb29a5d8d avformat/avformat.h: update the comment from deprecated to new API
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-03-23 14:04:39 +08:00
Carl Eugen Hoyos 4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Carl Eugen Hoyos 6a3520bf98 lavf: Constify AVProbeData* in av_probe_input_format(). 2019-03-20 19:04:49 +01:00
Carl Eugen Hoyos cc49341084 lavf/avformat: Add a warning that ff_const59 is not part of the public api. 2019-03-20 18:56:47 +01:00
Carl Eugen Hoyos 3aa6208db9 lavf: Constify AVInputFormat pointer. 2019-03-20 18:52:38 +01:00
Carl Eugen Hoyos 9461e4bc69 lavf: Constify AVOutputFormat pointer. 2019-03-20 18:38:48 +01:00
Gyan Doshi 67747c89ad avformat: deprecate unused MP4A_LATM flag
A generic lavf flag for AAC LATM packetization for the RTP muxer was
added in ef409645f0 and then made inert 20 days later in 0832122880
when a private muxer option was added and the generic flag no longer
read.
2018-06-13 10:24:33 +05:30
Aman Gupta 2b2f2f65f3 avformat: add fields to AVProgram/AVStream for PMT change tracking
These fields will allow the mpegts demuxer to expose details about
the PMT/program which created the AVProgram and its AVStreams.

In mpegts, a PMT which advertises streams has a version number
which can be incremented at any time. When the version changes,
the pids which correspond to each of it's streams can also change.

Since ffmpeg creates a new AVStream per pid by default, an API user
needs the ability to (a) detect when the PMT changed, and (b) tell
which AVStream were added to replace earlier streams.

This has been a long-standing issue with ffmpeg's handling of mpegts
streams with PMT changes, and I found two related patches in the wild
that attempt to solve the same problem:

The first is in MythTV's ffmpeg fork, where they added a
void (*streams_changed)(void*); to AVFormatContext and call it from
their fork of the mpegts demuxer whenever the PMT changes.

The second was proposed by XBMC in
https://ffmpeg.org/pipermail/ffmpeg-devel/2012-December/135036.html,
where they created a new AVMEDIA_TYPE_DATA stream with id=0 and
attempted to send packets to it whenever the PMT changed.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-18 19:00:29 -07:00
Aman Gupta 5dfeb7f081 avformat/mpegts: tag video streams with still images
Parses the video_stream_descriptor (H.222 2.6.2) to look
for the still_picture_flag. This is exposed to the user
via a new AV_DISPOSITION_STILL_IMAGE.

See for example https://tmm1.s3.amazonaws.com/music-choice.ts,
whose video stream only updates every ~6 seconds.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-17 12:03:22 -07:00
Aman Gupta 2734f8d63a avformat: add skip_estimate_duration_from_pts
For seekable mpegts streams, duration is calculated from
pts by seeking to the end of the file for a pts and subtracting
the initial pts to compute a duration.

This can be expensive in terms of added latency during
probe, especially when streaming over a network. This new
option lets you skip the duration calculation, which is useful
when you don't care about the value and want to save some overhead.

This patch is particularly useful when dealing with live mpegts
streams. Normally such streams are not seekable, so durations
are not calculated. However in my case I am dealing with a seekable
live mpegts stream (networked access to a .ts file which is still
being appended to).

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-17 11:33:01 -07:00
Josh de Kock 42d26145e9 lavf: move avpriv function definition to internal.h
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 02:16:14 +01:00
Josh de Kock 65452bcd64 lavd: remove linked lists
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-03-31 23:26:31 +01:00
Aman Gupta 4f40d64e00 avformat/mpegts: set AV_DISPOSITION_DEPENDENT for mix_type=0 supplementary audio
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-02-23 13:47:29 -08:00
Josh de Kock 0694d87024 lavf: add new API for iterating muxers and demuxers 2018-02-06 18:57:42 +00:00
Marton Balint fa8308d3d4 avformat: deprecate AVFormatContext filename field
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Marton Balint ea3672b7d6 avformat: add url field to AVFormatContext
This will replace the 1024 character limited filename field. Compatiblity for
output contexts are provided by copying filename field to URL if URL is unset
and by providing an internal function for muxers to set both url and filename
at once.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
wm4 6194d7e564 avformat, hls: add a flag to signal unavailability of seeking
The seek function can just return an error if seeking is unavailable,
but often this is too late. Add a flag that signals that the stream is
unseekable, and use it in HLS.
2018-01-27 04:10:52 +01:00
James Almer 4f6b34f1f8 avformat: small AVFormatContext doxy cosmetics
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-18 13:00:25 -03:00
James Almer 1b5d3c08e3 avformat: small cosmetics after 6512ff72f9
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-17 19:39:33 -03:00
wm4 631c56a8e4 avformat: make avformat_network_init() explicitly optional
It was sort of optional before - if you didn't call it, networking was
initialized on demand, and an ugly warning was logged. Also, the doxygen
comments threatened that it would be made strictly required one day.

Make it explicitly optional. I would prefer to deprecate it fully, but
there might still be legitimate reasons to use this. But the average
user won't need it.

This is needed only for two reasons: to initialize TLS libraries like
OpenSSL and GnuTLS, and winsock.

OpenSSL and GnuTLS were already silently initialized on demand if the
global network init function was not called. They also have various
thread-safety acrobatics, which make concurrent initialization within
libavformat safe. In addition, the libraries are moving towards making
their global init functions safe, which removes all need for central
global init. In particular, GnuTLS 3.5.16 and OpenSSL 1.1.0g have been
found to have safe init functions. In all cases, they use internal
reference counters to avoid that the global uninit functions interfere
with concurrent uses of the library by other API users who called global
init.

winsock should be thread-safe as well, and maintains an internal
reference counter as well.

Since we still support ancient TLS libraries, which do not have this
fixed, and since it's unknown whether winsock and GnuTLS
reinitialization is costly in any way, don't deprecate the libavformat
functions yet.
2018-01-16 12:57:04 +01:00
wm4 6512ff72f9 avformat: deprecate another ffserver API leftover 2018-01-16 12:54:53 +01:00
James Almer d6d605eb05 avformat/mux: stop delaying writing the header
Every bitstream filter behaves as intended now, so there's no need to
wait for the first packet of every stream.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-12-06 15:43:59 -03:00
James Almer 936a4c04b9 avformat: remove unnecessary AVStreamParseType enum offset
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-18 20:17:05 -03:00
Michael Niedermayer b197d83ca3 avformat/utils: Look at the first 3 frames if timestamps indicate frame reorder but decoder delay does not
Fixes: Ticket6487

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-11 14:15:15 +01:00
James Almer cd1ff3e45d avformat: move priv_pts from AVStream to an internal struct
It has no reason to be in a public header, even if defined as private.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-07 23:20:50 -03:00
James Almer c8e8092543 avformat/avformat.h: fix pairs typo
Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 10:35:40 -03:00
James Almer b7785d10b0 avformat: deprecate getters and setters for AVFormatContext and AVStream fields
The fields can be accessed directly, so these are not needed anymore.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 10:29:43 -03:00
James Almer 307c24b32f avformat: move public AVStream fields up in the struct
Remove the silly second notice.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 10:29:33 -03:00
James Almer ca2b779423 avformat: remove use of deprecated AVFMT_FLAG_KEEP_SIDE_DATA flag
It has no effect whatsoever since the major bump.
Replace the flag's documentation to reflect this as well.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 00:09:52 -03:00
Carl Eugen Hoyos 693a11b8a2 lavf: Remove AVFMT_RAWPICTURE.
Deprecated since October 2015.
2017-10-26 23:43:11 +02:00
James Almer b89081e01b avformat: remove dead av_stream_get_side_data() cruft
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-22 01:36:28 -03:00
James Almer a295fee284 Merge commit '263358e0c9e7ffaa965fdbe986c8b18381d2b24a'
* commit '263358e0c9e7ffaa965fdbe986c8b18381d2b24a':
  lavf: Drop deprecated AVFract type and related field

Merged-by: James Almer <jamrial@gmail.com>
2017-10-21 15:51:11 -03:00
Max Weber 9e392c6ece libavformat/avformat.h: Move docs inside of #if
Otherwise AVTimebaseSource gets av_apply_bitstream_filters' documentation in doxygen.

Signed-off-by: Max Weber <mii7303@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-30 14:35:25 +02:00
Vittorio Giovara 263358e0c9 lavf: Drop deprecated AVFract type and related field
Deprecated in 05/2014.
2017-03-23 10:09:12 +01:00
wm4 d682ae70b4 avcodec, avformat: deprecate anything related to side data merging
This patch deprecates anything that has to do with merging/splitting
side data. Automatic side data merging (and splitting), as well as all
API symbols involved in it, are removed completely.

Two FF_API_ defines are dedicated to deprecating API symbols related to
this: FF_API_MERGE_SD_API removes av_packet_split/merge_side_data in
libavcodec, and FF_API_LAVF_KEEPSIDE_FLAG deprecates
AVFMT_FLAG_KEEP_SIDE_DATA in libavformat.

Since it was claimed that changing the default from merging side data to
not doing it is an ABI change, there are two additional FF_API_ defines,
which stop using the side data merging/splitting by default (and remove
any code in avformat/avcodec doing this): FF_API_MERGE_SD in libavcodec,
and FF_API_LAVF_MERGE_SD in libavformat.

It is very much intended that FF_API_MERGE_SD and FF_API_LAVF_MERGE_SD
are quickly defined to 0 in the next ABI bump, while the API symbols are
retained for a longer time for the sake of compatibility.
AVFMT_FLAG_KEEP_SIDE_DATA will (very much intentionally) do nothing for
most of the time it will still be defined. Keep in mind that no code
exists that actually tries to unset this flag for any reason, nor does
such code need to exist. Code setting this flag explicitly will work as
before. Thus it's ok for AVFMT_FLAG_KEEP_SIDE_DATA to do nothing once
side data merging has been removed from libavformat.

In order to avoid that anyone in the future does this incorrectly, here
is a small guide how to update the internal code on bumps:

- next ABI bump (probably soon):
  - define FF_API_LAVF_MERGE_SD to 0, and remove all code covered by it
  - define FF_API_MERGE_SD to 0, and remove all code covered by it
- next API bump (typically two years in the future or so):
  - define FF_API_LAVF_KEEPSIDE_FLAG to 0, and remove all code covered
    by it
  - define FF_API_MERGE_SD_API to 0, and remove all code covered by it

This forces anyone who actually wants packet side data to temporarily
use deprecated API to get it all. If you ask me, this is batshit fucked
up crazy, but it's how we roll. Making AVFMT_FLAG_KEEP_SIDE_DATA to be
set by default was rejected as an ABI change, so I'm going all the way
to get rid of this once and for all.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-21 06:13:45 +01:00
wm4 227f6e1e8d avformat: fix AVStream private fields marker
Public fields were added after the private fields (negating the entire
point of this). New private fields go into AVStreamInternal anyway.

The new marker was set by guessing which fields are supposed to be
private and wshich not. recommended_encoder_configuration is accessed by
ffserver_config.c directly, and is supposed to use the public API.

ffmpeg.c accesses AVStream.cur_dts, even though it's a private field,
but that seems to be an older error.
2017-03-02 10:32:21 +01:00
wm4 554bc4eea8 avcodec, avutil, avformat: remove AVOption requirement for some fields
Allow all struct fields to be accessed directly, as long as they're
public.

Before this change, many fields were "public", but could be accessed via
AVOption only. This meant they were effectively not public, but were
present for documentation purposes, which was incredibly confusing at
best.
2017-03-02 10:32:12 +01:00
Tobias Rapp c324e2c5db ffmpeg: pass output stream duration as a hint to the muxer
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-19 01:54:49 +01:00
Michael Niedermayer 1296f84495 avformat: Add max_streams option
This allows user apps to stop OOM due to excessive number of streams

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-08 18:25:30 +01:00
Jun Zhao f17eea883a lavf: fix the wrong warning msg and comments about av_find_stream_info
av_find_stream_info() was deprecated by avformat_find_stream_info(),
correct the warning message in the avformat_find_stream_info() and
comments in the avformat.h

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-05 21:30:12 +01:00
James Almer 79ff9935ae utils: Add av_stream_add_side_data()
Functionally similar to av_packet_add_side_data(). Allows the use of an
already allocated buffer as stream side data.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-23 10:36:13 -05:00
James Almer 2ab50647ff avformat/utils: add av_stream_add_side_data()
Functionally similar to av_packet_add_side_data(). Allows the use of an
already allocated buffer as stream side data.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 22:17:13 -03:00
Michael Niedermayer 2b09a3ad19 Revert "img2 encoder: allow %t in filename, based on patch from Yuval Adam"
breaks API

Found-by: jamrial
This reverts commit 1a956c64c8.
2016-11-01 23:03:24 +01:00