Mercurial > pt1.oyama
comparison libdlna-0.2.3/src/image_png.c @ 129:4f6d9621ee00
add multi session streaming & add depending librarys.
- libupnp-1.6.6
- libdlna-0.2.3
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Sun, 10 Oct 2010 15:33:18 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
128:3a7d8d2f0585 | 129:4f6d9621ee00 |
---|---|
1 /* | |
2 * libdlna: reference DLNA standards implementation. | |
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org> | |
4 * | |
5 * This file is part of libdlna. | |
6 * | |
7 * libdlna is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2.1 of the License, or (at your option) any later version. | |
11 * | |
12 * libdlna is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with libdlna; if not, write to the Free Software | |
19 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 | |
25 #include "dlna_internals.h" | |
26 #include "profiles.h" | |
27 | |
28 /* Profile for image thumbnails */ | |
29 static dlna_profile_t png_tn = { | |
30 .id = "PNG_TN", | |
31 .mime = MIME_IMAGE_PNG, | |
32 .label = LABEL_IMAGE_ICON | |
33 }; | |
34 | |
35 /* Profile for small icons */ | |
36 static dlna_profile_t png_sm_ico = { | |
37 .id = "PNG_SM_ICO", | |
38 .mime = MIME_IMAGE_PNG, | |
39 .label = LABEL_IMAGE_ICON | |
40 }; | |
41 | |
42 /* Profile for large icons */ | |
43 static dlna_profile_t png_lrg_ico = { | |
44 .id = "PNG_LRG_ICO", | |
45 .mime = MIME_IMAGE_PNG, | |
46 .label = LABEL_IMAGE_ICON | |
47 }; | |
48 | |
49 /* Profile for image class content of high resolution */ | |
50 static dlna_profile_t png_lrg = { | |
51 .id = "PNG_LRG", | |
52 .mime = MIME_IMAGE_PNG, | |
53 .label = LABEL_IMAGE_PICTURE | |
54 }; | |
55 | |
56 static const struct { | |
57 dlna_profile_t *profile; | |
58 int max_width; | |
59 int max_height; | |
60 } png_profiles_mapping[] = { | |
61 { &png_sm_ico, 48, 48 }, | |
62 { &png_lrg_ico, 120, 120 }, | |
63 { &png_tn, 160, 160 }, | |
64 { &png_lrg, 4096, 4096 }, | |
65 { NULL, 0, 0 } | |
66 }; | |
67 | |
68 static dlna_profile_t * | |
69 probe_png (AVFormatContext *ctx, | |
70 dlna_container_type_t st, | |
71 av_codecs_t *codecs) | |
72 { | |
73 int i; | |
74 | |
75 if (!stream_ctx_is_image (ctx, codecs, st)) | |
76 return NULL; | |
77 | |
78 /* check for PNG compliant codec */ | |
79 if (codecs->vc->codec_id != CODEC_ID_PNG) | |
80 return NULL; | |
81 | |
82 for (i = 0; png_profiles_mapping[i].profile; i++) | |
83 if (codecs->vc->width <= png_profiles_mapping[i].max_width && | |
84 codecs->vc->height <= png_profiles_mapping[i].max_height) | |
85 return png_profiles_mapping[i].profile; | |
86 | |
87 return NULL; | |
88 } | |
89 | |
90 dlna_registered_profile_t dlna_profile_image_png = { | |
91 .id = DLNA_PROFILE_IMAGE_PNG, | |
92 .class = DLNA_CLASS_IMAGE, | |
93 .extensions = "png", | |
94 .probe = probe_png, | |
95 .next = NULL | |
96 }; |