Commit Graph

61 Commits

Author SHA1 Message Date
ejurgensen 6221e24f1b Support for live ICY metadata for streams (incl. artwork) 2015-03-14 21:42:53 +01:00
ejurgensen 2879458e98 Fix for issue #62 (slow internet streams), credit @chme 2015-01-02 23:24:44 +01:00
ejurgensen a69619a5a7 Implement is_remote() and change how transcode_needed() is used
transcode_needed() was getting called needlessly in http_daapd.c,
because 1) once it is determined that a given codec needs transcoding
for a given client there is no reason to call and check again, 2)
transcoding is irrelevant for remotes. Also some cleaning up of
user_agent_filter().
2014-12-28 23:37:12 +01:00
chme 7889d92a81 Identify "android" user-agent as a remote client in transcode_needed()
(similar to the check in user_agent_filter())
2014-12-28 09:37:19 +01:00
ejurgensen 88fcfa061d Add compability with ffmpeg's libswresample 2014-10-02 22:48:50 +02:00
ejurgensen cf091e8d8b Adjust daapcache so it serves User-Agent to httpd_daap's reply handlers 2014-08-23 00:02:01 +02:00
ejurgensen 17ffdc56ad Fix bug where streams with sample rate < 44100 stop too early (with libav 10+)
- avresample_convert should be passed max samples to convert, not
number of samples in input (which for low sample rates is lower
than output)
2014-07-06 23:31:20 +02:00
ejurgensen 2247fadbfa Some preprocessor conditions for compability on OpenWrt 2014-06-16 23:31:44 +02:00
ejurgensen 687f349927 Let configure check libevent version and include according to version 2014-03-13 23:33:35 +01:00
ejurgensen 7ed6cc98c3 Add support for Spotify (squashed commit), and:
- Try to not return items which a client can't play
    - Remove inotify subscription to IN_MODIFY and IN_CREATE
    - Fix crash on unknown codec type in transcode.c
    - Probably added some new bugs...
2014-03-11 23:20:29 +01:00
ejurgensen 7997377deb Adjust for libav 10 API
With libav 10 the API is (again...) changed, adjust for that and
add the appropriate version conditions
2014-02-17 23:05:24 +01:00
Justin Maggard f9a76aeb1a Add User-Agent detection for iTunes video playback on OSX
iTunes on OSX has a different User-Agent when playing back video
files.  Detect this so we can deterimine his codec support.
2014-02-05 17:34:27 -08:00
ejurgensen 785383861b ffmpeg/libav conditions for CodecID and AVCODEC_MAX_AUDIO_FRAME_SIZE (thanks @freultwah) 2014-01-27 21:24:08 +01:00
ejurgensen 5d6d7c7f82 Only allocate transcode resample buffer once, but make it large 2014-01-19 23:27:39 +01:00
ejurgensen c2c072eb58 Plug bad mem leak if using libavcodec 54.35 (libav9) or above 2014-01-19 23:09:40 +01:00
ejurgensen efd4d56de5 Fix a few missing libav conditions 2014-01-06 21:41:30 +01:00
ejurgensen edaa8fe4f2 Add libav version conditions 2014-01-02 22:49:18 +01:00
ejurgensen 21584fa1ff Minor adjustment of log message in transcode.c 2013-12-30 23:47:41 +01:00
ejurgensen 8663641e84 Account for no channel_layout (resample) + add free decode frame 2013-12-30 23:16:30 +01:00
ejurgensen 3a8936cd26 Change to libav 9 resampling (avresample)
Some of the previous libav stuff removed, re-add later
2013-12-30 13:03:53 +01:00
ejurgensen 73b2d08400 Rework of transcode.c for libav 9. Resampling is broken in this commit. 2013-12-30 00:40:16 +01:00
ejurgensen 0fd65b285d Fix some ffmpeg/libav compiler conditions 2013-11-25 19:43:17 +01:00
ejurgensen dea8d02c76 Downgrade log message severity 2013-11-23 11:04:10 +01:00
ejurgensen 3471b6c147 Cleaning up deprecated ffmpeg/libav 2013-09-07 23:39:22 +02:00
ejurgensen c1c171e21f Include for av_rescale_q was missing
- and has been for a while, it seems
2013-09-04 22:33:47 +02:00
ejurgensen fa965dee75 Changed SAMPLE_FMT_S16 for ffmpeg 0.11 2013-05-24 20:33:26 +02:00
Julien BLACHE ed20d3f7de libav 0.7: use av_get_bytes_per_sample() instead of av_get_bits_per_sample_fmt() 2011-09-10 12:48:14 +02:00
Julien BLACHE dbe22c2c02 libav 0.7: use avformat_open_input() instead of av_open_input_file() 2011-09-10 12:48:14 +02:00
Julien BLACHE b1d31feb53 libav 0.7: Switch from av_get_bits_per_sample_format() to ..._fmt() 2011-06-02 22:16:52 +02:00
Julien BLACHE ecf064082f libav 0.7: Use skip_frame instead of hurry_up 2011-06-02 22:16:52 +02:00
Julien BLACHE b203f1ea1f libav 0.7: Replace CODEC_TYPE_* with AVMEDIA_TYPE_* 2011-06-02 22:09:42 +02:00
Julien BLACHE ec5ace7dc9 Reset hurry_up to 0 after we acquired a frame with known PTS 2011-06-02 22:06:44 +02:00
Julien BLACHE 67daf3259a Use avcodec_decode_audio3() when available (FFmpeg 0.6) 2011-02-23 18:26:42 +01:00
Julien BLACHE 75fb755db7 Assign ms to target_pts to ensure full 64bit computation of target_pts
Clang produced interesting results without this (or casting ms to int64_t),
as the seek target got mis-computed and fell short of the requested seek
target in ms (ex. wanted 18569 ms -> got 555 ms).
2010-09-13 22:06:53 +02:00
Julien BLACHE 115ded61d0 Move code around, no functional changes
Assign start_time right at the start, making the target_pts computation more
obvious wrt start_time and showing the symmetry of the target_pts and got_pts
computations.
2010-09-13 22:06:52 +02:00
Julien BLACHE d1af41f0e7 Fix got_pts computation wrt start_time
Substract start_time from got_pts after actually getting got_pts, and then
rescale the result.
2010-09-13 22:06:12 +02:00
Julien BLACHE 17daace67f Add seek support to transcode 2010-05-02 11:21:08 +02:00
Julien BLACHE 9fb7ec8e5c Make the WAV header optional 2010-05-02 11:21:08 +02:00
Julien BLACHE 5475c18308 Remove FLAC-specific raw mode
Older versions of ffmpeg did not support raw FLAC streams properly and needed
to be fed the raw stream manually; looks like it's been fixed in ffmpeg 0.5.
2010-03-28 16:19:30 +02:00
Julien BLACHE 887d1bf5ca Small clarification in transcode_cleanup() 2010-03-28 16:14:36 +02:00
Julien BLACHE d71fa2b72e Replace av_read_packet() (obsolete) by av_read_frame()
Fixes MP3 playback, probably others too.
2010-03-25 20:28:23 +01:00
Julien BLACHE 19b6780a3c Remove provisions for multi-library support
It is now clear that multi-library support will not happen, so remove whatever
provisions were in the code for that.

It comes with a small change to the configuration file, too.

With this, DB schema version went to 9.
2010-03-19 19:09:18 +01:00
Julien BLACHE d6285eef40 Add audio resampling to the audio decoding code
Transcoded (decoded) files will now always come out in signed, little endian,
16bit, 44100 Hz, stereo format regardless of the format of the input file.

This in effect fixes transcoding (and playback on some devices) for files that
do not match this format.

There's probably a discussion to be had regarding handling of 48 kHz and 96 kHz
content, though, as downsampling to 44.1 kHz to have the client or final output
device upsample again is clearly not an optimal solution.
2010-03-15 18:38:33 +01:00
Julien BLACHE 8375ac75ca Rework error handling in transcode_setup()
Add the setup_fail_codec label and jump to it if an error occurs once the
codec has been opened. In the raw input codepath, don't use this label until
the file is properly opened, as it also closes the fd and frees the raw
buffer.

This also fixes a file descriptor leak in the case where an error happened
after the file was opened in the raw input codepath.
2010-03-15 18:35:29 +01:00
Julien BLACHE db0690afa1 Use int16_t for decoded audio data buffers 2010-03-15 18:34:14 +01:00
Julien BLACHE a5a46b8a53 Fix lseek() return value handling
lseek() returns an off_t and not an int, using an int to store and
test the return value means we'll error out when the position in the file
gets past INT_MAX.
2010-02-10 18:19:32 +01:00
Julien BLACHE 58faeaceca Integer types cleanup
Try to be a bit more strict about integer types, use off_t or int64_t for
file size and file offsets.

Replace safe_ato*() by safe_atoi32() and safe_atoi64(), fix integer types
at call sites to match.
2010-02-02 21:09:56 +01:00
Julien BLACHE dd1712abdc Use glibc endianness-related headers if available
BSD headers aren't working properly on kFreeBSD, so use the glibc ones.
2010-01-17 10:52:58 +01:00
Julien BLACHE 79cdb4f9aa Make forked-daapd build on GNU/kFreeBSD 2010-01-10 17:49:01 +01:00
Julien BLACHE 3724f943b9 Use sys/endian.h on FreeBSD 2010-01-09 13:42:59 +01:00