Class: MXFInfo::InfoObject

Inherits:
Object
  • Object
show all
Defined in:
lib/mxfinfo.rb,
ext/mxfinfo/mxfinfo.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(path) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'ext/mxfinfo/mxfinfo.c', line 94

static 
VALUE cio_new(VALUE class, VALUE path)
{
  Check_Type(path, T_STRING);
  const char *fn = StringValuePtr(path);

  AvidMXFInfo *info = ALLOC(AvidMXFInfo);

  int result = ami_read_info(fn, info, 1);

  if(result != 0) 
  {
    ami_free_info(info);

    switch(result) 
    {
            case -2:
              rb_raise(rb_eIOError, "Failed to open file.");
                break;
            case -3:
              rb_raise(rb_eIOError, "Failed to read header partition.");
                break;
            case -4:
              rb_raise(rb_eStandardError, "File is not OP-Atom.");
                break;
            case -1:
            default:
              rb_raise(rb_eStandardError, "Failed to read info.");
                break;
    }

    return Qnil;
  } 
  else
  {
    VALUE tdata = Data_Wrap_Struct(class, 0, cio_free, info);
    return tdata;
  }
}

Instance Method Details

#aspect_ratioObject



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'ext/mxfinfo/mxfinfo.c', line 212

static
VALUE cio_get_aspect_ratio(VALUE self)
{
  AvidMXFInfo *info;
  Data_Get_Struct(self, AvidMXFInfo, info);
  if(info->isVideo && info->aspectRatio.denominator != 0)
  {
    return rb_rational_new(INT2FIX(info->aspectRatio.numerator),
      INT2FIX(info->aspectRatio.denominator)); 
  }
  else
  {
    return Qnil;
  }
}

#audio_sampling_rateObject

#channel_countObject Also known as: channelcount, c_count

#clip_createdObject Also known as: clip_created_at

#clip_durationObject

#clip_nameObject

#clip_track_stringObject



255
256
257
258
259
260
261
262
# File 'ext/mxfinfo/mxfinfo.c', line 255

static
VALUE cio_get_clip_track_string(VALUE self)
{
  AvidMXFInfo *info;
  Data_Get_Struct(self, AvidMXFInfo, info);

  return rb_str_new2((info->tracksString == NULL) ? "" : info->tracksString);
}

#display_heightObject

#display_widthObject

#edit_rateObject

#essence_container_labelObject Also known as: essence_label

#essence_typeObject



204
205
206
207
208
209
210
# File 'ext/mxfinfo/mxfinfo.c', line 204

def essence_type
  result = self.send(:essence_type_orig)
  if result.start_with?("DNxHD")
    result.gsub!(/ \(\d+\)/, "")
  end
  result
end

#essence_type_origObject



28
# File 'lib/mxfinfo.rb', line 28

alias_method :essence_type_orig, :essence_type

#file_source_package_uidObject Also known as: file_package_uid

#frame_layoutObject

#is_videoObject

Left that in for reference (array creation). static VALUE cio_get_material_package_uid(VALUE self) {

AvidMXFInfo *info;
Data_Get_Struct(self, AvidMXFInfo, info);

unsigned char *uid = (unsigned char*) &info->materialPackageUID;

VALUE ary = rb_ary_new2(32);
for(unsigned int i = 0; i < 32; i++)
{
  rb_ary_store(ary, i, CHR2FIX(uid[i]));
}

return ary;

}



196
197
198
199
200
201
202
# File 'ext/mxfinfo/mxfinfo.c', line 196

static
VALUE cio_get_is_video(VALUE self)
{
  AvidMXFInfo *info;
  Data_Get_Struct(self, AvidMXFInfo, info);
  return info->isVideo ? Qtrue : Qfalse;
}

#material_package_uidObject

#num_audio_tracksObject Also known as: audiotracks, audio_tracks, a_tracks

#num_video_tracksObject Also known as: videotracks, v_tracks, video_tracks

int numMaterialPackageAttributes

#physical_package_locatorObject

#physical_package_nameObject

#physical_package_typeObject



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'ext/mxfinfo/mxfinfo.c', line 228

static
VALUE cio_get_physical_package_type(VALUE self)
{
  AvidMXFInfo *info;
  Data_Get_Struct(self, AvidMXFInfo, info);

  VALUE ret = Qnil;
  switch (info->physicalPackageType)
  {
  case TAPE_PHYS_TYPE:
    ret = ID2SYM(rb_intern("tape"));
    break;
  case IMPORT_PHYS_TYPE:
    ret = ID2SYM(rb_intern("import"));
    break;
  case RECORDING_PHYS_TYPE:
    ret = ID2SYM(rb_intern("recording"));
    break;
  case UNKNOWN_PHYS_TYPE:
  default:
    ret = ID2SYM(rb_intern("unknown"));
    break;
  }

  return ret;
}

#physical_source_package_uidObject

#picture_coding_labelObject

#project_edit_rateObject

#project_nameObject

#quantization_bitsObject

#render_file?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/mxfinfo.rb', line 24

def render_file?
  physical_package_name == "Precompute Source Mob"
end

#segment_durationObject

#segment_offsetObject

#start_timecodeObject

#stored_heightObject

#stored_widthObject

#track_durationObject

#track_numberObject Also known as: t_number, tracknumber

#tracks_stringObject