FFmpeg
avisynth.c
Go to the documentation of this file.
1 /*
2  * AviSynth(+) support
3  * Copyright (c) 2012 AvxSynth Team
4  *
5  * This file is part of FFmpeg
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/internal.h"
24 #include "libavutil/opt.h"
25 
26 #include "libavcodec/internal.h"
27 
28 #include "avformat.h"
29 #include "internal.h"
30 #include "config.h"
31 
32 /* Enable function pointer definitions for runtime loading. */
33 #define AVSC_NO_DECLSPEC
34 
35 /* Platform-specific directives. */
36 #ifdef _WIN32
37  #include "compat/w32dlfcn.h"
39  #undef EXTERN_C
40  #define AVISYNTH_LIB "avisynth"
41 #else
42  #include <dlfcn.h>
43  #define AVISYNTH_NAME "libavisynth"
44  #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF
45 #endif
46 
47 /* Endianness guards for audio */
48 #if HAVE_BIGENDIAN
49  #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## BE)
50 #else
51  #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## LE)
52 #endif
53 
54 #include <avisynth/avisynth_c.h>
55 
56 typedef struct AviSynthLibrary {
57  void *library;
58 #define AVSC_DECLARE_FUNC(name) name ## _func name
59  AVSC_DECLARE_FUNC(avs_bit_blt);
60  AVSC_DECLARE_FUNC(avs_clip_get_error);
61  AVSC_DECLARE_FUNC(avs_check_version);
62  AVSC_DECLARE_FUNC(avs_create_script_environment);
63  AVSC_DECLARE_FUNC(avs_delete_script_environment);
64  AVSC_DECLARE_FUNC(avs_get_audio);
65  AVSC_DECLARE_FUNC(avs_get_error);
66  AVSC_DECLARE_FUNC(avs_get_frame);
67  AVSC_DECLARE_FUNC(avs_get_version);
68  AVSC_DECLARE_FUNC(avs_get_video_info);
69  AVSC_DECLARE_FUNC(avs_invoke);
70  AVSC_DECLARE_FUNC(avs_is_color_space);
71  AVSC_DECLARE_FUNC(avs_release_clip);
72  AVSC_DECLARE_FUNC(avs_release_value);
73  AVSC_DECLARE_FUNC(avs_release_video_frame);
74  AVSC_DECLARE_FUNC(avs_take_clip);
75  AVSC_DECLARE_FUNC(avs_bits_per_pixel);
76  AVSC_DECLARE_FUNC(avs_get_height_p);
77  AVSC_DECLARE_FUNC(avs_get_pitch_p);
78  AVSC_DECLARE_FUNC(avs_get_read_ptr_p);
79  AVSC_DECLARE_FUNC(avs_get_row_size_p);
80  AVSC_DECLARE_FUNC(avs_is_planar_rgb);
81  AVSC_DECLARE_FUNC(avs_is_planar_rgba);
82  AVSC_DECLARE_FUNC(avs_get_frame_props_ro);
83  AVSC_DECLARE_FUNC(avs_prop_get_int);
84  AVSC_DECLARE_FUNC(avs_prop_get_type);
85  AVSC_DECLARE_FUNC(avs_get_env_property);
86 #undef AVSC_DECLARE_FUNC
88 
89 typedef enum AviSynthFlags {
98 
99 typedef struct AviSynthContext {
100  const AVClass *class;
101  AVS_ScriptEnvironment *env;
102  AVS_Clip *clip;
103  const AVS_VideoInfo *vi;
104 
105  /* avisynth_read_packet_video() iterates over this. */
106  int n_planes;
107  const int *planes;
108 
111  int64_t curr_sample;
112 
113  int error;
114 
115  uint32_t flags;
116 
117  /* Linked list pointers. */
120 
121 static const int avs_planes_packed[1] = { 0 };
122 static const int avs_planes_grey[1] = { AVS_PLANAR_Y };
123 static const int avs_planes_yuv[3] = { AVS_PLANAR_Y, AVS_PLANAR_U,
124  AVS_PLANAR_V };
125 static const int avs_planes_rgb[3] = { AVS_PLANAR_G, AVS_PLANAR_B,
126  AVS_PLANAR_R };
127 static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U,
128  AVS_PLANAR_V, AVS_PLANAR_A };
129 static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B,
130  AVS_PLANAR_R, AVS_PLANAR_A };
131 
132 /* A conflict between C++ global objects, atexit, and dynamic loading requires
133  * us to register our own atexit handler to prevent double freeing. */
135 static int avs_atexit_called = 0;
136 
137 /* Linked list of AviSynthContexts. An atexit handler destroys this list. */
139 
140 static av_cold void avisynth_atexit_handler(void);
141 
143 {
144  avs_library.library = dlopen(AVISYNTH_LIB, RTLD_NOW | RTLD_LOCAL);
145  if (!avs_library.library)
146  return AVERROR_UNKNOWN;
147 
148 #define LOAD_AVS_FUNC(name, continue_on_fail) \
149  avs_library.name = (name ## _func) \
150  dlsym(avs_library.library, #name); \
151  if (!continue_on_fail && !avs_library.name) \
152  goto fail;
153 
154  LOAD_AVS_FUNC(avs_bit_blt, 0);
155  LOAD_AVS_FUNC(avs_clip_get_error, 0);
156  LOAD_AVS_FUNC(avs_check_version, 0);
157  LOAD_AVS_FUNC(avs_create_script_environment, 0);
158  LOAD_AVS_FUNC(avs_delete_script_environment, 0);
159  LOAD_AVS_FUNC(avs_get_audio, 0);
160  LOAD_AVS_FUNC(avs_get_error, 1); // New to AviSynth 2.6
161  LOAD_AVS_FUNC(avs_get_frame, 0);
162  LOAD_AVS_FUNC(avs_get_version, 0);
163  LOAD_AVS_FUNC(avs_get_video_info, 0);
164  LOAD_AVS_FUNC(avs_invoke, 0);
165  LOAD_AVS_FUNC(avs_is_color_space, 1);
166  LOAD_AVS_FUNC(avs_release_clip, 0);
167  LOAD_AVS_FUNC(avs_release_value, 0);
168  LOAD_AVS_FUNC(avs_release_video_frame, 0);
169  LOAD_AVS_FUNC(avs_take_clip, 0);
170  LOAD_AVS_FUNC(avs_bits_per_pixel, 1);
171  LOAD_AVS_FUNC(avs_get_height_p, 1);
172  LOAD_AVS_FUNC(avs_get_pitch_p, 1);
173  LOAD_AVS_FUNC(avs_get_read_ptr_p, 1);
174  LOAD_AVS_FUNC(avs_get_row_size_p, 1);
175  LOAD_AVS_FUNC(avs_is_planar_rgb, 1);
176  LOAD_AVS_FUNC(avs_is_planar_rgba, 1);
177  LOAD_AVS_FUNC(avs_get_frame_props_ro, 1);
178  LOAD_AVS_FUNC(avs_prop_get_int, 1);
179  LOAD_AVS_FUNC(avs_prop_get_type, 1);
180  LOAD_AVS_FUNC(avs_get_env_property, 1);
181 #undef LOAD_AVS_FUNC
182 
183  atexit(avisynth_atexit_handler);
184  return 0;
185 
186 fail:
187  dlclose(avs_library.library);
188  return AVERROR_UNKNOWN;
189 }
190 
191 /* Note that avisynth_context_create and avisynth_context_destroy
192  * do not allocate or free the actual context! That is taken care of
193  * by libavformat. */
195 {
196  AviSynthContext *avs = s->priv_data;
197  int ret;
198 
199  if (!avs_library.library)
200  if (ret = avisynth_load_library())
201  return ret;
202 
203  avs->env = avs_library.avs_create_script_environment(3);
204  if (avs_library.avs_get_error) {
205  const char *error = avs_library.avs_get_error(avs->env);
206  if (error) {
207  av_log(s, AV_LOG_ERROR, "%s\n", error);
208  return AVERROR_UNKNOWN;
209  }
210  }
211 
212  if (!avs_ctx_list) {
213  avs_ctx_list = avs;
214  } else {
215  avs->next = avs_ctx_list;
216  avs_ctx_list = avs;
217  }
218 
219  return 0;
220 }
221 
223 {
224  if (avs_atexit_called)
225  return;
226 
227  if (avs == avs_ctx_list) {
228  avs_ctx_list = avs->next;
229  } else {
231  while (prev->next != avs)
232  prev = prev->next;
233  prev->next = avs->next;
234  }
235 
236  if (avs->clip) {
237  avs_library.avs_release_clip(avs->clip);
238  avs->clip = NULL;
239  }
240  if (avs->env) {
241  avs_library.avs_delete_script_environment(avs->env);
242  avs->env = NULL;
243  }
244 }
245 
247 {
249 
250  while (avs) {
251  AviSynthContext *next = avs->next;
253  avs = next;
254  }
255  dlclose(avs_library.library);
256 
257  avs_atexit_called = 1;
258 }
259 
260 /* Create AVStream from audio and video data. */
262 {
263  AviSynthContext *avs = s->priv_data;
264  const AVS_Map *avsmap;
265  AVS_VideoFrame *frame;
266  int error;
267  int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA
268  int sar_num = 1;
269  int sar_den = 1;
270 
273  st->codecpar->width = avs->vi->width;
274  st->codecpar->height = avs->vi->height;
275 
276  st->avg_frame_rate = (AVRational) { avs->vi->fps_numerator,
277  avs->vi->fps_denominator };
278  st->start_time = 0;
279  st->duration = avs->vi->num_frames;
280  st->nb_frames = avs->vi->num_frames;
281  avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator);
282 
283 
284  switch (avs->vi->pixel_type) {
285  /* 10~16-bit YUV pix_fmts (AviSynth+) */
286  case AVS_CS_YUV444P10:
288  planar = 1;
289  break;
290  case AVS_CS_YUV422P10:
292  planar = 1;
293  break;
294  case AVS_CS_YUV420P10:
296  planar = 1;
297  break;
298  case AVS_CS_YUV444P12:
300  planar = 1;
301  break;
302  case AVS_CS_YUV422P12:
304  planar = 1;
305  break;
306  case AVS_CS_YUV420P12:
308  planar = 1;
309  break;
310  case AVS_CS_YUV444P14:
312  planar = 1;
313  break;
314  case AVS_CS_YUV422P14:
316  planar = 1;
317  break;
318  case AVS_CS_YUV420P14:
320  planar = 1;
321  break;
322  case AVS_CS_YUV444P16:
324  planar = 1;
325  break;
326  case AVS_CS_YUV422P16:
328  planar = 1;
329  break;
330  case AVS_CS_YUV420P16:
332  planar = 1;
333  break;
334  /* 8~16-bit YUV pix_fmts with Alpha (AviSynth+) */
335  case AVS_CS_YUVA444:
337  planar = 4;
338  break;
339  case AVS_CS_YUVA422:
341  planar = 4;
342  break;
343  case AVS_CS_YUVA420:
345  planar = 4;
346  break;
347  case AVS_CS_YUVA444P10:
349  planar = 4;
350  break;
351  case AVS_CS_YUVA422P10:
353  planar = 4;
354  break;
355  case AVS_CS_YUVA420P10:
357  planar = 4;
358  break;
359  case AVS_CS_YUVA422P12:
361  planar = 4;
362  break;
363  case AVS_CS_YUVA444P16:
365  planar = 4;
366  break;
367  case AVS_CS_YUVA422P16:
369  planar = 4;
370  break;
371  case AVS_CS_YUVA420P16:
373  planar = 4;
374  break;
375  /* Planar RGB pix_fmts (AviSynth+) */
376  case AVS_CS_RGBP:
378  planar = 3;
379  break;
380  case AVS_CS_RGBP10:
382  planar = 3;
383  break;
384  case AVS_CS_RGBP12:
386  planar = 3;
387  break;
388  case AVS_CS_RGBP14:
390  planar = 3;
391  break;
392  case AVS_CS_RGBP16:
394  planar = 3;
395  break;
396  /* Single precision floating point Planar RGB (AviSynth+) */
397  case AVS_CS_RGBPS:
399  planar = 3;
400  break;
401  /* Planar RGB pix_fmts with Alpha (AviSynth+) */
402  case AVS_CS_RGBAP:
404  planar = 5;
405  break;
406  case AVS_CS_RGBAP10:
408  planar = 5;
409  break;
410  case AVS_CS_RGBAP12:
412  planar = 5;
413  break;
414  case AVS_CS_RGBAP16:
416  planar = 5;
417  break;
418  /* Single precision floating point Planar RGB with Alpha (AviSynth+) */
419  case AVS_CS_RGBAPS:
421  planar = 5;
422  break;
423  /* 10~16-bit gray pix_fmts (AviSynth+) */
424  case AVS_CS_Y10:
426  planar = 2;
427  break;
428  case AVS_CS_Y12:
430  planar = 2;
431  break;
432  case AVS_CS_Y14:
434  planar = 2;
435  break;
436  case AVS_CS_Y16:
438  planar = 2;
439  break;
440  /* Single precision floating point gray (AviSynth+) */
441  case AVS_CS_Y32:
443  planar = 2;
444  break;
445  /* pix_fmts added in AviSynth 2.6 */
446  case AVS_CS_YV24:
448  planar = 1;
449  break;
450  case AVS_CS_YV16:
452  planar = 1;
453  break;
454  case AVS_CS_YV411:
456  planar = 1;
457  break;
458  case AVS_CS_Y8:
460  planar = 2;
461  break;
462  /* 16-bit packed RGB pix_fmts (AviSynth+) */
463  case AVS_CS_BGR48:
465  break;
466  case AVS_CS_BGR64:
468  break;
469  /* AviSynth 2.5 pix_fmts */
470  case AVS_CS_BGR24:
472  break;
473  case AVS_CS_BGR32:
475  break;
476  case AVS_CS_YUY2:
478  break;
479  case AVS_CS_YV12:
481  planar = 1;
482  break;
483  case AVS_CS_I420: // Is this even used anywhere?
485  planar = 1;
486  break;
487  default:
489  "unknown AviSynth colorspace %d\n", avs->vi->pixel_type);
490  avs->error = 1;
491  return AVERROR_UNKNOWN;
492  }
493 
494  switch (planar) {
495  case 5: // Planar RGB + Alpha
496  avs->n_planes = 4;
497  avs->planes = avs_planes_rgba;
498  break;
499  case 4: // YUV + Alpha
500  avs->n_planes = 4;
501  avs->planes = avs_planes_yuva;
502  break;
503  case 3: // Planar RGB
504  avs->n_planes = 3;
505  avs->planes = avs_planes_rgb;
506  break;
507  case 2: // Y8
508  avs->n_planes = 1;
509  avs->planes = avs_planes_grey;
510  break;
511  case 1: // YUV
512  avs->n_planes = 3;
513  avs->planes = avs_planes_yuv;
514  break;
515  default:
516  avs->n_planes = 1;
517  avs->planes = avs_planes_packed;
518  }
519 
520  /* Read AviSynth+'s frame properties to set additional info.
521  *
522  * Due to a bug preventing the C interface from accessing frame
523  * properties in earlier versions of interface version 8, and
524  * previous attempts at being clever resulting in pre-8 versions
525  * of AviSynth+ segfaulting, only enable this if we detect
526  * version 9 at the minimum. Technically, 8.1 works, but the time
527  * distance between 8.1 and 9 is very small, so just restrict it to 9. */
528 
529  if (avs_library.avs_get_version(avs->clip) >= 9) {
530 
531  frame = avs_library.avs_get_frame(avs->clip, 0);
532  avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame);
533 
534  /* Field order */
536  if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) {
538  } else {
539  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, &error)) {
540  case 0:
542  break;
543  case 1:
545  break;
546  case 2:
548  break;
549  default:
551  }
552  }
553  }
554 
555  /* Color Range */
556  if(avs->flags & AVISYNTH_FRAMEPROP_RANGE) {
557  if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) {
559  } else {
560  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) {
561  case 0:
563  break;
564  case 1:
566  break;
567  default:
569  }
570  }
571  }
572 
573  /* Color Primaries */
575  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, &error)) {
576  case 1:
578  break;
579  case 2:
581  break;
582  case 4:
584  break;
585  case 5:
587  break;
588  case 6:
590  break;
591  case 7:
593  break;
594  case 8:
596  break;
597  case 9:
599  break;
600  case 10:
602  break;
603  case 11:
605  break;
606  case 12:
608  break;
609  case 22:
611  break;
612  default:
614  }
615  }
616 
617  /* Color Transfer Characteristics */
619  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Transfer", 0, &error)) {
620  case 1:
622  break;
623  case 2:
625  break;
626  case 4:
628  break;
629  case 5:
631  break;
632  case 6:
634  break;
635  case 7:
637  break;
638  case 8:
640  break;
641  case 9:
643  break;
644  case 10:
646  break;
647  case 11:
649  break;
650  case 12:
652  break;
653  case 13:
655  break;
656  case 14:
658  break;
659  case 15:
661  break;
662  case 16:
664  break;
665  case 17:
667  break;
668  case 18:
670  break;
671  default:
673  }
674  }
675 
676  /* Matrix coefficients */
677  if(avs->flags & AVISYNTH_FRAMEPROP_MATRIX) {
678  if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == AVS_PROPTYPE_UNSET) {
680  } else {
681  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Matrix", 0, &error)) {
682  case 0:
684  break;
685  case 1:
687  break;
688  case 2:
690  break;
691  case 4:
693  break;
694  case 5:
696  break;
697  case 6:
699  break;
700  case 7:
702  break;
703  case 8:
705  break;
706  case 9:
708  break;
709  case 10:
711  break;
712  case 11:
714  break;
715  case 12:
717  break;
718  case 13:
720  break;
721  case 14:
723  break;
724  default:
726  }
727  }
728  }
729 
730  /* Chroma Location */
732  if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ChromaLocation") == AVS_PROPTYPE_UNSET) {
734  } else {
735  switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ChromaLocation", 0, &error)) {
736  case 0:
738  break;
739  case 1:
741  break;
742  case 2:
744  break;
745  case 3:
747  break;
748  case 4:
750  break;
751  case 5:
753  break;
754  default:
756  }
757  }
758  }
759 
760  /* Sample aspect ratio */
761  if(avs->flags & AVISYNTH_FRAMEPROP_SAR) {
762  sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, &error);
763  sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, &error);
764  st->sample_aspect_ratio = (AVRational){ sar_num, sar_den };
765  }
766 
767  avs_library.avs_release_video_frame(frame);
768  } else {
770  /* AviSynth works with frame-based video, detecting field order can
771  * only work when avs_is_field_based returns 'false'. */
772  av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi));
773  if (avs_is_field_based(avs->vi) == 0) {
774  if (avs_is_tff(avs->vi)) {
776  }
777  else if (avs_is_bff(avs->vi)) {
779  }
780  }
781  }
782 
783  return 0;
784 }
785 
787 {
788  AviSynthContext *avs = s->priv_data;
789 
791  st->codecpar->sample_rate = avs->vi->audio_samples_per_second;
792  st->codecpar->ch_layout.nb_channels = avs->vi->nchannels;
793  st->duration = avs->vi->num_audio_samples;
794  avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second);
795 
796  switch (avs->vi->sample_type) {
797  case AVS_SAMPLE_INT8:
799  break;
800  case AVS_SAMPLE_INT16:
801  st->codecpar->codec_id = PCM(S16);
802  break;
803  case AVS_SAMPLE_INT24:
804  st->codecpar->codec_id = PCM(S24);
805  break;
806  case AVS_SAMPLE_INT32:
807  st->codecpar->codec_id = PCM(S32);
808  break;
809  case AVS_SAMPLE_FLOAT:
810  st->codecpar->codec_id = PCM(F32);
811  break;
812  default:
814  "unknown AviSynth sample type %d\n", avs->vi->sample_type);
815  avs->error = 1;
816  return AVERROR_UNKNOWN;
817  }
818  return 0;
819 }
820 
822 {
823  AviSynthContext *avs = s->priv_data;
824  AVStream *st;
825  int ret;
826  int id = 0;
827 
828  if (avs_has_video(avs->vi)) {
829  st = avformat_new_stream(s, NULL);
830  if (!st)
831  return AVERROR_UNKNOWN;
832  st->id = id++;
834  return ret;
835  }
836  if (avs_has_audio(avs->vi)) {
837  st = avformat_new_stream(s, NULL);
838  if (!st)
839  return AVERROR_UNKNOWN;
840  st->id = id++;
842  return ret;
843  }
844  return 0;
845 }
846 
848 {
849  AviSynthContext *avs = s->priv_data;
850  AVS_Value val;
851  int ret;
852 
854  return ret;
855 
856  if (!avs_library.avs_check_version(avs->env, 7)) {
857  AVS_Value args[] = {
858  avs_new_value_string(s->url),
859  avs_new_value_bool(1) // filename is in UTF-8
860  };
861  val = avs_library.avs_invoke(avs->env, "Import",
862  avs_new_value_array(args, 2), 0);
863  } else {
864  AVS_Value arg;
865 #ifdef _WIN32
866  char *filename_ansi;
867  /* Convert UTF-8 to ANSI code page */
868  if (utf8toansi(s->url, &filename_ansi)) {
870  goto fail;
871  }
872  arg = avs_new_value_string(filename_ansi);
873 #else
874  arg = avs_new_value_string(s->url);
875 #endif
876  val = avs_library.avs_invoke(avs->env, "Import", arg, 0);
877 #ifdef _WIN32
878  av_free(filename_ansi);
879 #endif
880  }
881 
882  if (avs_is_error(val)) {
883  av_log(s, AV_LOG_ERROR, "%s\n", avs_as_error(val));
885  goto fail;
886  }
887  if (!avs_is_clip(val)) {
888  av_log(s, AV_LOG_ERROR, "AviSynth script did not return a clip\n");
890  goto fail;
891  }
892 
893  avs->clip = avs_library.avs_take_clip(val, avs->env);
894  avs->vi = avs_library.avs_get_video_info(avs->clip);
895 
896  /* On Windows, FFmpeg supports AviSynth interface version 6 or higher.
897  * This includes AviSynth 2.6 RC1 or higher, and AviSynth+ r1718 or higher,
898  * and excludes 2.5 and the 2.6 alphas. */
899 
900  if (avs_library.avs_get_version(avs->clip) < 6) {
902  "AviSynth version is too old. Please upgrade to either AviSynth 2.6 >= RC1 or AviSynth+ >= r1718.\n");
904  goto fail;
905  }
906 
907  /* Release the AVS_Value as it will go out of scope. */
908  avs_library.avs_release_value(val);
909 
911  goto fail;
912 
913  return 0;
914 
915 fail:
917  return ret;
918 }
919 
921  AVPacket *pkt, int *discard)
922 {
923  AviSynthContext *avs = s->priv_data;
924 
925  avs->curr_stream++;
926  avs->curr_stream %= s->nb_streams;
927 
928  *st = s->streams[avs->curr_stream];
929  if ((*st)->discard == AVDISCARD_ALL)
930  *discard = 1;
931  else
932  *discard = 0;
933 
934  return;
935 }
936 
937 /* Copy AviSynth clip data into an AVPacket. */
939  int discard)
940 {
941  AviSynthContext *avs = s->priv_data;
942  AVS_VideoFrame *frame;
943  unsigned char *dst_p;
944  const unsigned char *src_p;
945  int n, i, plane, rowsize, planeheight, pitch, bits, ret;
946  const char *error;
947 
948  if (avs->curr_frame >= avs->vi->num_frames)
949  return AVERROR_EOF;
950 
951  /* This must happen even if the stream is discarded to prevent desync. */
952  n = avs->curr_frame++;
953  if (discard)
954  return 0;
955 
956  bits = avs_library.avs_bits_per_pixel(avs->vi);
957 
958  /* Without the cast to int64_t, calculation overflows at about 9k x 9k
959  * resolution. */
960  pkt->size = (((int64_t)avs->vi->width *
961  (int64_t)avs->vi->height) * bits) / 8;
962  if (!pkt->size)
963  return AVERROR_UNKNOWN;
964 
965  if ((ret = av_new_packet(pkt, pkt->size)) < 0)
966  return ret;
967 
968  pkt->pts = n;
969  pkt->dts = n;
970  pkt->duration = 1;
971  pkt->stream_index = avs->curr_stream;
972 
973  frame = avs_library.avs_get_frame(avs->clip, n);
974  error = avs_library.avs_clip_get_error(avs->clip);
975  if (error) {
976  av_log(s, AV_LOG_ERROR, "%s\n", error);
977  avs->error = 1;
979  return AVERROR_UNKNOWN;
980  }
981 
982  dst_p = pkt->data;
983  for (i = 0; i < avs->n_planes; i++) {
984  plane = avs->planes[i];
985  src_p = avs_library.avs_get_read_ptr_p(frame, plane);
986  pitch = avs_library.avs_get_pitch_p(frame, plane);
987 
988  rowsize = avs_library.avs_get_row_size_p(frame, plane);
989  planeheight = avs_library.avs_get_height_p(frame, plane);
990 
991  /* Flip RGB video. */
992  if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) ||
993  avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) ||
994  avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) {
995  src_p = src_p + (planeheight - 1) * pitch;
996  pitch = -pitch;
997  }
998 
999  avs_library.avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch,
1000  rowsize, planeheight);
1001  dst_p += rowsize * planeheight;
1002  }
1003 
1004  avs_library.avs_release_video_frame(frame);
1005  return 0;
1006 }
1007 
1009  int discard)
1010 {
1011  AviSynthContext *avs = s->priv_data;
1012  AVRational fps, samplerate;
1013  int samples, ret;
1014  int64_t n;
1015  const char *error;
1016 
1017  if (avs->curr_sample >= avs->vi->num_audio_samples)
1018  return AVERROR_EOF;
1019 
1020  fps.num = avs->vi->fps_numerator;
1021  fps.den = avs->vi->fps_denominator;
1022  samplerate.num = avs->vi->audio_samples_per_second;
1023  samplerate.den = 1;
1024 
1025  if (avs_has_video(avs->vi)) {
1026  if (avs->curr_frame < avs->vi->num_frames)
1027  samples = av_rescale_q(avs->curr_frame, samplerate, fps) -
1028  avs->curr_sample;
1029  else
1030  samples = av_rescale_q(1, samplerate, fps);
1031  } else {
1032  samples = 1000;
1033  }
1034 
1035  /* After seeking, audio may catch up with video. */
1036  if (samples <= 0) {
1037  pkt->size = 0;
1038  pkt->data = NULL;
1039  return 0;
1040  }
1041 
1042  if (avs->curr_sample + samples > avs->vi->num_audio_samples)
1043  samples = avs->vi->num_audio_samples - avs->curr_sample;
1044 
1045  /* This must happen even if the stream is discarded to prevent desync. */
1046  n = avs->curr_sample;
1047  avs->curr_sample += samples;
1048  if (discard)
1049  return 0;
1050 
1051  pkt->size = avs_bytes_per_channel_sample(avs->vi) *
1052  samples * avs->vi->nchannels;
1053  if (!pkt->size)
1054  return AVERROR_UNKNOWN;
1055 
1056  if ((ret = av_new_packet(pkt, pkt->size)) < 0)
1057  return ret;
1058 
1059  pkt->pts = n;
1060  pkt->dts = n;
1061  pkt->duration = samples;
1062  pkt->stream_index = avs->curr_stream;
1063 
1064  avs_library.avs_get_audio(avs->clip, pkt->data, n, samples);
1065  error = avs_library.avs_clip_get_error(avs->clip);
1066  if (error) {
1067  av_log(s, AV_LOG_ERROR, "%s\n", error);
1068  avs->error = 1;
1070  return AVERROR_UNKNOWN;
1071  }
1072  return 0;
1073 }
1074 
1076 {
1077  int ret;
1078 
1079  // Calling library must implement a lock for thread-safe opens.
1080  if (ret = ff_lock_avformat())
1081  return ret;
1082 
1083  if (ret = avisynth_open_file(s)) {
1085  return ret;
1086  }
1087 
1089  return 0;
1090 }
1091 
1093 {
1094  AviSynthContext *avs = s->priv_data;
1095  AVStream *st;
1096  int discard = 0;
1097  int ret;
1098 
1099  if (avs->error)
1100  return AVERROR_UNKNOWN;
1101 
1102  /* If either stream reaches EOF, try to read the other one before
1103  * giving up. */
1104  avisynth_next_stream(s, &st, pkt, &discard);
1105  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
1106  ret = avisynth_read_packet_video(s, pkt, discard);
1107  if (ret == AVERROR_EOF && avs_has_audio(avs->vi)) {
1108  avisynth_next_stream(s, &st, pkt, &discard);
1109  return avisynth_read_packet_audio(s, pkt, discard);
1110  }
1111  } else {
1112  ret = avisynth_read_packet_audio(s, pkt, discard);
1113  if (ret == AVERROR_EOF && avs_has_video(avs->vi)) {
1114  avisynth_next_stream(s, &st, pkt, &discard);
1115  return avisynth_read_packet_video(s, pkt, discard);
1116  }
1117  }
1118 
1119  return ret;
1120 }
1121 
1123 {
1124  if (ff_lock_avformat())
1125  return AVERROR_UNKNOWN;
1126 
1127  avisynth_context_destroy(s->priv_data);
1129  return 0;
1130 }
1131 
1132 static int avisynth_read_seek(AVFormatContext *s, int stream_index,
1133  int64_t timestamp, int flags)
1134 {
1135  AviSynthContext *avs = s->priv_data;
1136  AVStream *st;
1137  AVRational fps, samplerate;
1138 
1139  if (avs->error)
1140  return AVERROR_UNKNOWN;
1141 
1142  fps = (AVRational) { avs->vi->fps_numerator,
1143  avs->vi->fps_denominator };
1144  samplerate = (AVRational) { avs->vi->audio_samples_per_second, 1 };
1145 
1146  st = s->streams[stream_index];
1147  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
1148  /* AviSynth frame counts are signed int. */
1149  if ((timestamp >= avs->vi->num_frames) ||
1150  (timestamp > INT_MAX) ||
1151  (timestamp < 0))
1152  return AVERROR_EOF;
1153  avs->curr_frame = timestamp;
1154  if (avs_has_audio(avs->vi))
1155  avs->curr_sample = av_rescale_q(timestamp, samplerate, fps);
1156  } else {
1157  if ((timestamp >= avs->vi->num_audio_samples) || (timestamp < 0))
1158  return AVERROR_EOF;
1159  /* Force frame granularity for seeking. */
1160  if (avs_has_video(avs->vi)) {
1161  avs->curr_frame = av_rescale_q(timestamp, fps, samplerate);
1162  avs->curr_sample = av_rescale_q(avs->curr_frame, samplerate, fps);
1163  } else {
1164  avs->curr_sample = timestamp;
1165  }
1166  }
1167 
1168  return 0;
1169 }
1170 
1171 #define AVISYNTH_FRAMEPROP_DEFAULT AVISYNTH_FRAMEPROP_FIELD_ORDER | AVISYNTH_FRAMEPROP_RANGE | \
1172  AVISYNTH_FRAMEPROP_PRIMARIES | AVISYNTH_FRAMEPROP_TRANSFER | \
1173  AVISYNTH_FRAMEPROP_MATRIX | AVISYNTH_FRAMEPROP_CHROMA_LOCATION
1174 #define OFFSET(x) offsetof(AviSynthContext, x)
1175 static const AVOption avisynth_options[] = {
1176  { "avisynth_flags", "set flags related to reading frame properties from script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVISYNTH_FRAMEPROP_DEFAULT}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1177  { "field_order", "read field order", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_FIELD_ORDER}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1178  { "range", "read color range", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_RANGE}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1179  { "primaries", "read color primaries", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_PRIMARIES}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1180  { "transfer", "read color transfer characteristics", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_TRANSFER}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1181  { "matrix", "read matrix coefficients", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_MATRIX}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1182  { "chroma_location", "read chroma location", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_CHROMA_LOCATION}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1183  { "sar", "read sample aspect ratio", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_SAR}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },
1184  { NULL },
1185 };
1186 
1188  .class_name = "AviSynth demuxer",
1189  .item_name = av_default_item_name,
1190  .option = avisynth_options,
1191  .version = LIBAVUTIL_VERSION_INT,
1192 };
1193 
1195  .name = "avisynth",
1196  .long_name = NULL_IF_CONFIG_SMALL("AviSynth script"),
1197  .priv_data_size = sizeof(AviSynthContext),
1202  .extensions = "avs",
1203  .priv_class = &avisynth_demuxer_class,
1204 };
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:31
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:502
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:422
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:481
wchar_filename.h
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: codec_par.h:40
AVCOL_PRI_EBU3213
@ AVCOL_PRI_EBU3213
EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors.
Definition: pixfmt.h:549
opt.h
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: options.c:237
avisynth_demuxer_class
static const AVClass avisynth_demuxer_class
Definition: avisynth.c:1187
avisynth_atexit_handler
static av_cold void avisynth_atexit_handler(void)
Definition: avisynth.c:246
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:58
OFFSET
#define OFFSET(x)
Definition: avisynth.c:1174
avisynth_load_library
static av_cold int avisynth_load_library(void)
Definition: avisynth.c:142
AVCodecParameters::color_space
enum AVColorSpace color_space
Definition: codec_par.h:151
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AVCOL_TRC_LINEAR
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
Definition: pixfmt.h:567
AVCHROMA_LOC_BOTTOM
@ AVCHROMA_LOC_BOTTOM
Definition: pixfmt.h:687
avisynth_read_seek
static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: avisynth.c:1132
avisynth_read_packet
static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: avisynth.c:1092
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
AviSynthContext::curr_sample
int64_t curr_sample
Definition: avisynth.c:111
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:501
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:661
avs_atexit_called
static int avs_atexit_called
Definition: avisynth.c:135
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:374
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:496
AviSynthLibrary::library
void * library
Definition: avisynth.c:57
avs_planes_yuv
static const int avs_planes_yuv[3]
Definition: avisynth.c:123
AVOption
AVOption.
Definition: opt.h:251
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:561
AVISYNTH_FRAMEPROP_MATRIX
@ AVISYNTH_FRAMEPROP_MATRIX
Definition: avisynth.c:94
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:1028
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:459
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:588
AVCOL_TRC_BT2020_12
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
Definition: pixfmt.h:574
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:311
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:497
AVCOL_SPC_BT2020_CL
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:599
AviSynthContext::curr_stream
int curr_stream
Definition: avisynth.c:109
ff_unlock_avformat
int ff_unlock_avformat(void)
Definition: utils.c:53
AVCodecParameters::color_primaries
enum AVColorPrimaries color_primaries
Definition: codec_par.h:149
AviSynthLibrary
Definition: avisynth.c:56
AVCOL_SPC_BT470BG
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition: pixfmt.h:593
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:763
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:477
AVCOL_TRC_IEC61966_2_1
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:572
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
fail
#define fail()
Definition: checkasm.h:134
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:475
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:503
AVISYNTH_FRAMEPROP_SAR
@ AVISYNTH_FRAMEPROP_SAR
Definition: avisynth.c:96
AVCOL_TRC_GAMMA28
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
Definition: pixfmt.h:564
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
val
static double val(void *priv, double ch)
Definition: aeval.c:77
AV_FIELD_UNKNOWN
@ AV_FIELD_UNKNOWN
Definition: codec_par.h:39
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:443
AVCOL_TRC_LOG_SQRT
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:569
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:998
AVISYNTH_LIB
#define AVISYNTH_LIB
Definition: avisynth.c:44
planar
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
Definition: audioconvert.c:56
AVRational::num
int num
Numerator.
Definition: rational.h:59
avisynth_create_stream_video
static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
Definition: avisynth.c:261
AVCOL_TRC_GAMMA22
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:563
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:462
AVCodecParameters::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: codec_par.h:150
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:656
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:471
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:479
s
#define s(width, name)
Definition: cbs_vp9.c:256
AVCHROMA_LOC_TOP
@ AVCHROMA_LOC_TOP
Definition: pixfmt.h:685
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:97
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:480
LOAD_AVS_FUNC
#define LOAD_AVS_FUNC(name, continue_on_fail)
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AVCOL_TRC_BT1361_ECG
@ AVCOL_TRC_BT1361_ECG
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:571
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:472
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition: pixfmt.h:594
avisynth_read_close
static av_cold int avisynth_read_close(AVFormatContext *s)
Definition: avisynth.c:1122
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:128
PCM
#define PCM(format)
Definition: avisynth.c:51
bits
uint8_t bits
Definition: vp3data.h:128
avs_ctx_list
static AviSynthContext * avs_ctx_list
Definition: avisynth.c:138
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:470
avs_planes_rgba
static const int avs_planes_rgba[4]
Definition: avisynth.c:129
AVCOL_PRI_SMPTE428
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
Definition: pixfmt.h:545
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:442
AviSynthContext::error
int error
Definition: avisynth.c:113
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
avisynth_next_stream
static void avisynth_next_stream(AVFormatContext *s, AVStream **st, AVPacket *pkt, int *discard)
Definition: avisynth.c:920
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AVCOL_PRI_SMPTE240M
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
Definition: pixfmt.h:542
AV_PIX_FMT_GRAYF32
#define AV_PIX_FMT_GRAYF32
Definition: pixfmt.h:491
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:536
AVCOL_SPC_CHROMA_DERIVED_CL
@ AVCOL_SPC_CHROMA_DERIVED_CL
Chromaticity-derived constant luminance system.
Definition: pixfmt.h:602
AVCOL_PRI_BT470BG
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:540
arg
const char * arg
Definition: jacosubdec.c:67
AVCOL_PRI_SMPTE170M
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:541
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:440
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:76
AVFormatContext
Format I/O context.
Definition: avformat.h:1216
AviSynthContext::env
AVS_ScriptEnvironment * env
Definition: avisynth.c:101
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:478
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
AviSynthContext::planes
const int * planes
Definition: avisynth.c:107
AV_PIX_FMT_BGR48
#define AV_PIX_FMT_BGR48
Definition: pixfmt.h:450
NULL
#define NULL
Definition: coverity.c:32
avisynth_context_destroy
static av_cold void avisynth_context_destroy(AviSynthContext *avs)
Definition: avisynth.c:222
AVCHROMA_LOC_LEFT
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:682
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCHROMA_LOC_TOPLEFT
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:684
AVCOL_TRC_IEC61966_2_4
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
Definition: pixfmt.h:570
avisynth_read_packet_audio
static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int discard)
Definition: avisynth.c:1008
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:535
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AviSynthContext::flags
uint32_t flags
Definition: avisynth.c:115
avisynth_read_header
static av_cold int avisynth_read_header(AVFormatContext *s)
Definition: avisynth.c:1075
avs_library
static AviSynthLibrary avs_library
Definition: avisynth.c:134
AVCOL_TRC_BT2020_10
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:573
AVCOL_SPC_YCGCO
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
Definition: pixfmt.h:596
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:460
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:213
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:627
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:178
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:1000
AVCOL_PRI_BT2020
@ AVCOL_PRI_BT2020
ITU-R BT2020.
Definition: pixfmt.h:544
avisynth_options
static const AVOption avisynth_options[]
Definition: avisynth.c:1175
AviSynthContext::clip
AVS_Clip * clip
Definition: avisynth.c:102
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:575
AVCOL_PRI_SMPTE431
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
Definition: pixfmt.h:547
AVPacket::size
int size
Definition: packet.h:375
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:115
AVCOL_TRC_SMPTE240M
@ AVCOL_TRC_SMPTE240M
Definition: pixfmt.h:566
avisynth_read_packet_video
static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int discard)
Definition: avisynth.c:938
avisynth_create_stream
static int avisynth_create_stream(AVFormatContext *s)
Definition: avisynth.c:821
AVCOL_PRI_FILM
@ AVCOL_PRI_FILM
colour filters using Illuminant C
Definition: pixfmt.h:543
AVISYNTH_FRAMEPROP_PRIMARIES
@ AVISYNTH_FRAMEPROP_PRIMARIES
Definition: avisynth.c:92
AVCOL_TRC_LOG
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:568
AviSynthContext
Definition: avisynth.c:99
AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_GBRPF32
Definition: pixfmt.h:488
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:464
ff_lock_avformat
int ff_lock_avformat(void)
Definition: utils.c:48
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:466
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:681
AVStream::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:1017
AVISYNTH_FRAMEPROP_TRANSFER
@ AVISYNTH_FRAMEPROP_TRANSFER
Definition: avisynth.c:93
AviSynthFlags
AviSynthFlags
Definition: avisynth.c:89
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:373
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:432
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
AV_FIELD_TT
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition: codec_par.h:41
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:498
attributes.h
AVCOL_SPC_CHROMA_DERIVED_NCL
@ AVCOL_SPC_CHROMA_DERIVED_NCL
Chromaticity-derived non-constant luminance system.
Definition: pixfmt.h:601
AviSynthContext::curr_frame
int curr_frame
Definition: avisynth.c:110
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:560
AVISYNTH_FRAMEPROP_CHROMA_LOCATION
@ AVISYNTH_FRAMEPROP_CHROMA_LOCATION
Definition: avisynth.c:95
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition: pixfmt.h:595
avs_planes_grey
static const int avs_planes_grey[1]
Definition: avisynth.c:122
AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_BGRA64
Definition: pixfmt.h:454
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:598
internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:129
AVISYNTH_FRAMEPROP_DEFAULT
#define AVISYNTH_FRAMEPROP_DEFAULT
Definition: avisynth.c:1171
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:476
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:282
AVCodecParameters::color_range
enum AVColorRange color_range
Video only.
Definition: codec_par.h:148
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:590
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:644
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:143
avisynth_create_stream_audio
static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st)
Definition: avisynth.c:786
AVCOL_PRI_BT470M
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:538
AVStream::id
int id
Format-specific stream ID.
Definition: avformat.h:962
ret
ret
Definition: filter_design.txt:187
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:948
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AVISYNTH_FRAMEPROP_RANGE
@ AVISYNTH_FRAMEPROP_RANGE
Definition: avisynth.c:91
avformat.h
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:463
AVCodecParameters::chroma_location
enum AVChromaLocation chroma_location
Definition: codec_par.h:152
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:468
AVISYNTH_FRAMEPROP_FIELD_ORDER
@ AVISYNTH_FRAMEPROP_FIELD_ORDER
Definition: avisynth.c:90
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:579
AVCHROMA_LOC_CENTER
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
Definition: pixfmt.h:683
ff_avisynth_demuxer
const AVInputFormat ff_avisynth_demuxer
Definition: avisynth.c:1194
AVRational::den
int den
Denominator.
Definition: rational.h:60
AVCOL_SPC_FCC
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:592
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:499
AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:489
avs_planes_rgb
static const int avs_planes_rgb[3]
Definition: avisynth.c:125
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
AVCOL_TRC_SMPTE170M
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:565
AVPacket::stream_index
int stream_index
Definition: packet.h:376
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
avs_planes_yuva
static const int avs_planes_yuva[4]
Definition: avisynth.c:127
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:331
AVCodecParameters::format
int format
Definition: codec_par.h:86
AVCOL_PRI_SMPTE432
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
Definition: pixfmt.h:548
AviSynthContext::n_planes
int n_planes
Definition: avisynth.c:106
AviSynthContext::vi
const AVS_VideoInfo * vi
Definition: avisynth.c:103
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:62
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCOL_SPC_SMPTE2085
@ AVCOL_SPC_SMPTE2085
SMPTE 2085, Y'D'zD'x.
Definition: pixfmt.h:600
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
AviSynthContext::next
struct AviSynthContext * next
Definition: avisynth.c:118
AV_FIELD_BB
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition: codec_par.h:42
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:224
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AviSynthLibrary::AVSC_DECLARE_FUNC
AVSC_DECLARE_FUNC(avs_bit_blt)
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVCOL_TRC_SMPTE428
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
Definition: pixfmt.h:577
avisynth_context_create
static av_cold int avisynth_context_create(AVFormatContext *s)
Definition: avisynth.c:194
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:469
avisynth_open_file
static int avisynth_open_file(AVFormatContext *s)
Definition: avisynth.c:847
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:988
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:441
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition: pixfmt.h:589
AVCOL_SPC_ICTCP
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Definition: pixfmt.h:603
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
avs_planes_packed
static const int avs_planes_packed[1]
Definition: avisynth.c:121
AVCHROMA_LOC_BOTTOMLEFT
@ AVCHROMA_LOC_BOTTOMLEFT
Definition: pixfmt.h:686
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:467
w32dlfcn.h