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 
     19 /**
     20  *  @file pv_return_codes.h
     21  *  @brief This file defines the general return and event codes to be used by PVMF elements.
     22  *         Theses base-level codes are unique. Error codes are negative values and informational
     23  *         codes are positive values.
     24  *  NOTE: If you add any new event, update the PVMFStatusToString method as well.
     25  */
     26 
     27 #ifndef PVMF_RETURN_CODES_H_INCLUDED
     28 #define PVMF_RETURN_CODES_H_INCLUDED
     29 
     30 #ifndef OSCL_BASE_H_INCLUDED
     31 #include "oscl_base.h"
     32 #endif
     33 
     34 
     35 typedef int32 PVMFStatus;
     36 
     37 // Return codes
     38 /*
     39  Return code for general success
     40  */
     41 const PVMFStatus PVMFSuccess = 1;
     42 /*
     43  Return code for pending completion
     44  */
     45 const PVMFStatus PVMFPending = 0;
     46 /*
     47  Return code for never set
     48  */
     49 const PVMFStatus PVMFNotSet = 2;
     50 
     51 
     52 // Error codes (negative values)
     53 
     54 /*
     55  Definition of first error event in range (not an actual error code).
     56  */
     57 const PVMFStatus PVMFErrFirst = (-1);
     58 /*
     59  Return code for general failure
     60  */
     61 const PVMFStatus PVMFFailure = (-1);
     62 /*
     63  Error due to cancellation
     64  */
     65 const PVMFStatus PVMFErrCancelled = (-2);
     66 /*
     67  Error due to no memory being available
     68  */
     69 const PVMFStatus PVMFErrNoMemory = (-3);
     70 /*
     71  Error due to request not being supported
     72  */
     73 const PVMFStatus PVMFErrNotSupported = (-4);
     74 /*
     75  Error due to invalid argument
     76  */
     77 const PVMFStatus PVMFErrArgument = (-5);
     78 /*
     79  Error due to invalid resource handle being specified
     80  */
     81 const PVMFStatus PVMFErrBadHandle = (-6);
     82 /*
     83  Error due to resource already exists and another one cannot be created
     84  */
     85 const PVMFStatus PVMFErrAlreadyExists = (-7);
     86 /*
     87  Error due to resource being busy and request cannot be handled
     88  */
     89 const PVMFStatus PVMFErrBusy = (-8);
     90 /*
     91  Error due to resource not ready to accept request
     92  */
     93 const PVMFStatus PVMFErrNotReady = (-9);
     94 /*
     95  Error due to data corruption being detected
     96  */
     97 const PVMFStatus PVMFErrCorrupt = (-10);
     98 /*
     99  Error due to request timing out
    100  */
    101 const PVMFStatus PVMFErrTimeout = (-11);
    102 /*
    103  Error due to general overflow
    104  */
    105 const PVMFStatus PVMFErrOverflow = (-12);
    106 /*
    107  Error due to general underflow
    108  */
    109 const PVMFStatus PVMFErrUnderflow = (-13);
    110 /*
    111  Error due to resource being in wrong state to handle request
    112  */
    113 const PVMFStatus PVMFErrInvalidState = (-14);
    114 /*
    115  Error due to resource not being available
    116  */
    117 const PVMFStatus PVMFErrNoResources = (-15);
    118 /*
    119  Error due to invalid configuration of resource
    120  */
    121 const PVMFStatus PVMFErrResourceConfiguration = (-16);
    122 /*
    123  Error due to general error in underlying resource
    124  */
    125 const PVMFStatus PVMFErrResource = (-17);
    126 /*
    127  Error due to general data processing
    128  */
    129 const PVMFStatus PVMFErrProcessing = (-18);
    130 /*
    131  Error due to general port processing
    132  */
    133 const PVMFStatus PVMFErrPortProcessing = (-19);
    134 /*
    135  Error due to lack of authorization to access a resource.
    136  */
    137 const PVMFStatus PVMFErrAccessDenied = (-20);
    138 /*
    139  Error due to the lack of a valid license for the content
    140  */
    141 const PVMFStatus PVMFErrLicenseRequired = (-21);
    142 /*
    143  Error due to the lack of a valid license for the content.  However
    144  a preview is available.
    145  */
    146 const PVMFStatus PVMFErrLicenseRequiredPreviewAvailable = (-22);
    147 /*
    148  Error due to the download content length larger than the maximum request size
    149  */
    150 const PVMFStatus PVMFErrContentTooLarge = (-23);
    151 /*
    152  Error due to a maximum number of objects in use
    153  */
    154 const PVMFStatus PVMFErrMaxReached = (-24);
    155 /*
    156  Return code for low disk space
    157  */
    158 const PVMFStatus PVMFLowDiskSpace = (-25);
    159 /*
    160  Error due to the requirement of user-id and password input from app for HTTP basic/digest authentication
    161  */
    162 const PVMFStatus PVMFErrHTTPAuthenticationRequired = (-26);
    163 /*
    164  PVMFMediaClock specific error. Callback has become invalid due to change in direction of NPT clock.
    165 */
    166 const PVMFStatus PVMFErrCallbackHasBecomeInvalid = (-27);
    167 /*
    168  PVMFMediaClock specific error. Callback is called as clock has stopped.
    169 */
    170 const PVMFStatus PVMFErrCallbackClockStopped = (-28);
    171 /*
    172  Error due to missing call for ReleaseMatadataValue() API
    173  */
    174 const PVMFStatus PVMFErrReleaseMetadataValueNotDone = (-29);
    175 /*
    176  Error due to the redirect error
    177 */
    178 const PVMFStatus PVMFErrRedirect = (-30);
    179 /*
    180  Error if a given method or API is not implemented. This is NOT the same as PVMFErrNotSupported.
    181 */
    182 const PVMFStatus PVMFErrNotImplemented = (-31);
    183 /*
    184  Error: the video container is not valid for progressive playback.
    185  */
    186 const PVMFStatus PVMFErrContentInvalidForProgressivePlayback = (-32);
    187 /*
    188  Placeholder for last event in range.
    189  */
    190 const PVMFStatus PVMFErrLast = (-100);
    191 /*
    192  Macro to tell if a value is in PVMFErr range
    193  */
    194 #define IsPVMFErrCode(s) ((PVMFErrLast<=s)&&(s<=PVMFErrFirst))
    195 
    196 // Informational codes (positive values)
    197 
    198 const PVMFStatus PVMFInfoFirst = 10;
    199 
    200 /*
    201  Notification that a port was created
    202  */
    203 const PVMFStatus PVMFInfoPortCreated = 10;
    204 /*
    205  Notification that a port was deleted
    206  */
    207 const PVMFStatus PVMFInfoPortDeleted = 11;
    208 /*
    209  Notification that a port was connected
    210  */
    211 const PVMFStatus PVMFInfoPortConnected = 12;
    212 /*
    213  Notification that a port was disconnected
    214  */
    215 const PVMFStatus PVMFInfoPortDisconnected = 13;
    216 /*
    217  Notification that an overflow occurred (not fatal error)
    218  */
    219 const PVMFStatus PVMFInfoOverflow = 14;
    220 /*
    221  Notification that an underflow occurred (not fatal error)
    222  */
    223 const PVMFStatus PVMFInfoUnderflow = 15;
    224 /*
    225  Notification that a processing failure occurred (not fatal error)
    226  */
    227 const PVMFStatus PVMFInfoProcessingFailure = 16;
    228 /*
    229  Notification that end of data stream has been reached
    230  */
    231 const PVMFStatus PVMFInfoEndOfData = 17;
    232 /*
    233  Notification that a data buffer has been created
    234  */
    235 const PVMFStatus PVMFInfoBufferCreated = 18;
    236 /*
    237  Notification that buffering of data has started
    238  */
    239 const PVMFStatus PVMFInfoBufferingStart = 19;
    240 /*
    241  Notification for data buffering level status
    242  */
    243 const PVMFStatus PVMFInfoBufferingStatus = 20;
    244 /*
    245  Notification that data buffering has completed
    246  */
    247 const PVMFStatus PVMFInfoBufferingComplete = 21;
    248 /*
    249  Notification that data is ready for use
    250  */
    251 const PVMFStatus PVMFInfoDataReady = 22;
    252 /*
    253  Notification for position status
    254  */
    255 const PVMFStatus PVMFInfoPositionStatus = 23;
    256 /*
    257  Notification for node state change
    258  */
    259 const PVMFStatus PVMFInfoStateChanged = 24;
    260 /*
    261  Notification that data was discarded during synchronization.
    262  */
    263 const PVMFStatus PVMFInfoDataDiscarded = 25;
    264 /*
    265  Notification that error handling has started
    266  */
    267 const PVMFStatus PVMFInfoErrorHandlingStart = 26;
    268 /*
    269  Notification that error handling has completed
    270  */
    271 const PVMFStatus PVMFInfoErrorHandlingComplete = 27;
    272 /*
    273  Notification from a remote source
    274  */
    275 const PVMFStatus PVMFInfoRemoteSourceNotification = 28;
    276 /*
    277  Notification that license acquisition has started.
    278  */
    279 const PVMFStatus PVMFInfoLicenseAcquisitionStarted = 29;
    280 /*
    281  Notification that download content length is available
    282  */
    283 const PVMFStatus PVMFInfoContentLength = 30;
    284 /*
    285  Notification that downloaded content reaches the maximum request size, and will
    286  be truncated, especially for the case of unavailable content length
    287  */
    288 const PVMFStatus PVMFInfoContentTruncated = 31;
    289 /*
    290  Notification that source format is not supported, typically sent
    291  during protocol rollover
    292  */
    293 const PVMFStatus PVMFInfoSourceFormatNotSupported = 32;
    294 /*
    295  Notification that a clip transition has occurred while playing a playlist
    296  */
    297 const PVMFStatus PVMFInfoPlayListClipTransition = 33;
    298 /*
    299  Notification that content type for download or HTTP streaming is available
    300  */
    301 const PVMFStatus PVMFInfoContentType = 34;
    302 /*
    303  Notification that paticular track is disable. This one is on a per track basis.
    304  */
    305 const PVMFStatus PVMFInfoTrackDisable = 35;
    306 /*
    307  Notification that unexpected data has been obtained, especially for download,
    308  when client receives from server more data than requested in content-length header
    309  */
    310 const PVMFStatus PVMFInfoUnexpectedData = 36;
    311 /*
    312  Notification that server discnnect happens after download is complete
    313  */
    314 const PVMFStatus PVMFInfoSessionDisconnect = 37;
    315 /*
    316  Notification that new meadi stream has been started
    317  */
    318 const PVMFStatus PVMFInfoStartOfData = 38;
    319 /*
    320  Notification that node has processed a command with ReportObserver marker info
    321  */
    322 const PVMFStatus PVMFInfoReportObserverRecieved = 39;
    323 /*
    324  Notification that meta data is available with source node
    325  */
    326 const PVMFStatus PVMFInfoMetadataAvailable = 40;
    327 /*
    328  Notification that duration is available with source node
    329  */
    330 const PVMFStatus PVMFInfoDurationAvailable = 41;
    331 /*
    332  Notification that Change Position request not supported
    333  */
    334 const PVMFStatus PVMFInfoChangePlaybackPositionNotSupported = 42;
    335 /*
    336  Notification that the content is poorly inter-leaved
    337  */
    338 const PVMFStatus PVMFInfoPoorlyInterleavedContent = 43;
    339 /*
    340  Notification for actual playback position after repositioning
    341  */
    342 const PVMFStatus PVMFInfoActualPlaybackPosition = 44;
    343 /*
    344  Notification that the live buffer is empty
    345  */
    346 const PVMFStatus PVMFInfoLiveBufferEmpty = 45;
    347 /*
    348  Notification that a server has responded with 200 OK to a Playlist play request
    349  */
    350 const PVMFStatus PVMFInfoPlayListSwitch = 46;
    351 /*
    352  Notification of configuration complete
    353  */
    354 const PVMFStatus PVMFMIOConfigurationComplete = 47;
    355 /*
    356  Notification that the video track is falling behind
    357  */
    358 const PVMFStatus PVMFInfoVideoTrackFallingBehind = 48;
    359 /*
    360  Notification that memory is not available for new RTP packets
    361  */
    362 const PVMFStatus PVMFInfoSourceOverflow = 49;
    363 /*
    364  Notification for Media data length in shoutcast session
    365  */
    366 const PVMFStatus PVMFInfoShoutcastMediaDataLength = 50;
    367 /*
    368  Notification for clip bitrate in shoutcast session
    369  */
    370 const PVMFStatus PVMFInfoShoutcastClipBitrate = 51;
    371 /*
    372  Notification for shoutcast session
    373  */
    374 const PVMFStatus PVMFInfoIsShoutcastSesssion = 52;
    375 /*
    376  Placeholder for end of range
    377  */
    378 const PVMFStatus PVMFInfoLast = 100;
    379 /*
    380  Macro to tell if a code is in PVMFInfo range
    381  */
    382 #define IsPVMFInfoCode(s) ((PVMFInfoFirst<=s)&&(s<=PVMFInfoLast))
    383 
    384 // Convert a PVMFStatus code to a string that can be used in logs.
    385 // @param status code.
    386 // @return a human readable string representing the status.
    387 OSCL_IMPORT_REF const char *PVMFStatusToString(const PVMFStatus status);
    388 
    389 #endif
    390