mlt_properties_set_int( properties, "height", codec_context->height );
mlt_properties_set_double( properties, "aspect_ratio", av_q2d( codec_context->sample_aspect_ratio ) );
}
+
+ // Read Metadata
+ if (context->title != NULL)
+ mlt_properties_set(properties, "meta.attr.title.markup", context->title );
+ if (context->author != NULL)
+ mlt_properties_set(properties, "meta.attr.author.markup", context->author );
+ if (context->copyright != NULL)
+ mlt_properties_set(properties, "meta.attr.copyright.markup", context->copyright );
+ if (context->comment != NULL)
+ mlt_properties_set(properties, "meta.attr.comment.markup", context->comment );
+ if (context->album != NULL)
+ mlt_properties_set(properties, "meta.attr.album.markup", context->album );
+ if (context->year != 0)
+ mlt_properties_set_int(properties, "meta.attr.year.markup", context->year );
+ if (context->track != 0)
+ mlt_properties_set_int(properties, "meta.attr.track.markup", context->track );
// We're going to cheat here - for a/v files, we will have two contexts (reasoning will be clear later)
if ( av == 0 && !av_bypass && audio_index != -1 && video_index != -1 )
static int producer_open( mlt_producer this, char *file );
static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index );
+/** Structure for metadata reading
+*/
+
+typedef struct _sw_metadata sw_metadata;
+
+struct _sw_metadata {
+ char * name;
+ char * content;
+};
+
+static sw_metadata *vorbis_metadata_from_str (char * str)
+{
+ sw_metadata * meta = NULL;
+ int i;
+
+ for (i = 0; str[i]; i++) {
+ str[i] = tolower(str[i]);
+ if (str[i] == '=') {
+ str[i] = '\0';
+ meta = malloc (sizeof (sw_metadata));
+ meta->name = malloc( strlen(str) + 18 );
+ sprintf(meta->name, "meta.attr.%s.markup", str);
+ meta->content = strdup (&str[i+1]);
+ break;
+ }
+ }
+ return meta;
+}
+
/** Constructor for libvorbis.
*/
// Assign the ov structure
mlt_properties_set_data( properties, "ogg_vorbis_file", ov, 0, producer_file_close, NULL );
+ // Read metadata
+ sw_metadata * metadata = NULL;
+ char **ptr = ov_comment(ov, -1)->user_comments;
+ while(*ptr) {
+ metadata = vorbis_metadata_from_str (*ptr);
+ if (metadata != NULL)
+ mlt_properties_set(properties, metadata->name, metadata->content);
+ ++ptr;
+ }
+
if ( ov_seekable( ov ) )
{
// Get the length of the file