annotate libdlna-0.2.3/src/audio_atrac3.c @ 130:cc3e3f370aec

tune for streaming.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sun, 10 Oct 2010 22:44:28 +0900
parents 4f6d9621ee00
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
129
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
1 /*
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
2 * libdlna: reference DLNA standards implementation.
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org>
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
4 *
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
5 * This file is part of libdlna.
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
6 *
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
7 * libdlna is free software; you can redistribute it and/or
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
11 *
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
12 * libdlna is distributed in the hope that it will be useful,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
15 * Lesser General Public License for more details.
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
16 *
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
18 * License along with libdlna; if not, write to the Free Software
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
19 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
20 */
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
21
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
22 #include <stdlib.h>
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
23 #include <string.h>
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
24
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
25 #include "dlna_internals.h"
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
26 #include "profiles.h"
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
27
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
28 /* Profile for audio media class content */
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
29 static dlna_profile_t atrac3 = {
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
30 .id = "ATRAC3plus",
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
31 .mime = MIME_AUDIO_ATRAC,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
32 .label = LABEL_AUDIO_2CH_MULTI
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
33 };
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
34
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
35 audio_profile_t
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
36 audio_profile_guess_atrac (AVCodecContext *ac)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
37 {
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
38 if (!ac)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
39 return AUDIO_PROFILE_INVALID;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
40
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
41 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
42 if (ac->codec_id == CODEC_ID_ATRAC3)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
43 return AUDIO_PROFILE_ATRAC;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
44 #endif
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
45
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
46 return AUDIO_PROFILE_INVALID;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
47 }
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
48
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
49 static dlna_profile_t *
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
50 probe_atrac3 (AVFormatContext *ctx dlna_unused,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
51 dlna_container_type_t st dlna_unused,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
52 av_codecs_t *codecs)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
53 {
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
54 if (!stream_ctx_is_audio (codecs))
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
55 return NULL;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
56
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
57 if (audio_profile_guess_atrac (codecs->ac) == AUDIO_PROFILE_ATRAC)
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
58 return &atrac3;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
59
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
60 return NULL;
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
61 }
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
62
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
63 dlna_registered_profile_t dlna_profile_audio_atrac3 = {
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
64 .id = DLNA_PROFILE_AUDIO_ATRAC3,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
65 .class = DLNA_CLASS_AUDIO,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
66 .extensions = "at3p,acm,wav",
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
67 .probe = probe_atrac3,
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
68 .next = NULL
4f6d9621ee00 add multi session streaming & add depending librarys.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
69 };