Commit Graph

10160 Commits

Author SHA1 Message Date
Vittorio Giovara 84bf64d359 bethsoftvid: simplify return handling
Fixes a double free in case of av_packet_new_side_data() failure.
2014-10-29 17:02:27 +00:00
Vittorio Giovara e9ba309831 assdec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 703626
2014-10-29 16:54:43 +00:00
Vittorio Giovara f64d7e919e mtv: improve header check and avoid division by zero
CC: libav-stable@libav.org
Bug-Id: CID 732203 / CID 732204
2014-10-29 16:54:43 +00:00
Michael Niedermayer b3d11437ca oggenc: remove unneeded null check
The code would have segfaulted before if oggstream were NULL.

CC: libav-stable@libav.org
Bug-Id: CID 732218
2014-10-29 16:54:37 +00:00
Tomas Härdin 11467ecf51 mxfdec: reduce loop bound in mxf_read_pixel_layout()
Makes coverity less confused and code more readable.

Bug-Id: CID 732262
2014-10-27 19:08:02 +00:00
Vittorio Giovara e6c66f1e4e bethsoftvid: check return value and clean memory
CC: libav-stable@libav.org
Bug-Id: CID 733777
2014-10-27 18:21:40 +00:00
Vittorio Giovara b46b233baf filmstripdec: avoid integer overflow
CC: libav-stable@libav.org
Bug-Id: CID 732246
2014-10-27 18:21:40 +00:00
Vittorio Giovara 090c67d586 matroskaenc: write correct Display{Width, Height} in stereo encoding
should be the raw amount of pixels (for example 3840x1080 for full HD side by
side) and the DisplayWidth/Height in pixels should be the amount of pixels for
one plane (1920x1080 for that full HD stream)."

So, move the aspect ratio check in the mkv_write_stereo_mode() function
and always write the embl when stereo format and/or aspect ration is set.
Also add a few comments to that function.

CC: libav-stable@libav.org
Found-by: Asan Usipov <asan.usipov@gmail.com>
2014-10-27 18:21:35 +00:00
Martin Storsjö ed6dad3737 lavf: Implement ff_brktimegm using gmtime_r
While a standalone implementation is nice, we already depend on
gmtime and gmtime_r in a number of places.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 82ee7d0dda Use gmtime_r instead of gmtime and localtime_r instead of localtime
gmtime isn't thread safe in general. In msvcrt (which lacks gmtime_r),
the buffer used by gmtime is thread specific though.

One call to localtime is left in avconv_opt.c, where thread safety
shouldn't matter (instead of making avconv depend on the libavutil
internal header).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 9dcf239721 lavf: Check the return value of strftime
If the buffer provided to strftime is too small, the buffer contents
are indeterminate - it does not guarantee actually null terminating
the buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 851ace79a3 wtv: Avoid needlessly calling gmtime twice with the same argument
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Vittorio Giovara 50dbe6b354 mov: fix assigment check
CC: libav-stable@libav.org
Bug-Id: CID 1197050
2014-10-24 23:48:57 +01:00
Tomas Härdin 7df3b426bb mxfenc: Fix possible integer overflows
None of these are likely unless the user is writing a file with two billion
streams or a duration of around two months.

CC: libav-stable@libav.org
Bug-Id: CID 700568 / CID 700569 / CID 700570 /
        CID 700571 / CID 700572 / CID 700573
2014-10-24 23:48:57 +01:00
Vittorio Giovara ad6b00d85f mxfdec: add missing break
CC: libav-stable@libav.org
Bug-Id: CID 732232
2014-10-24 23:48:57 +01:00
Vittorio Giovara 28c020d4df matroskaenc: check avio_open_dyn_buf return value
CC: libav-stable@libav.org
Bug-Id: CID 703629
2014-10-24 23:48:57 +01:00
Vittorio Giovara e0caa1eb4e matroskadec: check return values
CC: libav-stable@libav.org
Bug-Id: CID 733712
2014-10-24 23:48:51 +01:00
Vittorio Giovara 3c1199c3c4 matroskadec: fix leak on error
CC: libav-stable@libav.org
Bug-Id: CID 1026767
2014-10-24 23:43:25 +01:00
Luca Barbato 7785ce1c76 lavf: replace rename() with ff_rename()
The new function wraps errno so that its value is correctly reported
when other functions overwrite it (eg. in case of logging).

CC: libav-stable@libav.org
Bug-Id: CID 1135748
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-10-24 23:42:53 +01:00
Vittorio Giovara 0b66fb4505 flac_picture: prevent a possible out of bound write
At "mimetype[len] = 0;" mimetype is a 64 element array and len might be
equal to or greater than that.

CC: libav-stable@libav.org
Bug-Id: CID 1061055
2014-10-24 23:42:53 +01:00
Vittorio Giovara f1ed83e23a img2dec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 1087077
2014-10-24 23:42:53 +01:00
Vittorio Giovara 1967cd4e4c audiointerleave: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 1087078
2014-10-24 23:42:53 +01:00
Anton Khirnov ef363ebd59 mp3enc: write full LAME frame
Most importantly, it contains the encoder delay and replaygain info.
2014-10-24 09:03:16 +02:00
Anton Khirnov 99143140de mp3dec: fix reading the Xing tag
The quality scale field is only supposed to be present if the fourth bit
is set. In practice, lame always sets it, but other tools might not.

CC:libav-stable@libav.org
2014-10-24 09:03:16 +02:00
Martin Storsjö 6df9d9b55d lavf: Use av_gettime_relative
The ones left using av_gettime are NTP timestamps (for RTCP,
which is specified to send the actual current realtime clock
in RTCP SR packets), and the NUT muxer timestamper, which is
documented as using wallclock time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:45 +03: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
Vittorio Giovara b69183f65d nutenc: check for negative index rather than assert
CC: libav-stable@libav.org
Bug-Id: CID 703721
2014-10-21 14:37:48 +01:00
Vittorio Giovara be42c0b8d5 rmdec: stricter error check to avoid theoretical unitialized use
CC: libav-stable@libav.org
Bug-Id: CID 90558
2014-10-21 14:37:48 +01:00
Vittorio Giovara 7207dd8f82 rmdec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 733714
2014-10-21 14:37:48 +01:00
Vittorio Giovara 629b2ed0ac flvdec: make sure to check create_stream and report the same error
CC: libav-stable@libav.org
Bug-Id: CID 732242
2014-10-21 14:37:48 +01:00
Vittorio Giovara f22aa6b841 flvdec: avoid unitialized use of a struct member
CC: libav-stable@libav.org
Bug-Id: CID 718141
2014-10-21 14:37:48 +01:00
Vittorio Giovara e73d26bbd6 smoothstreamingenc: explict cast to avoid overflow
CC: libav-stable@libav.org
Bug-Id: CID 732248
2014-10-21 14:37:48 +01:00
Luca Barbato d2771a1dc0 rtpproto: Free the addrinfo pointer on failure
CC: libav-stable@libav.org
Bug-Id: CID 1238797
2014-10-20 10:47:29 +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
Vittorio Giovara 350ed18292 rtpdec_hevc: drop unnecessary check
len is always >=1 in that case.

Bug-Id: CID 1238784
2014-10-20 10:44:42 +01:00
Vittorio Giovara 322b571d55 rtmpproto: remove dead code
Expression already evaluated before, redundant since
0533868642.

Bug-Id: CID 732199
2014-10-20 10:44:22 +01:00
Vittorio Giovara 7b48bf9524 wtv: clean memory on error
CC: libav-stable@libav.org
Bug-Id: CID 718002
2014-10-20 10:38:38 +01:00
Vittorio Giovara 9fbc613f0d wtv: check seek_by_sector return value
CC: libav-stable@libav.org
Bug-Id: CID 1198258
2014-10-20 10:38:38 +01:00
Vittorio Giovara d7f530b0d6 aviobuf: check context before using it
Avoid a possible null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CID 1135769
2014-10-20 10:38:38 +01:00
Michael Niedermayer 02484d1a93 avio: fix sizeof argument
CC: libav-stable@libav.org
Bug-Id: CID 732284
2014-10-20 10:38:38 +01:00
Vittorio Giovara 8ab3b71e4b idcin: fix return check
CC: libav-stable@libav.org
Bug-Id: CID 732198
2014-10-20 10:38:37 +01:00
Alexander Drozdov 0034314a69 rtmp: Always call rtmp_close() on rtmp_open() failure
Prevent possible memory leaks.

Connect to nginx and request a non-existent resource to
trigger the issue.

CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Uwe L. Korn <uwelk@xhochy.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-10-18 17:37:11 +02:00
Anton Khirnov fb238f8230 urlprotocol: remove unused url_interrupt_cb declaration
It is a remnant of the old interrupt callback API.
2014-10-18 05:01:20 +02:00
Uwe L. Korn 9bec3ca2b8 rtmpproto: Add pause support
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-17 23:13:51 +03:00
Uwe L. Korn f4cd8b80b9 rtmpproto: Track last received timestamp
Some RTMP commands need the most recent timestamp as their parameter, so
keep track of it. This must be the most recent one and not e.g. the max
received timestamp as it can decrease again through seeking.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-17 23:13:37 +03:00
Uwe L. Korn e65c776d18 rtmpproto: Add getStreamLength call to query duration
In (non-live) streams with no metadata, the duration of a stream can
be retrieved by calling the RTMP function getStreamLength with the
playpath. The server will return a positive duration upon the request if
the duration is known, otherwise either no response or a duration of 0
will be returned.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-17 12:07:19 +03:00
Uwe L. Korn 324b23dde1 rtmpproto: Add function to read a number response
Packets that contain a number as a result to a rtmp function call are
structured the same way (String, Number, Null, Number). This new method
also includes more bounds checks to better handle packets that are not
structured as expected.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-17 12:07:19 +03:00
Luca Barbato 0db6bbb24c avformat: Make avformat_free_context handle NULL
Work as the other free()-like functions.

Bug-Id: CID 1087081
CC: libav-stable@libav.org
2014-10-17 09:55:46 +01:00
Michael Lynch 460b509a34 rtsp: Check a memory allocation
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-16 09:19:03 +03:00
Martin Storsjö 79dd756e14 rtmpproto: Fix a typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 21:00:39 +03:00
Martin Storsjö ced7238cd0 rtpdec_hevc: Use av_realloc instead of av_malloc+memcpy
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 20:54:32 +03:00
Martin Storsjö 752e71e74f rtpdec_hevc: Rename a variable for clarity
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 20:54:30 +03:00
Vittorio Giovara 74b0237798 mov: Correctly check the color transfer characteristics range
Reported-by: Ruoyu <liangry@ucweb.com>
2014-10-15 14:48:40 +01:00
Martin Storsjö e5cfc8fdad sdp: Provide out of bound parameter sets for HEVC if extradata is set
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 12:12:54 +03:00
Martin Storsjö 9b7f932ee5 rtpdec_hevc: Parse out of band vps/sps/pps/sei from fmtp lines
These are assembled into extradata in the order vps/sps/pps/sei.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 12:12:02 +03:00
Anton Khirnov 2d6e58497e lavf: switch to AVCodecContext.framerate for demuxing 2014-10-15 06:37:55 +00:00
Martin Storsjö a74f8121d8 mov: Handle tfdt atoms
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-14 13:52:32 +03:00
Martin Storsjö c2c22c75cf movenc: Write tfdt atoms
These allow getting the absolute start timestamp of a fragment
without reading preceding timestamps. This fixes sync between
tracks if starting from fragments in different streams that don't
align exactly.

This also is a prerequisite for producing DASH content.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-14 13:52:32 +03:00
Anton Khirnov eabdc2a830 lavf: use initial_padding instead of deprecated delay 2014-10-13 19:10:30 +00:00
Mark McGough 76c70e33d2 icecast: Do not use chunked post
Icecast uses HTTP 1.0 while Libav uses HTTP 1.1 and enables by
default chunked post.

Icecast actually forwards the HTTP chunk headers to the listener
as part of the media stream (without the chunk encoding HTTP headers)
causing the players to lose sync.

Disabling the option is enough to feed icecast properly.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-10-12 19:54:07 +02:00
Martin Storsjö e44ee1eb8d movenc: Simplify code by using an existing local pointer
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:48:09 +03:00
Martin Storsjö dad12ce452 movenc: Print a warning for an unhandled case of nonzero start dts with empty_moov
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:46:56 +03:00
Martin Storsjö dbb472cb2f movenc: Write edit lists for fragmented files as well, if necessary
This is necessary to get the right timestamp offset for content
that starts with dts != 0.

This currently only helps when writing fragmented files with a non-empty
moov atom. When writing an empty moov atom, we don't have any packets
yet, so we don't know the starting dts for the tracks.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:46:31 +03:00
Martin Storsjö 95ee4e2ce7 movenc: Add some comments explaining subtle details in writing the edit lists
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:46:01 +03:00
Michael Niedermayer 72f801619a movenc: Adjust edit lists to trim out parts of tracks with negative pts
This makes sure that audio preroll for e.g. AAC is signaled correctly.

Previously we only wrote the edit list correctly if we had negative
dts but started with pts == 0 (e.g. for video with B-frames).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:45:55 +03:00
Martin Storsjö 8bef433881 smoothstreamingenc: Simplify code by removing a redundant variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:42:42 +03:00
Michael Niedermayer bd239c9a2e lavf: Don't drop both pts and dts if timestamps are invalid
In these cases, only drop dts. Because if we drop both we have no
timestamps at all for some files.

This improves playback of HLS streams from GoPro cameras.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 01:32:52 +03:00
Luca Barbato 1d4579e38e tcp: Add AVOption support 2014-10-10 16:29:07 +02:00
Luca Barbato cd9d6399fd tls: Support passing old-style tcp options
Make tcp and tls urls near-interchangeable.
2014-10-10 16:29:07 +02:00
Luca Barbato 3df8d52fcd rtsp: Add rtsps to the probe 2014-10-10 16:29:06 +02:00
Luca Barbato c839b0439f rtsp: Support tls when in listen mode 2014-10-10 16:29:06 +02:00
Luca Barbato 8b2e9636c5 rtsp: Support tls-encapsulated RTSP 2014-10-10 16:29:06 +02:00
Luca Barbato c27328e749 rtsp: Check for command strings without spaces
Prevent a NULL-pointer dereference.

CC: libav-stable@libav.org
2014-10-10 16:29:06 +02:00
Luca Barbato 09e1ccc8cd sctp: Use AVERROR_BUG instead of abort()
Trying to write to a stream id larger the the maximum requested is
a programming error, still there is no reason to leave a
reachable abort() in the codebase.

CC: libav-stable@libav.org
2014-10-10 16:29:06 +02:00
Luca Barbato eb4f906900 lavf: More informative error message
Print the timestamp values and not just the stream index.
2014-10-10 16:29:06 +02:00
Vittorio Giovara 0d8a3656ba mov: support the Color Parameter Atoms 'colr' 2014-10-08 18:17:50 +01:00
Sylvain Rabot 167e6f1489 dump: Update streams and chapters printout format
This matches the -map option which requires '%d:%d' format.
2014-10-08 18:17:49 +01:00
Vittorio Giovara 20a5956b8d dump: split audio and video probing on multiple lines
Also always report pixel format.
2014-10-08 18:17:49 +01:00
Vittorio Giovara 7ae9791b64 avformat: bump version after mime_type change 2014-10-08 15:59:51 +01:00
Andreas Cadhalpun b15b06ebf5 avformat: use const char* instead of uint8_t* for AVProbeData.mime_type
This makes the field consistent with AVInputFormat.mime_type and the
argument type of av_match_name.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-10-08 15:13:15 +01:00
Martin Storsjö 28816050e4 lavf: Set the stream time base hint properly for chained muxers
This avoids warnings about using the codec time base as time
base hint.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-06 23:30:52 +03:00
Martin Storsjö b762494438 sdp: Simplify parsing/conversion of H264 extradata
By using ff_avc_write_annexb_extradata instead of the h264_mp4toannexb
BSF, the code for doing the conversion itself is kept much shorter,
there's less state to restore at the end, we don't risk leaving the
AVCodecContext in an inconsistent state if returning early due to
errors, etc.

Also add a missing free if the base64 encoding fails.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-06 23:29:58 +03:00
Joakim Roubert 55f03d8726 hlsenc: Add parameter -hls_allow_cache
The -hls_allow_cache parameter enables explicitly setting the
EXT-X-ALLOW-CACHE tag in the manifest file. That tag indicates
whether the client MAY or MUST NOT cache downloaded media
segments for later replay.

Valid values are 1 (=YES) or 0 (=NO) and the EXT-X-ALLOW-CACHE
will not show in the manifest for other values (or if
-hls_allow_cache is not used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-03 20:20:28 +03:00
Justin Ruggles 19133e96d3 lavf: fix memleaks in avformat_find_stream_info()
When AVFMT_FLAG_NOBUFFER is set, the packets are not added to the
AVFormatContext packet list, so they need to be freed when they are
no longer needed.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-09-29 17:54:25 +00:00
Timothy B. Terriberry a05f5052fe sdp: Make opus declaration conform to the spec
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-29 13:48:42 +03:00
Andreas Cadhalpun 883e98bc25 probe: Bump the score for mime type matching
It should be more trustworthy than extension matching.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-26 20:56:16 +02:00
Diego Biurrun 4d5b99dacd caf: Give context structure a consistent name 2014-09-26 00:44:41 -07:00
Gabriel Dume 4620affa24 m4vdec: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-25 01:58:51 -07:00
Gabriel Dume 86a361081d lmlm4: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-25 01:44:32 -07:00
Gabriel Dume 95d312d6c8 concat: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-25 01:44:31 -07:00
Martin Storsjö 2f172f1ae9 rtsp: Clear the session id on redirects
This fixes handling redirects in case the server provided a session
id within the redirect reply.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-24 23:34:02 +03:00
Thomas Volkert ddf5fb71ee rtpenc: HEVC/H.265 support
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-24 23:33:26 +03:00
Martin Storsjö a2efbecc4e libavformat: Move avc mp4 startcode parsing to a shared file
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-24 23:33:17 +03:00
Vittorio Giovara c463dfc7e4 rtpdec_hevc: Drop a duplicated, nonstandard entry
The RFC spec draft only specifies the "H265" name - there is no
specification saying how to interpret "HEVC" (if such a packet
format is specified it could be an entirely different format).

Since this is a very new standard (still a draft), there is little
need for compatibility with existing, broken implementations. Therefore
remove the extra alias, to avoid the risk of encouraging incorrect
usage.

Intentionally keeping the ff_hevc_dynamic_handler name for the
handler, to use "hevc" consistently as name for the codec instead
of "h265" within the library internals as long as there only is one
single variant in actual use.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-24 10:44:14 +03:00
Martin Storsjö 2bb2c2bd75 rtpenc_chain: Pass the initial time_base hint on to the chained muxer
In practice this hint is ignored - the rtp muxer always overwrites
the stream time base without taking the hint into account. But as
a general practice this is the correct way to pass a time base hint
on to a chained muxer.

This avoids warnings about using the codec time base as hint
being deprecated.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-17 22:53:27 +03:00
Katerina Barone-Adesi c5560e72d0 apetag: Fix APE tag size check
The size variable is (correctly) unsigned, but is passed to several functions
which take signed parameters, such as avio_read, sometimes after having
numbers added to it. So ensure that size remains within the bounds that
these functions can handle.

CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-17 06:37:05 -07:00
Martin Storsjö 803e82276b libavformat: Check mkdir return error codes
Previously, the returned error codes were intentionally ignored
(see fadd3a6821), to avoid aborting if the directory already
existed. If the mkdir actually failed, this was caught when
opening files within the directory fails anyway.

By handling the error code here (but explicitly ignoring EEXIST),
the error messages and return codes in these cases are more
appropriate and less confusing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-07 23:20:29 +03:00
Diego Biurrun 4d55e9de27 vc1: Split bits used in libavformat into a separate header
This reduces inter-library dependencies.
2014-09-04 07:11:03 -07:00
Thomas Volkert 95e177eeb2 rtpdec: HEVC/H.265 support
As specified in draft-ietf-payload-rtp-h265-06.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-03 02:39:24 +02:00
Luca Barbato 7968059e5c mpegts: Allow custom max resync size 2014-09-03 02:38:03 +02:00