~ubuntu-branches/ubuntu/natty/exif/natty

« back to all changes in this revision

Viewing changes to exif/actions.c

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2008-03-31 19:39:44 UTC
  • mfrom: (4.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080331193944-xndxlofl9m7h7a83
Tags: 0.6.15-5
* Adopt the package within pkg-phototools:
  - Set the Maintainer to the group
  - Add Frederic Peters and myself as Uploaders.
  - Add Vcs-Browser and Vcs-Git fields accordingly.
* debian/control:
  - Add a Homepage field.
  - Update Standards-Version to 3.7.3
  - Fix build dep version for libexif-dev.
  - Add build dep on quilt for patches extracted from package diff.
  - Add build dep on gettext for swedish translation.
* debian/copyright:
  - convert file to utf-8.
  - Point to LGPL-2 rather than just LGPL, which now points to
    LGPL-3.
* debian/rules
  - Fix autotools timestamp issues which causes FTBFS (closes: #445609)
  - Fix lintian 'clean error' warning.
* debian/patches
  - Extract swedish translation patch from package diff (cf. bug 397370).
  - Extract patch related to default ifd from package diff (cf. bug 428255).
  - Extract patch related to manpage improvements from package diff (cf.
    bugs 320497 and 321855).

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#define ENTRY_FOUND     "   *   "
32
32
#define ENTRY_NOT_FOUND "   -   "
33
33
 
 
34
#define CN(s) ((s) ? (s) : "(NULL)")
 
35
 
34
36
void
35
37
action_tag_table (const char *filename, ExifData *ed)
36
38
{
64
66
{
65
67
        unsigned char *ids = data;
66
68
        char v[128];
 
69
        ExifIfd ifd = exif_entry_get_ifd (e);
67
70
 
68
71
        if (*ids)
69
72
                fprintf (stdout, "0x%04x", e->tag);
70
73
        else
71
 
                fprintf (stdout, "%-20.20s", C(exif_tag_get_title (e->tag)));
 
74
                fprintf (stdout, "%-20.20s", C(exif_tag_get_title_in_ifd (e->tag, ifd)));
72
75
        printf ("|");
73
76
        if (*ids)
74
77
                fprintf (stdout, "%-72.72s",
98
101
}
99
102
 
100
103
void
101
 
action_mnote_list (const char *filename, ExifData *ed)
 
104
action_mnote_list (const char *filename, ExifData *ed, unsigned char ids)
102
105
{
103
 
        unsigned int i, bs = 1024, c;
 
106
        unsigned int i, bs = 1024, c, id;
104
107
        char b[1024];
 
108
        char b1[1024], b2[1024];
105
109
        ExifMnoteData *n;
 
110
        const char *p;
106
111
 
107
112
        n = exif_data_get_mnote_data (ed);
108
113
        if (!n) {
109
 
                printf (_("Unknown MakerNote format."));
 
114
                printf (_("Unknown MakerNote format.\n"));
110
115
                return;
111
116
        }
112
117
 
121
126
        default:
122
127
                printf (_("MakerNote contains %i values:\n"), c);
123
128
        }
124
 
        for (i = 0; i < c; i++)
125
 
                printf ("%s: %s\n", C(exif_mnote_data_get_title (n, i)),
126
 
                        C(exif_mnote_data_get_value (n, i, b, bs)));
127
 
        exif_mnote_data_unref (n);
 
129
        for (i = 0; i < c; i++) {
 
130
                if ( ids ) {
 
131
                        id = exif_mnote_data_get_id  (n,i);
 
132
                        sprintf(b1,"0x%04x",id);
 
133
                } else {
 
134
                        p = C (exif_mnote_data_get_title (n, i));
 
135
                        strncpy (b1, p ? p : _("Unknown tag"), bs);
 
136
                }
 
137
                p = C (exif_mnote_data_get_value (n, i, b, bs));
 
138
                strncpy (b2, p ? p : _("Unknown value"), bs);
 
139
                /* printf ("%s|%s\n", b1, b2); */
 
140
                if (ids)
 
141
                        fprintf (stdout, "%-6.6s", b1);
 
142
                else
 
143
                        fprintf (stdout, "%-20.20s", b1);
 
144
                fputc ('|', stdout);
 
145
                if (ids) {
 
146
                        fputs (CN (b2), stdout);
 
147
                } else {
 
148
                        fprintf (stdout, "%-58.58s", b2);
 
149
                }
 
150
                fputc ('\n', stdout);
 
151
        }
128
152
}
129
153
 
130
154
void
140
164
                exif_byte_order_get_name (order));
141
165
        fputc ('\n', stdout);
142
166
        print_hline (ids);
143
 
        if (ids)
 
167
        if (ids) {
144
168
                fprintf (stdout, "%-6.6s", _("Tag"));
145
 
        else
 
169
        } else {
146
170
                fprintf (stdout, "%-20.20s", _("Tag"));
 
171
        }
147
172
        fputc ('|', stdout);
148
173
        if (ids)
149
174
                fprintf (stdout, "%-72.72s", _("Value"));
165
190
{
166
191
        unsigned char *ids = data;
167
192
        char v[1024];
 
193
        ExifIfd ifd = exif_entry_get_ifd (e);
168
194
 
169
 
        if (*ids) fprintf (stdout, "0x%04x", e->tag);
170
 
        else fprintf (stdout, "%s", exif_tag_get_title (e->tag));
171
 
        printf ("\t");
172
 
        fprintf (stdout, "%-.1024s", exif_entry_get_value (e, v, sizeof (v)));
 
195
        if (*ids) {
 
196
                fprintf (stdout, "0x%04x", e->tag);
 
197
        } else {
 
198
                fputs (CN (exif_tag_get_title_in_ifd (e->tag, ifd)), stdout);
 
199
        }
 
200
        fputc ('\t', stdout);
 
201
        fputs (CN (exif_entry_get_value (e, v, sizeof (v))), stdout);
173
202
        fputc ('\n', stdout);
174
203
}
175
204
 
188
217
        if (ed->size)
189
218
                fprintf (stdout, _("ThumbnailSize\t%i\n"), ed->size);
190
219
}
 
220
 
 
221
static void
 
222
show_entry_xml (ExifEntry *e, void *data)
 
223
{
 
224
        unsigned char *ids = data;
 
225
        char v[1024], t[1024];
 
226
 
 
227
        if (*ids) {
 
228
                fprintf (stdout, "<0x%04x>", e->tag);
 
229
                fprintf (stdout, "%s", exif_entry_get_value (e, v, sizeof (v)));
 
230
                fprintf (stdout, "</0x%04x>", e->tag);
 
231
        } else {
 
232
                int x;
 
233
                strncpy (t, exif_tag_get_title (e->tag), sizeof (t));
 
234
 
 
235
    /* Remove invalid characters from tag eg. (, ), space */
 
236
                for (x = 0; x < strlen (t); x++)
 
237
                        if ((t[x] == '(') || (t[x] == ')') || (t[x] == ' '))
 
238
                                t[x] = '_';
 
239
 
 
240
                fprintf (stdout, "\t<%s>", t);
 
241
                fprintf (stdout, "%s", exif_entry_get_value (e, v, sizeof (v)));
 
242
                fprintf (stdout, "</%s>\n", t);
 
243
        }
 
244
}
 
245
 
 
246
static void
 
247
show_xml (ExifContent *content, void *data)
 
248
{
 
249
        exif_content_foreach_entry (content, show_entry_xml, data);
 
250
}
 
251
 
 
252
void
 
253
action_tag_list_xml (const char *filename, ExifData *ed, unsigned char ids)
 
254
{
 
255
        if (!ed) return;
 
256
 
 
257
        fprintf(stdout, "<exif>\n");
 
258
        exif_data_foreach_content (ed, show_xml, &ids);
 
259
        fprintf(stdout, "</exif>\n");
 
260
}