summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/utils: return pending IO error on EOF in av_read_frame()Marton Balint2019-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | avio_feof() returns true both in case of actual EOF and in case of IO errors. Some demuxers (matroska) have special handling to be able to return the proper error for this exact reason, e.g.: if (avio_feof(pb)) { if (pb->error) { return pb->error; } else { return AVERROR_EOF; } } However, most of the demuxers do not, and they simply return AVERROR_EOF if avio_feof() is true, so there is a real chance that IO errors are mistaken for EOF. We might just say that the API user should always check the IO context error attribute on EOF to make sure no IO errors happened, but not even ffmpeg.c does this. It should be more intuitive to the API user if we simply return the IO error as the return value of av_read_frame() instead of AVERROR_EOF. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/avidec: add support for recognizing HEVC fourcc when demuxingMarton Balint2019-08-31
| | | | | | | | | | | Some security cams generate this, as well as some versions of VirtualDub and VLC so support for _reading_ such files is justified. Fixes ticket #7110. See also this discussion: https://patchwork.ffmpeg.org/patch/8744/ Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: fix teletext PTS when selecting teletext streams onlyMarton Balint2019-08-31
| | | | | | | | | | | | | | | After a1b4f120c031e6697bac9fd8c725d9c37ee36d13 the teletext PTS values were set to AV_NOPTS_VALUE if the stream of the PCR pid was discarded. What actually matters is that if we parse the PCR of the PCR PID or not, so let's use the cached discard value of the actual PCR PID instead of the stream discard value, which may be different. Also fixes ticket #7567, which was caused by the fact that teletext PTS values were not touched if the PCR pid was discarded even before a1b4f120c031e6697bac9fd8c725d9c37ee36d13. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec: add IMM5 decoderPaul B Mahol2019-08-29
|
* avformat/mpsubdec: Remove floating point usageMichael Niedermayer2019-08-29
| | | | | | | | | | | This makes the code bitexact between platforms. Intermediate timestamps between frames are preserved. The timebase is simplified. Rounding differs from doubles in cases where timestamps/durations are "funny" Suggested-by: jb Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/dump: dump the vbv_delay with N/A instead of 18446744073709551615Limin Wang2019-08-28
| | | | | | | | | | | | | | | | How to check it: ./ffmpeg -f lavfi -i testsrc -c:v mpeg2video -f null - master: Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: 18446744073709551615 patch applied: Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dsfdec: set packet pts/duration/pos correctlyPaul B Mahol2019-08-28
|
* avformat/mov: improve timecode calculationPaul B Mahol2019-08-28
| | | | | Fixes timecode calculation for NTSC frame rates. Fixes ticket #5978.
* avformat/dhav: always initializer retPaul B Mahol2019-08-28
|
* avformat/hlsenc: remove unused valueSteven Liu2019-08-26
| | | | | CID: 1452644 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak of filenameSteven Liu2019-08-26
| | | | | CID: 1452445 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak in hls_write_trailerSteven Liu2019-08-26
| | | | | | fix CID: 1426931 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/movenc: add muxing support for Dolby TrueHD streamsJames Almer2019-08-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: add demuxing support for Dolby TrueHD streamsJames Almer2019-08-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dhav: handle files missing data at startPaul B Mahol2019-08-24
| | | | | Try to seek to end of file and if signature is found seek backwards until last valid chunk is found.
* avformat/dhav: gracefully handle corrupted filesPaul B Mahol2019-08-24
| | | | Try to find next valid chunk in offsets of 0x8000 from last good one.
* avformat/mpegtsenc: get rid of packet counting for sdt/pat/pmtMarton Balint2019-08-23
| | | | | | | | | | | | | The packet counting based approach caused excessive sdt/pat/pmt for VBR, so let's use a timestamp based approach instead similar to how we emit PCRs. SDT/PAT/PMT period should be consistent for both VBR and CBR from now on. Also change the type of sdt_period and pat_period to AV_OPT_TYPE_DURATION so no floating point math is necessary. Fixes ticket #3714. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: move some code around and simplify a bitMarton Balint2019-08-23
| | | | | | | PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only packet. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: add support for setting PCR interval for VBR streamsMarton Balint2019-08-23
| | | | | | | | Also document the algorithm for the default PCR interval. Fixes ticket #8061. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: rename pcr_period variable to pcr_period_msMarton Balint2019-08-23
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpsubdec: Check pts / duration before castMichael Niedermayer2019-08-23
| | | | | | | | Fixes: 3e+47 is outside the range of representable values of type 'int' Fixes: 16057/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5691111307214848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: delete unused codeleozhang2019-08-23
| | | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: leozhang <leozhang@qiyi.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: do not ignore bad size errorsMarton Balint2019-08-22
| | | | | | | The return value was unintentionally lost after 00a2652df3bf25a27d174cc67ed508b5317cb115. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/realtextdec: free queue on errorMichael Niedermayer2019-08-22
| | | | | | | | | Fixes: memleak Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Check av_xiphlacing() return value before useMichael Niedermayer2019-08-22
| | | | | | | | | Fixes: out of array access Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hlsenc: avformat/hlsenc: simplified codeSteven Liu2019-08-21
| | | | | | simplified code for get dirname string in hls_delete_old_segments Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: simplified code of use_localtime in hls_initSteven Liu2019-08-21
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak in update_variant_stream_infoSteven Liu2019-08-21
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: reindent codeSteven Liu2019-08-20
| | | | and remove redundant empty line
* avformat/hlsenc: remove unuse comment of the codeSteven Liu2019-08-20
|
* lavf/hlsenc: free the old_filname to avoid memory leakJun Zhao2019-08-20
| | | | | | | | free the old_filname to avoid memory leak in error handle path. Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavf/hlsenc: fix one warning: unused variable 'filename' [-Wunused-variable]Limin Wang2019-08-20
| | | | | Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: merge mpegts and fmp4 workflow to one workflowSteven Liu2019-08-18
| | | | | | | | write mpegts or fmp4 context into buffer, and flush the buffer into output file when split fragment. merge two format split workflow into one workflow Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf/dump: use error log level for invalid sizeLimin Wang2019-08-18
| | | | | Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/avio: remove 4k limit from avio_printfMarton Balint2019-08-17
| | | | | | | | We do this by switching to AVBPrint. v2: Also set IO context error flag in case of ENOMEM. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/assenc: optimize writing dialogsMarton Balint2019-08-17
| | | | | | | | An example where the preivously added API can be useful. Also fixes ticket #6390. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/avio: add avio_print_string_array and avio_printMarton Balint2019-08-17
| | | | | | | These functions can be used to print a variable number of strings consecutively to the IO context. Unlike av_bprintf, no temporary buffer is necessary. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/matroskadec: Fix seekingAndreas Rheinhardt2019-08-16
| | | | | | | | | | | | | | | | | matroska_reset_status (a function that is used during seeking (among other things)) used an int for the return value of avio_seek which returns an int64_t. Checking the return value then indicated an error even though the seek was successfull for targets in the range of 2GB-4GB, 6GB-8GB, ... This error implied that the status hasn't been reset and in particular, the old level was still considered to be in force, so that ebml_parse returned errors because the newly parsed elements were of course not contained in the previously active and still wrongly considered active master element any more. Addresses ticket #8084. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/utils: fix error like "offset 0x1f85: partial file"tomajsjiang2019-08-15
| | | | | | | | | fix error like "offset 0x1f85: partial file", the root cause is when read the mp4 file from http, and the moov in the end of the mp4 file, reconfig the buffer will drop some data. Signed-off-by: Jun Zhao <barryjzhao@tencent.com> Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
* lavf/avio: add a ffio_realloc_buf API for AVIO buffer realloctomajsjiang2019-08-15
| | | | | | Add new API ffio_realloc_buf for AVIO buffer realloc. Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
* avformat/mux: Use av_packet_rescale_tsAndreas Rheinhardt2019-08-15
| | | | | | | | | ff_write_chained essentially duplicated the functionality of av_packet_rescale_ts. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Use const AVPacket * in compare functionsAndreas Rheinhardt2019-08-15
| | | | | | | | | There is no reason for these functions to modify the given packets at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegtsenc: remove deprecated resend_headers optionMarton Balint2019-08-14
| | | | | | Deprecated since 2014. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix PCR generation intervalsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | PCR generation was based on counting packets for both CBR and VBR streams. Couting packets might have worked for CBR streams (when muxrate was specified) but it only took into account the packets of a service (or the packets of the PCR stream lately), so even that was problematic for multi program streams. The new code works on actual timestamps for both CBR and VBR streams. For VBR streams the behaviour of the old code is simulated by selecting a PCR interval which is the highest multiple of the frame duration but still less than 100 ms. It should be trivial to add support for setting the PCR interval for VBR streams as well in a later patch. The accuracy of PCR packets for CBR streams was greatly improved by preemtively sending them at PCR intervals even if sending the payload of another stream is in progress. This may fix these tickets: - #5750 - #7524 Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: use increasing numbers in default service namesMarton Balint2019-08-14
| | | | | | Maybe we should use service ID instead of increasing numbers? Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: remove section_write_packet forward declarationMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: factorize setting up servicesMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix incorrect PCR selection with multiple programsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MPEG-TS muxer had a serious bug related to the use of multiple programs: in that case, the PCR pid selection was incomplete for all services except one. This patch solves this problem and selects a stream to become PCR for each service, preferably the video stream. This patch also moves pcr calculation attributes to MpegTSWriteStream from MpegTSService. PCR is a per-stream and not per-service thing, so it was misleading to refer to it as something that is per-service. Also remove *service from MpegTSWriteStream because a stream can belong to multiple services so it was misleading to select one for each stream. You can check the result with this example command: ./ffmpeg -loglevel verbose -y -f lavfi -i \ "testsrc=s=64x64:d=10,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=10,asetnsamples=1152[out2]" \ -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact \ -codec:v libx264 -codec:a mp2 -pix_fmt yuv420p \ -map '0:v:0' \ -map '0:v:1' \ -map '0:a:0' \ -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out.ts You should now see this: [mpegts @ 0x37505c0] service 1 using PCR in pid=256 [mpegts @ 0x37505c0] service 2 using PCR in pid=257 [mpegts @ 0x37505c0] service 3 using PCR in pid=258 [mpegts @ 0x37505c0] service 4 using PCR in pid=256 Fixes ticket #8039. v2: a video is stream is preferred if there are no programs, just like before the patch. Signed-off-by: Marton Balint <cus@passwd.hu>
* libavformat/subfile: Fix SEEK_CUR and SEEK_END seekingAndreas Rheinhardt2019-08-13
| | | | | | | | | | | Up until now, when performing a SEEK_END seek, the subfile protocol ignored the desired position (relative to EOF) and used the current absolute offset in the input file instead. And when performing a SEEK_CUR seek, the current position has been ignored. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf/concat: implement FFSEEK_SIZE.Nicolas George2019-08-13
|