From e44f66afa165f7fe339e94fc5b54fabb2351730a Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 1 Feb 2010 09:24:32 +0000 Subject: misc fixes git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30480 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Changelog | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Changelog b/Changelog index 4418beb246..f806eae23a 100644 --- a/Changelog +++ b/Changelog @@ -5,25 +5,25 @@ MPlayer (1.0) * YUY2 Lossless Codec (YLC0) via binary DLL * Truemotion RT codec (TR20) via binary DLL * Nogantech Codec (NTN1 and NTN2) via binary DLL - * add new FourCCs (m1v1,yuvs,VYUY,Y42B,V422,YUNV,UYNV,UYNY,uyv1,2Vu1,P422,HDYC, - IJLV,MVJP) - TwoCCs (0xA106,0x6c75,0xAAC0,0x55005354) + * add new FourCCs (m1v1, yuvs, VYUY, Y42B, V422, YUNV, UYNV, UYNY, uyv1, + 2Vu1, P422, HDYC, IJLV, MVJP) + TwoCCs (0xA106, 0x6c75, 0xAAC0, 0x55005354) to existing decoders. - * AMR now handled via opencore decoder - * updated Windoes Media Screen Codec (MSS1,MSS2) via binary DLL - * h264 decoder (CoreAVC) on Windows only via binary DLL + * AMR now handled via OpenCORE decoder + * updated Windows Media Screen Codec (MSS1, MSS2) via binary DLL + * CoreAVC H.264 decoder via binary DLL (Windows only) * Kega Game video codec (KGV1) via binary DLL - * SoftLab-NSK Forward MPEG2 I-frames (SLIF) via binary DLL - * JPEG2000 support via OpenJPEG + * SoftLab-NSK Forward MPEG-2 I-frames (SLIF) via binary DLL + * JPEG 2000 support via OpenJPEG Demuxers: - * support for TrueHD in BluRay streams in libmpdemux - * more BluRay codec support with lavf - * fix length in asf/wmv files - * support ISDB-Tb dvb streams + * support for TrueHD in Blu-ray streams in libmpdemux + * more Blu-ray codec support with lavf + * fix length in ASF/WMV files + * support ISDB-Tb DVB streams Drivers: - * Support for more formats in OpenGL vos (different YUV + * Support for more formats in OpenGL video output drivers (different YUV subsampling, 16 bit per component) * Selectable YUV to RGB conversion standard for -vo gl (-vo gl:colorspace=...:levelconv=...) @@ -31,16 +31,16 @@ MPlayer (1.0) Other: * -nosub option for disabling auto-selected subtitles - * support for displaying subs in the term (FIXME) - * support for subtitles with audio only files + * support for displaying subs in the terminal (FIXME) + * support for subtitles with audio-only files * support for right-to-left languages with embedded subtitles * support for 8 channel audio * sync dvd:// and dvdnav:// features - * support for mpeg4 asp in VDPAU video output (non B-frame only) + * support for MPEG-4 ASP in VDPAU video output (non B-frame only) * support for live and non-live DVB teletext with demuxer lavf * -name, -title and -use-filename-title options for MPlayer * support for stream handling via FFmpeg - Use e.g. ffmpeg://http://example.com/test + (use e.g. ffmpeg://http://example.com/test) * experimental support for external libass, configure with --disable-ass-internal * better support for 16-bit-per-component formats and formats -- cgit v1.2.3 From f275d3d32cfb72e7aa26ad74e99f008a0c9c4eff Mon Sep 17 00:00:00 2001 From: komh Date: Mon, 1 Feb 2010 14:09:53 +0000 Subject: Add OS/2 KAI audio driver support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30481 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Changelog | 1 + DOCS/man/en/mplayer.1 | 16 +++ Makefile | 1 + configure | 26 ++++ libao2/ao_kai.c | 331 ++++++++++++++++++++++++++++++++++++++++++++++++++ libao2/audio_out.c | 4 + 6 files changed, 379 insertions(+) create mode 100644 libao2/ao_kai.c diff --git a/Changelog b/Changelog index f806eae23a..e0c8e11aa2 100644 --- a/Changelog +++ b/Changelog @@ -28,6 +28,7 @@ MPlayer (1.0) * Selectable YUV to RGB conversion standard for -vo gl (-vo gl:colorspace=...:levelconv=...) * -vo matrixview finally added + * add OS/2 KAI audio driver (-ao kai) Other: * -nosub option for disabling auto-selected subtitles diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 600db5d0f0..d3b5703af2 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -2858,6 +2858,22 @@ Playing a file with \-v will show a list of available devices. .PD 1 . .TP +.B kai (OS/2 only) +OS/2 KAI audio output driver +.PD 0 +.RSs +.IPs uniaud +Force UNIAUD mode +.IPs dart +Force DART mode +.IPs (no)share +Open audio in shareable or exclusive mode. +.IPs bufsize= +Set buffer size to in samples (default: 2048). +.RE +.PD 1 +. +.TP .B dart (OS/2 only) OS/2 DART audio output driver .PD 0 diff --git a/Makefile b/Makefile index a3971dda5c..1d59ad44e7 100644 --- a/Makefile +++ b/Makefile @@ -590,6 +590,7 @@ SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c SRCS_MPLAYER-$(JOYSTICK) += input/joystick.c SRCS_MPLAYER-$(JPEG) += libvo/vo_jpeg.c +SRCS_MPLAYER-$(KAI) += libao2/ao_kai.c SRCS_MPLAYER-$(KVA) += libvo/vo_kva.c SRCS_MPLAYER-$(LIBAVCODEC) += libvo/vo_png.c SRCS_MPLAYER-$(LIBMENU) += libmenu/menu.c \ diff --git a/configure b/configure index 1c5f8090de..15a5745ddf 100755 --- a/configure +++ b/configure @@ -424,6 +424,7 @@ Audio output: --disable-nas disable NAS audio output [autodetect] --disable-sgiaudio disable SGI audio output [autodetect] --disable-sunaudio disable Sun audio output [autodetect] + --disable-kai disable KAI audio output [autodetect] --disable-dart disable DART audio output [autodetect] --disable-win32waveout disable Windows waveout audio output [autodetect] --disable-coreaudio disable CoreAudio audio output [autodetect] @@ -617,6 +618,7 @@ _arts=auto _esd=auto _pulse=auto _jack=auto +_kai=auto _dart=auto _openal=auto _libcdio=auto @@ -1010,6 +1012,8 @@ for ac_option do --disable-jack) _jack=no ;; --enable-openal) _openal=yes ;; --disable-openal) _openal=no ;; + --enable-kai) _kai=yes ;; + --disable-kai) _kai=no ;; --enable-dart) _dart=yes ;; --disable-dart) _dart=no ;; --enable-mad) _mad=yes ;; @@ -6021,6 +6025,26 @@ fi #if irix if os2 ; then +echocheck "KAI (UNIAUD/DART)" +if test "$_kai" = auto; then + cat > $TMPC << EOF +#include +#include +int main(void) { return 0; } +EOF + _kai=no; + cc_check -lkai && _kai=yes +fi +if test "$_kai" = yes ; then + def_kai='#define CONFIG_KAI 1' + libs_mplayer="$libs_mplayer -lkai" + _aomodules="kai $_aomodules" +else + def_kai='#undef CONFIG_KAI' + _noaomodules="kai $_noaomodules" +fi +echores "$_kai" + echocheck "DART" if test "$_dart" = auto; then cat > $TMPC << EOF @@ -8533,6 +8557,7 @@ IVTV = $_ivtv JACK = $_jack JOYSTICK = $_joystick JPEG = $_jpeg +KAI = $_kai KVA = $_kva LADSPA = $_ladspa LIBA52 = $_liba52 @@ -8972,6 +8997,7 @@ $def_dart $def_esd $def_esd_latency $def_jack +$def_kai $def_nas $def_openal $def_openal_h diff --git a/libao2/ao_kai.c b/libao2/ao_kai.c new file mode 100644 index 0000000000..a52b60e0b5 --- /dev/null +++ b/libao2/ao_kai.c @@ -0,0 +1,331 @@ +/* + * OS/2 KAI audio output driver + * + * Copyright (c) 2010 by KO Myung-Hun (komh@chollian.net) + * + * 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. + */ + +#define INCL_DOS +#define INCL_DOSERRORS +#include + +#include +#include +#include +#include + +#include + +#include "config.h" +#include "libaf/af_format.h" +#include "audio_out.h" +#include "audio_out_internal.h" +#include "mp_msg.h" +#include "libvo/fastmemcpy.h" +#include "subopt-helper.h" +#include "libavutil/fifo.h" + +static const ao_info_t info = { + "KAI audio output", + "kai", + "KO Myung-Hun ", + "" +}; + +LIBAO_EXTERN(kai) + +#define OUTBURST_SAMPLES 512 +#define DEFAULT_SAMPLES (OUTBURST_SAMPLES << 2) + +#define CHUNK_SIZE ao_data.outburst + +static AVFifoBuffer *m_audioBuf; + +static int m_nBufSize = 0; + +static volatile int m_fQuit = FALSE; + +static KAISPEC m_kaiSpec; + +static HKAI m_hkai; + +static int write_buffer(unsigned char *data, int len) +{ + int nFree = av_fifo_space(m_audioBuf); + + len = FFMIN(len, nFree); + + return av_fifo_generic_write(m_audioBuf, data, len, NULL); +} + +static int read_buffer(unsigned char *data, int len) +{ + int nBuffered = av_fifo_size(m_audioBuf); + + len = FFMIN(len, nBuffered); + + av_fifo_generic_read(m_audioBuf, data, len, NULL); + return len; +} + +// end ring buffer stuff + +static ULONG APIENTRY kai_audio_callback(PVOID pCBData, PVOID pBuffer, + ULONG ulSize) +{ + int nReadLen; + + nReadLen = read_buffer(pBuffer, ulSize); + if (nReadLen < ulSize && !m_fQuit) { + memset((uint8_t *)pBuffer + nReadLen, m_kaiSpec.bSilence, ulSize - nReadLen); + nReadLen = ulSize; + } + + return nReadLen; +} + +// to set/get/query special features/parameters +static int control(int cmd, void *arg) +{ + switch (cmd) { + case AOCONTROL_GET_VOLUME: + { + ao_control_vol_t *vol = arg; + + vol->left = vol->right = kaiGetVolume(m_hkai, MCI_STATUS_AUDIO_ALL); + + return CONTROL_OK; + } + + case AOCONTROL_SET_VOLUME: + { + int mid; + ao_control_vol_t *vol = arg; + + mid = (vol->left + vol->right) / 2; + kaiSetVolume(m_hkai, MCI_SET_AUDIO_ALL, mid); + + return CONTROL_OK; + } + } + + return CONTROL_UNKNOWN; +} + +static void print_help(void) +{ + mp_msg(MSGT_AO, MSGL_FATAL, + "\n-ao kai commandline help:\n" + "Example: mplayer -ao kai:noshare\n" + " open audio in exclusive mode\n" + "\nOptions:\n" + " uniaud\n" + " Use UNIAUD audio driver\n" + " dart\n" + " Use DART audio driver\n" + " (no)share\n" + " Open audio in shareable or exclusive mode\n" + " bufsize=\n" + " Set buffer size to in samples(default: 2048)\n"); +} + +// open & set up audio device +// return: 1=success 0=fail +static int init(int rate, int channels, int format, int flags) +{ + int fUseUniaud = 0; + int fUseDart = 0; + int fShare = 1; + ULONG kaiMode; + KAICAPS kc; + int nSamples = DEFAULT_SAMPLES; + int nBytesPerSample; + KAISPEC ksWanted; + + const opt_t subopts[] = { + {"uniaud", OPT_ARG_BOOL, &fUseUniaud, NULL}, + {"dart", OPT_ARG_BOOL, &fUseDart, NULL}, + {"share", OPT_ARG_BOOL, &fShare, NULL}, + {"bufsize", OPT_ARG_INT, &nSamples, int_non_neg}, + {NULL} + }; + + const char *audioDriver[] = {"DART", "UNIAUD",}; + + if (subopt_parse(ao_subdevice, subopts) != 0) { + print_help(); + return 0; + } + + if (fUseUniaud && fUseDart) + mp_msg(MSGT_VO, MSGL_WARN,"KAI: Multiple mode specified!!!\n"); + + if (fUseUniaud) + kaiMode = KAIM_UNIAUD; + else if (fUseDart) + kaiMode = KAIM_DART; + else + kaiMode = KAIM_AUTO; + + if (kaiInit(kaiMode)) { + mp_msg(MSGT_VO, MSGL_ERR, "KAI: Init failed!!!\n"); + return 0; + } + + kaiCaps(&kc); + mp_msg(MSGT_AO, MSGL_V, "KAI: selected audio driver = %s\n", + audioDriver[kc.ulMode - 1]); + mp_msg(MSGT_AO, MSGL_V, "KAI: PDD name = %s, maximum channels = %lu\n", + kc.szPDDName, kc.ulMaxChannels); + + if (!nSamples) + nSamples = DEFAULT_SAMPLES; + + mp_msg(MSGT_AO, MSGL_V, "KAI: open in %s mode, buffer size = %d sample(s)\n", + fShare ? "shareable" : "exclusive", nSamples); + + switch (format) { + case AF_FORMAT_S16_LE: + case AF_FORMAT_S8: + break; + + default: + format = AF_FORMAT_S16_LE; + mp_msg(MSGT_AO, MSGL_V, "KAI: format %s not supported defaulting to Signed 16-bit Little-Endian\n", + af_fmt2str_short(format)); + break; + } + + nBytesPerSample = (af_fmt2bits(format) >> 3) * channels; + + ksWanted.usDeviceIndex = 0; + ksWanted.ulType = KAIT_PLAY; + ksWanted.ulBitsPerSample = af_fmt2bits(format); + ksWanted.ulSamplingRate = rate; + ksWanted.ulDataFormat = MCI_WAVE_FORMAT_PCM; + ksWanted.ulChannels = channels; + ksWanted.ulNumBuffers = 2; + ksWanted.ulBufferSize = nBytesPerSample * nSamples; + ksWanted.fShareable = fShare; + ksWanted.pfnCallBack = kai_audio_callback; + ksWanted.pCallBackData = NULL; + + if (kaiOpen(&ksWanted, &m_kaiSpec, &m_hkai)) { + mp_msg(MSGT_VO, MSGL_ERR, "KAI: Open failed!!!\n"); + return 0; + } + + mp_msg(MSGT_AO, MSGL_V, "KAI: obtained buffer count = %lu, size = %lu bytes\n", + m_kaiSpec.ulNumBuffers, m_kaiSpec.ulBufferSize); + + m_fQuit = FALSE; + + ao_data.channels = channels; + ao_data.samplerate = rate; + ao_data.format = format; + ao_data.bps = nBytesPerSample * rate; + ao_data.outburst = nBytesPerSample * OUTBURST_SAMPLES; + ao_data.buffersize = m_kaiSpec.ulBufferSize; + + m_nBufSize = (m_kaiSpec.ulBufferSize * m_kaiSpec.ulNumBuffers) << 3; + + // multiple of CHUNK_SIZE + m_nBufSize = (m_nBufSize / CHUNK_SIZE) * CHUNK_SIZE; + + // and one more chunk plus round up + m_nBufSize += 2 * CHUNK_SIZE; + + mp_msg(MSGT_AO, MSGL_V, "KAI: internal audio buffer size = %d bytes\n", + m_nBufSize); + + m_audioBuf = av_fifo_alloc(m_nBufSize); + + kaiPlay(m_hkai); + + // might cause PM DLLs to be loaded which incorrectly enable SIG_FPE, + // which AAC decoding might trigger. + // so, mask off all floating-point exceptions. + _control87(MCW_EM, MCW_EM); + + return 1; +} + +// close audio device +static void uninit(int immed) +{ + m_fQuit = TRUE; + + if (!immed) + while (kaiStatus(m_hkai) & KAIS_PLAYING) + DosSleep(1); + + kaiClose(m_hkai); + + kaiDone(); + + av_fifo_free(m_audioBuf); +} + +// stop playing and empty buffers (for seeking/pause) +static void reset(void) +{ + kaiPause(m_hkai); + + // Reset ring-buffer state + av_fifo_reset(m_audioBuf); + + kaiResume(m_hkai); +} + +// stop playing, keep buffers (for pause) +static void audio_pause(void) +{ + kaiPause(m_hkai); +} + +// resume playing, after audio_pause() +static void audio_resume(void) +{ + kaiResume(m_hkai); +} + +// return: how many bytes can be played without blocking +static int get_space(void) +{ + return av_fifo_space(m_audioBuf); +} + +// plays 'len' bytes of 'data' +// it should round it down to outburst*n +// return: number of bytes played +static int play(void *data, int len, int flags) +{ + + if (!(flags & AOPLAY_FINAL_CHUNK)) + len = (len / ao_data.outburst) * ao_data.outburst; + + return write_buffer(data, len); +} + +// return: delay in seconds between first and last sample in buffer +static float get_delay(void) +{ + int nBuffered = av_fifo_size(m_audioBuf); // could be less + + return (float)nBuffered / (float)ao_data.bps; +} diff --git a/libao2/audio_out.c b/libao2/audio_out.c index fc41a73e57..09f498fa4e 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -47,6 +47,7 @@ extern const ao_functions_t audio_out_sun; extern const ao_functions_t audio_out_sgi; extern const ao_functions_t audio_out_win32; extern const ao_functions_t audio_out_dsound; +extern const ao_functions_t audio_out_kai; extern const ao_functions_t audio_out_dart; extern const ao_functions_t audio_out_dxr2; extern const ao_functions_t audio_out_ivtv; @@ -64,6 +65,9 @@ const ao_functions_t* const audio_out_drivers[] = #ifdef CONFIG_WIN32WAVEOUT &audio_out_win32, #endif +#ifdef CONFIG_KAI + &audio_out_kai, +#endif #ifdef CONFIG_DART &audio_out_dart, #endif -- cgit v1.2.3 From 92f21ea5ccfc33ed6dd37d5b67800a9c5a9c4cc6 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Feb 2010 18:20:22 +0000 Subject: Reword tfields documentation to reflect that it works mostly with MPlayer, not just mencoder. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30482 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index d3b5703af2..6f1230c375 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -7091,8 +7091,8 @@ Height unchanged at half framerate. .B tfields[=mode[:field_dominance]] Temporal field separation \- split fields into frames, doubling the output framerate. -Like the telecine filter, tfields will only work properly with -MEncoder, and only if both \-fps and \-ofps are set to the +Like the telecine filter, tfields might not work completely right unless +used with MEncoder and both \-fps and \-ofps set to the desired (double) framerate! .PD 0 .RSs -- cgit v1.2.3 From 3540bd7af543587be1bf3f58b21f25697c4a76d6 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Feb 2010 19:14:01 +0000 Subject: Fix -vf tfields=1 so it does not read out of bounds or leave parts of the output frame uninitialized. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30483 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_tfields.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index 851d3f24da..b4768e2060 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -43,13 +43,16 @@ static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w int x, y; src += ss; dest += ds; + h--; if (field) { + fast_memcpy(dest - ds, src - ss, w); src += ss; dest += ds; - h -= 2; + h--; } - for (y=h/2; y; y--) { - for (x=0; x 0; y--) { + dest[0] = src[0]; + for (x=1; x src[x]) && (src[x+ss] > src[x]))) { //dest[x] = (src[x+ss] + src[x-ss])>>1; @@ -59,9 +62,12 @@ static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w } else dest[x] = src[x]; } + dest[w-1] = src[w-1]; dest += ds<<1; src += ss<<1; } + if (h & 1) + fast_memcpy(dest, src, w); } #if HAVE_AMD3DNOW -- cgit v1.2.3 From 2aa41effad0c9eb8efe5e2b471d4b83314f5e10a Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Feb 2010 22:14:17 +0000 Subject: Enable query_format for vf_tfields to make sure it isn't used for formats that definitely do not work, e.g. RBG with tfields=1 mode. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30484 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_tfields.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index b4768e2060..8147661244 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -455,11 +455,13 @@ static int continue_buffered_image(struct vf_instance_s *vf) return ret; } -#if 0 static int query_format(struct vf_instance_s* vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ + /* FIXME - figure out which formats exactly work */ switch (fmt) { + default: + if (vf->priv->mode == 1) + return 0; case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: @@ -467,7 +469,6 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt) } return 0; } -#endif static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -495,7 +496,7 @@ static int open(vf_instance_t *vf, char* args) struct vf_priv_s *p; vf->config = config; vf->put_image = put_image; - //vf->query_format = query_format; + vf->query_format = query_format; vf->uninit = uninit; vf->default_reqs = VFCAP_ACCEPT_STRIDE; vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); -- cgit v1.2.3