Commit Graph

19718 Commits

Author SHA1 Message Date
Michael Niedermayer
9859f54db3 avformat/ffmdec: Silence "may be used uninitialized in this function" warnings
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 19:45:31 +01:00
Michael Niedermayer
b98510de5c avformat/ffmdec: cleanup on extradata memory allocation failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 19:45:31 +01:00
Michael Niedermayer
fdf588d7cf avformat/ffmdec: Forward error code from ffm_read_header()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 19:45:31 +01:00
Michael Niedermayer
c143e7939f avformat/ffmdec: remove last use of st->codec
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 17:25:40 +01:00
Carl Eugen Hoyos
5a237c33b8 lavf/asfdec_f: Remove CR/LF from avpriv_request_sample() call. 2016-12-03 15:41:27 +01:00
Michael Niedermayer
418a2b2478 avformat/ffmdec: Drop flags2, debug and codec->time_base setting
It should still be possible to set these through recommended_encoder_configuration

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 14:05:15 +01:00
Michael Niedermayer
e706e2e775 avformat/ffmdec: Check media type for chunks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 14:05:15 +01:00
Michael Niedermayer
591c032421 avformat/ffmdec: replace most codec uses by codecpar
This is a bit messy as codecar does not support AVOptions so we need
to use AVCodecContext where AVOptions are required and copy back and forth.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 14:05:15 +01:00
Michael Niedermayer
5cd3ea1cc0 avformat/ffmdec: Remove some st->codec uses which set encoder parameters
Modern ffserver should not need these

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 14:05:15 +01:00
Michael Niedermayer
afcf15b0db avformat/oggparsespeex: Check frames_per_packet and packet_size
The speex specification does not seem to restrict these values, thus
the limits where choosen so as to avoid multiplicative overflow

Fixes undefined behavior
Fixes: 635422.ogg

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 03:59:13 +01:00
Michael Niedermayer
90da187f1d avformat/utils: Check start/end before computing duration in update_stream_timings()
Fixes undefined behavior
Fixes: 637428.ogg

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 03:59:13 +01:00
Vittorio Giovara
25fcbf7a84 hevc: Support extradata changes
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-02 15:04:24 -05:00
Michael Niedermayer
4059cd3952 avformat/ffmenc: Remove the last use of st->codec
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-02 19:37:00 +01:00
Michael Niedermayer
78519a0029 avformat/ffmenc: Make ffm_write_header_codec_ctx() use codecpar
This would be simpler if codecpar supported AVOptions
modern ffserver should be unaffected by this, older ffserver which required the
muxer to directly access the encoder could have issues with this, but this
direct access is just wrong and unsafe

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-02 19:37:00 +01:00
Michael Niedermayer
e8215b77ff avformat/ffmenc: set bitexact mode for old API without accessing the encoder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-02 19:37:00 +01:00
Michael Niedermayer
c06d4f2ced avformat/ffmenc: Drop ffm_write_header_codec_private_ctx()
This accesses the private encoder context, it should not be used by
the current ffserver it may affect old ffserver versions but i believe
there is consens that accessing the private encoder context from the muxer
is completely wrong.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-02 19:37:00 +01:00
Michael Niedermayer
b7d94c19cd avformat/ffmenc: Replace some st->codec use by codecpar
Note, this temporarly drops the ability to set ffmpeg encoder debug and flags2 via ffserver.conf

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-02 19:37:00 +01:00
Rainer Hochecker
7a9db61da3 matroskadec: partly revert "demux relevant subtitle packets after a seek"
This reverts parts of c16582579b. The hard
coded 30 seconds are a lot, and finishing the seek can takes several
seconds when the source is on a network share. Remove this code
entirely, because it does more bad than good.

(Commit message provided by committer, based on the original messages
by the patch author.)

Signed-off-by: Rainer Hochecker <fernetmenta@online.de>
Signed-off-by: wm4 <nfxjfg@googlemail.com>
2016-12-02 13:59:17 +01:00
Gregory J. Wolfe
9c041a3cd5 avformat/tests/fifo_muxer: includes libavformat/network.h to define ETIMEDOUT for fate build.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-01 23:42:50 +01:00
Vittorio Giovara
7010ebdf1f mov: Evaluate the movie display matrix
This matrix needs to be applied after all others have (currently only
display matrix from trak), but cannot be handled in movie box, since
streams are not allocated yet. So store it in main context, and apply
it when appropriate, that is after parsing the tkhd one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-30 12:18:58 -05:00
Andreas Cadhalpun
2c908f22c2 avidec: fix leaking extradata
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-30 02:22:50 +01:00
Michael Schenk
18b9466937 matroskadec: prevent access of elements after freeing
Using the decode interrupt feature of ffmpeg may cause crashes by
accessing previously freed pointers in matroska_read_close.

To prevent this reset nb_elem to zero after freeing the elements,
because ffmpeg normally tests for nb_elem.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-30 01:15:38 +01:00
Andreas Cadhalpun
c0175fa92b idroqdec: fix leaking pkt on failure
The code calls av_new_packet a few lines above and the allocated memory
has to be freed in case of an error.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-30 00:22:45 +01:00
Michael Niedermayer
744a0b5206 avformat/idroqdec: Check chunk_size for being too large
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-29 19:26:26 +01:00
Michael Niedermayer
102f7d0ee6 avformat/rmenc: Check framerate before storing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-27 23:28:23 +01:00
Michael Niedermayer
a06e84b56e avformat/utils: Fix type mismatch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-27 04:08:00 +01:00
Andreas Cadhalpun
ff5f4bd976 lavf: always forward codec_whitelist in avformat_find_stream_info
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-26 23:37:55 +01:00
Steven Liu
af7d0ad983 refine avformat/flvdec set bit_rate 2016-11-26 11:28:22 +08:00
Steven Liu
7c5478a203 avformat/flvdec: move set bit_rate from parse AMF OBJECT to
create_stream

before patch:
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x714 [SAR 1:1 DAR 640:357], 25 fps, 25 tbr, 1k tbn, 50 tbc

after patch:
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x714 [SAR 1:1 DAR 640:357], 2576 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-26 08:56:18 +08:00
Steven Liu
ee24c8ad01 avformat/flvenc: fix ticket 5976 and use old commit
mythtv have problem with non-seekable dont write duration and filesize
and there have problem with some other server and player with 0 value
duation and filesize.
So add a flv flags to fix the ticket and make a choose for users.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2016-11-26 08:52:19 +08:00
Carl Eugen Hoyos
e0791c5aaf lavf/flvdec: Set avg_frame_rate for video streams.
Requested-by: qw, applemax82 at 163 dot com
Reviewed-by: Steven Liu
2016-11-25 11:06:14 +01:00
Andreas Cadhalpun
98b3a7979f flvdec: require need_context_update when changing codec id
Otherwise the codec context and codecpar might disagree on the codec id,
triggering asserts in av_parser_parse2.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 00:35:46 +01:00
Andreas Cadhalpun
dbefbb61b7 sbgdec: prevent NULL pointer access
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 01:16:42 +01:00
Andreas Cadhalpun
de4ded0636 rmdec: validate block alignment
This fixes division by zero crashes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 00:57:10 +01:00
Michael Niedermayer
4e5049a230 avformat/mpeg: Adjust vid probe threshold to correct mis-detection
Fixes: _ij.mp3

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-23 00:54:45 +01:00
Andreas Cadhalpun
fdb8c455b6 mxfdec: fix NULL pointer dereference in mxf_read_packet_old
Metadata streams have priv_data set to NULL.

Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 00:40:52 +01:00
Steven Liu
d316b21dba avformat/flvenc: add no_metadata to flvflags
some flv have no metadata,
ffmpeg will same with the source flv stream.

Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
2016-11-22 10:18:23 +08:00
James Almer
0b8df0ce48 avformat/utils: add missing brackets around arguments in av_realloc() call
Found-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 23:02:20 -03:00
Matthew Gregan
156fbbb562 avformat/movenc: Restrict experimental VP9 support to MODE_MP4.
Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 16:07:14 -03:00
Matthew Gregan
2d73d25670 Add experimental demuxing support for FLAC in ISO BMFF (MP4).
Based on the draft spec at https://git.xiph.org/?p=flac.git;a=blob;f=doc/isoflac.txt

Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 15:38:34 -03:00
Matthew Gregan
7dc4200c38 Add experimental muxing support for FLAC in ISO BMFF (MP4).
Based on the draft spec at https://git.xiph.org/?p=flac.git;a=blob;f=doc/isoflac.txt

'-strict experimental' is required to create files in this format.

Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 15:36:42 -03:00
James Almer
8c1342e631 avformat/matroskaenc: write updated STREAMINFO metadata for FLAC streams if available
FLAC streams originating from the FLAC encoder send updated and more
complete STREAMINFO metadata as part of the last packet, so write that
to CodecPrivate instead of the incomplete one available in extradata
during init.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-20 19:31:32 -03:00
James Almer
ee888cfbe7 avformat/matroskaenc: postpone writing the Tracks master
This will allow us to write updated stream information not available
during write_header().

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-20 19:31:32 -03:00
Andreas Cadhalpun
1c7da19a4b ffmdec: validate codec parameters
A negative extradata size for example gets passed to memcpy in
avcodec_parameters_from_context causing a segmentation fault.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-20 20:08:35 +01:00
James Almer
0ffea35657 avformat/utils: check for overflow before reallocating side data
This makes av_stream_add_side_data() consistent with av_packet_add_side_data().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 20:11:50 -03:00
James Almer
2343f23e4d avformat/matroska: use av_stream_add_side_data() for stereo3d side data
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 12:20:50 -03:00
James Almer
eb3a59c903 avformat/mov: reuse existing err variable
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 00:54:58 -03:00
James Almer
77f033eb98 avformat/mov: use av_stream_add_side_data() for displaymatrix side data
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 22:20:36 -03: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
Steven Liu
4696f7639b avformat/flvdec: add debug message to list keyframes index metadata
when parsing keyframe index metadata, list the message by trace log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-19 02:15:27 +01:00
James Almer
50e0e96f3f avformat/apngenc: use the stream parameters extradata if available
Fixes remuxing apng streams coming from the apng demuxer, which sends extradata
during init.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 12:26:44 -03:00
James Almer
16c429166d Revert "apngdec: use side data to pass extradata to the decoder"
This reverts commit e0c6b32046.

Said commit changed the behavior of the demuxer and decoder in a non
backwards compatible way.
Demuxers should make extradata available at init if possible, and send
new extradata as side data within a packet if needed.

A better fix for the remuxing crash will follow.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 12:24:28 -03:00
Michael Niedermayer
709c87109d avformat/movenc: Check frame rate before use.
Fixes division by 0
This is similar to how avg_frame_rate is checked elsewhere
Fixes: 6d24add0455f41b1b45b7ba615cd46f3/asan_generic_dc34c3_5480_0a2ef411cae999b9871ed71a2e481b71.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-17 19:03:41 +01:00
Hendrik Leppkes
4a485daa7f Merge commit '4f7723cb3b913c577842a5bb088c804ddacac8df'
* commit '4f7723cb3b913c577842a5bb088c804ddacac8df':
  movenc: Add an option for skipping writing the mfra/tfra/mfro trailer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-17 14:54:51 +01:00
Carl Eugen Hoyos
9648ce2a18 lavf/Makefile: Fix rule for the data muxer. 2016-11-14 13:33:22 +01:00
Hendrik Leppkes
d8ffdefbdc Merge commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f'
* commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f':
  mov: Save number of stsd elements after stream extradata allocation

Mostly noop, see 8b43ee4054

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 12:41:32 +01:00
Hendrik Leppkes
a0bc6b51d4 Merge commit 'e72d6fa08a3c1876109149401753a8d2c736d418'
* commit 'e72d6fa08a3c1876109149401753a8d2c736d418':
  build: Move MP2 muxer declaration away from MP3 muxer code

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 11:20:15 +01:00
Rodger Combs
f8e3ebde56
lavf/mux: don't warn about missing timestamps on attached pictures 2016-11-14 01:45:02 -06:00
Hendrik Leppkes
8fad4b4e25 Merge commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05'
* commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05':
  movenc: Apply offsets on timestamps when peeking into interleaving queues

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-13 22:57:02 +01:00
Andreas Cadhalpun
25012c5644 filmstripdec: correctly check image dimensions
This prevents a division by zero in read_packet.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-13 19:18:14 +01:00
Vlad Tarca
2bd83ef26a avformat: Add Pro-MPEG CoP #3-R2 FEC protocol
Pro-MPEG Code of Practice #3 release 2 forward error correction for rtp_mpegts streams

Signed-off-by: Vlad Tarca <vtarca@mobibase.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-13 11:38:15 +01:00
Marton Balint
e20e9b9033 lavf/fifo: fix undefined behaviour in deinit when destroying mutex
Reviewed-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-11-13 03:10:36 +01:00
James Almer
66453b1fba avformat/mov: zero initialize codec_name in mov_parse_stsd_video()
Fixes valgrind warning about "Conditional jump or move depends on uninitialised value(s)"

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-12 20:52:22 -03:00
Robert Nagy
c0dc9df2cc increment initial_prog_date_time when removing old segments
Fixes https://trac.ffmpeg.org/ticket/5940#ticket

Reviewed-by: Michael Niedermayer <<michael@niedermayer.cc>>
Signed-off-by: Robert Nagy <ronag89@gmail.com>
Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
2016-11-12 17:15:28 +08:00
Andreas Cadhalpun
89eb398c7f icodec: correctly check avio_read return value
It can read less than the requested amount, in which case buf contains
uninitialized data, causing problems like segmentation faults later on.

Also make sure that image->size is positive, so that it can't match a
negative error code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-10 22:02:49 +01:00
Sasi Inguva
c8dc11bb9e lavf/mov.c: Fallback to finding non-keyframe in fix_index, if keyframe search fails.
Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-10 17:44:47 +01:00
Steven Liu
863ebe6f83 avformat/flvenc: add add_keyframe_index option
Add keyframe index metadata
Used to facilitate seeking; particularly for HTTP pseudo streaming.
 1. read live streaming or file by sequence
 2. if use add_keyframe_index option, add a mark flag at the position,
    use to insert new context at the last step.
 3. add the keyframes *offset* and *timestamp* into a list
 4. if use add_keyframe_index option, shift the metadata data from
    mark flag offset
 5. insert the keyframes *offset* and *timestamp* from the list by
    sequence
 6. free the list
 7. end.

Add FATE test case;

Reviewed-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Steven Liu <liuqi@gosun.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-10 10:30:48 +08:00
Michael Niedermayer
2bc66d9e43 nut: add gray12 support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-10 01:18:43 +01:00
Andreas Cadhalpun
d54c95a143 icodec: add ico_read_close to fix leaking ico->images
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-09 21:10:41 +01:00
Andreas Cadhalpun
467eece1be icodec: fix leaking pkt on error
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-09 21:10:35 +01:00
Andreas Cadhalpun
1bbb18fe82 mpegts: prevent division by zero
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-08 22:27:11 +01:00
Andreas Cadhalpun
ff100c9dd9 matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_header
The code assumes that s->streams[0] is valid.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-08 20:17:31 +01:00
James Almer
70c6a1bcf0 avformat/matroskadec: fix DiscardPadding element parsing
If the value is negative then it means padding at the start of the packet
instead of at the end.

Based on a patch by Hendrik Leppkes.

Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-08 13:43:53 -03:00
Vittorio Giovara
a765ba647d avformat/mov: Read multiple stsd from DV
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-08 14:07:41 +01:00
Andreas Cadhalpun
2c90316b46 hls: fix leaking avio_opts on hls_read_header error
Use the hls_close function to reduce code duplication.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 19:44:41 +01:00
Andreas Cadhalpun
a305e0e5c0 hls: move hls_close above hls_read_header
This is needed for the following commit.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 19:43:43 +01:00
Anssi Hannula
e2193b53ea avformat/hls: Add missing error check for avcodec_parameters_copy()
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07 18:56:36 +02:00
Anssi Hannula
3d2f636497 avformat/hls: Fix probing mpegts audio streams that use probing
Commit 04964ac311 ("avformat/hls: Fix missing streams in some
cases with MPEG TS") caused a regression where subdemuxer streams that
use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly.

This is because the codec parameters from the subdemuxer stream, once
probed, are not passed on to the main stream.

Fix that by updating the codec parameters if the codec id changes.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07 18:56:36 +02:00
Anssi Hannula
9a51cd35b8 avformat/hls: Factor copying stream info to a separate function
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07 18:56:36 +02:00
Andreas Cadhalpun
34aeb5dbc4 xmv: validate sample_rate
AVCodecParameters.sample_rate is a signed integer, so
XMVAudioPacket.sample_rate should be, too.

A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
54b8fbbc5d voc_packet: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
eb205eda3f oggparsespeex: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
f748e3b5a2 nuv: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
2c818c3821 mvdec: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
0747754622 mpeg4audio: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Also check for errors from avpriv_mpeg4audio_get_config in
ff_mp4_read_dec_config_descr.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
9d36602abc mov: validate sidx timescale
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
a398f054fd mov: validate time_scale
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
fc022e77ee mov: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

fate-aac-al07_96 fails if sample_rate == 0 is rejected in
ff_mov_read_stsd_entries.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
0009457dc0 ffmdec: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
872fcfcc0f bfi: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun
2eb05eaa68 adxdec: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
fuqiuping
2d72ea68f0 avformat/flvenc: support mp3 audio with 48khz
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-06 22:46:25 +01:00
Michael Niedermayer
c6bc823eea avformat/tcp: Put struct sockaddr_in6 under #if
Fixes: error: dereferencing pointer to incomplete type

Tested-by: Dave Yeo <daveryeo@telus.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-06 21:29:12 +01:00
Stefano Sabatini
755472124f lavf/mpegtsenc: write metadata descriptor for timed ID3 packets
This is required since some programs are not able to correctly recognize
the metadata. See H.222, 2.6.58 Metadata pointer descriptor.

putstr8() is modified in order to allow to skip writing the string
length.
2016-11-06 12:36:51 +01:00
Stefano Sabatini
9ccdf04bd0 lavf/mpegtsenc: move putstr8 definition up
This allows to use the function in a future commit.
2016-11-06 12:36:43 +01:00
James Almer
75a13115cd avformat/mux: remove unnecessary autobsf hack
autobsf has been ported to the new bsf API.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-05 22:42:23 -03:00
James Almer
e8a39f584a avformat/framehash: also print channel layout as a string
This should be more useful for users since numerical values for channel
layout can be confusing and unintuitive.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-05 22:42:22 -03:00
Andreas Cadhalpun
0efb610611 mxfdec: fix NULL pointer dereference
Metadata streams have priv_data set to NULL.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-05 18:56:41 +01:00
liu jc
c0f6eff6a7 avformat/tcp: workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
Signed-off-by: liujingchao <jcliu@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-05 18:48:00 +01:00
Timur Aydin
7746103227 avformat/rtpdec: Add support for 24 bit RTSP audio playback
When ffplay is used to play from the RTSP URL that serves 24 bit audio
content, ffplay fails to recognize the audio codec format. The attached
patch adds support for playing 24 bit audio content over RTSP by
defining a dynamic payload handler for "L24".

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-05 17:21:57 +01:00
Matt Oliver
d6f85ec270 avformat/avisynth.c: Use new safe dlopen code.
Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2016-11-05 18:08:53 +11:00
Michael Niedermayer
9e58812519 avformat/mux: split side data before internal auto BSF
The bitstream filters do not work with merged in side data

This leaves the input packet split if it is being split.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-04 22:12:59 -03:00
James Almer
6005c7e656 Revert "avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame"
This reverts commit fba2a8a254.

The changes were right for av_write_frame() but not for av_interleaved_write_frame().
The following commit will fix this in a simpler way.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-04 21:59:48 -03:00
Carl Eugen Hoyos
222f59afd1 lavf/movenc: Do not print an error when muxing gray8 rawvideo.
This was fixed in 9a27780821
2016-11-05 00:43:31 +01:00
James Almer
fba2a8a254 avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame
Similarly, merge it back before returning.

Fixes ticket #5927.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-04 17:13:43 -03:00
Carl Eugen Hoyos
db23fde784 lavf/mux: Add missing CR/LF to error messages. 2016-11-04 12:23:47 +01:00
Sasi Inguva
4abe1ff08f lavf/mov.c: Use the first sidx for tracks without sidx.
According to spec ISO_IEC_15444_12 "For any media stream for which no segment index is present, referred to as non‐indexed stream, the media stream associated with the first Segment Index box in the segment serves as a reference stream in a sense that it also describes the subsegments for any non‐indexed media stream."

Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-03 19:03:22 +01:00
Andreas Cadhalpun
f84ae3f04a avformat: close parser if codec changed
The parser depends on the codec and thus must not be used with a different one.
If it is, the 'avctx->codec_id == s->parser->codec_ids[0] ...' assert in
av_parser_parse2 gets triggered.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-02 22:19:14 +01:00
James Almer
5cb57131d3 avformat/matroskaenc: use display aspect ratio for DisplayWidth and DisplayHeight when possible
This avoids potential rounding errors and guarantees the source aspect
ratio is preserved.
Keep writing pixel values when Stereo 3D Mode is enabled and for WebM,
as the format doesn't support anything else.

This fixes ticket #5743, implementing the suggestion from ticket #5903.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-02 17:08:38 -03:00
James Almer
bab6b60675 avformat/matroskaenc: support writing Chroma Location elements
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-02 17:07:04 -03:00
Michael Niedermayer
a566c952f9 avformat/mpegtsenc: Add option to mark stream begin as discontinuous
This avoids continuity check failures in concatenated streams

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-02 16:34:01 +01:00
Rodger Combs
1a958f4eb0
lavf/matroskaenc: don't try to modify the header when live-streaming 2016-11-02 01:16:26 -05:00
Rodger Combs
be28ce210d
lavf/matroskaenc: fix uninitialized read 2016-11-02 01:16:26 -05:00
Rodger Combs
8e6478b723
lavf/segment: fix autobsf 2016-11-02 01:16:23 -05: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
rogerdpack
1a956c64c8 img2 encoder: allow %t in filename, based on patch from Yuval Adam
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-01 22:29:23 +01:00
Andreas Cadhalpun
e0c6b32046 apngdec: use side data to pass extradata to the decoder
Fixes remuxing apng streams coming from the apng demuxer.
This is a regression since 940b8908b9.

Found-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-01 18:49:28 +01:00
Andreas Cadhalpun
9d83b209d8 mov: immediately return from mov_fix_index without old index entries
If there are no index entries, e_old = st->index_entries is only one
byte large, since it was created by av_realloc called with size 0.

Thus accessing e_old[0].timestamp causes a heap buffer overflow.

Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-01 18:45:34 +01:00
Adriano Pallavicino
6089c44a2a Fix build warnings due to misleading indentation
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-01 17:44:10 +01:00
Carl Eugen Hoyos
f73a3aacbb lavf/mov: Only search for invalid moov in free if compliance < STRICT. 2016-11-01 11:37:34 +01:00
Sasi Inguva
5e965582d5 lavf/mov.c: Use the correct timescale when seeking for audio.
Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-10-31 13:43:43 +00:00
Mark Thompson
e8634fb92e openssl: Allow newer TLS versions than TLSv1
The use of TLSv1_*_method() disallows newer protocol versions; instead
use SSLv23_*_method() and then explicitly disable the deprecated
protocol versions which should not be supported.

Fixes ticket #5915.
2016-10-30 13:18:45 +00:00
Michael Niedermayer
077939626e avformat/flvdec: Fix regression loosing streams
Fixes: unknown_video.flv

Found-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-28 12:31:01 +02:00
Andreas Cadhalpun
940b8908b9 apng: use side data to pass extradata to muxer
This fixes creating apng files, which is broken since commit
5ef1959080.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-28 01:53:52 +02:00
Stephen Hutchinson
bf14393635 avisynth: fix Planar RGB output
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-27 04:37:57 +02:00
James Almer
eabbc64728 avformat/matroskaenc: fix cue relative position values when CRC32 is enabled
The dynamic buffer does not contain the CRC32 element so calls to avio_tell()
don't take it into account. This resulted in CueRelativePosition values being
six bytes short.
This is a regression since 6724525a15

Instead of adding yet another custom check for CRC32 to fix a size or an offset,
remove the existing ones and reserve the six bytes in the dynamic buffer.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-26 16:28:59 -03:00
Michael Niedermayer
1609935b6c Bump minor versions after 3.2 branchpoint to seperate release
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 20:52:42 +02:00
Michael Niedermayer
3f3025205f Bump minor versions for 3.2
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 20:52:42 +02:00
Michael Niedermayer
38e5a4f3bb Revert "avformat/utils: Discard huge timestamps which would cause overflows if used in basic computations"
Some people seem to oppose this the patch seems to have been missed for a month on the ML
lets restart the discussion and solve this after the release

This reverts commit e936c8d176.
2016-10-26 20:31:04 +02:00
Michael Niedermayer
e936c8d176 avformat/utils: Discard huge timestamps which would cause overflows if used in basic computations
Allowing larger timestamps makes it impossible to calculate basic things like the
difference of 2 timestamps or their sum without checking each individual computation for
overflow.
This should avoid a significant number of overflow checks

Fixes Ticket5136

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 19:46:00 +02:00
Michael Niedermayer
d88a6bedb9 avformat/isom: Fix old API regression with exporting max bitrate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 19:46:00 +02:00
Suman-
a81494b603 lavf/flvdec: init AVPacket::pos to FLVTAG offset
Current code doesn't initialize AVPacket::pos. Made it point to FLVTAG so flv_read_packet can decode from pos

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 02:12:18 +02:00
Rodger Combs
490c6bda0e
lavf/mov: reindent
Reviewed-By: Michael Niedermayer <michael@niedermayer.cc>
2016-10-24 05:47:10 -05:00
Rodger Combs
697400eac0
lavf/mov: improve tref/chap chapter handling
3 parts:
- Supports multiple chapter streams
- Exports regular text chapter streams as opaque data. This prevents consumers
  from showing chapters as if they were regular subtitle streams.
- Exports video chapter streams as thumbnails, and provides the first one as
  an attached_pic.
2016-10-24 05:47:10 -05:00
Rodger Combs
73ead477dd
lavf: add AV_DISPOSITION_TIMED_THUMBNAILS
Reviewed-By: Michael Niedermayer <michael@niedermayer.cc>
2016-10-24 05:47:05 -05:00
Rodger Combs
d99d7cbdfc
lavf/rawenc: add automatic bitstream filtering for H264+HEVC 2016-10-24 03:53:24 -05:00
Rodger Combs
42cb050a05
lavf/movenc+dashenc: add automatic bitstream filtering
This is disabled by default when the empty_moov flag is enabled
2016-10-24 03:53:23 -05:00
Rodger Combs
c972a28fc3
lavf/dashenc: add deinit function 2016-10-24 03:53:23 -05:00
Rodger Combs
e83d5d7e58
lavf/movenc: add deinit function 2016-10-24 03:53:22 -05:00
Rodger Combs
45f5c55732
lavf/segment: fix writing separate header with auto BSF 2016-10-24 03:53:22 -05:00
Rodger Combs
c7cd6ad850
lavf/segment: add deinit function 2016-10-24 03:53:22 -05:00
Rodger Combs
a246fef163
lavf/mux: add avformat_init_output
This allows a consumer to run the muxer's init function without actually
writing the header, which is useful in chained muxers that support
automatic bitstream filtering.
2016-10-24 03:53:21 -05:00
Carlos Fernandez
728ccae8a2 lavf/mpegts: add missed fixes to scte35 section callback
They somehow got lost along the patch versions.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-10-23 00:10:34 +02:00
James Almer
cc71fa319f avformat/matroskaenc: write DisplayWidth and DisplayHeight elements only if they differ from PixelWidth and PixelHeight
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-22 15:00:15 -03:00
Andreas Cadhalpun
178eebd79e mpegts: handle AVMEDIA_TYPE_UNKNOWN correctly
It is negative, so can't be used for left shifting.

This fixes ubsan runtime error: shift exponent -1 is negative

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-22 19:23:12 +02:00
Carl Eugen Hoyos
6969bed12c lavf/rtpdec_g726: Map mime type G726 to g726le.
Add new mime types AAL2-G726 for g726 as suggested in rfc 3551.

This patch will break interaction with applications that incorrectly
use big-endian G.726 with mime type G726 but we know of at least one
device (DVTel camera) that correctly implements the rfc, so do the same.

Fixes ticket #5890.
2016-10-22 03:53:38 +02:00
Andreas Cadhalpun
c8a6eb58d7 doc: fix spelling errors
Thanks to Mathieu Malaterre <malat@debian.org> for reporting the
Que/Queue typo. (https://bugs.debian.org/839542)

Reviewed-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-21 23:58:47 +02:00
Carlos Fernandez
5db3c9476c lavf/mpegts: SCTE-35 extraction from mpegts
Reviewed-by: Marton Balint <cus@passwd.hu>
Acked-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Carlos Fernandez <carlos@ccextractor.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-10-21 20:41:19 +02:00
Michael Niedermayer
fecb3e82a4 avformat/mxfdec: Check size to avoid integer overflow in mxf_read_utf16_string()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-21 20:06:29 +02:00
Michael Niedermayer
c495f4ffde avformat/mxfdec: Fix mixed declaration and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-21 20:06:29 +02:00