Commit Graph

134 Commits

Author SHA1 Message Date
ejurgensen
1e3df5ba52 [-] Add forgotten type in err2str() 2016-10-11 21:32:16 +02:00
ejurgensen
e5d328061b [logger] Be better at logging ffmpeg/libav error messages 2016-09-25 22:01:07 +02:00
ejurgensen
1fbb4b0d59 [transcode] Fix problem for file types where ffmpeg decode returns 0
It seems ffmpeg/libav reads a file type like Monkey's audio in large
chunks, so that each packet must be passed to the decoder multiple
times. The decoder will return 0 until the packet is completed. This
change makes forked-daapd able to deal with a return value of 0.
2016-05-06 00:23:07 +02:00
ejurgensen
42e68311eb [transcode] Increase read timeout slightly 2016-03-25 20:56:08 +01:00
ejurgensen
7d1d52e8f0 [transcode] Fix missing channel number for newer ffmpeg (closes #241) 2016-03-20 19:22:16 +01:00
ejurgensen
73cddbb9de [transcode] Fix type of stream_index so the tests make sense 2016-02-06 19:51:13 +01:00
ejurgensen
0d55e055c0 [ffmpeg] Update most deprecated functions 2016-01-05 23:22:01 +01:00
ejurgensen
7caf8cc66a [artwork] Add ability to rescale Spotify (should improve caching so we don't save too large images) 2016-01-05 21:44:44 +01:00
ejurgensen
93a6765c8c [transcode] Fix freeze problem where av_read_frame would block on broken connections 2015-12-09 20:00:09 +01:00
ejurgensen
7894a4d85f [transcode] Don't push NULL frames to filtergraph when flushing, can lead to segfault 2015-10-25 19:59:06 +01:00
ejurgensen
3e80e5c517 [transcode] Don't pass error to player on eof + some comments and cleaning 2015-10-22 22:09:19 +02:00
ejurgensen
e20d2c544d [transcode] Comments and raise MAX_BAD_PACKETS to 5 2015-10-22 21:01:43 +02:00
ejurgensen
058b2fb0d6 [transcode] Improve decoding to allow for decoder special cases, like decoders not processing
entire packets, rejecting packets and not returning frames. Should fix issue with network
streams not opening.
2015-10-21 23:53:21 +02:00
ejurgensen
2a610812a5 Refactor transcode.c so it can actually transcode + use new capability to support mp3 streaming.
Also includes the skeleton for perhaps supporting video in the future. Adds more fine-grained
ffmpeg/libav compability checks. Dependency on libavresample/libswresample exchanged with
dependency on libavfilter, which seems more versatile.
2015-10-09 23:58:27 +02:00
chme
e1147c00a1 [player] Refactor player to better fit the queue refactor 2015-10-04 07:59:58 +02:00
ejurgensen
68912efa1f Enable resuming playback from saved position for certain media kinds (eg audiobooks) 2015-08-04 22:33:32 +02:00
chme
659f9c09bb Use enum values for data_kind and media_kind 2015-04-23 11:34:44 +02:00
ejurgensen
99cda05dab Remove player metadata event timer (use the existing instead) 2015-04-11 20:30:31 +02:00
ejurgensen
e72447954a Some cleaning up of ICY artwork retrieval 2015-04-09 22:22:42 +02:00
ejurgensen
56ece92209 Remember to actually request ICY metadata in transcode.c 2015-04-02 00:09:12 +02:00
ejurgensen
e49c941a00 Add a worker thread to support async tasks from the player thread
(and maybe others later)
2015-03-31 23:05:24 +02:00
ejurgensen
a529d78880 Don't crash on no metadata... 2015-03-29 20:16:56 +02:00
ejurgensen
b8d8df132b Support for remote m3u playlists (ref pr #79) 2015-03-20 23:40:42 +01:00
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
Julien BLACHE
974a74a833 Update copyright notices for 2010 2010-01-05 19:34:00 +01:00
Ace Jones
040e760789 Add support for Remote, the iPhone remote control for iTunes
Remote needs the same DAAP query quirk as iTunes and supports the
same codecs.
2009-12-30 18:49:52 +01:00
Julien BLACHE
df2cbea9b2 Add supported codec list for Front Row and QuickTime
Patch from Ace Jones <ace.jones1@yahoo.com>.
2009-12-08 20:45:57 +01:00
Julien BLACHE
8f07db5c10 Add support for FLAC files with ID3v2 tags.
Patch from Wolfgang Holler <woelfs@googlemail.com>.
2009-11-18 20:14:03 +01:00
Julien BLACHE
11909725e2 Use ffmpeg's memory allocator for transcode buffer
ffmpeg's allocator ensures the allocated memory is properly aligned for
any kind of optimized operation used in ffmpeg.
2009-07-24 08:19:31 +02:00
Julien BLACHE
2323fd302c Fix memory leak (transcode buffer) 2009-07-24 08:18:53 +02:00
Julien BLACHE
a200703393 Switch to the new database code 2009-06-10 19:04:18 +02:00
Julien BLACHE
11fd038d16 Use new logger facility 2009-05-09 17:14:06 +02:00
Julien BLACHE
10bb9dec57 Remove useless daapd.h 2009-05-05 16:22:11 +02:00
Julien BLACHE
e4fe084619 Use embedded evhttp 2009-05-03 11:16:57 +02:00
Julien BLACHE
2c2498b6b4 Add transcoding infrastructure 2009-05-03 11:16:57 +02:00