annotate libmpdemux/demux_avs.c @ 16863:a147f0c505d9

Complete sync with 1.192
author reynaldo
date Wed, 26 Oct 2005 01:35:27 +0000
parents 6ff303d2876b
children 67c30d47ffd4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
1 /*
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
2 * Demuxer for avisynth
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
3 * Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
4 *
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
6 * modify it under the terms of the GNU Library General Public
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
9 *
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
13 * Library General Public License for more details.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
14 *
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
15 * You should have received a copy of the GNU Library General Public
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
16 * License along with this library; if not, write to the
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
18 * Boston, MA 02111-1307, USA.
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
19 */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
20
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
21 #include <stdio.h>
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
22 #include <stdlib.h>
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
23 #include <unistd.h>
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
24
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
25 #include "config.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
26 #include "mp_msg.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
27 #include "help_mp.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
28
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
29 #include "stream.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
30 #include "demuxer.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
31 #include "stheader.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
32
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
33 #include "wine/windef.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
34
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
35 #ifdef WIN32_LOADER
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
36 #include "ldt_keeper.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
37 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
38
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
39 #include "demux_avs.h"
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
40
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
41 #define MAX_AVS_SIZE 16 * 1024 /* 16k should be enough */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
42 #undef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
43
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
44 HMODULE WINAPI LoadLibraryA(LPCSTR);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
45 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
46 int WINAPI FreeLibrary(HMODULE);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
47
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
48 typedef WINAPI AVS_ScriptEnvironment* (*imp_avs_create_script_environment)(int version);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
49 typedef WINAPI AVS_Value (*imp_avs_invoke)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
50 typedef WINAPI const AVS_VideoInfo *(*imp_avs_get_video_info)(AVS_Clip *);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
51 typedef WINAPI AVS_Clip* (*imp_avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
52 typedef WINAPI AVS_VideoFrame* (*imp_avs_get_frame)(AVS_Clip *, int n);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
53 typedef WINAPI void (*imp_avs_release_video_frame)(AVS_VideoFrame *);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
54 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
55 //typedef WINAPI int (*imp_avs_get_audio)(AVS_Clip *, void * buf, uint64_t start, uint64_t count);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
56 typedef WINAPI int (*imp_avs_get_audio)(AVS_ScriptEnvironment *, void * buf, uint64_t start, uint64_t count);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
57 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
58
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
59 #define Q(string) # string
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
60 #define IMPORT_FUNC(x) \
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
61 AVS->x = ( imp_##x ) GetProcAddress(AVS->dll, Q(x)); \
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
62 if (!AVS->x) { mp_msg(MSGT_DEMUX,MSGL_V,"AVS: failed to load "Q(x)"()\n"); return 0; }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
63
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
64 typedef struct tagAVS
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
65 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
66 AVS_ScriptEnvironment *avs_env;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
67 AVS_Value handler;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
68 AVS_Clip *clip;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
69 const AVS_VideoInfo *video_info;
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
70 #ifdef WIN32_LOADER
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
71 ldt_fs_t* ldt_fs;
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
72 #endif
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
73 HMODULE dll;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
74 int frameno;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
75 int init;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
76
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
77 imp_avs_create_script_environment avs_create_script_environment;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
78 imp_avs_invoke avs_invoke;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
79 imp_avs_get_video_info avs_get_video_info;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
80 imp_avs_take_clip avs_take_clip;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
81 imp_avs_get_frame avs_get_frame;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
82 imp_avs_release_video_frame avs_release_video_frame;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
83 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
84 imp_avs_get_audio avs_get_audio;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
85 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
86 } AVS_T;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
87
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
88 AVS_T *initAVS(const char *filename)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
89 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
90 AVS_T *AVS = (AVS_T *) malloc (sizeof(AVS_T));
14695
faust3
parents: 14693
diff changeset
91 AVS_Value arg0 = avs_new_value_string(filename);
faust3
parents: 14693
diff changeset
92 AVS_Value args = avs_new_value_array(&arg0, 1);
faust3
parents: 14693
diff changeset
93
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
94 memset(AVS, 0, sizeof(AVS_T));
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
95
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
96 #ifdef WIN32_LOADER
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
97 AVS->ldt_fs = Setup_LDT_Keeper();
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
98 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
99
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
100 AVS->dll = LoadLibraryA("avisynth.dll");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
101 if(!AVS->dll)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
102 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
103 mp_msg(MSGT_DEMUX ,MSGL_V, "AVS: failed to load avisynth.dll\n");
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
104 goto avs_err;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
105 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
106
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
107 /* Dynamic import of needed stuff from avisynth.dll */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
108 IMPORT_FUNC(avs_create_script_environment);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
109 IMPORT_FUNC(avs_invoke);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
110 IMPORT_FUNC(avs_get_video_info);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
111 IMPORT_FUNC(avs_take_clip);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
112 IMPORT_FUNC(avs_get_frame);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
113 IMPORT_FUNC(avs_release_video_frame);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
114 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
115 IMPORT_FUNC(avs_get_audio);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
116 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
117
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
118 AVS->avs_env = AVS->avs_create_script_environment(AVISYNTH_INTERFACE_VERSION);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
119 if (!AVS->avs_env)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
120 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
121 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_create_script_environment failed\n");
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
122 goto avs_err;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
123 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
124
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
125
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
126 AVS->handler = AVS->avs_invoke(AVS->avs_env, "Import", args, 0);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
127
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
128 if (avs_is_error(AVS->handler))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
129 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
130 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth error: %s\n", avs_as_string(AVS->handler));
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
131 goto avs_err;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
132 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
133
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
134 if (!avs_is_clip(AVS->handler))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
135 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
136 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth doesn't return a clip\n");
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
137 goto avs_err;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
138 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
139
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
140 return AVS;
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
141
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
142 avs_err:
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
143 if (AVS->dll) FreeLibrary(AVS->dll);
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
144 #ifdef WIN32_LOADER
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
145 Restore_LDT_Keeper(AVS->ldt_fs);
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
146 #endif
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
147 free(AVS);
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
148 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
149 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
150
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
151 /* Implement RGB MODES ?? */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
152 #if 0
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
153 static __inline int get_mmioFOURCC(const AVS_VideoInfo *v)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
154 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
155 if (avs_is_rgb(v)) return mmioFOURCC(8, 'R', 'G', 'B');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
156 if (avs_is_rgb24(v)) return mmioFOURCC(24, 'R', 'G', 'B');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
157 if (avs_is_rgb32(v)) return mmioFOURCC(32, 'R', 'G', 'B');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
158 if (avs_is_yv12(v)) return mmioFOURCC('Y', 'V', '1', '2');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
159 if (avs_is_yuy(v)) return mmioFOURCC('Y', 'U', 'Y', ' ');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
160 if (avs_is_yuy2(v)) return mmioFOURCC('Y', 'U', 'Y', '2');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
161 return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
162 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
163 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
164
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
165 static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
166 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
167 AVS_VideoFrame *curr_frame;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
168 demux_packet_t *dp = NULL;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
169 AVS_T *AVS = (AVS_T *) demuxer->priv;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
170
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
171 demux_stream_t *d_video=demuxer->video;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
172 sh_video_t *sh_video=d_video->sh;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
173
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
174 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
175 demux_stream_t *d_audio=demuxer->audio;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
176 sh_audio_t *sh_audio=d_audio->sh;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
177 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
178
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
179 if (AVS->video_info->num_frames < AVS->frameno) return 0; // EOF
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
180
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
181 curr_frame = AVS->avs_get_frame(AVS->clip, AVS->frameno);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
182 if (!curr_frame)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
183 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
184 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: error getting frame -- EOF??\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
185 return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
186 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
187
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
188 if (avs_has_video(AVS->video_info))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
189 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
190 dp = new_demux_packet(curr_frame->vfb->data_size);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
191 sh_video->num_frames_decoded++;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
192 sh_video->num_frames++;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
193
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
194 d_video->pts=AVS->frameno / sh_video->fps; // OSD
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
195
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
196 memcpy(dp->buffer, curr_frame->vfb->data + curr_frame->offset, curr_frame->vfb->data_size);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
197 ds_add_packet(demuxer->video, dp);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
198
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
199 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
200
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
201 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
202 /* Audio */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
203 if (avs_has_audio(AVS->video_info))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
204 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
205 int l = sh_audio->wf->nAvgBytesPerSec;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
206 dp = new_demux_packet(l);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
207
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
208 if (AVS->avs_get_audio(AVS->avs_env, dp->buffer, AVS->frameno*sh_video->fps*l, l))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
209 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
210 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_audio() failed\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
211 return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
212 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
213 ds_add_packet(demuxer->audio, dp);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
214 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
215 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
216
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
217 AVS->frameno++;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
218 AVS->avs_release_video_frame(curr_frame);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
219 return 1;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
220 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
221
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
222 static demuxer_t* demux_open_avs(demuxer_t* demuxer)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
223 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
224 sh_video_t *sh_video = NULL;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
225 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
226 sh_audio_t *sh_audio = NULL;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
227 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
228 int found = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
229 AVS_T *AVS = (AVS_T *) demuxer->priv;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
230 AVS->frameno = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
231
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
232 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: demux_open_avs()\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
233 demuxer->seekable = 1;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
234
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
235 AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
236 if(!AVS->clip)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
237 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
238 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
239 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
240 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
241
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
242 AVS->video_info = AVS->avs_get_video_info(AVS->clip);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
243 if (!AVS->video_info)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
244 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
245 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
246 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
247 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
248
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
249 if (!avs_is_yv12(AVS->video_info))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
250 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
251 AVS->handler = AVS->avs_invoke(AVS->avs_env, "ConvertToYV12", avs_new_value_array(&AVS->handler, 1), 0);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
252 if (avs_is_error(AVS->handler))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
253 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
254 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Cannot convert input video to YV12: %s\n", avs_as_string(AVS->handler));
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
255 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
256 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
257
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
258 AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
259
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
260 if(!AVS->clip)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
261 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
262 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
263 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
264 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
265
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
266 AVS->video_info = AVS->avs_get_video_info(AVS->clip);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
267 if (!AVS->video_info)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
268 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
269 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
270 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
271 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
272 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
273
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
274 // TODO check field-based ??
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
275
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
276 /* Video */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
277 if (avs_has_video(AVS->video_info))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
278 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
279 found = 1;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
280 sh_video = new_sh_video(demuxer, 0);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
281
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
282 demuxer->video->sh = sh_video;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
283 sh_video->ds = demuxer->video;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
284
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
285 sh_video->disp_w = AVS->video_info->width;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
286 sh_video->disp_h = AVS->video_info->height;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
287
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
288 //sh_video->format = get_mmioFOURCC(AVS->video_info);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
289 sh_video->format = mmioFOURCC('Y', 'V', '1', '2');
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
290 sh_video->fps = (float) ((float) AVS->video_info->fps_numerator / (float) AVS->video_info->fps_denominator);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
291 sh_video->frametime = 1.0 / sh_video->fps;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
292
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
293 sh_video->bih = (BITMAPINFOHEADER*) malloc(sizeof(BITMAPINFOHEADER) + (256 * 4));
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
294 sh_video->bih->biCompression = sh_video->format;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
295 sh_video->bih->biBitCount = avs_bits_per_pixel(AVS->video_info);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
296 //sh_video->bih->biPlanes = 2;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
297
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
298 sh_video->bih->biWidth = AVS->video_info->width;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
299 sh_video->bih->biHeight = AVS->video_info->height;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
300 sh_video->num_frames = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
301 sh_video->num_frames_decoded = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
302 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
303
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
304 #ifdef ENABLE_AUDIO
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
305 /* Audio */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
306 if (avs_has_audio(AVS->video_info))
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
307 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
308 found = 1;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
309 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);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
310
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
311 sh_audio = new_sh_audio(demuxer, 0);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
312 demuxer->audio->sh = sh_audio;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
313 sh_audio->ds = demuxer->audio;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
314
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
315 sh_audio->wf = (WAVEFORMATEX*) malloc(sizeof(WAVEFORMATEX));
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
316 sh_audio->wf->wFormatTag = sh_audio->format = 0x1;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
317 sh_audio->wf->nChannels = sh_audio->channels = AVS->video_info->nchannels;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
318 sh_audio->wf->nSamplesPerSec = sh_audio->samplerate = AVS->video_info->audio_samples_per_second;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
319 sh_audio->wf->nAvgBytesPerSec = AVS->video_info->audio_samples_per_second * 4;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
320 sh_audio->wf->nBlockAlign = 4;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
321 sh_audio->wf->wBitsPerSample = sh_audio->samplesize = 16; // AVS->video_info->sample_type ??
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
322 sh_audio->wf->cbSize = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
323 sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
324 sh_audio->o_bps = sh_audio->wf->nAvgBytesPerSec;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
325 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
326 #endif
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
327
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
328 AVS->init = 1;
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
329 if (found)
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
330 return demuxer;
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
331 else
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
332 return NULL;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
333 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
334
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
335 static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
336 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
337 demux_stream_t *d_video=demuxer->video;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
338 sh_video_t *sh_video=d_video->sh;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
339 AVS_T *AVS = (AVS_T *) demuxer->priv;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
340
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
341 switch(cmd)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
342 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
343 case DEMUXER_CTRL_GET_TIME_LENGTH:
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
344 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
345 if (!AVS->video_info->num_frames) return DEMUXER_CTRL_DONTKNOW;
16346
6ff303d2876b Make -identify's 'ID_LENGTH=' print a float and not an integer.. The
ods15
parents: 16175
diff changeset
346 *((double *)arg) = (double)AVS->video_info->num_frames / sh_video->fps;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
347 return DEMUXER_CTRL_OK;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
348 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
349 case DEMUXER_CTRL_GET_PERCENT_POS:
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
350 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
351 if (!AVS->video_info->num_frames) return DEMUXER_CTRL_DONTKNOW;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
352 *((int *)arg) = (int) (AVS->frameno * 100 / AVS->video_info->num_frames);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
353 return DEMUXER_CTRL_OK;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
354 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
355 default:
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
356 return DEMUXER_CTRL_NOTIMPL;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
357 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
358 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
359
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
360 static void demux_close_avs(demuxer_t* demuxer)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
361 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
362 AVS_T *AVS = (AVS_T *) demuxer->priv;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
363 // TODO release_clip?
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
364 if (AVS)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
365 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
366 if (AVS->dll)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
367 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
368 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Unloading avisynth.dll\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
369 FreeLibrary(AVS->dll);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
370 }
15613
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
371 #ifdef WIN32_LOADER
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
372 Restore_LDT_Keeper(AVS->ldt_fs);
5b57ccc4b640 memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents: 15298
diff changeset
373 #endif
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
374 free(AVS);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
375 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
376 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
377
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
378 static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs,int flags)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
379 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
380 demux_stream_t *d_video=demuxer->video;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
381 sh_video_t *sh_video=d_video->sh;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
382 AVS_T *AVS = (AVS_T *) demuxer->priv;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
383 int video_pos=AVS->frameno;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
384
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
385 //mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
386
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
387 // seek absolute
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
388 if (flags&1) video_pos=0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
389
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
390 video_pos += (rel_seek_secs * sh_video->fps);
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
391 if (video_pos < 0) video_pos = 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
392 if (video_pos > AVS->video_info->num_frames) video_pos = AVS->video_info->num_frames;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
393
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
394 AVS->frameno = video_pos;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
395 sh_video->num_frames_decoded = video_pos;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
396 sh_video->num_frames = video_pos;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
397 d_video->pts=AVS->frameno / sh_video->fps; // OSD
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
398 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
399
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
400 static int avs_check_file(demuxer_t *demuxer)
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
401 {
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
402 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_check_file - attempting to open file %s\n", demuxer->filename);
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
403
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
404 if (!demuxer->filename) return 0;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
405
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
406 /* Avoid crazy memory eating when passing an mpg stream */
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
407 if (demuxer->movi_end > MAX_AVS_SIZE)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
408 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
409 mp_msg(MSGT_DEMUX,MSGL_V, "AVS: File is too big, aborting...\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
410 return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
411 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
412
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
413 demuxer->priv = initAVS(demuxer->filename);
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
414
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
415 if (demuxer->priv)
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
416 {
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
417 mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init Ok\n");
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
418 return DEMUXER_TYPE_AVS;
14693
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
419 }
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
420 mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init failed\n");
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
421 return 0;
37116118ab6a avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff changeset
422 }
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
423
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
424
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
425 demuxer_desc_t demuxer_desc_avs = {
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
426 "Avisynth demuxer",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
427 "avs",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
428 "AVS",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
429 "Gianluigi Tiesi",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
430 "Requires binary dll",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
431 DEMUXER_TYPE_AVS,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
432 0, // unsafe autodetect
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
433 avs_check_file,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
434 demux_avs_fill_buffer,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
435 demux_open_avs,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
436 demux_close_avs,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
437 demux_seek_avs,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
438 demux_avs_control
6b86089c2edd Demuxer modularization
rtognimp
parents: 15613
diff changeset
439 };