author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 14 Dec 2018 01:40:13 +0100 | |
changeset 14444 | d084fc76c566 |
parent 7813 | 7ac83d79b897 |
permissions | -rw-r--r-- |
7813
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
1 |
/* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
2 |
* This file is part of Libav. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
3 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
4 |
* Libav is free software; you can redistribute it and/or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
5 |
* modify it under the terms of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
6 |
* License as published by the Free Software Foundation; either |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
7 |
* version 2.1 of the License, or (at your option) any later version. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
8 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
9 |
* Libav is distributed in the hope that it will be useful, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
12 |
* Lesser General Public License for more details. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
13 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
15 |
* License along with Libav; if not, write to the Free Software |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
17 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
18 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
19 |
#ifndef AVUTIL_PARSEUTILS_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
20 |
#define AVUTIL_PARSEUTILS_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
21 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
22 |
#include <time.h> |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
23 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
24 |
#include "rational.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
25 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
26 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
27 |
* @file |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
28 |
* misc parsing utilities |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
29 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
30 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
31 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
32 |
* Parse str and put in width_ptr and height_ptr the detected values. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
33 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
34 |
* @param[in,out] width_ptr pointer to the variable which will contain the detected |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
35 |
* width value |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
36 |
* @param[in,out] height_ptr pointer to the variable which will contain the detected |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
37 |
* height value |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
38 |
* @param[in] str the string to parse: it has to be a string in the format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
39 |
* width x height or a valid video size abbreviation. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
40 |
* @return >= 0 on success, a negative error code otherwise |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
41 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
42 |
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
43 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
44 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
45 |
* Parse str and store the detected values in *rate. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
46 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
47 |
* @param[in,out] rate pointer to the AVRational which will contain the detected |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
48 |
* frame rate |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
49 |
* @param[in] str the string to parse: it has to be a string in the format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
50 |
* rate_num / rate_den, a float number or a valid video rate abbreviation |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
51 |
* @return >= 0 on success, a negative error code otherwise |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
52 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
53 |
int av_parse_video_rate(AVRational *rate, const char *str); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
54 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
55 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
56 |
* Put the RGBA values that correspond to color_string in rgba_color. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
57 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
58 |
* @param color_string a string specifying a color. It can be the name of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
59 |
* a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
60 |
* possibly followed by "@" and a string representing the alpha |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
61 |
* component. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
62 |
* The alpha component may be a string composed by "0x" followed by an |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
63 |
* hexadecimal number or a decimal number between 0.0 and 1.0, which |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
64 |
* represents the opacity value (0x00/0.0 means completely transparent, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
65 |
* 0xff/1.0 completely opaque). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
66 |
* If the alpha component is not specified then 0xff is assumed. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
67 |
* The string "random" will result in a random color. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
68 |
* @param slen length of the initial part of color_string containing the |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
69 |
* color. It can be set to -1 if color_string is a null terminated string |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
70 |
* containing nothing else than the color. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
71 |
* @return >= 0 in case of success, a negative value in case of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
72 |
* failure (for example if color_string cannot be parsed). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
73 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
74 |
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
75 |
void *log_ctx); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
76 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
77 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
78 |
* Parse timestr and return in *time a corresponding number of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
79 |
* microseconds. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
80 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
81 |
* @param timeval puts here the number of microseconds corresponding |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
82 |
* to the string in timestr. If the string represents a duration, it |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
83 |
* is the number of microseconds contained in the time interval. If |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
84 |
* the string is a date, is the number of microseconds since 1st of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
85 |
* January, 1970 up to the time of the parsed date. If timestr cannot |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
86 |
* be successfully parsed, set *time to INT64_MIN. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
87 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
88 |
* @param timestr a string representing a date or a duration. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
89 |
* - If a date the syntax is: |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
90 |
* @code |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
91 |
* [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
92 |
* now |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
93 |
* @endcode |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
94 |
* If the value is "now" it takes the current time. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
95 |
* Time is local time unless Z is appended, in which case it is |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
96 |
* interpreted as UTC. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
97 |
* If the year-month-day part is not specified it takes the current |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
98 |
* year-month-day. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
99 |
* - If a duration the syntax is: |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
100 |
* @code |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
101 |
* [-]HH[:MM[:SS[.m...]]] |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
102 |
* [-]S+[.m...] |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
103 |
* @endcode |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
104 |
* @param duration flag which tells how to interpret timestr, if not |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
105 |
* zero timestr is interpreted as a duration, otherwise as a date |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
106 |
* @return 0 in case of success, a negative value corresponding to an |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
107 |
* AVERROR code otherwise |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
108 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
109 |
int av_parse_time(int64_t *timeval, const char *timestr, int duration); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
110 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
111 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
112 |
* Attempt to find a specific tag in a URL. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
113 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
114 |
* syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
115 |
* Return 1 if found. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
116 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
117 |
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
118 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
119 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
120 |
* Convert the decomposed UTC time in tm to a time_t value. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
121 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
122 |
time_t av_timegm(struct tm *tm); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
123 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
124 |
#endif /* AVUTIL_PARSEUTILS_H */ |