Remove the header decoding for PCM audio from mpeg.c and the
20/24bit parts from pcm.c and merge them into a new decoder in
pcm-dvd.c.
The decoder has added support for samples that span multiple
packets and modified 20/24bit group decoding. Both is needed to
decode samples that have been generated with DVD-Lab Pro 2. The
decoding of 16bit PCM and two channel 24bit is identical to
before. No other samples are known to verify the correctness of
the encoding this software does.
The complete list of tested formats is
48kHz/16bit/2-8 channels
48kHz/24bit/2-5 channels
96kHz/16bit/2-4 channels
96kHz/24bit/2 channels
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
When streaming to limelight, the app name is either a full
"appname/subaccount" or "appname/_definst_". In the latter case,
the app name can be simplified into simply "appname", but the
authentication hashing assumes the /_definst_ still to be present.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '310cc4bf82824f09bdd0b9147ed725cdbeaf9bdd':
smoothstreamingenc: Write to a temp file while updating the manifest
Merged-by: Michael Niedermayer <michaelni@gmx.at>
If a client tries to read the file while it's being updated, the client
would get an incomplete manifest. Instead write to a separate temp file
and atomically rename it to replace the previous one.
Signed-off-by: Martin Storsjö <martin@martin.st>
The element was only being written when the value == 1. But the default
value of this element is 1, so this has no useful effect. This element
needs to be written when the value == 0.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
* commit '2bbad1f94cbc5eab0aa2d937bc79d085477d0242':
movenc: Properly free allocated data on failures in mov_write_header
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '3559fb97c459c88b4f1d0eef80d55933d3b7fabe':
movenc: Check that tracks->enc exists before trying to free extradata
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '4d122b01e4ce539269ee2df193b061772c7374f6':
movenc: Check for allocation failures in mov_create_chapter_track
Merged-by: Michael Niedermayer <michaelni@gmx.at>
On failures in the write_trailer function, we could also ignore
the errors and try to finish the file despite these errors (which
would only leave an incomplete chapters track). It's probably better
to signal the error clearly to the caller though (and if this
function failed there's no guarantee that there's enough memory to
finish the trailer either).
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit 'b89e8759e053792704741d08cbc41c9ac3c7ed63':
mov: Write tmcd extradata
This commit should make no difference as we had tmcd support
already, which is not changed.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '08504380ddf25d6905e189e9bf52e7a4c771a415':
mov: Refactor codec specific final steps in mov_finalize_stsd_codec
Conflicts:
libavformat/mov.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'dc518a3ae21e7b6420131b813cfc6bcdcad26b7e':
mov: Refactor subtitle specific parsing in mov_parse_stsd_subtitle
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'a3b53ff062eaccdaa28964899c63520ef2978c2e':
mov: Refactor video specific parsing in mov_parse_stsd_video
Conflicts:
libavformat/mov.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
When a id3 tag is larger than the amount of space we will probe
give it a score similar to what a .mp3 extension would have given it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Fixes out of array reads
Found-by: Laurent Butti <laurentb@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '1f70a5ad284b33e8b3e2b40a5cb33055419781b7':
mov: use tkhd enabled flag to set the default track
Merged-by: Michael Niedermayer <michaelni@gmx.at>
QuickTime will play multiple audio tracks concurrently if this flag is
set for multiple audio tracks. And if no subtitle track has this flag
set, QuickTime will show no subtitles in the subtitle menu.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Faststart moves the moov atom to the beginning of the file and rewrites
the rest of the file after muxing is complete.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '6c786765cd5eb794dedd4a0970dfe689b16dfeeb':
movenc: Allow chapters to be written in trailer
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '64af59bc4916fac5578b31c89da13c30b591bddf':
avformat: Fix references to removed av_close_input_file in Doxygen
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This allows creation of frame accurate chapter marks from sources
like DVD and BD where the precise chapter location is not known until
the chapter mark has been reached during reading.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '22de0f8369f1f3edf1a55e1d275f3c07c617b53e':
mov: Compute max duration among the tracks with a timescale
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '39523030108815242178ac5e209c83070bd1baef':
mov: Set the timescale for data streams
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'b886f5c2f1e71b3e60e4265c500158d392b4b9a4':
mkv: Allow flushing the current cluster in progress
Conflicts:
libavformat/matroskaenc.c
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '59f595921eb2b848a80a74aa81b6bb43038c9ebe':
mkv: Flush the old cluster before writing a new one
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Allow emitting the current cluster that is being written before
starting a new one, simplifying how to figure out where clusters
are positioned in the output stream (for live streaming).
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
WebM files now support inband text tracks, as described in the
following specification:
http://wiki.webmproject.org/webm-metadata/temporal-metadata/webvtt-in-webm
The Matroska demuxer now detects the presence of WebVTT tracks,
synthesizing WebVTT packets (having codec id AV_CODEC_ID_WEBVTT) and
pushing them downstream in the normal way.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Seeking in certain broken files would cause ogg_read_timestamp
to fail because ogg_packet would go into a state where all packets
of stream 1 would be discarded until the end of the stream.
Bug-Id: 553
CC: libav-stable@libav.org
Signed-off-by: Jan Gerber <j@v2v.cc>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This avoids the loss of a packet in many cases if the packet size was wrong.
It also improves detection of packet size changes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
No case is known to have triggered this, but its more correct to check that the
new size differs.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Calculate the duration as accurately as possible to improve decoding of samples
where the last frame is smaller than the rest.
Example:
Take lossless-audio/luckynight-partial.tak from the FATE suit and convert it
to TTA muxed into matroska:
ffmpeg -i $(SAMPLES)/lossless-audio/luckynight-partial.tak -c:a tta lucky.mka
The framemd5 output for lucky.mka without this patch:
0, 0, 0, 46080, 184320, 7c3751ddd571d2903c3cf0ab4b3e3d0a
0, 46080, 46080, 46080, 184320, 6b70c782ba1da3f933fde2daa4f96b73
0, 92160, 92160, 46080, 184320, dcf70d89c54b9a4f0b302d4ec4fb302d
0, 138240, 138240, 46080, 184320, 48713ca38b388d2ea4abf5b86ed1226f
0, 184320, 184320, 46080, 184320, 12188a23648e7ebfb07cd6fe9197b2ea
0, 230400, 230400, 46080, 184320, 49653ab8186a5d4a044ed284671a26e0
0, 276480, 276480, 46080, 184320, 5e82c6a7fe58c7ea612c03a0a2927dd4
0, 322560, 322560, 46080, 184320, 83dc449dbd9eab5f2e8ad2b4403d6a21
0, 368640, 368640, 46080, 184320, bdd6b92c23d30978d4e802d305b0fc49
With this patch:
0, 0, 0, 46080, 184320, 7c3751ddd571d2903c3cf0ab4b3e3d0a
0, 46080, 46080, 46080, 184320, 6b70c782ba1da3f933fde2daa4f96b73
0, 92160, 92160, 46080, 184320, dcf70d89c54b9a4f0b302d4ec4fb302d
0, 138240, 138240, 46080, 184320, 48713ca38b388d2ea4abf5b86ed1226f
0, 184320, 184320, 46080, 184320, 12188a23648e7ebfb07cd6fe9197b2ea
0, 230400, 230400, 46080, 184320, 49653ab8186a5d4a044ed284671a26e0
0, 276480, 276480, 46080, 184320, 5e82c6a7fe58c7ea612c03a0a2927dd4
0, 322560, 322560, 46080, 184320, 83dc449dbd9eab5f2e8ad2b4403d6a21
0, 368640, 368640, 46080, 184320, bdd6b92c23d30978d4e802d305b0fc49
0, 414720, 414720, 4230, 16920, b50b440c5bbcecb8e9fbece643447593
The duration without this patch was calculated as 418950000000, which is bigger
than uint32_t and as such stored as 2338172288.
With this patch the duration is correctly calculated as 418950.
Signed-off-by: James Almer <jamrial@gmail.com>
Approved-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
In order to encapsuate Opus in Matroska, there is a new element
that has been added to the Matroska Spec, SeekPreRoll. It has the
duration in nanoseconds that has to be decoded before every seek.
Spec: http://matroska.org/technical/specs/index.html#SeekPreRoll
Proposal for encapsulateing Opus in Matroska:
http://wiki.xiph.org/MatroskaOpus
Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The mov/mp4 muxer has support for handling negative timestamps
via edit lists (which customarily is used for handling the 1-frame
delay due to B-frames as well).
Using the muxer's native way of handling it is better than using
the generic offsetting. The generic offsetting is a bit too
crude when e.g. the timebase of one track is 1/fps, where the
edit lists can handle it accurately.
Signed-off-by: Martin Storsjö <martin@martin.st>
Uses the 2.5 compatibility header included with the variant of
FFMS2 that uses AviSynth's C-interface. A copy of this header is
now provided in compat/avisynth.
avs_get_row_size_p and avs_get_height_p changed between versions
2.5 and 2.6. Since the avisynth_c.h header that avformat uses
assumes AviSynth 2.6, it would cause 2.5 to crash if given any
kind of real video (the Version() function was known to work,
though).
AvxSynth was unaffected by this issue because, despite being based
on AviSynth 2.5.8 and using 2.5.8's interface version number of 3,
it actually uses 2.6's versions of these functions.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '09c93b1b957f2049ea5fd8fb0e6f4d82680172f2':
hlsenc: Append the last incomplete segment when closing the output
Conflicts:
libavformat/hlsenc.c
See: 4630dfd1eb
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'c9031c7c1446a1a63eff7c0bf50d1ee559adf3fb':
hlsenc: Add a proper dependency on the mpegts muxer
Conflicts:
libavformat/Makefile
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '4b054a3400f728c54470ee6a1eefe1d82420f6a2':
rtpproto: Check the right feature detection macro
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '163a729725c6eb0081b0af41a7279f7d19aee86e':
electronicarts: Let functions always returning the same value return void
Merged-by: Michael Niedermayer <michaelni@gmx.at>
The counter itself shouldn't be wrapped, since it is used for
determining end_pts for the next segment - only wrap the number
used for the segment file name.
Signed-off-by: Martin Storsjö <martin@martin.st>
The hls muxer itself doesn't have any direct (object file level)
dependencies on mpegtsenc.o, and including that object file
directly doesn't ensure that it is registered so that the muxer
actually is accessible.
Signed-off-by: Martin Storsjö <martin@martin.st>
IPPROTO_IPV6 is unrelated here (it's only used in udp.c for
multicast sockopts), check for support for the sockaddr_in6
struct itself.
Signed-off-by: Martin Storsjö <martin@martin.st>
A file with a prepended ID3 tag of an uneven length was found
in the wild.
Check if the wav data starts at an uneven offset and use that
information to correct the seeking calculation in wav_seek_tag,
which used to only seek to even byte positions.
Regression since ac87eaf856
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
* commit '6b58e11a8331690ec32e9869db89ae10c54614e9':
rtpproto: Add an option for writing return packets to the address of the last received packets
Merged-by: Michael Niedermayer <michaelni@gmx.at>
An SDP description normally only contains the target IP address
and port for the packets. This means that we don't really have
any clue where to send the RTCP RR packets - previously they're
sent to the destination IP written in the SDP (at the same port),
which rarely is the actual peer. And if the source for the packets
is on a different port than the destination, it's never correct.
With a new option, we can choose to send the packets to the
address that the latest packet on each socket arrived from.
---
Some may even argue that this should be the default - perhaps,
but I'd rather keep it optional at first. Additionally, I'm not
sure if sending RTCP RR directly back to the source is
desireable for e.g. multicast.
Signed-off-by: Martin Storsjö <martin@martin.st>
If we've received packets on the same socket before, the return
packets are sent to that address. If we've only received packets
on the other socket, try to guess the source port for the other
one assuming the basic +1/-1 logic.
Signed-off-by: Martin Storsjö <martin@martin.st>
Move the sources documentation up below the marker for deprecated
otpions. Also mention the new block parameter, that was added
in 749722209.
Signed-off-by: Martin Storsjö <martin@martin.st>
It is possible to have an initial broken header and then valid packets.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
flushing just the asf demuxer but not the cores buffers leads to inconsistencies
and a "random" packet position which later causes an assertion failure
Fixes Ticket2853
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This makes the encoding of picture descriptions consistent with the
encoding of other text id3 tags and works better with iTunes, which
does not display pictures with some UTF-16 picture descriptions
(including a UTF-16 empty string, i.e. BOM + terminator). It also
saves a few bytes.
Example:
ffmpeg -f lavfi -i sine=b=4 -f lavfi -i smptebars -map 0:a -map 1:v \
-codec:a libmp3lame -codec:v mjpeg -id3v2_version 3 \
-metadata:s:v comment="Cover (front)" -t 3 -y out.mp3
This example does not set a picture description (-metadata:s:v title=)
so an empty string is written in the id3v2.3 APIC frame. Without this
patch, UTF-16 is used and the cover art does not display in iTunes.
With the patch the cover art is displayed. (Note that iTunes does not
display or have a way to set picture descriptions, only the picture
itself, but nevertheless has trouble skipping some UTF-16 descriptions.)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '8e1fe345577a42f99591caf8a06c447613449694':
rtmp: Detect and warn if the user tries to pass librtmp style parameters
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '9d5ec50ead97e088d77317e77b18cef06cb3d053':
ff_socket: put out-of-line and fallback to fcntl() for close-on-exec
Conflicts:
libavformat/network.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.
This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.
On systems not using msvcrt, the function is not duplicated.
Signed-off-by: Martin Storsjö <martin@martin.st>
This supports non-Linux systems (SOCK_CLOEXEC is non-standard) and
older Linux kernels to the extent possible.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit 'dfc6b5c81491abf7effb97b23af17ccf7adcd132':
file: Move win32 utf8->wchar open wrapper to libavutil
Merged-by: Michael Niedermayer <michaelni@gmx.at>
When libavformat was changed to use the new avpriv_open function
in 51eb213d00, this silently bypassed the existing wrapper for
win32. Move the win32 wrapper into libavutil/file.c to make sure
it gets called everywhere (not just in the libavformat case).
This makes sure that non-ascii file names gets opened properly
(where file names internally are stored as utf8, but they get
converted to wchar_t and opened with _wsopen).
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit 'f4d371b9737c0405b3bc46d7ca0c856c0a8616b1':
rtsp: Don't include the listen flag in the SDP demuxer flags
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This provides at least some protection against potential accidental
corruption of AVIO buffer workspace.
Signed-off-by: Martin Storsjö <martin@martin.st>
It's only relevant for the RTSP demuxer. Similarly, the custom_io
flag is only present in the SDP demuxer options list.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '62572435d4106098c090fb8f129a9090e41ff1eb':
rtpenc_chain: Check for errors from ffio_fdopen and ffio_open_dyn_packet_buf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'f542dedf72091af8e6f32a12bd64289c58857c21':
rtspenc: Check the return value from ffio_open_dyn_packet_buf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
'Fixes' ticket #2526 insofar as it stops 2.5.8 from crashing and
tells the user to upgrade to 2.6 if they want to make video input
work. A real solution to #2526 would be to get video input from
2.5.8 to work right.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Also clear the AVIOContext handle after freeing, to avoid
possible dangling pointers if the later call fails.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '255d9c570e117f0fcb8e51fa2c5996f3c4b2052b':
riff: Move demuxing code to a separate file.
Conflicts:
configure
libavformat/riff.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '3dd5c95deef51d7fbf6f4458ba42d1335d2f1472':
riff: Move muxing code to a separate file
Conflicts:
configure
libavformat/riff.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a':
tcp: Use a different log message and level if there's more addresses to try
Conflicts:
libavformat/tcp.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '2a0ec47bd70ebb79e8b2d2f956feeb3a813df798':
unix: Convert from AVERROR to errno range before comparing error codes
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '971cce7ebb48a58e72e4dc57b3008e2682bcf4e7':
riff.h: Remove stray extern declaration for non-existing symbol
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'c84ea750cf765c9d8845fca5546eb0ae25b9c855':
mpegts: Make discard_pid() faster for single-program streams
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'cabb1681697555e2c319c37c1f30f149207e9434':
mpegts: Remove one memcpy per packet
Conflicts:
libavformat/mpegts.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'daf1e0d3de03bd424016e2a7520e4e94ece5c0ac':
avio: Add an internal function for reading without copying
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This lowers the level of warnings printed if trying to connect
to a host name that provides both v6 and v4 addresses but the
service only is available on the v4 address (often occurring for
'localhost', with servers that aren't v6-aware).
Signed-off-by: Martin Storsjö <martin@martin.st>