Mercurial > pt1.oyama
comparison libdlna-0.2.3/src/audio_wma.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 /* WMA content (bit rate less than 193 kbps) */ | |
29 static dlna_profile_t wmabase = { | |
30 .id = "WMABASE", | |
31 .mime = MIME_AUDIO_WMA, | |
32 .label = LABEL_AUDIO_2CH | |
33 }; | |
34 | |
35 /* WMA content */ | |
36 static dlna_profile_t wmafull = { | |
37 .id = "WMAFULL", | |
38 .mime = MIME_AUDIO_WMA, | |
39 .label = LABEL_AUDIO_2CH | |
40 }; | |
41 | |
42 /* WMA professional version */ | |
43 static dlna_profile_t wmapro = { | |
44 .id = "WMAPRO", | |
45 .mime = MIME_AUDIO_WMA, | |
46 .label = LABEL_AUDIO_2CH_MULTI | |
47 }; | |
48 | |
49 audio_profile_t | |
50 audio_profile_guess_wma (AVCodecContext *ac) | |
51 { | |
52 audio_profile_t ap = AUDIO_PROFILE_INVALID; | |
53 | |
54 if (!ac) | |
55 return ap; | |
56 | |
57 /* check for WMA codec */ | |
58 if (ac->codec_id != CODEC_ID_WMAV1 && ac->codec_id != CODEC_ID_WMAV2) | |
59 return ap; | |
60 | |
61 if (ac->sample_rate <= 48000) | |
62 { | |
63 if (ac->bit_rate <= 193000) | |
64 { | |
65 /* WMA Baseline: stereo, up to 48 KHz, up to 192,999 bps */ | |
66 if (ac->channels <= 2) | |
67 return AUDIO_PROFILE_WMA_BASELINE; | |
68 } | |
69 else if (ac->bit_rate <= 385000) | |
70 { | |
71 /* WMA Full: stereo, up to 48 KHz, up to 385 Kbps */ | |
72 if (ac->channels <= 2) | |
73 return AUDIO_PROFILE_WMA_FULL; | |
74 } | |
75 } | |
76 else if (ac->sample_rate <= 96000) | |
77 { | |
78 /* WMA Professional: up to 7.1 channels, up to 1.5 Mbps and 96 KHz */ | |
79 if (ac->channels <= 8 && ac->bit_rate <= 1500000) | |
80 return AUDIO_PROFILE_WMA_PRO; | |
81 } | |
82 | |
83 return AUDIO_PROFILE_INVALID; | |
84 } | |
85 | |
86 static dlna_profile_t * | |
87 probe_wma (AVFormatContext *ctx dlna_unused, | |
88 dlna_container_type_t st, | |
89 av_codecs_t *codecs) | |
90 { | |
91 if (!stream_ctx_is_audio (codecs)) | |
92 return NULL; | |
93 | |
94 /* check for supported container */ | |
95 if (st != CT_ASF) | |
96 return NULL; | |
97 | |
98 switch (audio_profile_guess_wma (codecs->ac)) | |
99 { | |
100 case AUDIO_PROFILE_WMA_BASELINE: | |
101 return &wmabase; | |
102 case AUDIO_PROFILE_WMA_FULL: | |
103 return &wmafull; | |
104 case AUDIO_PROFILE_WMA_PRO: | |
105 return &wmapro; | |
106 default: | |
107 break; | |
108 } | |
109 | |
110 return NULL; | |
111 } | |
112 | |
113 dlna_registered_profile_t dlna_profile_audio_wma = { | |
114 .id = DLNA_PROFILE_AUDIO_WMA, | |
115 .class = DLNA_CLASS_AUDIO, | |
116 .extensions = "wma,asf", | |
117 .probe = probe_wma, | |
118 .next = NULL | |
119 }; |