summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/ai_alsa.c184
-rw-r--r--stream/asf_streaming.c4
-rw-r--r--stream/pnm.c8
-rw-r--r--stream/realrtsp/real.c14
-rw-r--r--stream/realrtsp/rmff.c3
-rw-r--r--stream/stream.c6
-rw-r--r--stream/stream_dvd_common.c7
-rw-r--r--stream/stream_ffmpeg.c4
-rw-r--r--stream/vcd_read.h4
-rw-r--r--stream/vcd_read_fbsd.h4
10 files changed, 31 insertions, 207 deletions
diff --git a/stream/ai_alsa.c b/stream/ai_alsa.c
deleted file mode 100644
index c5e2f3f623..0000000000
--- a/stream/ai_alsa.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <alloca.h>
-
-#include "config.h"
-
-#include <alsa/asoundlib.h>
-#include "audio_in.h"
-#include "mp_msg.h"
-
-int ai_alsa_setup(audio_in_t *ai)
-{
- snd_pcm_hw_params_t *params;
- snd_pcm_sw_params_t *swparams;
- int buffer_size;
- int err;
- unsigned int rate;
-
- snd_pcm_hw_params_alloca(&params);
- snd_pcm_sw_params_alloca(&swparams);
-
- err = snd_pcm_hw_params_any(ai->alsa.handle, params);
- if (err < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available.\n");
- return -1;
- }
- err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- if (err < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Access type not available.\n");
- return -1;
- }
- err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
- if (err < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Sample format not available.\n");
- return -1;
- }
- err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
- if (err < 0) {
- ai->channels = snd_pcm_hw_params_get_channels(params);
- mp_tmsg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n",
- ai->channels);
- } else {
- ai->channels = ai->req_channels;
- }
-
- err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, ai->req_samplerate, 0);
- assert(err >= 0);
- rate = err;
- ai->samplerate = rate;
-
- ai->alsa.buffer_time = 1000000;
- ai->alsa.buffer_time = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params,
- ai->alsa.buffer_time, 0);
- assert(ai->alsa.buffer_time >= 0);
- ai->alsa.period_time = ai->alsa.buffer_time / 4;
- ai->alsa.period_time = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params,
- ai->alsa.period_time, 0);
- assert(ai->alsa.period_time >= 0);
- err = snd_pcm_hw_params(ai->alsa.handle, params);
- if (err < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install hardware parameters: %s");
- snd_pcm_hw_params_dump(params, ai->alsa.log);
- return -1;
- }
- ai->alsa.chunk_size = snd_pcm_hw_params_get_period_size(params, 0);
- buffer_size = snd_pcm_hw_params_get_buffer_size(params);
- if (ai->alsa.chunk_size == buffer_size) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
- return -1;
- }
- snd_pcm_sw_params_current(ai->alsa.handle, swparams);
- err = snd_pcm_sw_params_set_sleep_min(ai->alsa.handle, swparams,0);
- assert(err >= 0);
- err = snd_pcm_sw_params_set_avail_min(ai->alsa.handle, swparams, ai->alsa.chunk_size);
- assert(err >= 0);
-
- err = snd_pcm_sw_params_set_start_threshold(ai->alsa.handle, swparams, 0);
- assert(err >= 0);
- err = snd_pcm_sw_params_set_stop_threshold(ai->alsa.handle, swparams, buffer_size);
- assert(err >= 0);
-
- assert(err >= 0);
- if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install software parameters:\n");
- snd_pcm_sw_params_dump(swparams, ai->alsa.log);
- return -1;
- }
-
- if (mp_msg_test(MSGT_TV, MSGL_V)) {
- snd_pcm_dump(ai->alsa.handle, ai->alsa.log);
- }
-
- ai->alsa.bits_per_sample = snd_pcm_format_physical_width(SND_PCM_FORMAT_S16_LE);
- ai->alsa.bits_per_frame = ai->alsa.bits_per_sample * ai->channels;
- ai->blocksize = ai->alsa.chunk_size * ai->alsa.bits_per_frame / 8;
- ai->samplesize = ai->alsa.bits_per_sample;
- ai->bytes_per_sample = ai->alsa.bits_per_sample/8;
-
- return 0;
-}
-
-int ai_alsa_init(audio_in_t *ai)
-{
- int err;
-
- err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
- if (err < 0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
- return -1;
- }
-
- err = snd_output_stdio_attach(&ai->alsa.log, stderr, 0);
-
- if (err < 0) {
- return -1;
- }
-
- err = ai_alsa_setup(ai);
-
- return err;
-}
-
-#ifndef timersub
-#define timersub(a, b, result) \
-do { \
- (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
- (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
- if ((result)->tv_usec < 0) { \
- --(result)->tv_sec; \
- (result)->tv_usec += 1000000; \
- } \
-} while (0)
-#endif
-
-int ai_alsa_xrun(audio_in_t *ai)
-{
- snd_pcm_status_t *status;
- int res;
-
- snd_pcm_status_alloca(&status);
- if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res));
- return -1;
- }
- if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
- struct timeval now, diff, tstamp;
- gettimeofday(&now, 0);
- snd_pcm_status_get_trigger_tstamp(status, &tstamp);
- timersub(&now, &tstamp, &diff);
- mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n",
- diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
- if (mp_msg_test(MSGT_TV, MSGL_V)) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA Status:\n");
- snd_pcm_status_dump(status, ai->alsa.log);
- }
- if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
- mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res));
- return -1;
- }
- return 0; /* ok, data should be accepted again */
- }
- mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA read/write error");
- return -1;
-}
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index 73197f4f54..8c747abfdf 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -23,6 +23,8 @@
#include <errno.h>
#include <limits.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
#include "mp_msg.h"
#include "options.h"
@@ -41,8 +43,6 @@
#include "network.h"
#include "tcp.h"
-#include "ffmpeg_files/intreadwrite.h"
-
#include "libmpdemux/asfguid.h"
extern int network_bandwidth;
diff --git a/stream/pnm.c b/stream/pnm.c
index 46c22361d9..b1baad70a3 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -23,8 +23,6 @@
* based upon code from joschka
*/
-#include "config.h"
-
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
@@ -35,6 +33,10 @@
#include <stdlib.h>
#include <sys/time.h>
#include <inttypes.h>
+
+#include <libavutil/intreadwrite.h>
+
+#include "config.h"
#if !HAVE_WINSOCK2_H
#include <sys/socket.h>
//#include <netinet/in.h>
@@ -43,8 +45,6 @@
#include <winsock2.h>
#endif
-#include "ffmpeg_files/intreadwrite.h"
-
#include "stream.h"
#include "libmpdemux/demuxer.h"
#include "osdep/timer.h"
diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c
index 3d06b4d667..daee0cd34a 100644
--- a/stream/realrtsp/real.c
+++ b/stream/realrtsp/real.c
@@ -30,18 +30,18 @@
#include <stdio.h>
#include <string.h>
+#include <libavutil/common.h>
+#include <libavutil/attributes.h>
+#include <libavutil/md5.h>
+#include <libavutil/intreadwrite.h>
+#include <libavutil/base64.h>
+#include <libavutil/avutil.h>
+
#include "config.h"
-#include "libavutil/common.h"
-#include "libavutil/attributes.h"
#include "real.h"
#include "asmrp.h"
#include "sdpplin.h"
#include "xbuffer.h"
-#include "libavutil/md5.h"
-#include "ffmpeg_files/intreadwrite.h"
-#include "libavutil/base64.h"
-
-#include <libavutil/avutil.h>
#include "stream/http.h"
#include "mp_msg.h"
diff --git a/stream/realrtsp/rmff.c b/stream/realrtsp/rmff.c
index d538222141..d85e696727 100644
--- a/stream/realrtsp/rmff.c
+++ b/stream/realrtsp/rmff.c
@@ -26,10 +26,11 @@
* adopted from joschkas real tools
*/
+#include <libavutil/intreadwrite.h>
+
#include "rmff.h"
#include "xbuffer.h"
#include "mp_msg.h"
-#include "ffmpeg_files/intreadwrite.h"
/*
#define LOG
diff --git a/stream/stream.c b/stream/stream.c
index 99225ca3b4..772c87dd9c 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -30,6 +30,9 @@
#include <strings.h>
#include <assert.h>
+#include <libavutil/intreadwrite.h>
+#include <libavutil/common.h>
+
#include "talloc.h"
#include "config.h"
@@ -38,15 +41,12 @@
#include <winsock2.h>
#endif
-#include <libavutil/common.h>
-
#include "mp_msg.h"
#include "osdep/shmem.h"
#include "osdep/timer.h"
#include "network.h"
#include "stream.h"
#include "libmpdemux/demuxer.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "m_option.h"
#include "m_struct.h"
diff --git a/stream/stream_dvd_common.c b/stream/stream_dvd_common.c
index b2f3a14fee..db566e5136 100644
--- a/stream/stream_dvd_common.c
+++ b/stream/stream_dvd_common.c
@@ -16,13 +16,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
#include <fcntl.h>
#include <inttypes.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <libavutil/intreadwrite.h>
+
+#include "config.h"
+
#include <dvdread/ifo_types.h>
+
#ifdef __FreeBSD__
#include <sys/cdrio.h>
#endif
@@ -37,7 +41,6 @@
#include "mp_msg.h"
#include "stream_dvd_common.h"
-#include "ffmpeg_files/intreadwrite.h"
const char * const dvd_audio_stream_types[8] = { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" };
const char * const dvd_audio_stream_channels[6] = { "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" };
diff --git a/stream/stream_ffmpeg.c b/stream/stream_ffmpeg.c
index 74e9db791c..a76b9e5f3b 100644
--- a/stream/stream_ffmpeg.c
+++ b/stream/stream_ffmpeg.c
@@ -101,9 +101,9 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
int dummy;
if (mode == STREAM_READ)
- flags = URL_RDONLY;
+ flags = AVIO_FLAG_READ;
else if (mode == STREAM_WRITE)
- flags = URL_WRONLY;
+ flags = AVIO_FLAG_WRITE;
else {
mp_msg(MSGT_OPEN, MSGL_ERR, "[ffmpeg] Unknown open mode %d\n", mode);
res = STREAM_UNSUPPORTED;
diff --git a/stream/vcd_read.h b/stream/vcd_read.h
index 8b8d2ab817..ed435e3317 100644
--- a/stream/vcd_read.h
+++ b/stream/vcd_read.h
@@ -23,9 +23,11 @@
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
+
+#include <libavutil/intreadwrite.h>
+
#include "mp_msg.h"
#include "stream.h"
-#include "ffmpeg_files/intreadwrite.h"
//=================== VideoCD ==========================
#if defined(__linux__) || defined(sun) || defined(__bsdi__)
diff --git a/stream/vcd_read_fbsd.h b/stream/vcd_read_fbsd.h
index 8a59a2a8ee..406cb902da 100644
--- a/stream/vcd_read_fbsd.h
+++ b/stream/vcd_read_fbsd.h
@@ -24,9 +24,11 @@
#include <sys/types.h>
#include <inttypes.h>
#include <unistd.h>
-#include "ffmpeg_files/intreadwrite.h"
#include <sys/cdio.h>
#include <sys/ioctl.h>
+
+#include <libavutil/intreadwrite.h>
+
#if defined(__NetBSD__) || defined(__OpenBSD__)
#define VCD_NETBSD 1
#endif