Commit graph

804 commits

Author SHA1 Message Date
Thiago Santos
59f6c82c32 asfdemux: careful to avoid crash on bogus data
When receiving bogus data, we have to avoid subtracting a value
larger than 'size' from 'size' variable, resulting in a wrap
that would make 'size' a really large bogus value.

Fixes #599333
2009-10-26 17:31:19 -03:00
Edward Hervey
33b4528a0e mpegaudioparse: Don't use expensive glib ways to get an enum nick.
Fixes #598761

This removes a good 50% of processing time for parsing a buffer.

We do this by simply... getting the nicks that we already have handy
instead of going through the expensive glib system.
2009-10-24 20:37:13 +02:00
Josep Torra
8841ca0a3c mpegstream: fix warning in macosx snow leopard 2009-10-11 16:16:09 +02:00
Josep Torra
9c6b0cacb5 mpegaudioparse: fix warning in macosx snow leopard 2009-10-11 16:14:08 +02:00
Josep Torra
8d77fcd1fb dvdsubdec: fix warning on macosx snow leopard 2009-10-11 16:09:11 +02:00
Josep Torra
c4fe899f1a asfdemux: fix warning in macosx snow leopard 2009-10-11 16:06:25 +02:00
René Stadler
0b0b07eb49 mp3parse: don't fail SEEKING query when upstream query fails for TIME format 2009-10-08 20:10:11 +03:00
Stefan Kost
d125baa8c5 build: fprintf, sprintf, sscanf need stdio.h 2009-10-07 14:22:09 +03:00
Wim Taymans
f2613470fd dvdlpcm: whitespace fixes 2009-10-05 12:14:18 +02:00
Mark Nauwelaerts
820abb3ab8 mpegaudioparse: prevent infinite (re)syncing
Conflicts:

	gst/mpegaudioparse/gstmpegaudioparse.c
2009-09-25 18:11:48 +02:00
Michael Smith
8307e177ba mp3parse: Refactor checking for sync. Make resyncing more reliable.
Previously, we could get false sync relatively easily - it sometimes happened
on real files. This cleans the code up a fair bit, and makes it require more
confirmation that we've found valid sync before continuing.
2009-09-22 12:17:18 -07:00
Mark Nauwelaerts
57d01c2526 mpegaudioparse: ensure 2 valid headers in a row when resyncing 2009-09-17 16:22:36 +02:00
Tim-Philipp Müller
59f5b02444 dvddemux: remove bogus ifndef 2009-09-11 10:05:30 +01:00
Tim-Philipp Müller
94a404cb8d dvdsubparse: GstAdapter is not a GstObject and should be freed with g_object_unref 2009-08-31 13:44:31 +01:00
David Schleef
0c15317848 asfdemux: Remove old non-built asfmux code
Remove so people don't confuse it with the new asfmux code
in -bad.
2009-08-24 14:00:23 -07:00
Mark Nauwelaerts
52f6764e4c mpegaudioparse: use metadata (xing, vbri) provided bytesize for conversions
Metadata provided seek tables are consistent with metadata's view of
total size, which typically matches real size, but need not do so
(e.g. a truncated file).  Fixes seeking and position reporting
in such truncated files (although duration based on metadata may then
still be incorrect).
2009-08-14 12:07:40 +02:00
Thiago Santos
6adb49c501 rtpasfdepay: set padding size to the correct value
asf packets in rtp packets should come with their padding fields
set to 0 and the depayload must update them to the correct
value before pushing downstream
2009-07-31 00:25:43 -03:00
Edward Hervey
6f58ca470e asfdemux: Refactor multiple packet pull.
This also fixes a bug by which the first buffer (in a multi-packet mode)
passed to asf_demux_parse_packet() would have a GST_BUFFER_SIZE of the
full incoming buffer and not just of the single asf packet.

Fixes corrupted frames introduced by latest commit.
2009-06-29 11:13:02 +02:00
Wim Taymans
0fc6f338dc asfdemux: use the right accurate field
Remove accurate variable and its faulty use because the real variable is an
instance variable.
2009-06-29 10:58:49 +02:00
Edward Hervey
d71973cc4c asfdemux: Sprinkle branch prediction macros accross the code 2009-06-28 17:52:38 +02:00
Edward Hervey
d451dff520 asfdemux: Delay newsegment handling until we have a keyframe.
We now have a chance for packets to be collected before we send out the
newsegment. If we're not in accurate seeking (keyunit) it will set
the segment start/time to the keyframe's timestamp.
2009-06-28 17:52:38 +02:00
Edward Hervey
3b63c95450 asfdemux: Remove useless check. We already have checked for it above. 2009-06-28 17:52:38 +02:00
Edward Hervey
a3c832405e asfdemux: No longer queue GOPs now that seeking is fixed.
We now *always* seek to the keyframe just before our requested position.
When we encounter the first keyframe and we were not accurate (therefore doing
keyframe seeking), we update the segment start position to the keyframe timestamp.
2009-06-28 17:50:45 +02:00
Edward Hervey
e6c6eefefb asfdemux: Store the accurate seeking flag 2009-06-28 17:50:45 +02:00
Edward Hervey
725da8579b asfdemux: Use the average frame duration for buffers without a duration.
This will still cause some timestamp jitter, but giving a hint as to the duration
rather than nothing seems to be a better idea.
Also, this allows some scenarios (like remuxing with asfmux) to estimate the total
duration using the accumulated packet duration (which will be correct).
2009-06-28 17:33:51 +02:00
Edward Hervey
99d9b34385 asfdemux: Use index entry packet count to optimize seeking.
The simple index entries also contain the number of packets one needs
to retrieve at a given position to get a full keyframe. We therefore
use that information to retrieve all those packets in one buffer when
working in pull-mode.
2009-06-28 17:33:48 +02:00
Thiago Santos
6e2a117eb2 asfdemux: Do not try to free const pointer
In gst_asf_demux_chain_headers, when 'goto wrong_type' was called
asfdemux tried to free a const pointer that had been cast to a
normal pointer variable.
2009-06-26 21:07:59 -03:00
Edward Hervey
3c683ead7b asfdemux: Use presentation timestamp when searching in the index.
We need to take the preroll into account... else we end up too early.
2009-06-26 20:45:09 +02:00
Edward Hervey
c1bf0a091c asfdemux: Convert index entry from presentation time to timestamps.
We weren't taking the preroll into account previously, meaning that we
were always seeking preroll nanoseconds too early... resulting in a lot
of dropped packets (which are before the start time).

This brings quit a bit closer to as-fast-as-possible seeking in asf files.
2009-06-26 13:35:38 +02:00
Edward Hervey
db5ddf927c asfdemux: Fix byte array metadata handling.
We basically discard byte array metadata. Should be trivial to adapt
to storing the pointers if we need it later on.
2009-06-26 10:58:56 +02:00
Edward Hervey
a3f200e4f8 asfdemux: Handle PAR/interlaced information stored in packet payload.
This is the 'other' way to store non 1/1 PAR in asf streams (by storing it
in the ASF Packet payload extensions).
2009-06-26 10:42:29 +02:00
Edward Hervey
1cc2eed416 asfdemux: Store/Handle global metadata (not specific to one stream).
This allows us to store (and handle) PAR information which might be stored there.
2009-06-26 10:42:29 +02:00
Mark Nauwelaerts
6aa267cfc8 mpegaudioparse: fix Xing inverse seek table building 2009-06-25 18:27:54 +02:00
Tim-Philipp Müller
16a09febbd asfdemux: don't try to free a NULL taglist 2009-06-23 16:45:00 +01:00
Tim-Philipp Müller
6ec0b61980 asfdemux: post tags only after we've created our source pads
Post global tags only after we've added our source pads, so that
tag events get sent downstream in addition to tag messages posted
on the bus. This makes sure tags can be picked up automatically
when transcoding, but also by tagreadbin/playbin2. Fixes #519721.

While we're at it, also add a container-format tag.
2009-06-23 02:14:00 +01:00
Tim-Philipp Müller
aa0d6f7b48 asfdemux: use new bytereader functions for image tag parsing 2009-06-23 01:38:01 +01:00
Mark Nauwelaerts
1874bf5910 asfdemux: remove some more unused variables 2009-06-22 19:10:17 +02:00
Mark Nauwelaerts
095c8eb5d4 rmdemux: plug buffer leaking 2009-06-22 19:10:15 +02:00
Wim Taymans
22b82d30e5 asfdepay: guard against dropped buffers
If a buffer was dropped, we might request data from the adapter that is not
there and then we get a NULL buffer.
2009-06-22 17:36:21 +02:00
Wim Taymans
36d0450d6e asfdemux: set DISCONT on streams
When we receive a DISCONT as input, don't clear our complete state but simply
mark a discont that will be put on the next buffer. The code will be able to
handle and throw away incomplete data.
Add some more debug info.
Remove an unused variable.
2009-06-22 17:16:58 +02:00
Wim Taymans
c53fd9ded1 asfdepay: set DELTA_UNIT flag correctly
Only set the DELTA_UNIT flag when we are not dealing with a keyframe.
Add some more debug info.
2009-06-22 17:15:52 +02:00
Wim Taymans
8de1502c9b asfdemux: fix latency calculations
We need to check for -1 as an invalid timestamp, not 1.
2009-06-22 13:39:41 +02:00
Tim-Philipp Müller
af3ab2ae94 mp3parse: don't put every single frame into the index
Let's not put every single mp3 frame in our index, a few frames per
second should be more than enough. For now use an index interval
of 100ms-500ms depending on the upstream size, to keep the index at
a reasonable size. Factor out the code that adds the index entry
into a separate function for better code readability.
2009-06-22 10:41:26 +01:00
Tim-Philipp Müller
1db592839e mp3parse: assume seekability only if we know the upstream size
While technically upstream may be seekable even if it doesn't know
the exact size, I can't think of a use case where this distincation
is relevant in practice, so for now just assume we're not seekable
if upstream doesn't provide us with a size. Makes sure we don't
build a seek index when streaming internet radio with sources that
pretend to be seekable until you try to actually seek.
2009-06-22 10:41:26 +01:00
Tim-Philipp Müller
0e285b3d29 x264enc, rdtmanager: fix compilation with debugging disabled 2009-06-19 15:01:46 +01:00
Tim-Philipp Müller
181db09d90 asfdemux: nicer metadata extraction of genre tags in some cases
Handle pseudo-strings like "(5)" and map them to the ID3v1 genre
that they presumably stand for.
2009-06-05 01:51:20 +01:00
Tim-Philipp Müller
2aeecee037 asfdemux: parse WM/Picture tags to extract cover art
Fixes #583112.
2009-06-05 01:37:54 +01:00
Tim-Philipp Müller
7c40c99238 asfdemux: fix bogus flow return handling in eos handler
Don't overwrite the origin flow return by whatever flow we get
when trying to push the remaining internally queued payloads.
We want to do our eos logic, ie. send an EOS event or segment-done
message in any case. Makes things EOS properly when an EOS event
is forced upon the pipeline so that the source returns
FLOW_UNEXPECTED to a pulling asfdemux. Should fix #582056.
2009-05-30 13:08:15 +01:00
Jan Schmidt
81b3c01d04 dvdlpcmdec: Add multichannel channel maps, and send some tags
Add a multichannel map to the output caps, and send at least a CODEC and
BITRATE tag. I'm not too sure about the 5.1 and 7.1 channel maps. I have
no samples and can't find info about the channel ordering, but this is
better than nothing.
2009-05-27 00:31:35 +01:00
Jan Schmidt
71325aa00a dvdsubdec: Remove some dead code
Remove some redundant memset - gobject memory is already initalised to 0.
Remove a commented out line leftover from the previous commit
2009-05-21 15:18:06 +01:00
Kapil Agrawal
59bd88e4bd dvdsubdec: Support ARGB output
Negotiate to and render into ARGB buffers directly if the peer supports it.
Fixes: #580869
2009-05-21 14:20:22 +01:00
Edward Hervey
f6f09cbb0a asfdemux: Downgrade simple statements from WARNING to DEBUG 2009-05-12 11:57:04 +02:00
Edward Hervey
61c00741a2 asf: Detect more payload extensions.
These should help fix interlaced/PAR issues with more files.
2009-05-12 11:53:45 +02:00
Tim-Philipp Müller
674323b56d mpegaudioparse: remove some pointless g_return_if_fail()s 2009-05-09 10:57:34 +01:00
Mark Nauwelaerts
e8a6ad2546 asfdemux: use upstream segment and timestamps for some interpolation
This should particularly help in case of upstream live src, e.g. rtspsrc,
and especially so if it has to perform fallback to TCP.
2009-05-07 12:23:51 +02:00
Edward Hervey
71da4cc7ae rtpasfdepay: Add support for fragmented packet (L == 0).
This happens with rtp-over-udp.
2009-05-07 12:39:00 +02:00
Jan Schmidt
b18371c1ca mp3parse: Don't reject valid Xing tables of contents
Some Xing headers apparently start the TOC at byte 1 instead of 0. Don't
reject them because of it, just subtract the initial offset when reading
the table.
2009-05-06 15:37:44 +01:00
Jan Schmidt
85a88a0a64 mp3parse: Allow more bits to change in headers during resynch
Be more lenient about what we accept as changing bits in a header - basically,
only require that the mp3 sync marker is present, for the mpeg version,
layer and samplerate.

Fixes: #581464
2009-05-06 15:27:01 +01:00
Edward Hervey
c1953235fa mpegaudioparse: Remove useless checks for valid buffer duration.
The buffer duration is set to a valid value at the very top of
emit_frame(), we therefore don't need to check it later on.
2009-05-06 13:15:30 +02:00
Edward Hervey
21d2fffb13 mpegaudioparse: Fix stop condition for outputting buffers.
Some mp3 streams have an offset in timestamps, requiring us to push the
frame *AFTER* segment.stop in order for the decoder to be able to push
all data up to the segment.stop position.
2009-05-06 13:13:35 +02:00
Mark Nauwelaerts
8b2812ca2e asfdemux: 0-base timestamps consistently (whether or not streaming)
This also makes timestamps (more) consistent before and after a possible
seek, and moreover makes for reasonable position reporting in live stream
(whose payload timestamps should not be taken for granted).
2009-05-05 22:41:41 +02:00
Mark Nauwelaerts
0b28139203 asfdemux: report initial latency due to internal preroll queue 2009-05-05 22:41:39 +02:00
Mark Nauwelaerts
c2d092765a asfdemux: enhance debug statement and refactor some initialization 2009-05-05 22:41:37 +02:00
Mark Nauwelaerts
b8297952cf asfdemux: handle FIXME; activate pads after internal preroll also when streaming 2009-05-05 22:41:35 +02:00
Mark Nauwelaerts
44ebe58377 asfdemux: handle FIXME; normalize preroll 2009-05-05 22:41:33 +02:00
Mark Nauwelaerts
b6d4fb9e4f asfdemux: fixes for streaming mode
* Improve newsegment handling, e.g. upstream might live in TIME.
* Only send newsegment if we have needed info.
* Avoid reading past end of data section.
2009-05-05 22:41:30 +02:00
Mark Nauwelaerts
2bd14c7153 asfdemux: fixes/enhancements for streaming mode
* Do not rock the boat by reacting to FLUSH_START.
* Try to handle TIME seeking by seeking upstream in BYTES.
* Handle SEEKING query.
2009-05-05 22:41:26 +02:00
Edward Hervey
804f65e6db asfpacket: Fix pull-mode timestamping handling.
The problem that happens is the following:
* A packet with multiple payloads comes in
* Those payloads get handled one by one
* The first payload contains the first audio payload with timestamp A
* The second payload contains the first video (key)frame with timestamp V (where V < A)

With the previous code, the following would happen:
* the first payload gets processed, then passed to queue_for_stream
* queue_for_stream detects it's the first valid timestamp received and stores
  first_ts = A
* the second payload gets processed, then pass to queue_for_stream
* queue_for_stream detects the timestamp is lower than first_ts... and
  discards it... resulting in losing the first keyframe of the video stream

We've been having this issue for *ages*... it's just that nobody noticed it
that much with playbin. But with playbin2's aggresive multiqueue handling, this
will result in multiqueue not being able to preroll (because the video decoder will
be dropping a ton of buffers before (maybe) receiving the next keyframe).

Tested with over 200 asf files, and they all play the first frame correctly now,
even the most braindead ones.
2009-04-23 09:04:41 +02:00
Michael Smith
e7450c2df7 mp3parse: don't build seek table if we can't seek.
Fixes #573720 - unbounded memory usage increase when listening to mp3
stream for a long time.
2009-04-21 14:16:52 -07:00
Edward Hervey
8dcbcd6645 mpegaudioparse: Remove dead assignment and duplicate code 2009-04-21 20:37:20 +02:00
Edward Hervey
29b34e049c rmdemux: Actually return the return value for the seek handling. 2009-04-21 20:37:19 +02:00
Edward Hervey
df349f9359 mpegstream: Remove dead assignments.
The duplicate assignment of update_time was weird... but it seems normal
that it's indeed the second statement which is the valid one.
2009-04-21 20:37:19 +02:00
Edward Hervey
fe68ecd653 dvdsub/mpegstream: _class_init: Remove unused class variables 2009-04-21 20:15:56 +02:00
Edward Hervey
bb6697ba4c asfdemux: Initialize flow for a corner case.
This might be caused by entering the if() line 1214 and then not having
any activated_streams.. resulting in reaching line 1267 without having
any valid flow value.
2009-04-19 14:03:58 +02:00
Edward Hervey
c1cd90eb57 rmdemux: Remove dead assignment, value is being overwritten before being read. 2009-04-19 13:59:24 +02:00
Edward Hervey
2a892f5856 rmdemux: Remove unused accurate flag.
I couldn't see any reason why this was there in the first place.
2009-04-19 13:58:31 +02:00
Edward Hervey
2190ad3962 realmedia: Remove dead assignments. The results are never read. 2009-04-19 13:57:59 +02:00
Edward Hervey
0d32a3703d realmedia: Remove useless variables, only being used once (or not). 2009-04-19 13:57:10 +02:00
Edward Hervey
ac0e11e55c remove empty method implementations. 2009-04-19 13:55:24 +02:00
Josep Torra
9cd1fddf15 rtspwms: fix condition to detect extension commands for WMS
Reply with OK to the extension commands for WMS.
2009-04-18 08:12:08 +02:00
Josep Torra
8258daf87c realmedia: add special Real header to DESCRIBE message only for Real
servers

Add headers that are specific to real only if a real server had been
detected by the OPTIONS message.
2009-04-15 11:09:56 +02:00
David Hoyt
3743c83ace synaesthesia: fix compilation on windows
Fix compilation under MSVC due to references to headers
that are not available with the MS SDKs.
Fixes #578524
2009-04-14 19:16:46 +02:00
Wim Taymans
ef31993f34 rtspwms: reply to extension commands
Reply with OK to the extension commands for WMS.
2009-04-14 10:54:37 +02:00
Wim Taymans
4203f7189c asfdepay: fix a comment 2009-04-14 10:53:51 +02:00
Wim Taymans
2377053422 asfdemux: add some more debugging 2009-04-14 10:53:33 +02:00
Tim-Philipp Müller
18e79995af realmedia: add special Real header to SETUP message only for Real servers
Fixes playback of Windows Media RTSP streams and other non-Real RTSP
streams where the server errors out because it can't handle the
Real-specific 'Required: com.real.retain-entity-for-setup' header
we've been adding unconditionally in the recent past.

For reference:
rtsp://66.111.34.191:601/broadcast/alnour.rm
rtsp://195.134.224.231/snowboard_100.wmv
2009-04-09 20:21:46 +01:00
Michael Smith
6b9c72619a asfdemux: link to all required libraries including indirectly used ones.
On win32, we're required to link to all the libraries used - including
ones only indirectly used by other libs. So, add gstaudio, gsttag, and
(for windows only) winsock.
2009-04-08 11:44:53 -07:00
Edward Hervey
5b045e7eac dvdlpcmdec: Fix factory klass, It's a 'Decoder', not a 'Demuxer'. 2009-03-26 20:23:14 +01:00
Wim Taymans
1731c58b9b realrtsp: add more headers
Parse the ETag from the describe method and pass the sessionid as the value for
the If-Match header is subsequent setup calls.
Fixes support for more RealMedia RTSP streams.
2009-03-25 16:39:06 +01:00
Jan Schmidt
d2c6f0b2b6 mp3parse: Fix glitches in the output when playing (for e.g.) AVI
Don't introduce glitches in the output by a) relaxing the threshold for
taking upstream timestamps in preference to our calculated timestamps and
b) only set the discont flag on outgoing buffers in response to an incoming
discont buffer.

Fixes: #575046
2009-03-13 19:25:12 +00:00
Alessandro Decina
abf7f47769 mp3parse: fix deadlock with accurate seeks.
Release pending_accurate_seeks_lock before forwarding the seek event upstream.
Fixes #575068.
2009-03-12 15:57:31 +01:00
Michael Smith
777eb4d9cc mp3parse: be more conservative when changing layer/rate/etc.
Don't allow a change in sample rate/channels/layer/version unless we can
see another frame at the correct offset. Prevents accidently flipping
due to simple single-bit corruption.
2009-03-06 13:21:36 -08:00
Jan Schmidt
b510f2ab6b rmdemux: Fix strict-aliasing warnings.
Use existing GST_READ_UINT32 and GST_WRITE_UINT32 macros instead of
hand-rolled ones.
2009-03-04 16:52:59 +00:00
René Stadler
be6292d4de mpegaudioparse: Remove empty lines added by buggy indent. 2009-03-04 16:17:06 +02:00
Mark Nauwelaerts
d950699d2e mpegaudioparse: Provide SEEKING query handling.
Since SEEK event handling might perform some conversion
from TIME to BYTES, do not let upstream fool application
into (TIME) seeking not being possible.
2009-02-27 14:58:21 +01:00
Michael Smith
d61498d842 mp3parse: fix accurate seeks to near 0
Integer underflow made accurate seeks to near zero fail and seek to
completely the wrong place. Fix by clamping to zero, since we can't seek
to negative times anyway.
2009-02-25 13:34:05 -08:00
Wim Taymans
d99f4c9756 rtspreal: ignore data streams. Fixes #527112
Ignore data streams when parsing the SDP as they don't contain anything we need
to put in the realmedia header.
2009-02-25 18:23:55 +01:00
Stefan Kost
e12ccaa63c rtpasfdepay: Fix the build by adding the needed include for atoi. 2009-02-23 10:50:50 +02:00
Edward Hervey
96d35e0819 Fix indentation. 2009-02-22 14:22:30 +01:00
Edward Hervey
52e30c1b33 pnmsrc: Error out gracefully if location is NULL. Run gst-indent 2009-02-22 14:21:22 +01:00