summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-12 15:30:21 +0200
committerwm4 <wm4@nowhere>2012-08-16 17:16:33 +0200
commitaebfbbf2bdda8e18beef90c16da97bd335f7d3b0 (patch)
treea7362bf3ef6f2d80a47b2e539a2ea4efe5e2e079 /libmpdemux
parentc6b03ffef6250096373c4a81a489dae9fbff9087 (diff)
downloadmpv-aebfbbf2bdda8e18beef90c16da97bd335f7d3b0.tar.bz2
mpv-aebfbbf2bdda8e18beef90c16da97bd335f7d3b0.tar.xz
Remove win32/qt/xanim/real binary codecs loading
Remove the win32 loader - the win32 emulation layer, as well as the code for using DirectShow/DMO/VFW codecs. Remove loading of xanim, QuickTime, and RealMedia codecs. The win32 emulation layer is based on a very old version of wine. Apparently, wine code was copied and hacked until it was somehow able to load a limited collection of binary codecs. It poked around in the code segment of some known binary codecs to disable unsupported win32 API calls to make them work. Example from module.c: for (i=0;i<5;i++) RVA(0x19e842)[i]=0x90; // make_new_region ? for (i=0;i<28;i++) RVA(0x19e86d)[i]=0x90; // call__call_CreateCompatibleDC ? for (i=0;i<5;i++) RVA(0x19e898)[i]=0x90; // jmp_to_call_loadbitmap ? for (i=0;i<9;i++) RVA(0x19e8ac)[i]=0x90; // call__calls_OLE_shit ? for (i=0;i<106;i++) RVA(0x261b10)[i]=0x90; // disable threads Just to show how utterly insane this code is. You wouldn't want even your worst enemy to have to maintain this. In fact, it seems nobody made major changes to this code ever since it was committed. Most formats can be decoded by libavcodecs these days, and the loader couldn't be used on 64 bit platforms anyway. The same is (probably) true for the other binary codecs. General note about how support for win32 codecs could be added back: It's not possible to replace the win32 loader code by using wine as library, because modern wine can not be linked with native Linux programs for certain reasons. It would be possible to to move DirectShow video decoding into a separate process linked with wine, like the CoreAVC-for-Linux patches do. There is also the mplayer-ww fork, which uses the dshownative library to use DirectShow codecs on Windows.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_avs.c476
-rw-r--r--libmpdemux/demux_avs.h173
-rw-r--r--libmpdemux/demux_mkv.c33
3 files changed, 1 insertions, 681 deletions
diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c
deleted file mode 100644
index e90e36c1a7..0000000000
--- a/libmpdemux/demux_avs.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Demuxer for avisynth
- * Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <unistd.h>
-#include <limits.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "stream/stream.h"
-#include "demuxer.h"
-#include "stheader.h"
-#include "libvo/fastmemcpy.h"
-
-#include "loader/wine/winbase.h"
-#include "loader/wine/windef.h"
-
-#ifdef WIN32_LOADER
-#include "loader/ldt_keeper.h"
-#endif
-
-#include "demux_avs.h"
-
-#define MAX_AVS_SIZE 16 * 1024 /* 16k should be enough */
-
-typedef WINAPI AVS_ScriptEnvironment* (*imp_avs_create_script_environment)(int version);
-typedef WINAPI AVS_Value (*imp_avs_invoke)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
-typedef WINAPI const AVS_VideoInfo *(*imp_avs_get_video_info)(AVS_Clip *);
-typedef WINAPI AVS_Clip* (*imp_avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
-typedef WINAPI void (*imp_avs_release_clip)(AVS_Clip *);
-typedef WINAPI AVS_VideoFrame* (*imp_avs_get_frame)(AVS_Clip *, int n);
-typedef WINAPI void (*imp_avs_release_video_frame)(AVS_VideoFrame *);
-typedef WINAPI int (*imp_avs_get_audio)(AVS_Clip *, void * buf, uint64_t start, uint64_t count);
-
-#define Q(string) # string
-#define IMPORT_FUNC(x) \
- AVS->x = ( imp_##x ) GetProcAddress(AVS->dll, Q(x)); \
- if (!AVS->x) { mp_msg(MSGT_DEMUX,MSGL_V,"AVS: failed to load "Q(x)"()\n"); return 0; }
-
-typedef struct tagAVS
-{
- AVS_ScriptEnvironment *avs_env;
- AVS_Value handler;
- AVS_Clip *clip;
- const AVS_VideoInfo *video_info;
-#ifdef WIN32_LOADER
- ldt_fs_t* ldt_fs;
-#endif
- HMODULE dll;
- int frameno;
- uint64_t sampleno;
- int init;
-
- imp_avs_create_script_environment avs_create_script_environment;
- imp_avs_invoke avs_invoke;
- imp_avs_get_video_info avs_get_video_info;
- imp_avs_take_clip avs_take_clip;
- imp_avs_release_clip avs_release_clip;
- imp_avs_get_frame avs_get_frame;
- imp_avs_release_video_frame avs_release_video_frame;
- imp_avs_get_audio avs_get_audio;
-} AVS_T;
-
-static AVS_T *initAVS(const char *filename)
-{
- AVS_T *AVS = malloc (sizeof(AVS_T));
- AVS_Value arg0 = avs_new_value_string(filename);
- AVS_Value args = avs_new_value_array(&arg0, 1);
-
- memset(AVS, 0, sizeof(AVS_T));
-
-#ifdef WIN32_LOADER
- AVS->ldt_fs = Setup_LDT_Keeper();
-#endif
-
- AVS->dll = LoadLibraryA("avisynth.dll");
- if(!AVS->dll)
- {
- mp_msg(MSGT_DEMUX ,MSGL_V, "AVS: failed to load avisynth.dll\n");
- goto avs_err;
- }
-
- /* Dynamic import of needed stuff from avisynth.dll */
- IMPORT_FUNC(avs_create_script_environment);
- IMPORT_FUNC(avs_invoke);
- IMPORT_FUNC(avs_get_video_info);
- IMPORT_FUNC(avs_take_clip);
- IMPORT_FUNC(avs_release_clip);
- IMPORT_FUNC(avs_get_frame);
- IMPORT_FUNC(avs_release_video_frame);
- IMPORT_FUNC(avs_get_audio);
-
- AVS->avs_env = AVS->avs_create_script_environment(AVISYNTH_INTERFACE_VERSION);
- if (!AVS->avs_env)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_create_script_environment failed\n");
- goto avs_err;
- }
-
-
- AVS->handler = AVS->avs_invoke(AVS->avs_env, "Import", args, 0);
-
- if (avs_is_error(AVS->handler))
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth error: %s\n", avs_as_string(AVS->handler));
- goto avs_err;
- }
-
- if (!avs_is_clip(AVS->handler))
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth doesn't return a clip\n");
- goto avs_err;
- }
-
- return AVS;
-
-avs_err:
- if (AVS->dll) FreeLibrary(AVS->dll);
-#ifdef WIN32_LOADER
- Restore_LDT_Keeper(AVS->ldt_fs);
-#endif
- free(AVS);
- return NULL;
-}
-
-/* Implement RGB MODES ?? */
-#if 0
-static __inline int get_mmioFOURCC(const AVS_VideoInfo *v)
-{
- if (avs_is_rgb(v)) return mmioFOURCC(8, 'R', 'G', 'B');
- if (avs_is_rgb24(v)) return mmioFOURCC(24, 'R', 'G', 'B');
- if (avs_is_rgb32(v)) return mmioFOURCC(32, 'R', 'G', 'B');
- if (avs_is_yv12(v)) return mmioFOURCC('Y', 'V', '1', '2');
- if (avs_is_yuy(v)) return mmioFOURCC('Y', 'U', 'Y', ' ');
- if (avs_is_yuy2(v)) return mmioFOURCC('Y', 'U', 'Y', '2');
- return 0;
-}
-#endif
-
-static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
-{
- AVS_VideoFrame *curr_frame;
- demux_packet_t *dp = NULL;
- AVS_T *AVS = demuxer->priv;
-
- if (ds == demuxer->video)
- {
- sh_video_t *sh_video = demuxer->video->sh;
- char *dst;
- int w, h;
- if (AVS->video_info->num_frames <= AVS->frameno) return 0; // EOF
-
- curr_frame = AVS->avs_get_frame(AVS->clip, AVS->frameno);
- if (!curr_frame)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: error getting frame -- EOF??\n");
- return 0;
- }
- w = curr_frame->row_size;
- h = curr_frame->height;
-
- dp = new_demux_packet(w * h + 2 * (w / 2) * (h / 2));
-
- dp->pts=AVS->frameno / sh_video->fps;
-
- dst = dp->buffer;
- memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offset,
- w, h, w, curr_frame->pitch);
- dst += w * h;
- w /= 2; h /= 2;
- memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetV,
- w, h, w, curr_frame->pitchUV);
- dst += w * h;
- memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetU,
- w, h, w, curr_frame->pitchUV);
- ds_add_packet(demuxer->video, dp);
-
- AVS->frameno++;
- AVS->avs_release_video_frame(curr_frame);
- }
-
- /* Audio */
- if (ds == demuxer->audio)
- {
- sh_audio_t *sh_audio = ds->sh;
- int samples = sh_audio->samplerate;
- uint64_t l;
- samples = FFMIN(samples, AVS->video_info->num_audio_samples - AVS->sampleno);
- if (!samples) return 0;
- l = samples * sh_audio->channels * sh_audio->samplesize;
- if (l > INT_MAX) {
- mp_msg(MSGT_DEMUX, MSGL_FATAL, "AVS: audio packet too big\n");
- return 0;
- }
- dp = new_demux_packet(l);
- dp->pts = AVS->sampleno / sh_audio->samplerate;
-
- if (AVS->avs_get_audio(AVS->clip, dp->buffer, AVS->sampleno, samples))
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_audio() failed\n");
- return 0;
- }
- ds_add_packet(demuxer->audio, dp);
-
- AVS->sampleno += samples;
- }
-
- return 1;
-}
-
-static demuxer_t* demux_open_avs(demuxer_t* demuxer)
-{
- int found = 0;
- AVS_T *AVS = demuxer->priv;
- int audio_samplesize = 0;
- AVS->frameno = 0;
- AVS->sampleno = 0;
-
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: demux_open_avs()\n");
- demuxer->seekable = 1;
-
- AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
- if(!AVS->clip)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
- return NULL;
- }
-
- AVS->video_info = AVS->avs_get_video_info(AVS->clip);
- if (!AVS->video_info)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
- return NULL;
- }
-
- if (!avs_is_yv12(AVS->video_info))
- {
- AVS->handler = AVS->avs_invoke(AVS->avs_env, "ConvertToYV12", avs_new_value_array(&AVS->handler, 1), 0);
- if (avs_is_error(AVS->handler))
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Cannot convert input video to YV12: %s\n", avs_as_string(AVS->handler));
- return NULL;
- }
-
- AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
-
- if(!AVS->clip)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
- return NULL;
- }
-
- AVS->video_info = AVS->avs_get_video_info(AVS->clip);
- if (!AVS->video_info)
- {
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
- return NULL;
- }
- }
-
- // TODO check field-based ??
-
- /* Video */
- if (avs_has_video(AVS->video_info))
- {
- sh_video_t *sh_video = new_sh_video(demuxer, 0);
- found = 1;
-
- if (demuxer->video->id == -1) demuxer->video->id = 0;
- if (demuxer->video->id == 0)
- demuxer->video->sh = sh_video;
- sh_video->ds = demuxer->video;
-
- sh_video->disp_w = AVS->video_info->width;
- sh_video->disp_h = AVS->video_info->height;
-
- //sh_video->format = get_mmioFOURCC(AVS->video_info);
- sh_video->format = mmioFOURCC('Y', 'V', '1', '2');
- sh_video->fps = (double) AVS->video_info->fps_numerator / (double) AVS->video_info->fps_denominator;
- sh_video->frametime = 1.0 / sh_video->fps;
-
- sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4));
- sh_video->bih->biCompression = sh_video->format;
- sh_video->bih->biBitCount = avs_bits_per_pixel(AVS->video_info);
- //sh_video->bih->biPlanes = 2;
-
- sh_video->bih->biWidth = AVS->video_info->width;
- sh_video->bih->biHeight = AVS->video_info->height;
- sh_video->num_frames = 0;
- sh_video->num_frames_decoded = 0;
- }
-
- /* Audio */
- if (avs_has_audio(AVS->video_info))
- switch (AVS->video_info->sample_type) {
- case AVS_SAMPLE_INT8: audio_samplesize = 1; break;
- case AVS_SAMPLE_INT16: audio_samplesize = 2; break;
- case AVS_SAMPLE_INT24: audio_samplesize = 3; break;
- case AVS_SAMPLE_INT32:
- case AVS_SAMPLE_FLOAT: audio_samplesize = 4; break;
- default:
- mp_msg(MSGT_DEMUX, MSGL_ERR, "AVS: unknown audio type, disabling\n");
- }
- if (audio_samplesize)
- {
- sh_audio_t *sh_audio = new_sh_audio(demuxer, 0);
- found = 1;
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Clip has audio -> Channels = %d - Freq = %d\n", AVS->video_info->nchannels, AVS->video_info->audio_samples_per_second);
-
- if (demuxer->audio->id == -1) demuxer->audio->id = 0;
- if (demuxer->audio->id == 0)
- demuxer->audio->sh = sh_audio;
- sh_audio->ds = demuxer->audio;
-
- sh_audio->wf = malloc(sizeof(*sh_audio->wf));
- sh_audio->wf->wFormatTag = sh_audio->format =
- (AVS->video_info->sample_type == AVS_SAMPLE_FLOAT) ? 0x3 : 0x1;
- sh_audio->wf->nChannels = sh_audio->channels = AVS->video_info->nchannels;
- sh_audio->wf->nSamplesPerSec = sh_audio->samplerate = AVS->video_info->audio_samples_per_second;
- sh_audio->samplesize = audio_samplesize;
- sh_audio->wf->nAvgBytesPerSec = sh_audio->channels * sh_audio->samplesize * sh_audio->samplerate;
- sh_audio->wf->nBlockAlign = sh_audio->channels * sh_audio->samplesize;
- sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;
- sh_audio->wf->cbSize = 0;
- sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
- }
-
- AVS->init = 1;
- if (found)
- return demuxer;
- else
- return NULL;
-}
-
-static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
-{
- sh_video_t *sh_video=demuxer->video->sh;
- sh_audio_t *sh_audio=demuxer->audio->sh;
- AVS_T *AVS = demuxer->priv;
-
- switch(cmd)
- {
- case DEMUXER_CTRL_GET_TIME_LENGTH:
- {
- double res = sh_video ? (double)AVS->video_info->num_frames / sh_video->fps : 0;
- if (sh_audio)
- res = FFMAX(res, (double)AVS->video_info->num_audio_samples / sh_audio->samplerate);
- *((double *)arg) = res;
- return DEMUXER_CTRL_OK;
- }
- case DEMUXER_CTRL_GET_PERCENT_POS:
- {
- if (sh_video)
- *((int *)arg) = AVS->frameno * 100 / AVS->video_info->num_frames;
- else
- *((int *)arg) = AVS->sampleno * 100 / AVS->video_info->num_audio_samples;
- return DEMUXER_CTRL_OK;
- }
- default:
- return DEMUXER_CTRL_NOTIMPL;
- }
-}
-
-static void demux_close_avs(demuxer_t* demuxer)
-{
- AVS_T *AVS = demuxer->priv;
-
- if (AVS)
- {
- if (AVS->dll)
- {
- if (AVS->clip)
- AVS->avs_release_clip(AVS->clip);
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Unloading avisynth.dll\n");
- FreeLibrary(AVS->dll);
- }
-#ifdef WIN32_LOADER
- Restore_LDT_Keeper(AVS->ldt_fs);
-#endif
- free(AVS);
- }
-}
-
-static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
-{
- sh_video_t *sh_video=demuxer->video->sh;
- sh_audio_t *sh_audio=demuxer->audio->sh;
- AVS_T *AVS = demuxer->priv;
- double video_pos = sh_video ?
- (double)AVS->frameno / sh_video->fps :
- (double)AVS->sampleno / sh_audio->samplerate;
- double duration = sh_video ?
- (double)AVS->video_info->num_frames / sh_video->fps :
- (double)AVS->video_info->num_audio_samples / sh_audio->samplerate;
-
- //mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags);
-
- if (flags&SEEK_ABSOLUTE) video_pos=0;
- if (flags&SEEK_FACTOR) rel_seek_secs *= duration;
-
- video_pos += rel_seek_secs;
- if (video_pos < 0) video_pos = 0;
-
- if (sh_video) {
- AVS->frameno = FFMIN(video_pos * sh_video->fps,
- AVS->video_info->num_frames);
- sh_video->num_frames_decoded = AVS->frameno;
- sh_video->num_frames = AVS->frameno;
- }
- video_pos += audio_delay;
- if (video_pos < 0) video_pos = 0;
- if (sh_audio)
- AVS->sampleno = FFMIN(video_pos * sh_audio->samplerate,
- AVS->video_info->num_audio_samples);
-}
-
-static int avs_check_file(demuxer_t *demuxer)
-{
- mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_check_file - attempting to open file %s\n", demuxer->filename);
-
- if (!demuxer->filename) return 0;
-
- /* Avoid crazy memory eating when passing an mpg stream */
- if (demuxer->movi_end > MAX_AVS_SIZE)
- {
- mp_msg(MSGT_DEMUX,MSGL_V, "AVS: File is too big, aborting...\n");
- return 0;
- }
-
- demuxer->priv = initAVS(demuxer->filename);
-
- if (demuxer->priv)
- {
- mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init Ok\n");
- return DEMUXER_TYPE_AVS;
- }
- mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init failed\n");
- return 0;
-}
-
-
-const demuxer_desc_t demuxer_desc_avs = {
- "Avisynth demuxer",
- "avs",
- "AVS",
- "Gianluigi Tiesi",
- "Requires binary dll",
- DEMUXER_TYPE_AVS,
- 0, // unsafe autodetect
- avs_check_file,
- demux_avs_fill_buffer,
- demux_open_avs,
- demux_close_avs,
- demux_seek_avs,
- demux_avs_control
-};
diff --git a/libmpdemux/demux_avs.h b/libmpdemux/demux_avs.h
deleted file mode 100644
index 7b5465714a..0000000000
--- a/libmpdemux/demux_avs.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Demuxer for avisynth
- * Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * Avisynth C Interface Version 0.20
- * Copyright 2003 Kevin Atkinson
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#ifndef MPLAYER_DEMUX_AVS_H
-#define MPLAYER_DEMUX_AVS_H
-
-#include <stdint.h>
-#include "loader/wine/windef.h"
-
-enum { AVISYNTH_INTERFACE_VERSION = 2 };
-
-enum
-{
- AVS_SAMPLE_INT8 = 1<<0,
- AVS_SAMPLE_INT16 = 1<<1,
- AVS_SAMPLE_INT24 = 1<<2,
- AVS_SAMPLE_INT32 = 1<<3,
- AVS_SAMPLE_FLOAT = 1<<4
-};
-
-enum
-{
- AVS_PLANAR_Y=1<<0,
- AVS_PLANAR_U=1<<1,
- AVS_PLANAR_V=1<<2,
- AVS_PLANAR_ALIGNED=1<<3,
- AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED,
- AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED,
- AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED
-};
-
-// Colorspace properties.
-enum
-{
- AVS_CS_BGR = 1<<28,
- AVS_CS_YUV = 1<<29,
- AVS_CS_INTERLEAVED = 1<<30,
- AVS_CS_PLANAR = 1<<31
-};
-
-// Specific colorformats
-enum
-{
- AVS_CS_UNKNOWN = 0,
- AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
- AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
- AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
- AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
- AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
- AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above
-};
-
-typedef struct AVS_Clip AVS_Clip;
-typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
-
-typedef struct AVS_Value AVS_Value;
-struct AVS_Value {
- short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
- // for some function e'rror
- short array_size;
- union {
- void * clip; // do not use directly, use avs_take_clip
- char boolean;
- int integer;
- float floating_pt;
- const char * string;
- const AVS_Value * array;
- } d;
-};
-
-// AVS_VideoInfo is layed out identicly to VideoInfo
-typedef struct AVS_VideoInfo {
- int width, height; // width=0 means no video
- unsigned fps_numerator, fps_denominator;
- int num_frames;
-
- int pixel_type;
-
- int audio_samples_per_second; // 0 means no audio
- int sample_type;
- uint64_t num_audio_samples;
- int nchannels;
-
- // Imagetype properties
-
- int image_type;
-} AVS_VideoInfo;
-
-typedef struct AVS_VideoFrameBuffer {
- BYTE * data;
- int data_size;
- // sequence_number is incremented every time the buffer is changed, so
- // that stale views can tell they're no longer valid.
- long sequence_number;
-
- long refcount;
-} AVS_VideoFrameBuffer;
-
-typedef struct AVS_VideoFrame {
- int refcount;
- AVS_VideoFrameBuffer * vfb;
- int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
-} AVS_VideoFrame;
-
-static inline AVS_Value avs_new_value_string(const char * v0)
-{ AVS_Value v; v.type = 's'; v.d.string = v0; return v; }
-
-static inline AVS_Value avs_new_value_array(AVS_Value * v0, int size)
-{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
-
-
-static inline int avs_is_error(AVS_Value v) { return v.type == 'e'; }
-static inline int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
-static inline int avs_is_string(AVS_Value v) { return v.type == 's'; }
-static inline int avs_has_video(const AVS_VideoInfo * p) { return p->width != 0; }
-static inline int avs_has_audio(const AVS_VideoInfo * p) { return p->audio_samples_per_second != 0; }
-
-static inline const char * avs_as_string(AVS_Value v)
-{ return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
-
-/* Color spaces */
-static inline int avs_is_rgb(const AVS_VideoInfo * p)
-{ return p->pixel_type & AVS_CS_BGR; }
-
-static inline int avs_is_rgb24(const AVS_VideoInfo * p)
-{ return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
-
-static inline int avs_is_rgb32(const AVS_VideoInfo * p)
-{ return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
-
-static inline int avs_is_yuy(const AVS_VideoInfo * p)
-{ return p->pixel_type & AVS_CS_YUV; }
-
-static inline int avs_is_yuy2(const AVS_VideoInfo * p)
-{ return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
-
-static inline int avs_is_yv12(const AVS_VideoInfo * p)
-{ return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); }
-
-static inline int avs_bits_per_pixel(const AVS_VideoInfo * p)
-{
- switch (p->pixel_type) {
- case AVS_CS_BGR24: return 24;
- case AVS_CS_BGR32: return 32;
- case AVS_CS_YUY2: return 16;
- case AVS_CS_YV12:
- case AVS_CS_I420: return 12;
- default: return 0;
- }
-}
-
-#endif /* MPLAYER_DEMUX_AVS_H */
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index bf6a53a14f..5bc890a970 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -53,10 +53,6 @@
#include "sub/sub.h"
-#ifdef CONFIG_QTX_CODECS
-#include "loader/qtx/qtxsdk/components.h"
-#endif
-
static const unsigned char sipr_swaps[38][2] = {
{0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68},
{13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46},
@@ -1157,7 +1153,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
int vid)
{
BITMAPINFOHEADER *bih;
- void *ImageDesc = NULL;
sh_video_t *sh_v;
if (track->ms_compat) { /* MS compatibility mode */
@@ -1222,32 +1217,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
memcpy(dst, src - 8, 8 + cnt);
track->realmedia = 1;
-#ifdef CONFIG_QTX_CODECS
- } else if (track->private_size >= sizeof(ImageDescription)
- && !strcmp(track->codec_id, MKV_V_QUICKTIME)) {
- ImageDescriptionPtr idesc;
-
- idesc = (ImageDescriptionPtr) track->private_data;
- idesc->idSize = be2me_32(idesc->idSize);
- idesc->cType = be2me_32(idesc->cType);
- idesc->version = be2me_16(idesc->version);
- idesc->revisionLevel = be2me_16(idesc->revisionLevel);
- idesc->vendor = be2me_32(idesc->vendor);
- idesc->temporalQuality = be2me_32(idesc->temporalQuality);
- idesc->spatialQuality = be2me_32(idesc->spatialQuality);
- idesc->width = be2me_16(idesc->width);
- idesc->height = be2me_16(idesc->height);
- idesc->hRes = be2me_32(idesc->hRes);
- idesc->vRes = be2me_32(idesc->vRes);
- idesc->dataSize = be2me_32(idesc->dataSize);
- idesc->frameCount = be2me_16(idesc->frameCount);
- idesc->depth = be2me_16(idesc->depth);
- idesc->clutID = be2me_16(idesc->clutID);
- bih->biPlanes = 1;
- bih->biCompression = idesc->cType;
- ImageDesc = idesc;
-#endif /* CONFIG_QTX_CODECS */
-
} else {
const videocodec_info_t *vi = vinfo;
while (vi->id && strcmp(vi->id, track->codec_id))
@@ -1295,7 +1264,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
sh_v->disp_w = track->v_dwidth;
sh_v->disp_h = track->v_dheight;
}
- sh_v->ImageDesc = ImageDesc;
+ sh_v->ImageDesc = NULL;
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Aspect: %f\n", sh_v->aspect);
sh_v->ds = demuxer->video;