Home | History | Annotate | Download | only in include
      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_TRACK_LEVEL_INFO_EXTENSION_H_INCLUDED
     19 #define PVMF_TRACK_LEVEL_INFO_EXTENSION_H_INCLUDED
     20 
     21 #ifndef OSCL_BASE_H_INCLUDED
     22 #include "oscl_base.h"
     23 #endif
     24 #ifndef PV_UUID_H_INCLUDED
     25 #include "pv_uuid.h"
     26 #endif
     27 #ifndef PV_INTERFACE_H
     28 #include "pv_interface.h"
     29 #endif
     30 #ifndef PVMF_MEDIA_PRESENTATION_INFO_H_INCLUDED
     31 #include "pvmf_media_presentation_info.h"
     32 #endif
     33 
     34 
     35 struct PVMFSampleNumTS
     36 {
     37     int32 iSampleNumber;
     38     PVMFTimestamp iTimestamp;
     39 };
     40 
     41 typedef Oscl_Vector<PVMFSampleNumTS, OsclMemAllocator> PVMFSampleNumTSList;
     42 
     43 
     44 #define PVMF_TRACK_LEVEL_INFO_INTERFACE_MIMETYPE "pvxxx/pvmf/pvmftracklevelinfointerface"
     45 #define PVMF_TRACK_LEVEL_INFO_INTERFACE_UUID PVUuid(0xb8a4c3ad,0x4c08,0x4962,0xbb,0x6b,0x0d,0x62,0x37,0x63,0xbd,0x22)
     46 
     47 class PVMFTrackLevelInfoExtensionInterface : public PVInterface
     48 {
     49     public:
     50         virtual void addRef() = 0;
     51         virtual void removeRef() = 0;
     52         virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface) = 0;
     53 
     54         /**
     55         * Retrieves the list of all available tracks from a source node as a list of track info. The returned
     56         * track info list is needed to call other methods from this extension interface.
     57         *
     58         * @param aTracks, a reference to a vector of PVMFTrackInfo which will be filled in with track info
     59         * of currently available tracks
     60         * @return PVMFSuccess if successfully retrieved else PVMFFailure for errors.
     61         */
     62         virtual PVMFStatus GetAvailableTracks(Oscl_Vector<PVMFTrackInfo, OsclMemAllocator>& aTracks) = 0;
     63 
     64         /**
     65         * Provides the timestamp for a specified sample number in a specific track
     66         *
     67         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the list of PVMFTrackInfo returned
     68         * by GetAvailableTracks() function. The sample number to timestamp conversion would be performed on the track
     69         * specified by this parameter
     70         * @param aSampleNum, the sample number in the specified track to return the timestamp. The sample number is
     71         * in 0-based index.
     72         * @param aTimestamp, a reference to PVMFTimestamp which will be filled with timestamp value for the specified sample
     73         * number in the specified track if this function completes successfully
     74         *
     75         * @return PVMFSuccess if timestamp is returned for the specified sample number, PVMFErrInvalidState if the information
     76         * is not available, else PVMFFailure for any other errors
     77         */
     78         virtual PVMFStatus GetTimestampForSampleNumber(PVMFTrackInfo& aTrackInfo, uint32 aSampleNum, PVMFTimestamp& aTimestamp) = 0;
     79 
     80         /**
     81         * Provides the sample number that is closest and before the specified timestamp in a specific track
     82         *
     83         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the PVMFMediaPresentationInfo returned
     84         * by GetAvailableTracks() function. The timestamp to sample number conversion would be performed on the track
     85         * specified by this parameter
     86         * @param aTimestamp, the timestamp in the specified track to return the sample number for.
     87         * in 0-based index.
     88         * @param aSampleNum, a reference to an integer which will be filled with the sample number (0-based index) value closest but before
     89         * the specified timestamp in the specified track if this function completes successfully. If the timestamp is greater than
     90         * the duration of the specified track, then the number for the last sample in the track will be returned.
     91         *
     92         * @return PVMFSuccess if sample number is returned for the specified timestamp, PVMFErrInvalidState if the information
     93         * is not available, else PVMFFailure for any other errors
     94         */
     95         virtual PVMFStatus GetSampleNumberForTimestamp(PVMFTrackInfo& aTrackInfo, PVMFTimestamp aTimestamp, uint32& aSampleNum) = 0;
     96 
     97         /**
     98         * Returns the number of synchronization samples in a specific track
     99         *
    100         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the PVMFMediaPresentationInfo returned
    101         * by GetAvailableTracks() function. The number of synchronization samples would be returned for the track
    102         * specified by this parameter
    103         * @param aNumSyncSamples, a reference to an integer which will be filled with the number of synchronization samples
    104         * in the specified track. If all the samples in the track are synchronizaton samples, then the integer would be set to -1.
    105         *
    106         * @return PVMFSuccess if the number of sync samples is returned for the specified track, PVMFErrInvalidState if the information
    107         * is not available, else PVMFFailure for any other errors
    108         */
    109         virtual PVMFStatus GetNumberOfSyncSamples(PVMFTrackInfo& aTrackInfo, int32& aNumSyncSamples) = 0;
    110 
    111         /**
    112         * Returns the list of synchronization sample information in a specific track
    113         *
    114         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the PVMFMediaPresentationInfo returned
    115         * by GetAvailableTracks() function. The synchronization sample info would be returned for the track
    116         * specified by this parameter
    117         * @param aList, a reference to a vector of PVMFSampleNumTS which will be filled with information about synchronization samples
    118         * in the specified track.
    119         * @param aStartIndex, the starting index in the synchronization sample list to fill aList with. (0-based index). If aStartIndex
    120         * is not specified, aList will be filled from the first synchronization sample in the track
    121         * @param aMaxEntries, the number of synchronization sample infos to fill in aList. If this parameter is not specified, this
    122         * function will put info on all synchronization samples for the specified track in aList.
    123         *
    124         * @return PVMFSuccess if the number of sync samples is returned for the specified track, PVMFErrInvalidState if the information
    125         * is not available, PVMFErrArgument if aStartIndex and/or aMaxEntries are invalid, PVMFErrNoMemory if memory allocation failure
    126         * occurs else PVMFFailure for any other errors
    127         */
    128         virtual PVMFStatus GetSyncSampleInfo(PVMFTrackInfo& aTrackInfo, PVMFSampleNumTSList& aList, uint32 aStartIndex = 0, int32 aMaxEntries = -1) = 0;
    129 
    130         /**
    131         * Returns the list of synchronization sample information in a specific track, based on a target timestamp.
    132         * This API attemps to return closest sync sample information both before and after a given target time.
    133         *
    134         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the PVMFMediaPresentationInfo returned
    135         * by GetAvailableTracks() function. The synchronization sample info would be returned for the track
    136         * specified by this parameter
    137         * @param aTargetTimeInMS, a reference to a target time in ms. The closest synchronization samples to this time would
    138         * be returned
    139         * @param aList, a reference to a vector of PVMFSampleNumTS which will be filled with information about synchronization
    140         * samples in the specified track. This list contains closest synchronization samples, to specified aTargetTimeInMS,
    141         * both before and after. If the list contains just one element then it typically means there are no sync samples
    142         * after the specified target time.
    143         * @param aHowManySamples, the  offset from base index in the synchronization sample list,if value is X then it will allow
    144         * to return X previous and X next synchronization samples from base index. If aHowManySamples
    145         * is not specified, aList will be filled from the one previous and one next synchronization sample from after base index in the track
    146         *
    147         * @return PVMFSuccess if the number of sync samples is returned for the specified track, PVMFErrInvalidState if the information
    148         * is not available, PVMFErrArgument if aTargetTimeInMS is invalid, PVMFErrNoMemory if memory allocation failure
    149         * occurs else PVMFFailure for any other errors
    150         */
    151         virtual PVMFStatus GetSyncSampleInfo(PVMFSampleNumTSList& aList, PVMFTrackInfo& aTrackInfo, int32 aTargetTimeInMS, uint32 aHowManySamples = 1) = 0;
    152 
    153         /**
    154         * Provides the timestamp of a specific track for a specified data position
    155         *
    156         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the list of PVMFTrackInfo returned
    157         * by GetAvailableTracks() function. The data position to timestamp conversion would be performed on the track
    158         * specified by this parameter
    159         * @param aDataPosition, the data position in the source to return the timestamp for the specified track. The data
    160         * position is number of bytes from beginning.
    161         * @param aTimestamp, a reference to PVMFTimestamp which will be filled with timestamp value in the specified track
    162         * for the specified data position if this function completes successfully
    163         *
    164         * @return PVMFSuccess if timestamp is returned for the specified data position, PVMFErrInvalidState if the information
    165         * is not available, else PVMFFailure for any other errors
    166         */
    167         virtual PVMFStatus GetTimestampForDataPosition(PVMFTrackInfo& aTrackInfo, uint32 aDataPosition, PVMFTimestamp& aTimestamp) = 0;
    168 
    169         /**
    170         * Provides the data position for the specified timestamp in a specific track
    171         *
    172         * @param aTrackInfo, a reference to a PVMFTrackInfo chosen from the PVMFMediaPresentationInfo returned
    173         * by GetAvailableTracks() function. The timestamp to data position conversion would be performed on the track
    174         * specified by this parameter
    175         * @param aTimestamp, the timestamp in the specified track to return the data position.
    176         * @param aDataPosition, a reference to an unsigned integer which will be filled with the data position
    177         * (bytes from beginning) closest but before the specified timestamp in the specified track if this function
    178         * completes successfully. If the timestamp is greater than the duration of the specified track, then the
    179         * data position for the last sample in the track will be returned.
    180         *
    181         * @return PVMFSuccess if data position is returned for the specified timestamp, PVMFErrInvalidState if the information
    182         * is not available, else PVMFFailure for any other errors
    183         */
    184         virtual PVMFStatus GetDataPositionForTimestamp(PVMFTrackInfo& aTrackInfo, PVMFTimestamp aTimestamp, uint32& aDataPosition) = 0;
    185 };
    186 
    187 #endif // PVMF_TRACK_LEVEL_INFO_EXTENSION_H_INCLUDED
    188 
    189