Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartatz committed Aug 29, 2024
1 parent 50dcf63 commit 8eb1904
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 131 deletions.
2 changes: 2 additions & 0 deletions src/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const char* m3u8err_getmessage(const int code) {
return "No URI specified";
case M3U8ERR_CLI_USER_INTERRUPTED:
return "User interrupted";
case M3U8ERR_CURLE_GET_INFO_FAILURE:
return "Could not get information about the cURL handler";
case M3U8ERR_CURLM_ADD_FAILURE:
return "Could not add the cURL handler to cURL multi";
case M3U8ERR_CURLM_INIT_FAILURE:
Expand Down
182 changes: 92 additions & 90 deletions src/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,96 +49,98 @@
#define M3U8ERR_CLI_URI_MISSING -41 /* No URI specified */
#define M3U8ERR_CLI_USER_INTERRUPTED -42 /* User interrupted */

#define M3U8ERR_CURLM_ADD_FAILURE -43 /* Could not add the cURL handler to cURL multi */
#define M3U8ERR_CURLM_INIT_FAILURE -44 /* Could not initialize the cURL multi interface */
#define M3U8ERR_CURLM_PERFORM_FAILURE -45 /* Could not perform on cURL multi */
#define M3U8ERR_CURLM_POLL_FAILURE -46 /* Could not poll on cURL multi */
#define M3U8ERR_CURLM_REMOVE_FAILURE -47 /* Could not remove the cURL handler from cURL multi */
#define M3U8ERR_CURLM_SETOPT_FAILURE -48 /* Could not set options on cURL multi */

#define M3U8ERR_CURLSH_INIT_FAILURE -49 /* Could not initialize the cURL Share interface */
#define M3U8ERR_CURLSH_SETOPT_FAILURE -50 /* Could not set options on Share HTTP client */

#define M3U8ERR_CURLU_INIT_FAILURE -51 /* Could not initialize the cURL URL interface */
#define M3U8ERR_CURLU_URL_GET_FAILURE -52 /* Could not get URL from this cURL URL interface */
#define M3U8ERR_CURLU_URL_SET_FAILURE -53 /* Could not set URL for this cURL URL interface */

#define M3U8ERR_CURL_INIT_FAILURE -54 /* Could not initialize the HTTP client due to an unexpected error */
#define M3U8ERR_CURL_REQUEST_FAILURE -55 /* HTTP request failure */
#define M3U8ERR_CURL_SETOPT_FAILURE -56 /* Could not set options on HTTP client */
#define M3U8ERR_CURL_SLIST_FAILURE -57 /* Could not append item to list */

#define M3U8ERR_DOWNLOAD_COULD_NOT_CREATE_TMPDIR -58 /* Could not create the temporary directory */
#define M3U8ERR_DOWNLOAD_COULD_NOT_MOVE_FILE -59 /* Could not move file to specified location */
#define M3U8ERR_DOWNLOAD_NO_TMPDIR -60 /* Could not find a suitable directory for storing temporary files */

#define M3U8ERR_EXPAND_FILENAME_FAILURE -61 /* Could not resolve filename */

#define M3U8ERR_FFMPEG_COMMAND_NOT_FOUND -62 /* Could locate the FFmpeg executable */
#define M3U8ERR_FFMPEG_MUXING_FAILURE -63 /* Could not mux media streams */

#define M3U8ERR_FSTREAM_LOCK_FAILURE -64 /* Could not lock file */
#define M3U8ERR_FSTREAM_OPEN_FAILURE -65 /* Could not open file */
#define M3U8ERR_FSTREAM_READ_EMPTY_FILE -66 /* Tried to read contents from an empty file */
#define M3U8ERR_FSTREAM_READ_FAILURE -67 /* Could not read data from file */
#define M3U8ERR_FSTREAM_SEEK_FAILURE -68 /* Could not seek file */
#define M3U8ERR_FSTREAM_TELL_FAILURE -69 /* Could not get current file position */
#define M3U8ERR_FSTREAM_WRITE_FAILURE -70 /* Could not write data to file */

#define M3U8ERR_GET_APP_FILENAME_FAILURE -71 /* Could not get app filename */

#define M3U8ERR_ITEM_EMPTY -72 /* This M3U8 tag must not contain empty items */
#define M3U8ERR_ITEM_INVALID_BRANGE -73 /* The value of this M3U8 item is not a valid byte range */
#define M3U8ERR_ITEM_INVALID_DTIME -74 /* The value of this M3U8 item is not a valid ISO/IEC 8601:2004 date/time representation */
#define M3U8ERR_ITEM_INVALID_ESTRING -75 /* The value of this M3U8 item is not a valid enumerated string */
#define M3U8ERR_ITEM_INVALID_UFLOAT -76 /* The value of this M3U8 attribute is not a valid decimal floating point number */
#define M3U8ERR_ITEM_INVALID_UINT -77 /* The value of this M3U8 attribute is not a valid decimal integer */
#define M3U8ERR_ITEM_INVALID_USTRING -78 /* The value of this M3U8 item is not a valid unquoted string */
#define M3U8ERR_ITEM_MISSING -79 /* This M3U8 tag is missing a required M3U8 item */
#define M3U8ERR_ITEM_VALUE_INVALID -80 /* The value of this M3U8 item is invalid or was not recognized */
#define M3U8ERR_ITEM_VALUE_TOO_LONG -81 /* The value of this M3U8 item is too long */

#define M3U8ERR_LOAD_UNSUPPORTED_URI -82 /* Could not load M3U8 playlist from this URI; this protocol is not supported or was not recognized */

#define M3U8ERR_MEDIA_NO_MATCHING_AUDIO -83 /* Could not find any audio stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_CLOSED_CAPTIONS -84 /* Could not find any closed-captions stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_SUBTITLES -85 /* Could not find any subtitle stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_VIDEO -86 /* Could not find any video stream matching this variant stream */
#define M3U8ERR_MEDIA_PLAYLIST_NO_SEGMENTS -87 /* This M3U8 playlist has no media segments */
#define M3U8ERR_MEDIA_UNEXPECTED_CC -88 /* This Variant Stream must not have a CLOSED-CAPTIONS attribute whose value is anything other than NONE */

#define M3U8ERR_MEMORY_ALLOCATE_FAILURE -89 /* Could not allocate memory */

#define M3U8ERR_PARSER_INVALID_BRANGE -90 /* Could not parse this string as a byte range */
#define M3U8ERR_PARSER_INVALID_DTIME -91 /* Could not parse this string as an ISO/IEC 8601:2004 date/time representation */
#define M3U8ERR_PARSER_INVALID_ESTRING -92 /* Could not parse this string as an enumerated string */
#define M3U8ERR_PARSER_INVALID_FLOAT -93 /* Could not parse this string as a signed decimal floating point number */
#define M3U8ERR_PARSER_INVALID_HEXSEQ -94 /* Could not parse this string as an hexadecimal sequence */
#define M3U8ERR_PARSER_INVALID_QSTRING -95 /* Could not parse this string as a quoted string */
#define M3U8ERR_PARSER_INVALID_RESOLUTION -96 /* Could not parse this string as a decimal resolution */
#define M3U8ERR_PARSER_INVALID_UFLOAT -97 /* Could not parse this string as a decimal floating point number */
#define M3U8ERR_PARSER_INVALID_UINT -98 /* Could not parse this string as a decimal integer */
#define M3U8ERR_PARSER_INVALID_USTRING -99 /* Could not parse this string as an unquoted string */

#define M3U8ERR_PLAYLIST_LINE_TOO_LONG -100 /* This M3U8 playlist contains a line that is too long */
#define M3U8ERR_PLAYLIST_LINE_UNTERMINATED -101 /* This M3U8 playlist contains a line that was not terminated */
#define M3U8ERR_PLAYLIST_MISSING_TAG -102 /* This M3U8 playlist is missing a required M3U8 tag */
#define M3U8ERR_PLAYLIST_TOO_LARGE -103 /* This M3U8 playlist exceeds the maximum allowed size */
#define M3U8ERR_PLAYLIST_UNEXPECTED_ITEM -104 /* Encountered an unexpected item on the first line of the playlist */
#define M3U8ERR_PLAYLIST_UNEXPECTED_TAG -105 /* Encountered an unexpected playlist tag */
#define M3U8ERR_PLAYLIST_UNEXPECTED_URI -106 /* This M3U8 tag does not expect any URI to be supplied, but a URI was encountered */
#define M3U8ERR_PLAYLIST_UNKNOWN_TYPE -107 /* Could not determine the type of this M3U8 playlist */
#define M3U8ERR_PLAYLIST_WRONG_TAG_POSITION -108 /* This M3U8 playlist contains a M3U8 tag that is not in the expected position */

#define M3U8ERR_PRINTF_WRITE_FAILURE -109 /* Could not format string using snprintf */

#define M3U8ERR_TAG_DUPLICATE -110 /* This M3U8 tag cannot be specified multiple times in the same playlist */
#define M3U8ERR_TAG_MISSING_ATTRIBUTES -111 /* This M3U8 tag requires a list of attributes to be supplied */
#define M3U8ERR_TAG_MISSING_ITEMS -112 /* This M3U8 tag requires a list of items to be supplied */
#define M3U8ERR_TAG_MISSING_VALUE -113 /* This M3U8 tag requires a single-value option to be supplied */
#define M3U8ERR_TAG_NAME_INVALID -114 /* The name of this M3U8 tag is invalid or was not recognized */
#define M3U8ERR_TAG_NON_MATCHING_ATTRIBUTES -115 /* The attributes of this M3U8 tag do not match those of the other M3U8 tag with the same ID */
#define M3U8ERR_TAG_TRAILING_OPTIONS -116 /* This M3U8 tag does not require any value to be supplied, but trailing options were found */
#define M3U8ERR_CURLE_GET_INFO_FAILURE -43 /* Could not get information about the cURL handler */

#define M3U8ERR_CURLM_ADD_FAILURE -44 /* Could not add the cURL handler to cURL multi */
#define M3U8ERR_CURLM_INIT_FAILURE -45 /* Could not initialize the cURL multi interface */
#define M3U8ERR_CURLM_PERFORM_FAILURE -46 /* Could not perform on cURL multi */
#define M3U8ERR_CURLM_POLL_FAILURE -47 /* Could not poll on cURL multi */
#define M3U8ERR_CURLM_REMOVE_FAILURE -48 /* Could not remove the cURL handler from cURL multi */
#define M3U8ERR_CURLM_SETOPT_FAILURE -49 /* Could not set options on cURL multi */

#define M3U8ERR_CURLSH_INIT_FAILURE -50 /* Could not initialize the cURL Share interface */
#define M3U8ERR_CURLSH_SETOPT_FAILURE -51 /* Could not set options on Share HTTP client */

#define M3U8ERR_CURLU_INIT_FAILURE -52 /* Could not initialize the cURL URL interface */
#define M3U8ERR_CURLU_URL_GET_FAILURE -53 /* Could not get URL from this cURL URL interface */
#define M3U8ERR_CURLU_URL_SET_FAILURE -54 /* Could not set URL for this cURL URL interface */

#define M3U8ERR_CURL_INIT_FAILURE -55 /* Could not initialize the HTTP client due to an unexpected error */
#define M3U8ERR_CURL_REQUEST_FAILURE -56 /* HTTP request failure */
#define M3U8ERR_CURL_SETOPT_FAILURE -57 /* Could not set options on HTTP client */
#define M3U8ERR_CURL_SLIST_FAILURE -58 /* Could not append item to list */

#define M3U8ERR_DOWNLOAD_COULD_NOT_CREATE_TMPDIR -59 /* Could not create the temporary directory */
#define M3U8ERR_DOWNLOAD_COULD_NOT_MOVE_FILE -60 /* Could not move file to specified location */
#define M3U8ERR_DOWNLOAD_NO_TMPDIR -61 /* Could not find a suitable directory for storing temporary files */

#define M3U8ERR_EXPAND_FILENAME_FAILURE -62 /* Could not resolve filename */

#define M3U8ERR_FFMPEG_COMMAND_NOT_FOUND -63 /* Could locate the FFmpeg executable */
#define M3U8ERR_FFMPEG_MUXING_FAILURE -64 /* Could not mux media streams */

#define M3U8ERR_FSTREAM_LOCK_FAILURE -65 /* Could not lock file */
#define M3U8ERR_FSTREAM_OPEN_FAILURE -66 /* Could not open file */
#define M3U8ERR_FSTREAM_READ_EMPTY_FILE -67 /* Tried to read contents from an empty file */
#define M3U8ERR_FSTREAM_READ_FAILURE -68 /* Could not read data from file */
#define M3U8ERR_FSTREAM_SEEK_FAILURE -69 /* Could not seek file */
#define M3U8ERR_FSTREAM_TELL_FAILURE -70 /* Could not get current file position */
#define M3U8ERR_FSTREAM_WRITE_FAILURE -71 /* Could not write data to file */

#define M3U8ERR_GET_APP_FILENAME_FAILURE -72 /* Could not get app filename */

#define M3U8ERR_ITEM_EMPTY -73 /* This M3U8 tag must not contain empty items */
#define M3U8ERR_ITEM_INVALID_BRANGE -74 /* The value of this M3U8 item is not a valid byte range */
#define M3U8ERR_ITEM_INVALID_DTIME -75 /* The value of this M3U8 item is not a valid ISO/IEC 8601:2004 date/time representation */
#define M3U8ERR_ITEM_INVALID_ESTRING -76 /* The value of this M3U8 item is not a valid enumerated string */
#define M3U8ERR_ITEM_INVALID_UFLOAT -77 /* The value of this M3U8 attribute is not a valid decimal floating point number */
#define M3U8ERR_ITEM_INVALID_UINT -78 /* The value of this M3U8 attribute is not a valid decimal integer */
#define M3U8ERR_ITEM_INVALID_USTRING -79 /* The value of this M3U8 item is not a valid unquoted string */
#define M3U8ERR_ITEM_MISSING -80 /* This M3U8 tag is missing a required M3U8 item */
#define M3U8ERR_ITEM_VALUE_INVALID -81 /* The value of this M3U8 item is invalid or was not recognized */
#define M3U8ERR_ITEM_VALUE_TOO_LONG -82 /* The value of this M3U8 item is too long */

#define M3U8ERR_LOAD_UNSUPPORTED_URI -83 /* Could not load M3U8 playlist from this URI; this protocol is not supported or was not recognized */

#define M3U8ERR_MEDIA_NO_MATCHING_AUDIO -84 /* Could not find any audio stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_CLOSED_CAPTIONS -85 /* Could not find any closed-captions stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_SUBTITLES -86 /* Could not find any subtitle stream matching this variant stream */
#define M3U8ERR_MEDIA_NO_MATCHING_VIDEO -87 /* Could not find any video stream matching this variant stream */
#define M3U8ERR_MEDIA_PLAYLIST_NO_SEGMENTS -88 /* This M3U8 playlist has no media segments */
#define M3U8ERR_MEDIA_UNEXPECTED_CC -89 /* This Variant Stream must not have a CLOSED-CAPTIONS attribute whose value is anything other than NONE */

#define M3U8ERR_MEMORY_ALLOCATE_FAILURE -90 /* Could not allocate memory */

#define M3U8ERR_PARSER_INVALID_BRANGE -91 /* Could not parse this string as a byte range */
#define M3U8ERR_PARSER_INVALID_DTIME -92 /* Could not parse this string as an ISO/IEC 8601:2004 date/time representation */
#define M3U8ERR_PARSER_INVALID_ESTRING -93 /* Could not parse this string as an enumerated string */
#define M3U8ERR_PARSER_INVALID_FLOAT -94 /* Could not parse this string as a signed decimal floating point number */
#define M3U8ERR_PARSER_INVALID_HEXSEQ -95 /* Could not parse this string as an hexadecimal sequence */
#define M3U8ERR_PARSER_INVALID_QSTRING -96 /* Could not parse this string as a quoted string */
#define M3U8ERR_PARSER_INVALID_RESOLUTION -97 /* Could not parse this string as a decimal resolution */
#define M3U8ERR_PARSER_INVALID_UFLOAT -98 /* Could not parse this string as a decimal floating point number */
#define M3U8ERR_PARSER_INVALID_UINT -99 /* Could not parse this string as a decimal integer */
#define M3U8ERR_PARSER_INVALID_USTRING -100 /* Could not parse this string as an unquoted string */

#define M3U8ERR_PLAYLIST_LINE_TOO_LONG -101 /* This M3U8 playlist contains a line that is too long */
#define M3U8ERR_PLAYLIST_LINE_UNTERMINATED -102 /* This M3U8 playlist contains a line that was not terminated */
#define M3U8ERR_PLAYLIST_MISSING_TAG -103 /* This M3U8 playlist is missing a required M3U8 tag */
#define M3U8ERR_PLAYLIST_TOO_LARGE -104 /* This M3U8 playlist exceeds the maximum allowed size */
#define M3U8ERR_PLAYLIST_UNEXPECTED_ITEM -105 /* Encountered an unexpected item on the first line of the playlist */
#define M3U8ERR_PLAYLIST_UNEXPECTED_TAG -106 /* Encountered an unexpected playlist tag */
#define M3U8ERR_PLAYLIST_UNEXPECTED_URI -107 /* This M3U8 tag does not expect any URI to be supplied, but a URI was encountered */
#define M3U8ERR_PLAYLIST_UNKNOWN_TYPE -108 /* Could not determine the type of this M3U8 playlist */
#define M3U8ERR_PLAYLIST_WRONG_TAG_POSITION -109 /* This M3U8 playlist contains a M3U8 tag that is not in the expected position */

#define M3U8ERR_PRINTF_WRITE_FAILURE -110 /* Could not format string using snprintf */

#define M3U8ERR_TAG_DUPLICATE -111 /* This M3U8 tag cannot be specified multiple times in the same playlist */
#define M3U8ERR_TAG_MISSING_ATTRIBUTES -112 /* This M3U8 tag requires a list of attributes to be supplied */
#define M3U8ERR_TAG_MISSING_ITEMS -113 /* This M3U8 tag requires a list of items to be supplied */
#define M3U8ERR_TAG_MISSING_VALUE -114 /* This M3U8 tag requires a single-value option to be supplied */
#define M3U8ERR_TAG_NAME_INVALID -115 /* The name of this M3U8 tag is invalid or was not recognized */
#define M3U8ERR_TAG_NON_MATCHING_ATTRIBUTES -116 /* The attributes of this M3U8 tag do not match those of the other M3U8 tag with the same ID */
#define M3U8ERR_TAG_TRAILING_OPTIONS -117 /* This M3U8 tag does not require any value to be supplied, but trailing options were found */

const char* m3u8err_getmessage(const int code);

Expand Down
Loading

0 comments on commit 8eb1904

Please sign in to comment.