~ubuntu-branches/ubuntu/maverick/brasero/maverick

« back to all changes in this revision

Viewing changes to libbrasero-utils/brasero-io.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-01-04 17:45:17 UTC
  • mfrom: (1.1.36 upstream)
  • Revision ID: james.westby@ubuntu.com-20100104174517-vz0avr4o1vdfusrf
Tags: 2.29.4-0ubuntu1
* New upstream release:
  - Bug fixes
  - Fixes for Video DVD
  - Updated translations.
* Add 001_nautilus_lazy_init.patch: Do not call brasero_*_start() at
  nautilus startup, they are very expensive; lazily initialize those
  instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
809
809
struct _BraseroIOMetadataCached {
810
810
        guint64 last_modified;
811
811
        BraseroMetadataInfo *info;
 
812
 
 
813
        guint missing_codec_used:1;
812
814
};
813
815
typedef struct _BraseroIOMetadataCached BraseroIOMetadataCached;
814
816
 
867
869
 
868
870
        g_file_info_set_attribute_boolean (info, BRASERO_IO_HAS_VIDEO, metadata->has_video);
869
871
        g_file_info_set_attribute_boolean (info, BRASERO_IO_IS_SEEKABLE, metadata->is_seekable);
870
 
 
871
872
        if (metadata->snapshot)
872
873
                g_file_info_set_attribute_object (info, BRASERO_IO_THUMBNAIL, G_OBJECT (metadata->snapshot));
873
874
 
952
953
                              GCancellable *cancel,
953
954
                              GFileInfo *info,
954
955
                              BraseroMetadata *metadata,
 
956
                              BraseroMetadataFlag flags,
955
957
                              BraseroMetadataInfo *meta_info)
956
958
{
957
959
        gboolean result;
988
990
                        cached->info = g_new0 (BraseroMetadataInfo, 1);
989
991
                        brasero_metadata_get_result (metadata, cached->info, NULL);
990
992
 
 
993
                        cached->missing_codec_used = (flags & BRASERO_METADATA_FLAG_MISSING) != 0;
 
994
 
991
995
                        g_queue_push_head (priv->meta_buffer, cached);
992
996
                        if (g_queue_get_length (priv->meta_buffer) > MAX_BUFFERED_META) {
993
997
                                cached = g_queue_pop_tail (priv->meta_buffer);
1051
1055
                cached = node->data;
1052
1056
                last_modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
1053
1057
                if (last_modified == cached->last_modified) {
 
1058
                        gboolean refresh_cache = FALSE;
 
1059
 
 
1060
                        if (flags & BRASERO_METADATA_FLAG_MISSING) {
 
1061
                                /* This cached result may indicate an error and
 
1062
                                 * this error could be related to the fact that
 
1063
                                 * it was not first looked for with missing
 
1064
                                 * codec detection. */
 
1065
                                if (!cached->missing_codec_used)
 
1066
                                        refresh_cache = TRUE;
 
1067
                        }
 
1068
 
1054
1069
                        if (flags & BRASERO_METADATA_FLAG_THUMBNAIL) {
1055
1070
                                /* If there isn't any snapshot retry */
1056
 
                                if (cached->info->snapshot) {
1057
 
                                        brasero_metadata_info_copy (meta_info, cached->info);
1058
 
                                        g_mutex_unlock (priv->lock_metadata);
1059
 
                                        return TRUE;
1060
 
                                }
 
1071
                                if (!cached->info->snapshot)
 
1072
                                        refresh_cache = TRUE;
1061
1073
                        }
1062
 
                        else {
 
1074
 
 
1075
                        if (!refresh_cache) {
1063
1076
                                brasero_metadata_info_copy (meta_info, cached->info);
1064
1077
                                g_mutex_unlock (priv->lock_metadata);
1065
1078
                                return TRUE;
1086
1099
                                             cancel,
1087
1100
                                             info,
1088
1101
                                             metadata,
 
1102
                                             flags,
1089
1103
                                             meta_info);
1090
1104
}
1091
1105
 
1637
1651
                                if (!brasero_io_get_file_count_process_playlist (self, cancel, data, child_uri))
1638
1652
                                        data->files_invalid ++;
1639
1653
                        }
1640
 
 
1641
 
                        data->files_invalid ++;
 
1654
                        else
 
1655
                                data->files_invalid ++;
1642
1656
                }
1643
1657
 
1644
1658
#endif
1744
1758
                                  (data->job.options & BRASERO_IO_INFO_FOLLOW_SYMLINK)?G_FILE_QUERY_INFO_NONE:G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,      /* follow symlinks by default*/
1745
1759
                                  cancel,
1746
1760
                                  NULL);
1747
 
 
1748
1761
        data->files_num ++;
 
1762
 
1749
1763
        if (!info) {
1750
1764
                g_object_unref (file);
1751
1765
                data->files_invalid ++;
1795
1809
                brasero_io_get_file_count_process_directory (BRASERO_IO (manager), cancel, data);
1796
1810
                return BRASERO_ASYNC_TASK_RESCHEDULE;
1797
1811
        }
1798
 
        else if (!data->uris) {
 
1812
 
 
1813
        if (!data->uris) {
1799
1814
                info = g_file_info_new ();
1800
1815
 
1801
1816
                /* set GFileInfo information */