Method: FFruby.formats

Defined in:
ext/ffruby/ffruby.c

.formats(klass) ⇒ Object

Returns an array of the input and output formats supported by FFmpeg. This method will hopefully be expanded to return more than just names in the future.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'ext/ffruby/ffruby.c', line 31

static VALUE ffruby_formats(VALUE self, VALUE klass)
{
  AVInputFormat *ifmt;
  AVOutputFormat *ofmt;
  VALUE array = rb_ary_new();

#ifdef HAVE_AV_IFORMAT_NEXT
  for (ifmt = av_iformat_next(NULL); ifmt; ifmt = av_iformat_next(ifmt))
#else
  for (ifmt = first_iformat; ifmt; ifmt = ifmt->next)
#endif
    rb_ary_push(array, rb_str_new2(ifmt->name));

#ifdef HAVE_AV_OFORMAT_NEXT
  for (ofmt = av_oformat_next(NULL); ofmt; ofmt = av_oformat_next(ofmt))
#else
  for (ofmt = first_oformat; ofmt; ofmt = ofmt->next)
#endif
    rb_ary_push(array, rb_str_new2(ofmt->name));

  return rb_funcall(rb_funcall(array, rb_intern("uniq"), 0), rb_intern("sort"), 0);
}