comparison libdlna-0.2.3/src/av_mpeg4_part10.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 #include <unistd.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28
29 #include <ffmpeg/avcodec.h>
30
31 #include "dlna_internals.h"
32 #include "profiles.h"
33 #include "containers.h"
34
35 typedef enum {
36 AVC_VIDEO_PROFILE_INVALID,
37 AVC_VIDEO_PROFILE_BL_QCIF15,
38 AVC_VIDEO_PROFILE_BL_L1B_QCIF,
39 AVC_VIDEO_PROFILE_BL_L12_CIF15,
40 AVC_VIDEO_PROFILE_BL_CIF15,
41 AVC_VIDEO_PROFILE_BL_CIF15_520,
42 AVC_VIDEO_PROFILE_BL_CIF15_540,
43 AVC_VIDEO_PROFILE_BL_L2_CIF30,
44 AVC_VIDEO_PROFILE_BL_CIF30,
45 AVC_VIDEO_PROFILE_BL_CIF30_940,
46 AVC_VIDEO_PROFILE_BL_L3L_SD,
47 AVC_VIDEO_PROFILE_BL_L3_SD,
48 AVC_VIDEO_PROFILE_MP_SD,
49 AVC_VIDEO_PROFILE_MP_HD
50 } avc_video_profile_t;
51
52 typedef struct video_properties_s {
53 int width;
54 int height;
55 } video_properties_t;
56
57 static video_properties_t profile_cif_res[] = {
58 { 352, 288 }, /* CIF */
59 { 352, 240 }, /* 525SIF */
60 { 320, 240 }, /* QVGA 4:3 */
61 { 320, 180 }, /* QVGA 16:9 */
62 { 240, 180 }, /* 1/7 VGA 4:3 */
63 { 240, 135 }, /* 1/7 VGA 16:9 */
64 { 208, 160 }, /* 1/9 VGA 4:3 */
65 { 176, 144 }, /* QCIF,625QCIF */
66 { 176, 120 }, /* 525QCIF */
67 { 160, 120 }, /* SQVGA 4:3 */
68 { 160, 112 }, /* 1/16 VGA 4:3 */
69 { 160, 90 }, /* SQVGA 16:9 */
70 { 128, 96 } /* SQCIF */
71 };
72
73 static video_properties_t profile_mp_l3_sd_res[] = {
74 { 720, 576 }, /* 625 D1 */
75 { 720, 480 }, /* 525 D1 */
76 { 640, 480 }, /* VGA */
77 { 640, 360 } /* VGA 16:9 */
78 };
79
80 static video_properties_t profile_mp_sd_res[] = {
81 { 720, 576 }, /* 625 D1 */
82 { 720, 480 }, /* 525 D1 */
83 { 704, 576 }, /* 625 4SIF */
84 { 704, 480 }, /* 525 4SIF */
85 { 640, 480 }, /* VGA */
86 { 640, 360 }, /* VGA 16:9 */
87 { 544, 576 }, /* 625 3/4 D1 */
88 { 544, 480 }, /* 525 3/4 D1 */
89 { 480, 576 }, /* 625 2/3 D1 */
90 { 480, 480 }, /* 525 2/3 D1 */
91 { 480, 360 }, /* 9/16 VGA 4:3 */
92 { 480, 270 }, /* 9/16 VGA 16:9 */
93 { 352, 576 }, /* 625 1/2 D1 */
94 { 352, 480 }, /* 525 1/2 D1 */
95 { 352, 288 }, /* CIF, 625SIF */
96 { 352, 240 }, /* 525SIF */
97 { 320, 240 }, /* QVGA 4:3 */
98 { 320, 180 }, /* QVGA 16:9 */
99 { 240, 180 }, /* 1/7 VGA 4:3 */
100 { 208, 160 }, /* 1/9 VGA 4:3 */
101 { 176, 144 }, /* QCIF,625QCIF */
102 { 176, 120 }, /* 525QCIF */
103 { 160, 120 }, /* SQVGA 4:3 */
104 { 160, 112 }, /* 1/16 VGA 4:3 */
105 { 160, 90 }, /* SQVGA 16:9 */
106 { 128, 96 } /* SQCIF */
107 };
108
109 static video_properties_t profile_mp_hd_res[] = {
110 { 1920, 1080 }, /* 1080p */
111 { 1920, 1152 },
112 { 1920, 540 }, /* 1080i */
113 { 1280, 720 } /* 720p */
114 };
115
116 /********************/
117 /* MPEG-4 Container */
118 /********************/
119
120 static dlna_profile_t avc_mp4_mp_sd_aac_mult5 = {
121 .id = "AVC_MP4_MP_SD_AAC_MULT5",
122 .mime = MIME_VIDEO_MPEG_4,
123 .label = LABEL_VIDEO_SD
124 };
125
126 static dlna_profile_t avc_mp4_mp_sd_heaac_l2 = {
127 .id = "AVC_MP4_MP_SD_HEAAC_L2",
128 .mime = MIME_VIDEO_MPEG_4,
129 .label = LABEL_VIDEO_SD
130 };
131
132 static dlna_profile_t avc_mp4_mp_sd_mpeg1_l3 = {
133 .id = "AVC_MP4_MP_SD_MPEG1_L3",
134 .mime = MIME_VIDEO_MPEG_4,
135 .label = LABEL_VIDEO_SD
136 };
137
138 static dlna_profile_t avc_mp4_mp_sd_ac3 = {
139 .id = "AVC_MP4_MP_SD_AC3",
140 .mime = MIME_VIDEO_MPEG_4,
141 .label = LABEL_VIDEO_SD
142 };
143
144 static dlna_profile_t avc_mp4_mp_sd_aac_ltp = {
145 .id = "AVC_MP4_MP_SD_AAC_LTP",
146 .mime = MIME_VIDEO_MPEG_4,
147 .label = LABEL_VIDEO_SD
148 };
149
150 static dlna_profile_t avc_mp4_mp_sd_aac_ltp_mult5 = {
151 .id = "AVC_MP4_MP_SD_AAC_LTP_MULT5",
152 .mime = MIME_VIDEO_MPEG_4,
153 .label = LABEL_VIDEO_SD
154 };
155
156 static dlna_profile_t avc_mp4_mp_sd_aac_ltp_mult7 = {
157 .id = "AVC_MP4_MP_SD_AAC_LTP_MULT7",
158 .mime = MIME_VIDEO_MPEG_4,
159 .label = LABEL_VIDEO_SD
160 };
161
162 static dlna_profile_t avc_mp4_mp_sd_atrac3plus = {
163 .id = "AVC_MP4_MP_SD_ATRAC3plus",
164 .mime = MIME_VIDEO_MPEG_4,
165 .label = LABEL_VIDEO_SD
166 };
167
168 static dlna_profile_t avc_mp4_bl_l3l_sd_aac = {
169 .id = "AVC_MP4_BL_L3L_SD_AAC",
170 .mime = MIME_VIDEO_MPEG_4,
171 .label = LABEL_VIDEO_SD
172 };
173
174 static dlna_profile_t avc_mp4_bl_l3l_sd_heaac = {
175 .id = "AVC_MP4_BL_L3L_SD_HEAAC",
176 .mime = MIME_VIDEO_MPEG_4,
177 .label = LABEL_VIDEO_SD
178 };
179
180 static dlna_profile_t avc_mp4_bl_l3_sd_aac = {
181 .id = "AVC_MP4_BL_L3_SD_AAC",
182 .mime = MIME_VIDEO_MPEG_4,
183 .label = LABEL_VIDEO_SD
184 };
185
186 static dlna_profile_t avc_mp4_mp_sd_bsac = {
187 .id = "AVC_MP4_MP_SD_BSAC",
188 .mime = MIME_VIDEO_MPEG_4,
189 .label = LABEL_VIDEO_SD
190 };
191
192 static dlna_profile_t avc_mp4_bl_cif30_aac_mult5 = {
193 .id = "AVC_MP4_BL_CIF30_AAC_MULT5",
194 .mime = MIME_VIDEO_MPEG_4,
195 .label = LABEL_VIDEO_CIF30
196 };
197
198 static dlna_profile_t avc_mp4_bl_cif30_heaac_l2 = {
199 .id = "AVC_MP4_BL_CIF30_HEAAC_L2",
200 .mime = MIME_VIDEO_MPEG_4,
201 .label = LABEL_VIDEO_CIF30
202 };
203
204 static dlna_profile_t avc_mp4_bl_cif30_mpeg1_l3 = {
205 .id = "AVC_MP4_BL_CIF30_MPEG1_L3",
206 .mime = MIME_VIDEO_MPEG_4,
207 .label = LABEL_VIDEO_CIF30
208 };
209
210 static dlna_profile_t avc_mp4_bl_cif30_ac3 = {
211 .id = "AVC_MP4_BL_CIF30_AC3",
212 .mime = MIME_VIDEO_MPEG_4,
213 .label = LABEL_VIDEO_CIF30
214 };
215
216 static dlna_profile_t avc_mp4_bl_cif30_aac_ltp = {
217 .id = "AVC_MP4_BL_CIF30_AAC_LTP",
218 .mime = MIME_VIDEO_MPEG_4,
219 .label = LABEL_VIDEO_CIF30
220 };
221
222 static dlna_profile_t avc_mp4_bl_cif30_aac_ltp_mult5 = {
223 .id = "AVC_MP4_BL_CIF30_AAC_LTP_MULT5",
224 .mime = MIME_VIDEO_MPEG_4,
225 .label = LABEL_VIDEO_CIF30
226 };
227
228 static dlna_profile_t avc_mp4_bl_l2_cif30_aac = {
229 .id = "AVC_MP4_BL_L2_CIF30_AAC",
230 .mime = MIME_VIDEO_MPEG_4,
231 .label = LABEL_VIDEO_CIF30
232 };
233
234 static dlna_profile_t avc_mp4_bl_cif30_bsac = {
235 .id = "AVC_MP4_BL_CIF30_BSAC",
236 .mime = MIME_VIDEO_MPEG_4,
237 .label = LABEL_VIDEO_CIF30
238 };
239
240 static dlna_profile_t avc_mp4_bl_cif30_bsac_mult5 = {
241 .id = "AVC_MP4_BL_CIF30_BSAC_MULT5",
242 .mime = MIME_VIDEO_MPEG_4,
243 .label = LABEL_VIDEO_CIF30
244 };
245
246 static dlna_profile_t avc_mp4_bl_cif15_heaac = {
247 .id = "AVC_MP4_BL_CIF15_HEAAC",
248 .mime = MIME_VIDEO_MPEG_4,
249 .label = LABEL_VIDEO_CIF15
250 };
251
252 static dlna_profile_t avc_mp4_bl_cif15_amr = {
253 .id = "AVC_MP4_BL_CIF15_AMR",
254 .mime = MIME_VIDEO_MPEG_4,
255 .label = LABEL_VIDEO_CIF15
256 };
257
258 static dlna_profile_t avc_mp4_bl_cif15_aac = {
259 .id = "AVC_MP4_BL_CIF15_AAC",
260 .mime = MIME_VIDEO_MPEG_4,
261 .label = LABEL_VIDEO_CIF15
262 };
263
264 static dlna_profile_t avc_mp4_bl_cif15_aac_520 = {
265 .id = "AVC_MP4_BL_CIF15_AAC_520",
266 .mime = MIME_VIDEO_MPEG_4,
267 .label = LABEL_VIDEO_CIF15
268 };
269
270 static dlna_profile_t avc_mp4_bl_cif15_aac_ltp = {
271 .id = "AVC_MP4_BL_CIF15_AAC_LTP",
272 .mime = MIME_VIDEO_MPEG_4,
273 .label = LABEL_VIDEO_CIF15
274 };
275
276 static dlna_profile_t avc_mp4_bl_cif15_aac_ltp_520 = {
277 .id = "AVC_MP4_BL_CIF15_AAC_LTP_520",
278 .mime = MIME_VIDEO_MPEG_4,
279 .label = LABEL_VIDEO_CIF15
280 };
281
282 static dlna_profile_t avc_mp4_bl_cif15_bsac = {
283 .id = "AVC_MP4_BL_CIF15_BSAC",
284 .mime = MIME_VIDEO_MPEG_4,
285 .label = LABEL_VIDEO_CIF15
286 };
287
288 static dlna_profile_t avc_mp4_bl_l12_cif15_heaac = {
289 .id = "AVC_MP4_BL_L12_CIF15_HEAAC",
290 .mime = MIME_VIDEO_MPEG_4,
291 .label = LABEL_VIDEO_CIF15
292 };
293
294 static dlna_profile_t avc_mp4_bl_l1b_qcif15_heaac = {
295 .id = "AVC_MP4_BL_L1B_QCIF15_HEAAC",
296 .mime = MIME_VIDEO_MPEG_4,
297 .label = LABEL_VIDEO_QCIF15
298 };
299
300 /*********************/
301 /* MPEG-TS Container */
302 /*********************/
303
304 static dlna_profile_t avc_ts_mp_sd_aac_mult5 = {
305 .id = "AVC_TS_MP_SD_AAC_MULT5",
306 .mime = MIME_VIDEO_MPEG_TS,
307 .label = LABEL_VIDEO_SD
308 };
309
310 static dlna_profile_t avc_ts_mp_sd_aac_mult5_t = {
311 .id = "AVC_TS_MP_SD_AAC_MULT5_T",
312 .mime = MIME_VIDEO_MPEG_TS,
313 .label = LABEL_VIDEO_SD
314 };
315
316 static dlna_profile_t avc_ts_mp_sd_aac_mult5_iso = {
317 .id = "AVC_TS_MP_SD_AAC_MULT5_ISO",
318 .mime = MIME_VIDEO_MPEG,
319 .label = LABEL_VIDEO_SD
320 };
321
322 static dlna_profile_t avc_ts_mp_sd_heaac_l2 = {
323 .id = "AVC_TS_MP_SD_HEAAC_L2",
324 .mime = MIME_VIDEO_MPEG_TS,
325 .label = LABEL_VIDEO_SD
326 };
327
328 static dlna_profile_t avc_ts_mp_sd_heaac_l2_t = {
329 .id = "AVC_TS_MP_SD_HEAAC_L2_T",
330 .mime = MIME_VIDEO_MPEG_TS,
331 .label = LABEL_VIDEO_SD
332 };
333
334 static dlna_profile_t avc_ts_mp_sd_heaac_l2_iso = {
335 .id = "AVC_TS_MP_SD_HEAAC_L2_ISO",
336 .mime = MIME_VIDEO_MPEG,
337 .label = LABEL_VIDEO_SD
338 };
339
340 static dlna_profile_t avc_ts_mp_sd_mpeg1_l3 = {
341 .id = "AVC_TS_MP_SD_MPEG1_L3",
342 .mime = MIME_VIDEO_MPEG_TS,
343 .label = LABEL_VIDEO_SD
344 };
345
346 static dlna_profile_t avc_ts_mp_sd_mpeg1_l3_t = {
347 .id = "AVC_TS_MP_SD_MPEG1_L3_T",
348 .mime = MIME_VIDEO_MPEG_TS,
349 .label = LABEL_VIDEO_SD
350 };
351
352 static dlna_profile_t avc_ts_mp_sd_mpeg1_l3_iso = {
353 .id = "AVC_TS_MP_SD_MPEG1_L3_ISO",
354 .mime = MIME_VIDEO_MPEG,
355 .label = LABEL_VIDEO_SD
356 };
357
358 static dlna_profile_t avc_ts_mp_sd_ac3 = {
359 .id = "AVC_TS_MP_SD_AC3",
360 .mime = MIME_VIDEO_MPEG_TS,
361 .label = LABEL_VIDEO_SD
362 };
363
364 static dlna_profile_t avc_ts_mp_sd_ac3_t = {
365 .id = "AVC_TS_MP_SD_AC3_T",
366 .mime = MIME_VIDEO_MPEG_TS,
367 .label = LABEL_VIDEO_SD
368 };
369
370 static dlna_profile_t avc_ts_mp_sd_ac3_iso = {
371 .id = "AVC_TS_MP_SD_AC3_ISO",
372 .mime = MIME_VIDEO_MPEG,
373 .label = LABEL_VIDEO_SD
374 };
375
376 static dlna_profile_t avc_ts_mp_sd_aac_ltp = {
377 .id = "AVC_TS_MP_SD_AAC_LTP",
378 .mime = MIME_VIDEO_MPEG_TS,
379 .label = LABEL_VIDEO_SD
380 };
381
382 static dlna_profile_t avc_ts_mp_sd_aac_ltp_t = {
383 .id = "AVC_TS_MP_SD_AAC_LTP_T",
384 .mime = MIME_VIDEO_MPEG_TS,
385 .label = LABEL_VIDEO_SD
386 };
387
388 static dlna_profile_t avc_ts_mp_sd_aac_ltp_iso = {
389 .id = "AVC_TS_MP_SD_AAC_LTP_ISO",
390 .mime = MIME_VIDEO_MPEG,
391 .label = LABEL_VIDEO_SD
392 };
393
394 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult5 = {
395 .id = "AVC_TS_MP_SD_AAC_LTP_MULT5",
396 .mime = MIME_VIDEO_MPEG_TS,
397 .label = LABEL_VIDEO_SD
398 };
399
400 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult5_t = {
401 .id = "AVC_TS_MP_SD_AAC_LTP_MULT5_T",
402 .mime = MIME_VIDEO_MPEG_TS,
403 .label = LABEL_VIDEO_SD
404 };
405
406 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult5_iso = {
407 .id = "AVC_TS_MP_SD_AAC_LTP_MULT5_ISO",
408 .mime = MIME_VIDEO_MPEG,
409 .label = LABEL_VIDEO_SD
410 };
411
412 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult7 = {
413 .id = "AVC_TS_MP_SD_AAC_LTP_MULT7",
414 .mime = MIME_VIDEO_MPEG_TS,
415 .label = LABEL_VIDEO_SD
416 };
417
418 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult7_t = {
419 .id = "AVC_TS_MP_SD_AAC_LTP_MULT7_T",
420 .mime = MIME_VIDEO_MPEG_TS,
421 .label = LABEL_VIDEO_SD
422 };
423
424 static dlna_profile_t avc_ts_mp_sd_aac_ltp_mult7_iso = {
425 .id = "AVC_TS_MP_SD_AAC_LTP_MULT7_ISO",
426 .mime = MIME_VIDEO_MPEG,
427 .label = LABEL_VIDEO_SD
428 };
429
430 static dlna_profile_t avc_ts_mp_sd_bsac = {
431 .id = "AVC_TS_MP_SD_BSAC",
432 .mime = MIME_VIDEO_MPEG_TS,
433 .label = LABEL_VIDEO_SD
434 };
435
436 static dlna_profile_t avc_ts_mp_sd_bsac_t = {
437 .id = "AVC_TS_MP_SD_BSAC_T",
438 .mime = MIME_VIDEO_MPEG_TS,
439 .label = LABEL_VIDEO_SD
440 };
441
442 static dlna_profile_t avc_ts_mp_sd_bsac_iso = {
443 .id = "AVC_TS_MP_SD_BSAC_ISO",
444 .mime = MIME_VIDEO_MPEG,
445 .label = LABEL_VIDEO_SD
446 };
447
448 static dlna_profile_t avc_ts_bl_cif30_aac_mult5 = {
449 .id = "AVC_TS_BL_CIF30_AAC_MULT5",
450 .mime = MIME_VIDEO_MPEG_TS,
451 .label = LABEL_VIDEO_CIF30
452 };
453
454 static dlna_profile_t avc_ts_bl_cif30_aac_mult5_t = {
455 .id = "AVC_TS_BL_CIF30_AAC_MULT5_T",
456 .mime = MIME_VIDEO_MPEG_TS,
457 .label = LABEL_VIDEO_CIF30
458 };
459
460 static dlna_profile_t avc_ts_bl_cif30_aac_mult5_iso = {
461 .id = "AVC_TS_BL_CIF30_AAC_MULT5_ISO",
462 .mime = MIME_VIDEO_MPEG,
463 .label = LABEL_VIDEO_CIF30
464 };
465
466 static dlna_profile_t avc_ts_bl_cif30_heaac_l2 = {
467 .id = "AVC_TS_BL_CIF30_HEAAC_L2",
468 .mime = MIME_VIDEO_MPEG_TS,
469 .label = LABEL_VIDEO_CIF30
470 };
471
472 static dlna_profile_t avc_ts_bl_cif30_heaac_l2_t = {
473 .id = "AVC_TS_BL_CIF30_HEAAC_L2_T",
474 .mime = MIME_VIDEO_MPEG_TS,
475 .label = LABEL_VIDEO_CIF30
476 };
477
478 static dlna_profile_t avc_ts_bl_cif30_heaac_l2_iso = {
479 .id = "AVC_TS_BL_CIF30_HEAAC_L2_ISO",
480 .mime = MIME_VIDEO_MPEG,
481 .label = LABEL_VIDEO_CIF30
482 };
483
484 static dlna_profile_t avc_ts_bl_cif30_mpeg1_l3 = {
485 .id = "AVC_TS_BL_CIF30_MPEG1_L3",
486 .mime = MIME_VIDEO_MPEG_TS,
487 .label = LABEL_VIDEO_CIF30
488 };
489
490 static dlna_profile_t avc_ts_bl_cif30_mpeg1_l3_t = {
491 .id = "AVC_TS_BL_CIF30_MPEG1_L3_T",
492 .mime = MIME_VIDEO_MPEG_TS,
493 .label = LABEL_VIDEO_CIF30
494 };
495
496 static dlna_profile_t avc_ts_bl_cif30_mpeg1_l3_iso = {
497 .id = "AVC_TS_BL_CIF30_MPEG1_L3_ISO",
498 .mime = MIME_VIDEO_MPEG,
499 .label = LABEL_VIDEO_CIF30
500 };
501
502 static dlna_profile_t avc_ts_bl_cif30_ac3 = {
503 .id = "AVC_TS_BL_CIF30_AC3",
504 .mime = MIME_VIDEO_MPEG_TS,
505 .label = LABEL_VIDEO_CIF30
506 };
507
508 static dlna_profile_t avc_ts_bl_cif30_ac3_t = {
509 .id = "AVC_TS_BL_CIF30_AC3_T",
510 .mime = MIME_VIDEO_MPEG_TS,
511 .label = LABEL_VIDEO_CIF30
512 };
513
514 static dlna_profile_t avc_ts_bl_cif30_ac3_iso = {
515 .id = "AVC_TS_BL_CIF30_AC3_ISO",
516 .mime = MIME_VIDEO_MPEG,
517 .label = LABEL_VIDEO_CIF30
518 };
519
520 static dlna_profile_t avc_ts_bl_cif30_aac_ltp = {
521 .id = "AVC_TS_BL_CIF30_AAC_LTP",
522 .mime = MIME_VIDEO_MPEG_TS,
523 .label = LABEL_VIDEO_CIF30
524 };
525
526 static dlna_profile_t avc_ts_bl_cif30_aac_ltp_t = {
527 .id = "AVC_TS_BL_CIF30_AAC_LTP_T",
528 .mime = MIME_VIDEO_MPEG_TS,
529 .label = LABEL_VIDEO_CIF30
530 };
531
532 static dlna_profile_t avc_ts_bl_cif30_aac_ltp_iso = {
533 .id = "AVC_TS_BL_CIF30_AAC_LTP_ISO",
534 .mime = MIME_VIDEO_MPEG,
535 .label = LABEL_VIDEO_CIF30
536 };
537
538 static dlna_profile_t avc_ts_bl_cif30_aac_ltp_mult5 = {
539 .id = "AVC_TS_BL_CIF30_AAC_LTP_MULT5",
540 .mime = MIME_VIDEO_MPEG_TS,
541 .label = LABEL_VIDEO_CIF30
542 };
543
544 static dlna_profile_t avc_ts_bl_cif30_aac_ltp_mult5_t = {
545 .id = "AVC_TS_BL_CIF30_AAC_LTP_MULT5_T",
546 .mime = MIME_VIDEO_MPEG_TS,
547 .label = LABEL_VIDEO_CIF30
548 };
549
550 static dlna_profile_t avc_ts_bl_cif30_aac_ltp_mult5_iso = {
551 .id = "AVC_TS_BL_CIF30_AAC_LTP_MULT5_ISO",
552 .mime = MIME_VIDEO_MPEG,
553 .label = LABEL_VIDEO_CIF30
554 };
555
556 static dlna_profile_t avc_ts_bl_cif30_aac_940 = {
557 .id = "AVC_TS_BL_CIF30_AAC_940",
558 .mime = MIME_VIDEO_MPEG_TS,
559 .label = LABEL_VIDEO_CIF30
560 };
561
562 static dlna_profile_t avc_ts_bl_cif30_aac_940_t = {
563 .id = "AVC_TS_BL_CIF30_AAC_940_T",
564 .mime = MIME_VIDEO_MPEG_TS,
565 .label = LABEL_VIDEO_CIF30
566 };
567
568 static dlna_profile_t avc_ts_bl_cif30_aac_940_iso = {
569 .id = "AVC_TS_BL_CIF30_AAC_940_ISO",
570 .mime = MIME_VIDEO_MPEG,
571 .label = LABEL_VIDEO_CIF30
572 };
573
574 static dlna_profile_t avc_ts_mp_hd_aac_mult5 = {
575 .id = "AVC_TS_MP_HD_AAC_MULT5",
576 .mime = MIME_VIDEO_MPEG_TS,
577 .label = LABEL_VIDEO_HD
578 };
579
580 static dlna_profile_t avc_ts_mp_hd_aac_mult5_t = {
581 .id = "AVC_TS_MP_HD_AAC_MULT5_T",
582 .mime = MIME_VIDEO_MPEG_TS,
583 .label = LABEL_VIDEO_HD
584 };
585
586 static dlna_profile_t avc_ts_mp_hd_aac_mult5_iso = {
587 .id = "AVC_TS_MP_HD_AAC_MULT5_ISO",
588 .mime = MIME_VIDEO_MPEG,
589 .label = LABEL_VIDEO_HD
590 };
591
592 static dlna_profile_t avc_ts_mp_hd_heaac_l2 = {
593 .id = "AVC_TS_MP_HD_HEAAC_L2",
594 .mime = MIME_VIDEO_MPEG_TS,
595 .label = LABEL_VIDEO_HD
596 };
597
598 static dlna_profile_t avc_ts_mp_hd_heaac_l2_t = {
599 .id = "AVC_TS_MP_HD_HEAAC_L2_T",
600 .mime = MIME_VIDEO_MPEG_TS,
601 .label = LABEL_VIDEO_HD
602 };
603
604 static dlna_profile_t avc_ts_mp_hd_heaac_l2_iso = {
605 .id = "AVC_TS_MP_HD_HEAAC_L2_ISO",
606 .mime = MIME_VIDEO_MPEG,
607 .label = LABEL_VIDEO_HD
608 };
609
610 static dlna_profile_t avc_ts_mp_hd_mpeg1_l3 = {
611 .id = "AVC_TS_MP_HD_MPEG1_L3",
612 .mime = MIME_VIDEO_MPEG_TS,
613 .label = LABEL_VIDEO_HD
614 };
615
616 static dlna_profile_t avc_ts_mp_hd_mpeg1_l3_t = {
617 .id = "AVC_TS_MP_HD_MPEG1_L3_T",
618 .mime = MIME_VIDEO_MPEG_TS,
619 .label = LABEL_VIDEO_HD
620 };
621
622 static dlna_profile_t avc_ts_mp_hd_mpeg1_l3_iso = {
623 .id = "AVC_TS_MP_HD_MPEG1_L3_ISO",
624 .mime = MIME_VIDEO_MPEG,
625 .label = LABEL_VIDEO_HD
626 };
627
628 static dlna_profile_t avc_ts_mp_hd_ac3 = {
629 .id = "AVC_TS_MP_HD_AC3",
630 .mime = MIME_VIDEO_MPEG_TS,
631 .label = LABEL_VIDEO_HD
632 };
633
634 static dlna_profile_t avc_ts_mp_hd_ac3_t = {
635 .id = "AVC_TS_MP_HD_AC3_T",
636 .mime = MIME_VIDEO_MPEG_TS,
637 .label = LABEL_VIDEO_HD
638 };
639
640 static dlna_profile_t avc_ts_mp_hd_ac3_iso = {
641 .id = "AVC_TS_MP_HD_AC3_ISO",
642 .mime = MIME_VIDEO_MPEG,
643 .label = LABEL_VIDEO_HD
644 };
645
646 static dlna_profile_t avc_ts_mp_hd_aac = {
647 .id = "AVC_TS_MP_HD_AAC",
648 .mime = MIME_VIDEO_MPEG_TS,
649 .label = LABEL_VIDEO_HD
650 };
651
652 static dlna_profile_t avc_ts_mp_hd_aac_t = {
653 .id = "AVC_TS_MP_HD_AAC_T",
654 .mime = MIME_VIDEO_MPEG_TS,
655 .label = LABEL_VIDEO_HD
656 };
657
658 static dlna_profile_t avc_ts_mp_hd_aac_iso = {
659 .id = "AVC_TS_MP_HD_AAC_ISO",
660 .mime = MIME_VIDEO_MPEG,
661 .label = LABEL_VIDEO_HD
662 };
663
664 static dlna_profile_t avc_ts_mp_hd_aac_ltp = {
665 .id = "AVC_TS_MP_HD_AAC_LTP",
666 .mime = MIME_VIDEO_MPEG_TS,
667 .label = LABEL_VIDEO_HD
668 };
669
670 static dlna_profile_t avc_ts_mp_hd_aac_ltp_t = {
671 .id = "AVC_TS_MP_HD_AAC_LTP_T",
672 .mime = MIME_VIDEO_MPEG_TS,
673 .label = LABEL_VIDEO_HD
674 };
675
676 static dlna_profile_t avc_ts_mp_hd_aac_ltp_iso = {
677 .id = "AVC_TS_MP_HD_AAC_LTP_ISO",
678 .mime = MIME_VIDEO_MPEG,
679 .label = LABEL_VIDEO_HD
680 };
681
682 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult5 = {
683 .id = "AVC_TS_MP_HD_AAC_LTP_MULT5",
684 .mime = MIME_VIDEO_MPEG_TS,
685 .label = LABEL_VIDEO_HD
686 };
687
688 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult5_t = {
689 .id = "AVC_TS_MP_HD_AAC_LTP_MULT5_T",
690 .mime = MIME_VIDEO_MPEG_TS,
691 .label = LABEL_VIDEO_HD
692 };
693
694 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult5_iso = {
695 .id = "AVC_TS_MP_HD_AAC_LTP_MULT5_ISO",
696 .mime = MIME_VIDEO_MPEG,
697 .label = LABEL_VIDEO_HD
698 };
699
700 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult7 = {
701 .id = "AVC_TS_MP_HD_AAC_LTP_MULT7",
702 .mime = MIME_VIDEO_MPEG_TS,
703 .label = LABEL_VIDEO_HD
704 };
705
706 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult7_t = {
707 .id = "AVC_TS_MP_HD_AAC_LTP_MULT7_T",
708 .mime = MIME_VIDEO_MPEG_TS,
709 .label = LABEL_VIDEO_HD
710 };
711
712 static dlna_profile_t avc_ts_mp_hd_aac_ltp_mult7_iso = {
713 .id = "AVC_TS_MP_HD_AAC_LTP_MULT7_ISO",
714 .mime = MIME_VIDEO_MPEG,
715 .label = LABEL_VIDEO_HD
716 };
717
718 static dlna_profile_t avc_ts_bl_cif15_aac = {
719 .id = "AVC_TS_BL_CIF15_AAC",
720 .mime = MIME_VIDEO_MPEG_TS,
721 .label = LABEL_VIDEO_CIF15
722 };
723
724 static dlna_profile_t avc_ts_bl_cif15_aac_t = {
725 .id = "AVC_TS_BL_CIF15_AAC_T",
726 .mime = MIME_VIDEO_MPEG_TS,
727 .label = LABEL_VIDEO_CIF15
728 };
729
730 static dlna_profile_t avc_ts_bl_cif15_aac_iso = {
731 .id = "AVC_TS_BL_CIF15_AAC_ISO",
732 .mime = MIME_VIDEO_MPEG,
733 .label = LABEL_VIDEO_CIF15
734 };
735
736 static dlna_profile_t avc_ts_bl_cif15_aac_540 = {
737 .id = "AVC_TS_BL_CIF15_AAC_540",
738 .mime = MIME_VIDEO_MPEG_TS,
739 .label = LABEL_VIDEO_CIF15
740 };
741
742 static dlna_profile_t avc_ts_bl_cif15_aac_540_t = {
743 .id = "AVC_TS_BL_CIF15_AAC_540_T",
744 .mime = MIME_VIDEO_MPEG_TS,
745 .label = LABEL_VIDEO_CIF15
746 };
747
748 static dlna_profile_t avc_ts_bl_cif15_aac_540_iso = {
749 .id = "AVC_TS_BL_CIF15_AAC_540_ISO",
750 .mime = MIME_VIDEO_MPEG,
751 .label = LABEL_VIDEO_CIF15
752 };
753
754 static dlna_profile_t avc_ts_bl_cif15_aac_ltp = {
755 .id = "AVC_TS_BL_CIF15_AAC_LTP",
756 .mime = MIME_VIDEO_MPEG_TS,
757 .label = LABEL_VIDEO_CIF15
758 };
759
760 static dlna_profile_t avc_ts_bl_cif15_aac_ltp_t = {
761 .id = "AVC_TS_BL_CIF15_AAC_LTP_T",
762 .mime = MIME_VIDEO_MPEG_TS,
763 .label = LABEL_VIDEO_CIF15
764 };
765
766 static dlna_profile_t avc_ts_bl_cif15_aac_ltp_iso = {
767 .id = "AVC_TS_BL_CIF15_AAC_LTP_ISO",
768 .mime = MIME_VIDEO_MPEG,
769 .label = LABEL_VIDEO_CIF15
770 };
771
772 static dlna_profile_t avc_ts_bl_cif15_bsac = {
773 .id = "AVC_TS_BL_CIF15_BSAC",
774 .mime = MIME_VIDEO_MPEG_TS,
775 .label = LABEL_VIDEO_CIF15
776 };
777
778 static dlna_profile_t avc_ts_bl_cif15_bsac_t = {
779 .id = "AVC_TS_BL_CIF15_BSAC_T",
780 .mime = MIME_VIDEO_MPEG_TS,
781 .label = LABEL_VIDEO_CIF15
782 };
783
784 static dlna_profile_t avc_ts_bl_cif15_bsac_iso = {
785 .id = "AVC_TS_BL_CIF15_BSAC_ISO",
786 .mime = MIME_VIDEO_MPEG,
787 .label = LABEL_VIDEO_CIF15
788 };
789
790 /******************/
791 /* 3GPP Container */
792 /******************/
793
794 static dlna_profile_t avc_3gpp_bl_cif30_amr_wbplus = {
795 .id = "AVC_3GPP_BL_CIF30_AMR_WBplus",
796 .mime = MIME_VIDEO_3GP,
797 .label = LABEL_VIDEO_CIF30
798 };
799
800 static dlna_profile_t avc_3gpp_bl_cif15_amr_wbplus = {
801 .id = "AVC_3GPP_BL_CIF15_AMR_WBplus",
802 .mime = MIME_VIDEO_3GP,
803 .label = LABEL_VIDEO_CIF15
804 };
805
806 static dlna_profile_t avc_3gpp_bl_qcif15_aac = {
807 .id = "AVC_3GPP_BL_QCIF15_AAC",
808 .mime = MIME_VIDEO_3GP,
809 .label = LABEL_VIDEO_QCIF15
810 };
811
812 static dlna_profile_t avc_3gpp_bl_qcif15_aac_ltp = {
813 .id = "AVC_3GPP_BL_QCIF15_AAC_LTP",
814 .mime = MIME_VIDEO_3GP,
815 .label = LABEL_VIDEO_QCIF15
816 };
817
818 static dlna_profile_t avc_3gpp_bl_qcif15_heaac = {
819 .id = "AVC_3GPP_BL_QCIF15_HEAAC",
820 .mime = MIME_VIDEO_3GP,
821 .label = LABEL_VIDEO_QCIF15
822 };
823
824 static dlna_profile_t avc_3gpp_bl_qcif15_amr_wbplus = {
825 .id = "AVC_3GPP_BL_QCIF15_AMR_WBplus",
826 .mime = MIME_VIDEO_3GP,
827 .label = LABEL_VIDEO_QCIF15
828 };
829
830 static dlna_profile_t avc_3gpp_bl_qcif15_amr = {
831 .id = "AVC_3GPP_BL_QCIF15_AMR",
832 .mime = MIME_VIDEO_3GP,
833 .label = LABEL_VIDEO_QCIF15
834 };
835
836 static const struct {
837 dlna_profile_t *profile;
838 dlna_container_type_t st;
839 avc_video_profile_t vp;
840 audio_profile_t ap;
841 } avc_profiles_mapping[] = {
842 /* MPEG-4 Container */
843 { &avc_mp4_mp_sd_aac_mult5, CT_MP4,
844 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_MULT5 },
845 { &avc_mp4_mp_sd_heaac_l2, CT_MP4,
846 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_HE_L2 },
847 { &avc_mp4_mp_sd_mpeg1_l3, CT_MP4,
848 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_MP3 },
849 { &avc_mp4_mp_sd_ac3, CT_MP4,
850 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AC3 },
851 { &avc_mp4_mp_sd_aac_ltp, CT_MP4,
852 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP },
853 { &avc_mp4_mp_sd_aac_ltp_mult5, CT_MP4,
854 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT5 },
855 { &avc_mp4_mp_sd_aac_ltp_mult7, CT_MP4,
856 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT7 },
857 { &avc_mp4_mp_sd_atrac3plus, CT_MP4,
858 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_ATRAC },
859 { &avc_mp4_mp_sd_bsac, CT_MP4,
860 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_BSAC },
861
862 { &avc_mp4_bl_l3l_sd_aac, CT_MP4,
863 AVC_VIDEO_PROFILE_BL_L3L_SD, AUDIO_PROFILE_AAC },
864 { &avc_mp4_bl_l3l_sd_heaac, CT_MP4,
865 AVC_VIDEO_PROFILE_BL_L3L_SD, AUDIO_PROFILE_AAC_HE_L2 },
866
867 { &avc_mp4_bl_l3_sd_aac, CT_MP4,
868 AVC_VIDEO_PROFILE_BL_L3_SD, AUDIO_PROFILE_AAC },
869
870 { &avc_mp4_bl_cif30_aac_mult5, CT_MP4,
871 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_MULT5 },
872 { &avc_mp4_bl_cif30_heaac_l2, CT_MP4,
873 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_HE_L2 },
874 { &avc_mp4_bl_cif30_mpeg1_l3, CT_MP4,
875 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_MP3 },
876 { &avc_mp4_bl_cif30_ac3, CT_MP4,
877 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AC3 },
878 { &avc_mp4_bl_cif30_aac_ltp, CT_MP4,
879 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP },
880 { &avc_mp4_bl_cif30_aac_ltp_mult5, CT_MP4,
881 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP_MULT5 },
882 { &avc_mp4_bl_cif30_bsac, CT_MP4,
883 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_BSAC },
884 { &avc_mp4_bl_cif30_bsac_mult5, CT_MP4,
885 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_BSAC_MULT5 },
886
887 { &avc_mp4_bl_l2_cif30_aac, CT_MP4,
888 AVC_VIDEO_PROFILE_BL_L2_CIF30, AUDIO_PROFILE_AAC },
889
890 { &avc_mp4_bl_cif15_heaac, CT_MP4,
891 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_HE_L2 },
892 { &avc_mp4_bl_cif15_amr, CT_MP4,
893 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AMR },
894 { &avc_mp4_bl_cif15_aac, CT_MP4,
895 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC },
896 { &avc_mp4_bl_cif15_aac_520, CT_MP4,
897 AVC_VIDEO_PROFILE_BL_CIF15_520, AUDIO_PROFILE_AAC },
898 { &avc_mp4_bl_cif15_aac_ltp, CT_MP4,
899 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_LTP },
900 { &avc_mp4_bl_cif15_aac_ltp_520, CT_MP4,
901 AVC_VIDEO_PROFILE_BL_CIF15_520, AUDIO_PROFILE_AAC_LTP },
902 { &avc_mp4_bl_cif15_bsac, CT_MP4,
903 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_BSAC },
904
905 { &avc_mp4_bl_l12_cif15_heaac, CT_MP4,
906 AVC_VIDEO_PROFILE_BL_L12_CIF15, AUDIO_PROFILE_AAC_HE_L2 },
907
908 { &avc_mp4_bl_l1b_qcif15_heaac, CT_MP4,
909 AVC_VIDEO_PROFILE_BL_L1B_QCIF, AUDIO_PROFILE_AAC_HE_L2 },
910
911 /* MPEG-TS Container */
912 { &avc_ts_mp_sd_aac_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
913 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_MULT5 },
914 { &avc_ts_mp_sd_aac_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
915 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_MULT5 },
916 { &avc_ts_mp_sd_aac_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
917 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_MULT5 },
918
919 { &avc_ts_mp_sd_heaac_l2, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
920 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_HE_L2 },
921 { &avc_ts_mp_sd_heaac_l2_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
922 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_HE_L2 },
923 { &avc_ts_mp_sd_heaac_l2_iso, CT_MPEG_TRANSPORT_STREAM,
924 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_HE_L2 },
925
926 { &avc_ts_mp_sd_mpeg1_l3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
927 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_MP3 },
928 { &avc_ts_mp_sd_mpeg1_l3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
929 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_MP3 },
930 { &avc_ts_mp_sd_mpeg1_l3_iso, CT_MPEG_TRANSPORT_STREAM,
931 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_MP3 },
932
933 { &avc_ts_mp_sd_ac3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
934 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AC3 },
935 { &avc_ts_mp_sd_ac3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
936 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AC3 },
937 { &avc_ts_mp_sd_ac3_iso, CT_MPEG_TRANSPORT_STREAM,
938 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AC3 },
939
940 { &avc_ts_mp_sd_aac_ltp, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
941 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP },
942 { &avc_ts_mp_sd_aac_ltp_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
943 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP },
944 { &avc_ts_mp_sd_aac_ltp_iso, CT_MPEG_TRANSPORT_STREAM,
945 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP },
946
947 { &avc_ts_mp_sd_aac_ltp_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
948 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT5 },
949 { &avc_ts_mp_sd_aac_ltp_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
950 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT5 },
951 { &avc_ts_mp_sd_aac_ltp_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
952 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT5 },
953
954 { &avc_ts_mp_sd_aac_ltp_mult7, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
955 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT7 },
956 { &avc_ts_mp_sd_aac_ltp_mult7_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
957 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT7 },
958 { &avc_ts_mp_sd_aac_ltp_mult7_iso, CT_MPEG_TRANSPORT_STREAM,
959 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_LTP_MULT7 },
960
961 { &avc_ts_mp_sd_bsac, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
962 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_BSAC },
963 { &avc_ts_mp_sd_bsac_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
964 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_BSAC },
965 { &avc_ts_mp_sd_bsac_iso, CT_MPEG_TRANSPORT_STREAM,
966 AVC_VIDEO_PROFILE_MP_SD, AUDIO_PROFILE_AAC_BSAC },
967
968 { &avc_ts_bl_cif30_aac_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
969 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_MULT5 },
970 { &avc_ts_bl_cif30_aac_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
971 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_MULT5 },
972 { &avc_ts_bl_cif30_aac_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
973 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_MULT5 },
974
975 { &avc_ts_bl_cif30_heaac_l2, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
976 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_HE_L2 },
977 { &avc_ts_bl_cif30_heaac_l2_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
978 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_HE_L2 },
979 { &avc_ts_bl_cif30_heaac_l2_iso, CT_MPEG_TRANSPORT_STREAM,
980 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_HE_L2 },
981
982 { &avc_ts_bl_cif30_mpeg1_l3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
983 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_MP3 },
984 { &avc_ts_bl_cif30_mpeg1_l3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
985 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_MP3 },
986 { &avc_ts_bl_cif30_mpeg1_l3_iso, CT_MPEG_TRANSPORT_STREAM,
987 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_MP3 },
988
989 { &avc_ts_bl_cif30_ac3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
990 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AC3 },
991 { &avc_ts_bl_cif30_ac3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
992 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AC3 },
993 { &avc_ts_bl_cif30_ac3_iso, CT_MPEG_TRANSPORT_STREAM,
994 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AC3 },
995
996 { &avc_ts_bl_cif30_aac_ltp, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
997 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP },
998 { &avc_ts_bl_cif30_aac_ltp_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
999 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP },
1000 { &avc_ts_bl_cif30_aac_ltp_iso, CT_MPEG_TRANSPORT_STREAM,
1001 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP },
1002
1003 { &avc_ts_bl_cif30_aac_ltp_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1004 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP_MULT5 },
1005 { &avc_ts_bl_cif30_aac_ltp_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1006 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP_MULT5 },
1007 { &avc_ts_bl_cif30_aac_ltp_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
1008 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AAC_LTP_MULT5 },
1009
1010 { &avc_ts_bl_cif30_aac_940, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1011 AVC_VIDEO_PROFILE_BL_CIF30_940, AUDIO_PROFILE_AAC },
1012 { &avc_ts_bl_cif30_aac_940_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1013 AVC_VIDEO_PROFILE_BL_CIF30_940, AUDIO_PROFILE_AAC },
1014 { &avc_ts_bl_cif30_aac_940_iso, CT_MPEG_TRANSPORT_STREAM,
1015 AVC_VIDEO_PROFILE_BL_CIF30_940, AUDIO_PROFILE_AAC },
1016
1017 { &avc_ts_mp_hd_aac_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1018 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_MULT5 },
1019 { &avc_ts_mp_hd_aac_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1020 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_MULT5 },
1021 { &avc_ts_mp_hd_aac_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
1022 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_MULT5 },
1023
1024 { &avc_ts_mp_hd_heaac_l2, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1025 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_HE_L2 },
1026 { &avc_ts_mp_hd_heaac_l2_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1027 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_HE_L2 },
1028 { &avc_ts_mp_hd_heaac_l2_iso, CT_MPEG_TRANSPORT_STREAM,
1029 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_HE_L2 },
1030
1031 { &avc_ts_mp_hd_mpeg1_l3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1032 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_MP3 },
1033 { &avc_ts_mp_hd_mpeg1_l3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1034 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_MP3 },
1035 { &avc_ts_mp_hd_mpeg1_l3_iso, CT_MPEG_TRANSPORT_STREAM,
1036 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_MP3 },
1037
1038 { &avc_ts_mp_hd_ac3, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1039 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AC3 },
1040 { &avc_ts_mp_hd_ac3_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1041 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AC3 },
1042 { &avc_ts_mp_hd_ac3_iso, CT_MPEG_TRANSPORT_STREAM,
1043 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AC3 },
1044
1045 { &avc_ts_mp_hd_aac, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1046 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC },
1047 { &avc_ts_mp_hd_aac_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1048 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC },
1049 { &avc_ts_mp_hd_aac_iso, CT_MPEG_TRANSPORT_STREAM,
1050 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC },
1051
1052 { &avc_ts_mp_hd_aac_ltp, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1053 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP },
1054 { &avc_ts_mp_hd_aac_ltp_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1055 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP },
1056 { &avc_ts_mp_hd_aac_ltp_iso, CT_MPEG_TRANSPORT_STREAM,
1057 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP },
1058
1059 { &avc_ts_mp_hd_aac_ltp_mult5, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1060 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT5 },
1061 { &avc_ts_mp_hd_aac_ltp_mult5_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1062 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT5 },
1063 { &avc_ts_mp_hd_aac_ltp_mult5_iso, CT_MPEG_TRANSPORT_STREAM,
1064 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT5 },
1065
1066 { &avc_ts_mp_hd_aac_ltp_mult7, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1067 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT7 },
1068 { &avc_ts_mp_hd_aac_ltp_mult7_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1069 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT7 },
1070 { &avc_ts_mp_hd_aac_ltp_mult7_iso, CT_MPEG_TRANSPORT_STREAM,
1071 AVC_VIDEO_PROFILE_MP_HD, AUDIO_PROFILE_AAC_LTP_MULT7 },
1072
1073 { &avc_ts_bl_cif15_aac, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1074 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC },
1075 { &avc_ts_bl_cif15_aac_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1076 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC },
1077 { &avc_ts_bl_cif15_aac_iso, CT_MPEG_TRANSPORT_STREAM,
1078 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC },
1079
1080 { &avc_ts_bl_cif15_aac_540, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1081 AVC_VIDEO_PROFILE_BL_CIF15_540, AUDIO_PROFILE_AAC },
1082 { &avc_ts_bl_cif15_aac_540_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1083 AVC_VIDEO_PROFILE_BL_CIF15_540, AUDIO_PROFILE_AAC },
1084 { &avc_ts_bl_cif15_aac_540_iso, CT_MPEG_TRANSPORT_STREAM,
1085 AVC_VIDEO_PROFILE_BL_CIF15_540, AUDIO_PROFILE_AAC },
1086
1087 { &avc_ts_bl_cif15_aac_ltp, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1088 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_LTP },
1089 { &avc_ts_bl_cif15_aac_ltp_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1090 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_LTP },
1091 { &avc_ts_bl_cif15_aac_ltp_iso, CT_MPEG_TRANSPORT_STREAM,
1092 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_LTP },
1093
1094 { &avc_ts_bl_cif15_bsac, CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS,
1095 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_BSAC },
1096 { &avc_ts_bl_cif15_bsac_t, CT_MPEG_TRANSPORT_STREAM_DLNA,
1097 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_BSAC },
1098 { &avc_ts_bl_cif15_bsac_iso, CT_MPEG_TRANSPORT_STREAM,
1099 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AAC_BSAC },
1100
1101 /* 3GPP Container */
1102 { &avc_3gpp_bl_cif30_amr_wbplus, CT_3GP,
1103 AVC_VIDEO_PROFILE_BL_CIF30, AUDIO_PROFILE_AMR_WB },
1104
1105 { &avc_3gpp_bl_cif15_amr_wbplus, CT_3GP,
1106 AVC_VIDEO_PROFILE_BL_CIF15, AUDIO_PROFILE_AMR_WB },
1107
1108 { &avc_3gpp_bl_qcif15_aac, CT_3GP,
1109 AVC_VIDEO_PROFILE_BL_QCIF15, AUDIO_PROFILE_AAC },
1110 { &avc_3gpp_bl_qcif15_aac_ltp, CT_3GP,
1111 AVC_VIDEO_PROFILE_BL_QCIF15, AUDIO_PROFILE_AAC_LTP },
1112 { &avc_3gpp_bl_qcif15_heaac, CT_3GP,
1113 AVC_VIDEO_PROFILE_BL_QCIF15, AUDIO_PROFILE_AAC_HE_L2 },
1114 { &avc_3gpp_bl_qcif15_amr_wbplus, CT_3GP,
1115 AVC_VIDEO_PROFILE_BL_QCIF15, AUDIO_PROFILE_AMR_WB },
1116 { &avc_3gpp_bl_qcif15_amr, CT_3GP,
1117 AVC_VIDEO_PROFILE_BL_QCIF15, AUDIO_PROFILE_AMR },
1118
1119 { NULL, 0, 0, 0 }
1120 };
1121
1122 static inline int
1123 is_valid_video_profile (video_properties_t res[],
1124 int size, AVCodecContext *vc)
1125 {
1126 int i;
1127
1128 for (i = 0; i < size / (int) sizeof (video_properties_t); i++)
1129 if (res[i].width == vc->width &&
1130 res[i].height == vc->height)
1131 return 1;
1132
1133 return 0;
1134 }
1135
1136 static avc_video_profile_t
1137 avc_video_get_profile (AVFormatContext *ctx, AVStream *vs, AVCodecContext *vc)
1138 {
1139 if (!vs || !vc)
1140 return AVC_VIDEO_PROFILE_INVALID;
1141
1142 /* stupid exception to CIF15 */
1143 if (vc->bit_rate <= 384000 && ctx->bit_rate <= 600000 &&
1144 vc->width == 320 && vc->height == 240)
1145 return AVC_VIDEO_PROFILE_BL_L12_CIF15;
1146
1147 /* CIF */
1148 if (is_valid_video_profile (profile_cif_res,
1149 sizeof (profile_cif_res), vc))
1150 {
1151 /* QCIF */
1152 if (vc->bit_rate <= 128000 && ctx->bit_rate <= 256000)
1153 {
1154 if (vs->r_frame_rate.num == 15 && vs->r_frame_rate.num == 1)
1155 return AVC_VIDEO_PROFILE_BL_QCIF15;
1156 else
1157 return AVC_VIDEO_PROFILE_BL_L1B_QCIF;
1158 }
1159
1160 /* CIF15 */
1161 if (ctx->bit_rate <= 520000) /* 520 kbps max system bitrate */
1162 return AVC_VIDEO_PROFILE_BL_CIF15_520;
1163 if (ctx->bit_rate <= 540000) /* 540 kbps max system bitrate */
1164 return AVC_VIDEO_PROFILE_BL_CIF15_540;
1165
1166 /* 384 kbps max video bitrate */
1167 if (vc->bit_rate <= 384000 && ctx->bit_rate <= 600000)
1168 return AVC_VIDEO_PROFILE_BL_CIF15;
1169
1170 /* CIF30 */
1171 if (ctx->bit_rate <= 940000) /* 940 kbps max system bitrate */
1172 return AVC_VIDEO_PROFILE_BL_CIF30_940;
1173 if (ctx->bit_rate <= 1300000) /* 1.3 Mbps kbps max system bitrate */
1174 return AVC_VIDEO_PROFILE_BL_L2_CIF30;
1175
1176 /* 2 Mbps max video bitrate */
1177 if (vc->bit_rate <= 2000000 && ctx->bit_rate <= 3000000)
1178 return AVC_VIDEO_PROFILE_BL_CIF30;
1179 }
1180
1181 /* SD */
1182 if (vc->bit_rate <= 4000000 /* 4 Mbps max */
1183 && is_valid_video_profile (profile_mp_l3_sd_res,
1184 sizeof (profile_mp_l3_sd_res), vc))
1185 return AVC_VIDEO_PROFILE_BL_L3_SD;
1186 /* what is BL_L3L ?? */
1187
1188 if (vc->bit_rate <= 10000000 /* 10 Mbps max */
1189 && is_valid_video_profile (profile_mp_sd_res,
1190 sizeof (profile_mp_sd_res), vc))
1191 return AVC_VIDEO_PROFILE_MP_SD;
1192
1193 /* HD */
1194 if (vc->bit_rate <= 20000000) /* 20 Mbps max */
1195 {
1196 if (is_valid_video_profile (profile_mp_hd_res,
1197 sizeof (profile_mp_hd_res), vc))
1198 return AVC_VIDEO_PROFILE_MP_HD;
1199
1200 /* dirty hack to support some excentric 480/720/1080(i,p) files
1201 where only one of the size is correct */
1202 if (vc->width == 1920 || vc->width == 1280 || vc->width == 720)
1203 return AVC_VIDEO_PROFILE_MP_HD;
1204 if (vc->height == 1080 || vc->height == 720 || vc->height == 480)
1205 return AVC_VIDEO_PROFILE_MP_HD;
1206 }
1207
1208 return AVC_VIDEO_PROFILE_INVALID;
1209 }
1210
1211 static dlna_profile_t *
1212 probe_avc (AVFormatContext *ctx,
1213 dlna_container_type_t st,
1214 av_codecs_t *codecs)
1215 {
1216 avc_video_profile_t vp;
1217 audio_profile_t ap;
1218 int i;
1219
1220 if (!stream_ctx_is_av (codecs))
1221 return NULL;
1222
1223 /* check for H.264/AVC codec */
1224 if (codecs->vc->codec_id != CODEC_ID_H264)
1225 return NULL;
1226
1227 /* check for a supported container */
1228 if (st != CT_3GP &&
1229 st != CT_MP4 &&
1230 st != CT_MPEG_TRANSPORT_STREAM &&
1231 st != CT_MPEG_TRANSPORT_STREAM_DLNA &&
1232 st != CT_MPEG_TRANSPORT_STREAM_DLNA_NO_TS)
1233 return NULL;
1234
1235 /* ensure we have a valid video codec bit rate */
1236 if (codecs->vc->bit_rate == 0)
1237 codecs->vc->bit_rate = codecs->ac->bit_rate ?
1238 ctx->bit_rate - codecs->ac->bit_rate : ctx->bit_rate;
1239
1240 /* check for valid video profile */
1241 vp = avc_video_get_profile (ctx, codecs->vs, codecs->vc);
1242 if (vp == AVC_VIDEO_PROFILE_INVALID)
1243 return NULL;
1244
1245 /* check for valid audio profile */
1246 ap = audio_profile_guess (codecs->ac);
1247 if (ap == AUDIO_PROFILE_INVALID)
1248 return NULL;
1249
1250 /* AAC fixup: _320 profiles are audio-only profiles */
1251 if (ap == AUDIO_PROFILE_AAC_320)
1252 ap = AUDIO_PROFILE_AAC;
1253 if (ap == AUDIO_PROFILE_AAC_HE_L2_320)
1254 ap = AUDIO_PROFILE_AAC_HE_L2;
1255
1256 /* find profile according to container type, video and audio profiles */
1257 for (i = 0; avc_profiles_mapping[i].profile; i++)
1258 if (avc_profiles_mapping[i].st == st &&
1259 avc_profiles_mapping[i].vp == vp &&
1260 avc_profiles_mapping[i].ap == ap)
1261 return avc_profiles_mapping[i].profile;
1262
1263 return NULL;
1264 }
1265
1266 dlna_registered_profile_t dlna_profile_av_mpeg4_part10 = {
1267 .id = DLNA_PROFILE_AV_MPEG4_PART10,
1268 .class = DLNA_CLASS_AV,
1269 .extensions = "mov,hdmov,mp4,3gp,3gpp,mpg,mpeg,mpe,mp2t,ts",
1270 .probe = probe_avc,
1271 .next = NULL
1272 };