• 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 PV_AVIFILE_H_INCLUDED
19 #include "pv_avifile.h"
20 #endif
21 
22 #ifndef PV_AVIFILE_PARSER_H_INCLUDED
23 #include "pv_avifile_parser.h"
24 #endif
25 
26 #ifndef OSCL_DLL_H_INCLUDED
27 #include "oscl_dll.h"
28 #endif
29 
OSCL_DLL_ENTRY_POINT_DEFAULT()30 OSCL_DLL_ENTRY_POINT_DEFAULT()
31 
32 OSCL_EXPORT_REF PVAviFile* PVAviFile::CreateAviFileParser(OSCL_wHeapString<OsclMemAllocator> aFileName, int32& aError, Oscl_FileServer* aFileServer,
33         PVMFCPMPluginAccessInterfaceFactory*  aCPM, OsclFileHandle*  aFileHandle)
34 {
35 
36     PVAviFileParser* pAviFileParser = NULL;
37 
38     OSCL_TRY(aError, pAviFileParser =
39                  OSCL_NEW(PVAviFileParser, (aFileName, aError, aFileServer, aCPM, aFileHandle));
40             );
41 
42     if (PV_AVI_FILE_PARSER_SUCCESS == aError)
43     {
44         pAviFileParser->ParseFile();
45         aError = pAviFileParser->GetStatus(); // get & log error, if any
46 
47         if (PV_AVI_FILE_PARSER_SUCCESS == aError)
48         {
49             return pAviFileParser;
50         }
51         else
52         {
53             OSCL_DELETE(pAviFileParser);
54             pAviFileParser = NULL;
55             return NULL;
56         }
57     }
58     else if (pAviFileParser != NULL)
59     {
60         OSCL_DELETE(pAviFileParser);
61         pAviFileParser = NULL;
62         return NULL;
63     }
64 
65     return NULL;
66 }
67 
68 
DeleteAviFileParser(PVAviFile * apAviFileParser)69 OSCL_EXPORT_REF void PVAviFile::DeleteAviFileParser(PVAviFile* apAviFileParser)
70 {
71     if (NULL != apAviFileParser)
72     {
73         PVAviFileParser* ptr = OSCL_STATIC_CAST(PVAviFileParser*, apAviFileParser);
74         OSCL_DELETE(ptr);
75         ptr = NULL;
76         apAviFileParser = NULL;
77     }
78 
79 }
80 
81 
82