Home | History | Annotate | Download | only in src
      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 /*
     19     The PVA_FF_IMpeg4File Class is INTERFACE that exsposes only those necessary
     20     methods of the underlying PVA_FF_Mpeg4File class.
     21 */
     22 
     23 #define IMPLEMENT_IMpeg4File_H__
     24 
     25 
     26 #include "oscl_base.h"
     27 #include "a_impeg4file.h"
     28 #include "mpeg4file.h"
     29 #include "atomutils.h"
     30 #ifndef OSCL_DLL_H_INCLUDED
     31 #include "oscl_dll.h"
     32 #endif
     33 
     34 // Define entry point for this DLL
     35 OSCL_DLL_ENTRY_POINT_DEFAULT()
     36 
     37 OSCL_EXPORT_REF
     38 // Static method to create the MP4 file and return the PVA_FF_IMpeg4File interface
     39 PVA_FF_IMpeg4File*
     40 PVA_FF_IMpeg4File::createMP4File(int32 mediaType,
     41                                  PVA_FF_UNICODE_STRING_PARAM outputPath,
     42                                  PVA_FF_UNICODE_STRING_PARAM postFix,
     43                                  void* osclFileServerSession,
     44                                  uint32 fileAuthoringFlags,
     45                                  PVA_FF_UNICODE_STRING_PARAM outputFileName, uint32 aCacheSize)
     46 {
     47     PVA_FF_Mpeg4File *mp4 = NULL;
     48     PV_MP4_FF_NEW(fp->auditCB, PVA_FF_Mpeg4File, (mediaType), mp4);
     49 
     50     mp4->SetTempOutputPath(outputPath);
     51     mp4->SetTempFilePostFix(postFix);
     52     mp4->SetCacheSize(aCacheSize);
     53 
     54     if (!mp4->setOutputFileName(outputFileName))
     55     {
     56         PV_MP4_FF_DELETE(NULL, PVA_FF_Mpeg4File, mp4);
     57         return NULL;
     58     }
     59 
     60     if (!(mp4->init(mediaType,
     61                     osclFileServerSession,
     62                     fileAuthoringFlags)))
     63     {
     64         PV_MP4_FF_DELETE(NULL, PVA_FF_Mpeg4File, mp4);
     65         return NULL;
     66     }
     67 
     68     return mp4;
     69 }
     70 
     71 OSCL_EXPORT_REF
     72 PVA_FF_IMpeg4File*
     73 PVA_FF_IMpeg4File::createMP4File(int32 mediaType,
     74                                  uint32 fileAuthoringFlags,
     75                                  MP4_AUTHOR_FF_FILE_HANDLE outputFileHandle,
     76                                  uint32 aCacheSize)
     77 {
     78     PVA_FF_Mpeg4File *mp4 = NULL;//OSCL_NEW(PVA_FF_Mpeg4File, (mediaType));
     79     PV_MP4_FF_NEW(fp->auditCB, PVA_FF_Mpeg4File, (mediaType), mp4);
     80 
     81     if (!mp4->setOutputFileHandle(outputFileHandle))
     82     {
     83         PV_MP4_FF_DELETE(NULL, PVA_FF_Mpeg4File, mp4);
     84         return NULL;
     85     }
     86 
     87     mp4->SetCacheSize(aCacheSize);
     88     if (!(mp4->init(mediaType,
     89                     NULL,
     90                     fileAuthoringFlags)))
     91     {
     92         PV_MP4_FF_DELETE(NULL, PVA_FF_Mpeg4File, mp4);
     93         return NULL;
     94     }
     95 
     96     return mp4;
     97 }
     98 OSCL_EXPORT_REF void PVA_FF_IMpeg4File::DestroyMP4FileObject(PVA_FF_IMpeg4File* aMP4FileObject)
     99 {
    100     PVA_FF_Mpeg4File* ptr = OSCL_STATIC_CAST(PVA_FF_Mpeg4File*, aMP4FileObject);
    101     PV_MP4_FF_DELETE(NULL, PVA_FF_Mpeg4File, ptr);
    102 }
    103