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_MP4_PROGDOWNLOAD_SUPPORT_EXTENSION_H_INCLUDED 19 #define PVMF_MP4_PROGDOWNLOAD_SUPPORT_EXTENSION_H_INCLUDED 20 21 #ifndef OSCL_BASE_H_INCLUDED 22 #include "oscl_base.h" 23 #endif 24 #ifndef OSCL_TYPES_H_INCLUDED 25 #include "oscl_types.h" 26 #endif 27 #ifndef OSCL_SHARED_PTR_H_INCLUDED 28 #include "oscl_shared_ptr.h" 29 #endif 30 #ifndef PVMF_MEDIA_CLOCK_H_INCLUDED 31 #include "pvmf_media_clock.h" 32 #endif 33 #ifndef PV_UUID_H_INCLUDED 34 #include "pv_uuid.h" 35 #endif 36 #ifndef PV_INTERFACE_H 37 #include "pv_interface.h" 38 #endif 39 40 #define PVMF_MP4_PROGDOWNLOAD_SUPPORT_INTERFACE_MIMETYPE "x-pvmf/pvmf/mp4ff/progdownload-support" 41 #define PVMF_MP4_PROGDOWNLOAD_SUPPORT_INTERFACE_UUID PVUuid(0x00f80b00, 0x4bd4, 0x4656, 0x8e, 0x0f, 0x63, 0xe0, 0x3d, 0x7a, 0x5f, 0x39) 42 43 class Oscl_File; 44 class PVMFDownloadProgressInterface; 45 46 class PVMFMP4ProgDownloadSupportInterface: public PVInterface 47 { 48 public: 49 /** 50 * Determines if the file is a progressively downloadable MP4 file. 51 * 52 * @param FilePointer - File pointer to the MP4/3GP 53 * file. Please note that the file open and close are handled by the 54 * caller, so the should already be opened and it will not be closed by 55 * this API. 56 * 57 * @param fileSize - Size of the downloaded file, thus far. 58 * 59 * @param uint32& currFilePosition - This API parses the top level 60 * atoms of the file to determine the relative positions of the media 61 * and meta data. This might take a few passes, depending on the how 62 * large the file is, and how the top-level atom layout. This value is 63 * used by the API to avoid parsing the same data all over again. In 64 * case the return value is INSUFFICIENT_DATA, then the caller needs to 65 * save the "currFilePosition" from the current call, in the next 66 * call. It should be initialized to zero. 67 * 68 * @param bool& oIsProgressiveDownloadable - Set to true if the clip is 69 * is progressive dowmloadable. 70 * 71 * @param uint32& metaDataSize - If the clip is progressive 72 * downloadable then this API also returns the meta data size. Player 73 * needs to wait for the file to grow past the metaDataSize before 74 * starting playback.This param is valid only if oIsProgressiveDownloadable 75 * is set to TRUE. 76 * 77 * @return MP4_ERROR_CODE - EVERYTHING_FINE, if a conclusion is reached 78 * either way on whether a clip is progressive downloadable or not. 79 * INSUFFICIENT_DATA, if more calls to this API are needed to reach a 80 * decision 81 * Any other return value indicates error. See isuceedfail.h in the mp4 fileformat 82 * parser for more information on the error codes. 83 */ 84 virtual int32 isProgressiveDownloadable(Oscl_File* FilePointer, 85 uint32 fileSize, 86 bool& oIsProgressiveDownloadable, 87 uint32& metaDataSize) = 0; 88 89 /** 90 * This API return the timestamp of a sample that is closest to the given 91 * fileSize. 92 * 93 * @param trackID 94 * 95 * @param fileSize 96 * 97 * @param uint32& timeStamp - gives the NPT in milliseconds of the closest sample to the fileSize byte offset. 98 * 99 * @return EVERYTHING_FINE - In case a valid sample and corresponding time 100 * stamp was located. 101 * INSUFFICIENT_DATA in case the very first sample location is past the fileSize 102 * NOT_SUPPORTED - in case "parsingMode" is set to 1, in "readMP4File" 103 * call 104 * Any other return value indicates ERROR. 105 * 106 */ 107 virtual int32 getMaxTrackTimeStamp(uint32 fileSize, uint32& timeStamp) = 0; 108 109 /** 110 * Returns the length of the entire presentation in the units of the movie timescale. 111 * 112 * @return - movie duration in units of the movie timescale. 113 * 114 */ 115 virtual uint32 getMovieDuration() = 0; 116 117 118 /** 119 * Returns the movie timescale. 120 * 121 * @return - movie timescale (i.e., ticks per second). 122 * 123 */ 124 virtual uint32 getMovieTimescale() = 0; 125 126 /** 127 * Sets the download progress interface which will be used to determine if there is sufficient 128 * data downloaded to proceed with playback and request notification play resume if autopause is 129 * necessary. 130 * 131 * @param download_progress - this parameter is an interface pointer to the set of APIs for download progress. 132 * 133 * @return - none 134 * 135 */ 136 virtual void setDownloadProgressInterface(PVMFDownloadProgressInterface* download_progress) = 0; 137 138 /** 139 * Callback in response to the requestResumeNotification call in PVMFDownloadProgressInterface when 140 * playback can continue 141 * 142 * @param aDownloadComplete Set to true if download operation has fully completed between requestResumeNotification and this callback 143 * 144 * @return - none 145 */ 146 virtual void playResumeNotification(bool aDownloadComplete) = 0; 147 148 }; 149 150 #endif //PVMF_MP4_PROGDOWNLOAD_SUPPORT_EXTENSION_H_INCLUDED 151 152