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



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'ext/mxfinfo/mxfinfo.c', line 109

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

  AvidMXFInfo *info = ALLOC(AvidMXFInfo);

  AmiReadInfoParams params = {
    fn,
    info,
    -1
  };

  rb_thread_call_without_gvl(ami_read_info_without_gvl, (void*) &params, NULL, NULL);

  if(params.result != 0)
  {
    // NOTE: When ami_read_info failed, *info has already been free'd.

    switch(params.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



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'ext/mxfinfo/mxfinfo.c', line 233

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



276
277
278
279
280
281
282
283
# File 'ext/mxfinfo/mxfinfo.c', line 276

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



225
226
227
228
229
230
231
# File 'ext/mxfinfo/mxfinfo.c', line 225

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

#essence_type_origObject



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

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;

}



217
218
219
220
221
222
223
# File 'ext/mxfinfo/mxfinfo.c', line 217

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



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'ext/mxfinfo/mxfinfo.c', line 249

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 Also known as: clip_edit_rate

#project_nameObject

#quantization_bitsObject

#render_file?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/mxfinfo.rb', line 32

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