• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #ifndef SDP_MEDIA_PARSER_REGISTRY_FACTORY
19 #include "sdp_mediaparser_registry_populator.h"
20 #endif
21 
22 #ifndef SDP_MEDIAPARSER_FACTORY_H
23 #include "sdp_mediaparser_factory.h"
24 #endif
25 
PopulateRegistry()26 SDPMediaParserRegistry* SDPMediaParserRegistryPopulater::PopulateRegistry()
27 {
28     SDPMediaParserRegistry* sdpMediaParserRegistry = NULL;
29     StrPtrLen aac_latm("MP4A-LATM");
30     StrPtrLen aac("AAC");
31     StrPtrLen amr("AMR");
32     StrPtrLen amrwb("AMR-WB");
33     StrPtrLen h263_old("H263-1998");
34     StrPtrLen h263("H263-2000");
35     StrPtrLen m4v("MP4V-ES");
36     StrPtrLen author_m4v("PVMP4V-ES");
37     StrPtrLen still("X-MP4V-IMAGE");
38     StrPtrLen h264("H264");
39     StrPtrLen pcma("PCMA");
40     StrPtrLen pcmu("PCMU");
41     StrPtrLen rfc3640("mpeg4-generic");
42 
43     SDPMediaParserRegistry::Init();
44 
45     sdpMediaParserRegistry =
46         SDPMediaParserRegistry::GetSDPMediaParserRegistry();
47 
48     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(aac_latm, OSCL_NEW(SDPAACMediaParserFactory, ()));
49     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(aac, OSCL_NEW(SDPAACMediaParserFactory, ()));
50     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(amr, OSCL_NEW(SDPAMRMediaParserFactory, ()));
51     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(amrwb, OSCL_NEW(SDPAMRMediaParserFactory, ()));
52     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(h263_old, OSCL_NEW(SDPH263MediaParserFactory, ()));
53     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(h263, OSCL_NEW(SDPH263MediaParserFactory, ()));
54     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(m4v, OSCL_NEW(SDPMPEG4MediaParserFactory, ()));
55     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(author_m4v, OSCL_NEW(SDPMPEG4MediaParserFactory, ()));
56     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(still, OSCL_NEW(SDPStillImageMediaParserFactory, ()));
57     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(h264, OSCL_NEW(SDPH264MediaParserFactory, ()));
58     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(pcma, OSCL_NEW(SDPPCMAMediaParserFactory, ()));
59     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(pcmu, OSCL_NEW(SDPPCMUMediaParserFactory, ()));
60     sdpMediaParserRegistry->addMediaParserFactoryToRegistry(rfc3640, OSCL_NEW(SDPRFC3640MediaParserFactory, ()));
61 
62     return sdpMediaParserRegistry;
63 }
64 
CleanupRegistry(SDPMediaParserRegistry * & aMediaParserRegistry)65 void SDPMediaParserRegistryPopulater::CleanupRegistry(SDPMediaParserRegistry*& aMediaParserRegistry)
66 {
67     StrPtrLen rfc3640("mpeg4-generic");
68     StrPtrLen pcmu("PCMU");
69     StrPtrLen pcma("PCMA");
70     StrPtrLen h264("H264");
71     StrPtrLen still("X-MP4V-IMAGE");
72     StrPtrLen author_m4v("PVMP4V-ES");
73     StrPtrLen m4v("MP4V-ES");
74     StrPtrLen h263("H263-2000");
75     StrPtrLen h263_old("H263-1998");
76     StrPtrLen amrwb("AMR-WB");
77     StrPtrLen amr("AMR");
78     StrPtrLen aac("AAC");
79     StrPtrLen aac_latm("MP4A-LATM");
80 
81     OsclMemoryFragment memFrag;
82 
83     memFrag.ptr = (OsclAny*)(rfc3640.c_str());
84     memFrag.len = (uint32)rfc3640.size();
85     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
86 
87     memFrag.ptr = (OsclAny*)(pcmu.c_str());
88     memFrag.len = (uint32)pcmu.size();
89     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
90 
91     memFrag.ptr = (OsclAny*)(pcma.c_str());
92     memFrag.len = (uint32)pcma.size();
93     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
94 
95     memFrag.ptr = (OsclAny*)(h264.c_str());
96     memFrag.len = (uint32)h264.size();
97     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
98 
99     memFrag.ptr = (OsclAny*)(still.c_str());
100     memFrag.len = (uint32)still.size();
101     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
102 
103     memFrag.ptr = (OsclAny*)(author_m4v.c_str());
104     memFrag.len = (uint32)author_m4v.size();
105     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
106 
107     memFrag.ptr = (OsclAny*)(m4v.c_str());
108     memFrag.len = (uint32)m4v.size();
109     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
110 
111     memFrag.ptr = (OsclAny*)(h263.c_str());
112     memFrag.len = (uint32)h263.size();
113     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
114 
115     memFrag.ptr = (OsclAny*)(h263_old.c_str());
116     memFrag.len = (uint32)h263_old.size();
117     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
118 
119     memFrag.ptr = (OsclAny*)(amrwb.c_str());
120     memFrag.len = (uint32)amrwb.size();
121     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
122 
123     memFrag.ptr = (OsclAny*)(amr.c_str());
124     memFrag.len = (uint32)amr.size();
125     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
126 
127     memFrag.ptr = (OsclAny*)(aac.c_str());
128     memFrag.len = (uint32)aac.size();
129     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
130 
131     memFrag.ptr = (OsclAny*)(aac_latm.c_str());
132     memFrag.len = (uint32)aac_latm.size();
133     OSCL_DELETE(aMediaParserRegistry->lookupSDPMediaParserFactory(memFrag));
134 
135     SDPMediaParserRegistry::Cleanup();
136 }
137