Mercurial > mplayer.hg
annotate libmpdemux/demux_avs.c @ 37003:2d8157b3b386
Fix the index passed to PutImage() for item type itVPotmeter.
Unlike the position for drawing the button (from bottom to top), the
index for the phase image has to be in the usual range, i.e. 0 for 0%
and numphases - 1 for 100%, so that the phase image can be designed
straightforwardly.
Fix the parameter although PutImage() currently doesn't work for item
type itVPotmeter at all.
author | ib |
---|---|
date | Fri, 28 Mar 2014 12:21:07 +0000 |
parents | 92dd1764392a |
children |
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 * |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
5 * This file is part of MPlayer. |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
6 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
7 * MPlayer is free software; you can redistribute it and/or |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
11 * |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
12 * MPlayer is distributed in the hope that it will be useful, |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
13 * 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
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
15 * Lesser General Public License for more details. |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
16 * |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public License |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
18 * along with MPlayer; if not, write to the Free Software Foundation, Inc., |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26473
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
14693
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 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
22 #include <stdio.h> |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
23 #include <stdlib.h> |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
24 #include <unistd.h> |
22420 | 25 #include <limits.h> |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
26 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
27 #include "config.h" |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
28 #include "mp_msg.h" |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
29 #include "help_mp.h" |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
30 |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
22450
diff
changeset
|
31 #include "stream/stream.h" |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
32 #include "demuxer.h" |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
33 #include "stheader.h" |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
34 #include "libvo/fastmemcpy.h" |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
35 |
31348
8df8a7c20f46
Replace forward declarations by proper loader/wine/winbase.h #include.
diego
parents:
30570
diff
changeset
|
36 #include "loader/wine/winbase.h" |
22606
97343cedd966
Use explicit path for headers from the loader/ directory.
diego
parents:
22605
diff
changeset
|
37 #include "loader/wine/windef.h" |
14693
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 #ifdef WIN32_LOADER |
22606
97343cedd966
Use explicit path for headers from the loader/ directory.
diego
parents:
22605
diff
changeset
|
40 #include "loader/ldt_keeper.h" |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
41 #endif |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
42 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
43 #include "demux_avs.h" |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
44 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
45 #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
|
46 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 typedef WINAPI AVS_Clip* (*imp_avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *); |
19210
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
51 typedef WINAPI void (*imp_avs_release_clip)(AVS_Clip *); |
14693
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 *); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
54 typedef WINAPI int (*imp_avs_get_audio)(AVS_Clip *, void * buf, uint64_t start, uint64_t count); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
55 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
56 #define Q(string) # string |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
57 #define IMPORT_FUNC(x) \ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
58 AVS->x = ( imp_##x ) GetProcAddress(AVS->dll, Q(x)); \ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
59 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
|
60 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
61 typedef struct tagAVS |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
62 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
63 AVS_ScriptEnvironment *avs_env; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
64 AVS_Value handler; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
65 AVS_Clip *clip; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
66 const AVS_VideoInfo *video_info; |
15613
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
67 #ifdef WIN32_LOADER |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
68 ldt_fs_t* ldt_fs; |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
69 #endif |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
70 HMODULE dll; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
71 int frameno; |
22420 | 72 uint64_t sampleno; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
73 int init; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
74 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
75 imp_avs_create_script_environment avs_create_script_environment; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
76 imp_avs_invoke avs_invoke; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
77 imp_avs_get_video_info avs_get_video_info; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
78 imp_avs_take_clip avs_take_clip; |
19210
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
79 imp_avs_release_clip avs_release_clip; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
80 imp_avs_get_frame avs_get_frame; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
81 imp_avs_release_video_frame avs_release_video_frame; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
82 imp_avs_get_audio avs_get_audio; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
83 } AVS_T; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
84 |
30570
98dc6ae7ede2
libmpdemux: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
85 static AVS_T *initAVS(const char *filename) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
86 { |
36438 | 87 AVS_T *AVS = calloc(1, sizeof(AVS_T)); |
14695 | 88 AVS_Value arg0 = avs_new_value_string(filename); |
89 AVS_Value args = avs_new_value_array(&arg0, 1); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
90 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
91 #ifdef WIN32_LOADER |
15613
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
92 AVS->ldt_fs = Setup_LDT_Keeper(); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
93 #endif |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
94 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
95 AVS->dll = LoadLibraryA("avisynth.dll"); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
96 if(!AVS->dll) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
97 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
98 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
|
99 goto avs_err; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
100 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
101 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
102 /* Dynamic import of needed stuff from avisynth.dll */ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
103 IMPORT_FUNC(avs_create_script_environment); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
104 IMPORT_FUNC(avs_invoke); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
105 IMPORT_FUNC(avs_get_video_info); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
106 IMPORT_FUNC(avs_take_clip); |
19210
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
107 IMPORT_FUNC(avs_release_clip); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
108 IMPORT_FUNC(avs_get_frame); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
109 IMPORT_FUNC(avs_release_video_frame); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
110 IMPORT_FUNC(avs_get_audio); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
111 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
112 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
|
113 if (!AVS->avs_env) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
114 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
115 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
|
116 goto avs_err; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
117 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
118 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
119 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
120 AVS->handler = AVS->avs_invoke(AVS->avs_env, "Import", args, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
121 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
122 if (avs_is_error(AVS->handler)) |
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 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
|
125 goto avs_err; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
126 } |
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_clip(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 doesn't return a clip\n"); |
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 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
133 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
134 return AVS; |
15613
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
135 |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
136 avs_err: |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
137 if (AVS->dll) FreeLibrary(AVS->dll); |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
138 #ifdef WIN32_LOADER |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
139 Restore_LDT_Keeper(AVS->ldt_fs); |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
140 #endif |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
141 free(AVS); |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
142 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
143 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
144 |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
145 /* Implement RGB MODES ?? */ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
146 #if 0 |
34653 | 147 static inline int get_mmioFOURCC(const AVS_VideoInfo *v) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
148 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 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
|
153 if (avs_is_yuy(v)) return mmioFOURCC('Y', 'U', 'Y', ' '); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
154 if (avs_is_yuy2(v)) return mmioFOURCC('Y', 'U', 'Y', '2'); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
155 return 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
156 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
157 #endif |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
158 |
16175 | 159 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
|
160 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
161 AVS_VideoFrame *curr_frame; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
162 demux_packet_t *dp = NULL; |
22428 | 163 AVS_T *AVS = demuxer->priv; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
164 |
22417
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
165 if (ds == demuxer->video) |
19213
606d2f7cd307
Move more stuff under if (avs_has_video... to simplify later patches.
reimar
parents:
19212
diff
changeset
|
166 { |
22422 | 167 sh_video_t *sh_video = demuxer->video->sh; |
36439 | 168 unsigned char *dst; |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
169 int w, h; |
22431
0cf22436ef75
Already frameno == num_frames means we reached EOF.
reimar
parents:
22430
diff
changeset
|
170 if (AVS->video_info->num_frames <= AVS->frameno) return 0; // EOF |
19214 | 171 |
172 curr_frame = AVS->avs_get_frame(AVS->clip, AVS->frameno); | |
173 if (!curr_frame) | |
174 { | |
175 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: error getting frame -- EOF??\n"); | |
176 return 0; | |
177 } | |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
178 w = curr_frame->row_size; |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
179 h = curr_frame->height; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
180 |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
181 dp = new_demux_packet(w * h + 2 * (w / 2) * (h / 2)); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
182 |
19212 | 183 dp->pts=AVS->frameno / sh_video->fps; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
184 |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
185 dst = dp->buffer; |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
186 memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offset, |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
187 w, h, w, curr_frame->pitch); |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
188 dst += w * h; |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
189 w /= 2; h /= 2; |
19219 | 190 memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetV, |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
191 w, h, w, curr_frame->pitchUV); |
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
192 dst += w * h; |
19219 | 193 memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetU, |
19218
950f60b90cf5
Handle frames with stride correctly (e.g. the "Version" source of current AVS).
reimar
parents:
19217
diff
changeset
|
194 w, h, w, curr_frame->pitchUV); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
195 ds_add_packet(demuxer->video, dp); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
196 |
19214 | 197 AVS->frameno++; |
198 AVS->avs_release_video_frame(curr_frame); | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
199 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
200 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
201 /* Audio */ |
22417
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
202 if (ds == demuxer->audio) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
203 { |
22417
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
204 sh_audio_t *sh_audio = ds->sh; |
22420 | 205 int samples = sh_audio->samplerate; |
22427 | 206 uint64_t l; |
207 samples = FFMIN(samples, AVS->video_info->num_audio_samples - AVS->sampleno); | |
208 if (!samples) return 0; | |
209 l = samples * sh_audio->channels * sh_audio->samplesize; | |
22420 | 210 if (l > INT_MAX) { |
22426 | 211 mp_msg(MSGT_DEMUX, MSGL_FATAL, "AVS: audio packet too big\n"); |
22420 | 212 return 0; |
213 } | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
214 dp = new_demux_packet(l); |
22432 | 215 dp->pts = AVS->sampleno / sh_audio->samplerate; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
216 |
22420 | 217 if (AVS->avs_get_audio(AVS->clip, dp->buffer, AVS->sampleno, samples)) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
218 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
219 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
|
220 return 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
221 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
222 ds_add_packet(demuxer->audio, dp); |
22420 | 223 |
224 AVS->sampleno += samples; | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
225 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
226 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
227 return 1; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
228 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
229 |
16175 | 230 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
|
231 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
232 int found = 0; |
22428 | 233 AVS_T *AVS = demuxer->priv; |
22429
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
234 int audio_samplesize = 0; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
235 AVS->frameno = 0; |
22420 | 236 AVS->sampleno = 0; |
14693
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: demux_open_avs()\n"); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
239 demuxer->seekable = 1; |
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 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
|
242 if(!AVS->clip) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
243 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
244 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n"); |
16175 | 245 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
246 } |
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 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
|
249 if (!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 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n"); |
16175 | 252 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
253 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
254 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
255 if (!avs_is_yv12(AVS->video_info)) |
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 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
|
258 if (avs_is_error(AVS->handler)) |
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 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Cannot convert input video to YV12: %s\n", avs_as_string(AVS->handler)); |
16175 | 261 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
262 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
263 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
264 AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
265 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
266 if(!AVS->clip) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
267 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
268 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n"); |
16175 | 269 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
270 } |
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 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
|
273 if (!AVS->video_info) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
274 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
275 mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n"); |
16175 | 276 return NULL; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
277 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
278 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
279 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
280 // TODO check field-based ?? |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
281 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
282 /* Video */ |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
283 if (avs_has_video(AVS->video_info)) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
284 { |
19211
f6be1a409147
Move variable declarations to the block level where they are actually used
reimar
parents:
19210
diff
changeset
|
285 sh_video_t *sh_video = new_sh_video(demuxer, 0); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
286 found = 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
287 |
22417
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
288 if (demuxer->video->id == -1) demuxer->video->id = 0; |
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
289 if (demuxer->video->id == 0) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
290 demuxer->video->sh = sh_video; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
291 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
292 sh_video->disp_w = AVS->video_info->width; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
293 sh_video->disp_h = AVS->video_info->height; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
294 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
295 //sh_video->format = get_mmioFOURCC(AVS->video_info); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
296 sh_video->format = mmioFOURCC('Y', 'V', '1', '2'); |
26472
67930b46705d
Calculate fps as double-precision to make switching to double-precision fps values easier.
reimar
parents:
25883
diff
changeset
|
297 sh_video->fps = (double) AVS->video_info->fps_numerator / (double) AVS->video_info->fps_denominator; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
298 sh_video->frametime = 1.0 / sh_video->fps; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
299 |
32100 | 300 sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4)); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
301 sh_video->bih->biCompression = sh_video->format; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
302 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
|
303 //sh_video->bih->biPlanes = 2; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
304 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
305 sh_video->bih->biWidth = AVS->video_info->width; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
306 sh_video->bih->biHeight = AVS->video_info->height; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
307 sh_video->num_frames = 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
308 sh_video->num_frames_decoded = 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
309 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
310 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
311 /* Audio */ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
312 if (avs_has_audio(AVS->video_info)) |
22429
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
313 switch (AVS->video_info->sample_type) { |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
314 case AVS_SAMPLE_INT8: audio_samplesize = 1; break; |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
315 case AVS_SAMPLE_INT16: audio_samplesize = 2; break; |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
316 case AVS_SAMPLE_INT24: audio_samplesize = 3; break; |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
317 case AVS_SAMPLE_INT32: |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
318 case AVS_SAMPLE_FLOAT: audio_samplesize = 4; break; |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
319 default: |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
320 mp_msg(MSGT_DEMUX, MSGL_ERR, "AVS: unknown audio type, disabling\n"); |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
321 } |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
322 if (audio_samplesize) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
323 { |
31609
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
31348
diff
changeset
|
324 sh_audio_t *sh_audio = new_sh_audio(demuxer, 0, NULL); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
325 found = 1; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
326 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
|
327 |
22417
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
328 if (demuxer->audio->id == -1) demuxer->audio->id = 0; |
0d507228e65b
Enable aid/vid stream selection, although it is quite useless currently.
reimar
parents:
22414
diff
changeset
|
329 if (demuxer->audio->id == 0) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
330 demuxer->audio->sh = sh_audio; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
331 |
32100 | 332 sh_audio->wf = malloc(sizeof(*sh_audio->wf)); |
22425
dacdd07fec16
Set format tag for float samples correctly (currently useless)
reimar
parents:
22422
diff
changeset
|
333 sh_audio->wf->wFormatTag = sh_audio->format = |
dacdd07fec16
Set format tag for float samples correctly (currently useless)
reimar
parents:
22422
diff
changeset
|
334 (AVS->video_info->sample_type == AVS_SAMPLE_FLOAT) ? 0x3 : 0x1; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
335 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
|
336 sh_audio->wf->nSamplesPerSec = sh_audio->samplerate = AVS->video_info->audio_samples_per_second; |
22429
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
337 sh_audio->samplesize = audio_samplesize; |
e0c231d90b7c
Support more avisynth audio sample types (untested)
reimar
parents:
22428
diff
changeset
|
338 sh_audio->wf->nAvgBytesPerSec = sh_audio->channels * sh_audio->samplesize * sh_audio->samplerate; |
22420 | 339 sh_audio->wf->nBlockAlign = sh_audio->channels * sh_audio->samplesize; |
340 sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8; | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
341 sh_audio->wf->cbSize = 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
342 sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
343 } |
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 AVS->init = 1; |
16175 | 346 if (found) |
347 return demuxer; | |
348 else | |
349 return NULL; | |
14693
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 |
16175 | 352 static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
353 { |
22422 | 354 sh_video_t *sh_video=demuxer->video->sh; |
22430
1c12f4697cec
Fix crash with avisynth audio-only files and take audio length into account when length is queried.
reimar
parents:
22429
diff
changeset
|
355 sh_audio_t *sh_audio=demuxer->audio->sh; |
22428 | 356 AVS_T *AVS = demuxer->priv; |
14693
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 switch(cmd) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
359 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
360 case DEMUXER_CTRL_GET_TIME_LENGTH: |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
361 { |
22430
1c12f4697cec
Fix crash with avisynth audio-only files and take audio length into account when length is queried.
reimar
parents:
22429
diff
changeset
|
362 double res = sh_video ? (double)AVS->video_info->num_frames / sh_video->fps : 0; |
1c12f4697cec
Fix crash with avisynth audio-only files and take audio length into account when length is queried.
reimar
parents:
22429
diff
changeset
|
363 if (sh_audio) |
1c12f4697cec
Fix crash with avisynth audio-only files and take audio length into account when length is queried.
reimar
parents:
22429
diff
changeset
|
364 res = FFMAX(res, (double)AVS->video_info->num_audio_samples / sh_audio->samplerate); |
1c12f4697cec
Fix crash with avisynth audio-only files and take audio length into account when length is queried.
reimar
parents:
22429
diff
changeset
|
365 *((double *)arg) = res; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
366 return DEMUXER_CTRL_OK; |
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 case DEMUXER_CTRL_GET_PERCENT_POS: |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
369 { |
22447 | 370 if (sh_video) |
22446 | 371 *((int *)arg) = AVS->frameno * 100 / AVS->video_info->num_frames; |
22447 | 372 else |
373 *((int *)arg) = AVS->sampleno * 100 / AVS->video_info->num_audio_samples; | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
374 return DEMUXER_CTRL_OK; |
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 default: |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
377 return DEMUXER_CTRL_NOTIMPL; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
378 } |
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 |
16175 | 381 static void demux_close_avs(demuxer_t* demuxer) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
382 { |
22428 | 383 AVS_T *AVS = demuxer->priv; |
19210
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
384 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
385 if (AVS) |
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 if (AVS->dll) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
388 { |
19210
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
389 if (AVS->clip) |
bef4df2fa6c6
call av_release_clip at uninit, part of a patch by Gianluigi Tiesi <mplayer at netfarm it>
reimar
parents:
17636
diff
changeset
|
390 AVS->avs_release_clip(AVS->clip); |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
391 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
|
392 FreeLibrary(AVS->dll); |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
393 } |
15613
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
394 #ifdef WIN32_LOADER |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
395 Restore_LDT_Keeper(AVS->ldt_fs); |
5b57ccc4b640
memory leak fixes, patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
15298
diff
changeset
|
396 #endif |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
397 free(AVS); |
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 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
400 |
17636 | 401 static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
402 { |
22434
a7438b68f5d5
Remove variable that is unnecessary after last patch
reimar
parents:
22433
diff
changeset
|
403 sh_video_t *sh_video=demuxer->video->sh; |
22448 | 404 sh_audio_t *sh_audio=demuxer->audio->sh; |
22428 | 405 AVS_T *AVS = demuxer->priv; |
22448 | 406 double video_pos = sh_video ? |
407 (double)AVS->frameno / sh_video->fps : | |
408 (double)AVS->sampleno / sh_audio->samplerate; | |
22449 | 409 double duration = sh_video ? |
410 (double)AVS->video_info->num_frames / sh_video->fps : | |
411 (double)AVS->video_info->num_audio_samples / sh_audio->samplerate; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
412 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
413 //mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
414 |
25883
baf32110d3fc
Use defines to give names to the different seek flags.
reimar
parents:
25707
diff
changeset
|
415 if (flags&SEEK_ABSOLUTE) video_pos=0; |
baf32110d3fc
Use defines to give names to the different seek flags.
reimar
parents:
25707
diff
changeset
|
416 if (flags&SEEK_FACTOR) rel_seek_secs *= duration; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
417 |
22448 | 418 video_pos += rel_seek_secs; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
419 if (video_pos < 0) video_pos = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
420 |
22448 | 421 if (sh_video) { |
422 AVS->frameno = FFMIN(video_pos * sh_video->fps, | |
423 AVS->video_info->num_frames); | |
424 sh_video->num_frames_decoded = AVS->frameno; | |
425 sh_video->num_frames = AVS->frameno; | |
426 } | |
26473
47864c18ff54
Take audio delay into account when seeking in avisynth demuxer.
reimar
parents:
26472
diff
changeset
|
427 video_pos += audio_delay; |
47864c18ff54
Take audio delay into account when seeking in avisynth demuxer.
reimar
parents:
26472
diff
changeset
|
428 if (video_pos < 0) video_pos = 0; |
22448 | 429 if (sh_audio) |
430 AVS->sampleno = FFMIN(video_pos * sh_audio->samplerate, | |
431 AVS->video_info->num_audio_samples); | |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
432 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
433 |
16175 | 434 static int avs_check_file(demuxer_t *demuxer) |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
435 { |
16175 | 436 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
|
437 |
16175 | 438 if (!demuxer->filename) return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
439 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
440 /* Avoid crazy memory eating when passing an mpg stream */ |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
441 if (demuxer->movi_end > MAX_AVS_SIZE) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
442 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
443 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
|
444 return 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
445 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
446 |
16175 | 447 demuxer->priv = initAVS(demuxer->filename); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27582
diff
changeset
|
448 |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
449 if (demuxer->priv) |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
450 { |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
451 mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init Ok\n"); |
16175 | 452 return DEMUXER_TYPE_AVS; |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
453 } |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
454 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
|
455 return 0; |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
diff
changeset
|
456 } |
16175 | 457 |
458 | |
25707
d4fe6e23283e
Make all demuxer_desc_t const, thus moving them to .rodata
reimar
parents:
22606
diff
changeset
|
459 const demuxer_desc_t demuxer_desc_avs = { |
16175 | 460 "Avisynth demuxer", |
461 "avs", | |
462 "AVS", | |
463 "Gianluigi Tiesi", | |
464 "Requires binary dll", | |
465 DEMUXER_TYPE_AVS, | |
466 0, // unsafe autodetect | |
467 avs_check_file, | |
468 demux_avs_fill_buffer, | |
469 demux_open_avs, | |
470 demux_close_avs, | |
471 demux_seek_avs, | |
472 demux_avs_control | |
473 }; |