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 PVMF_FILE_DATA_SINK_H_INCLUDED 19 #define PVMF_FILE_DATA_SINK_H_INCLUDED 20 21 #ifndef OSCL_MEM_H_INCLUDED 22 #include "oscl_mem.h" 23 #endif 24 25 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED 26 #include "pvmf_node_interface.h" 27 #endif 28 29 #ifndef PVMF_PORT_BASE_IMPL_H_INCLUDED 30 #include "pvmf_port_base_impl.h" 31 #endif 32 33 #ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED 34 #include "pvmf_simple_media_buffer.h" 35 #endif 36 37 #ifndef PVMF_MEDIA_DATA_H_INCLUDED 38 #include "pvmf_media_data.h" 39 #endif 40 41 #ifndef PVMI_CONFIG_AND_CAPABILITY_H_INCLUDED 42 #include "pvmi_config_and_capability_utils.h" 43 #endif 44 45 #ifndef PVMF_BUFFER_DATA_SINK_H_INCLUDED 46 #include "pvmf_buffer_data_sink.h" 47 #endif 48 49 class PVMFFileDataSink : public PVMFBufferDataSink 50 { 51 public: 52 OSCL_IMPORT_REF PVMFFileDataSink(int32 aPortTag); 53 OSCL_IMPORT_REF virtual ~PVMFFileDataSink(); 54 55 // PVMFPortInterface virtuals 56 PVMFStatus PutData(PVMFSharedMediaMsgPtr aMsg); 57 58 bool OpenFile(char *aFileName) 59 { 60 iWriteFile = fopen(aFileName, "wb"); 61 if (iWriteFile) 62 { 63 return true; 64 } 65 return false; 66 } 67 68 private: 69 FILE *iWriteFile; 70 }; 71 #endif 72