Commit Graph

54 Commits

Author SHA1 Message Date
Stefano Sabatini
0f6bf94eb7 avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil
Base escaping only escapes values required for base character data
according to part 2.4 of XML, and if additional flags are added
single and double quotes can additionally be escaped in order
to handle single and double quoted attributes.

Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Nicolas George
06f2651204 lavu/avstring: deprecate av_d2str().
It is no longer used in our code base and does not seem
to be used much in other projects.
2020-08-21 11:01:39 +02:00
Limin Wang
a77fb510c2 avutil/avstring: support input path as a null pointer or empty string
Linux and OSX systems support basename and dirname via <libgen.h>, I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.

You can get more description about the system interface by below command:
 "man 3 basename"

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:43 +08:00
Paul B Mahol
4b30726dd3 lavu: add locale-independent sscanf implementation
Copied and adopted from musl implementation.
 * converted all 'long double' to 'double'
 * removed %m support
2018-11-16 20:24:52 +01:00
Steven Liu
44cd7502c7 avutil/avstring: improve av_strreplace implement
Use AVBprint to implement av_strreplace
add av_strreplace test case TEST_STRREPLACE

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-11 10:54:35 +08:00
Steven Liu
99e5d81ef9 avutil/avstring: add av_strreplace API into avstring
refer to: http://creativeandcritical.net/str-replace-c
add av_strreplace API for replace string operations.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-01 10:55:04 +08:00
Lou Logan
06eef96b69 fix some a/an typos
Signed-off-by: Lou Logan <lou@lrcd.com>
2016-03-28 14:13:17 -08:00
Michael Niedermayer
a9b81bfd1c avutil/avstring: add a "ALL" entry and the possibility to negate matches to av_match_name()
This will extend the whitelist features to allow blacklisting individual protocols and to
explicitly force everything to be enabled.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-13 16:40:11 +01:00
Ganesh Ajjanagadde
a0e390e8ff avutil/avstring: add av_warn_unused_result
This does not trigger any warnings, but adds robustness.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-27 23:16:09 -04:00
Henrik Gramner
ad9a543e93 avutil/avstring: Inline some tiny functions
They're short enough that inlining them actually reduces code size due to
all the overhead associated with making a function call.
2015-09-26 22:08:02 +02:00
Rodger Combs
8e924629eb lavu/avstring: switch AV_ESCAPE_FLAGs to shift-based formatting
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-15 00:00:57 +02:00
Lukasz Marek
31886968d3 lavu/avstring: add av_append_path_component() funcion
Convinient function to build paths.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-31 23:50:46 +02:00
Michael Niedermayer
ed736890d6 Merge commit '4981baf9b803f3c4866b2e97fdadb008c62dc7ad'
* commit '4981baf9b803f3c4866b2e97fdadb008c62dc7ad':
  avstring: Mark some character handling functions av_const

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-07 22:33:09 +01:00
Henrik Gramner
4981baf9b8 avstring: Mark some character handling functions av_const
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 11:57:16 +02:00
Michael Niedermayer
0d92b0d5f4 avutil/avstring: Factor av_match_list() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-02 18:51:05 +02:00
Michael Niedermayer
31e0b5d3cb Merge commit '69e7336b8e16ee65226fc20381baf537f4b125e6'
* commit '69e7336b8e16ee65226fc20381baf537f4b125e6':
  avstring: Expose the simple name match function

Conflicts:
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-29 20:24:42 +02:00
Luca Barbato
69e7336b8e avstring: Expose the simple name match function
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-07-29 17:46:29 +02:00
Michael Niedermayer
911676c643 avutil/avstring: add av_strnlen()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-22 22:25:15 +01:00
Stefano Sabatini
68590650f0 lavu/avstring: add av_utf8_decode() function 2013-11-22 16:51:05 +01:00
Michael Niedermayer
6c17ff84ad Merge commit 'efa7f4202088c70caba11d7834641bc6eaf41830'
* commit 'efa7f4202088c70caba11d7834641bc6eaf41830':
  Use the avstring.h locale-independent character type functions
  avstring: Add locale independent versions of some ctype.h functions

Conflicts:
	avprobe.c
	doc/APIchanges
	libavcodec/dvdsubdec.c
	libavcodec/utils.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/eval.c
	libavutil/parseutils.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 14:57:41 +01:00
Reimar Döffinger
12c5c1d3e3 avstring: Add locale independent versions of some ctype.h functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:26 +02:00
Stefano Sabatini
9767ec6b86 lavu: add escape API
The escape API will be useful to perform escaping programmatically, which
is required when crafting argument strings, and will be used for context
printing as well.

This is based on the ffescape tool code, with a few extensions and fixes.
2013-03-07 01:12:04 +01:00
Reimar Döffinger
88d55b827d Remove incorrect use of ctype.h functions.
As far as I can tell the code should not change behaviour
depending on locale in any of these places.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-03-03 21:44:10 +01:00
Michael Niedermayer
25be63005f Merge commit 'b85a5e87af4254b80913fe33591d96361f30832b'
* commit 'b85a5e87af4254b80913fe33591d96361f30832b':
  lavu: Add av_strnstr()
  h264: Allow discarding the cropping information from SPS

Conflicts:
	Changelog
	doc/APIchanges
	libavcodec/avcodec.h
	libavcodec/version.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-25 14:36:45 +01:00
Vladimir Pantelic
b85a5e87af lavu: Add av_strnstr()
This is a length limited version of strstr()

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-25 10:47:51 +01:00
Michael Niedermayer
2ce43b37fc Merge commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405'
* commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405':
  hlsenc: check append_entry return value
  hlsenc: use the basename to generate the list entries
  avstring: add av_basename and av_dirname

Conflicts:
	Changelog
	doc/APIchanges
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 13:54:50 +01:00
Luca Barbato
d8fd06c37d avstring: add av_basename and av_dirname
Thread safe version of the common basename and dirname.
2012-12-29 17:26:22 +01:00
Michael Niedermayer
8bc7fe4daf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doxygen: misc consistency, spelling and wording fixes
  vcr1: drop unnecessary emms_c() calls without MMX code
  Replace all uses of av_close_input_file() with avformat_close_input().
  lavf: add avformat_close_input().
  lavf: deprecate av_close_input_stream().
  lavf doxy: add some basic demuxing documentation.
  lavf doxy: add some general lavf information.
  lavf doxy: add misc utility functions to a group.
  lavf doxy: add av_guess_codec/format to the encoding group.
  lavf doxy: add core functions to a doxy group.
  Add basic libavdevice documentation.
  lavc: convert error_recognition to err_recognition.
  avconv: update -map option help text
  x86: Require 7 registers for the cabac asm
  x86: bswap: remove test for bswap instruction
  bswap: make generic implementation more compiler-friendly
  h264: remove useless cast
  proresdec: fix decode_slice() prototype

Conflicts:
	configure
	doc/APIchanges
	ffprobe.c
	libavcodec/avcodec.h
	libavcodec/celp_math.h
	libavcodec/h264.c
	libavfilter/src_movie.c
	libavformat/anm.c
	libavformat/avformat.h
	libavformat/version.h
	libavutil/avstring.h
	libavutil/bswap.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-13 00:39:48 +01:00
Diego Biurrun
58c42af722 doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01:00
Michael Niedermayer
0b9a69f244 Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  aacdec: Fix PS in ADTS.
  avconv: Consistently use PIX_FMT_NONE.
  dsputil: use cpuflags in x86 emu_edge_core
  dsputil: use movups instead of movdqu in ff_emu_edge_core_sse()
  wma: initialize prev_block_len_bits, next_block_len_bits, and block_len_bits.
  mov: Remove some redundant and obsolete comments.
  Add libavutil/mathematics.h #includes for INFINITY
  doxy: structure libavformat groups
  doxy: introduce an empty structure in libavcodec
  doxy: provide a start page and document libavutil
  doxy: cleanup pixfmt.h
  regtest: split video encode/decode tests into individual targets
  ARM: add explicit .arch and .fpu directives to asm.S
  pthread: do not touch has_b_frames
  avconv: cleanup the transcoding loop in output_packet().
  avconv: split subtitle transcoding out of output_packet().
  avconv: split video transcoding out of output_packet().
  avconv: split audio transcoding out of output_packet().
  avconv: reindent.
  avconv: move streamcopy-only code out of decoding loop.
  ...

Conflicts:
	avconv.c
	libavcodec/aaccoder.c
	libavcodec/pthread.c
	libavcodec/version.h
	libavutil/audioconvert.h
	libavutil/avutil.h
	libavutil/mem.h
	tests/ref/vsynth1/dv
	tests/ref/vsynth1/mpeg2thread
	tests/ref/vsynth2/dv
	tests/ref/vsynth2/mpeg2thread

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-23 04:02:17 +01:00
Luca Barbato
757cd8d876 doxy: provide a start page and document libavutil
Introduce a basic layout, the subpages are currently left empty.

Split libavutil in multiple groups as example of the structure
2011-11-22 17:16:02 +01:00
Michael Niedermayer
13b7781ec8 Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
  x86inc: use sse versions of common macros instead of sse2 when applicable
  doc/APIchanges: add missing dates and hashes
  lavf: don't return from void av_update_cur_dts()
  Changelog: add more entries.
  Changelog: update ffmpeg/avconv incompatibility list.
  avconv: remove some redundant temporary variables.
  avconv: fix broken indentation
  avconv: move copy_initial_nonkeyframes to the options context.
  avconv: use file:stream instead of file.stream in log messages.
  doc/avconv: elaborate on basic functionality.
  doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
  openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
  Call avformat_network_init/deinit in the programs
  Remove leftover includes of strings.h
  avutil: Don't allow using strcasecmp/strncasecmp
  Replace all usage of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of toupper/tolower
  cosmetics: insert some spaces in explicit enum value assignments
  move 8SVX audio codecs to the audio codec list part on the next bump
  ...

Conflicts:
	avprobe.c
	doc/APIchanges
	ffplay.c
	ffserver.c
	libavcodec/avcodec.h
	libavdevice/bktr.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavformat/matroskaenc.c
	libavformat/wtv.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/avutil.h
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-07 03:01:43 +01:00
Reimar Döffinger
ba04ecfdac avstring: Add locale independent implementations of strcasecmp/strncasecmp
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:56 +02:00
Luca Barbato
07b172fe8f avstring: Add locale independent implementations of toupper/tolower
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:54 +02:00
Reimar Döffinger
96949dafcc Replace all strcasecmp/strncasecmp usages.
All current usages of it are incompatible with localization.
For example strcasecmp("i", "I") != 0 is possible, but would
break many of the places where it is used.
Instead use our own implementations that always treat the data
as ASCII.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2011-11-03 19:25:26 +01:00
Stefano Sabatini
b35e9e19e9 lavu: add av_strtok()
The function strtok_r() is part of the POSIX.1 specification, but is not
available on some platforms. We provide an internal implementation, so we
do not need to rely on a platform implementation.
2011-10-18 18:21:03 +02:00
Clément Bœsch
61e2e29691 av_string: add av_asprintf(). 2011-09-04 09:37:41 +02:00
Michael Niedermayer
686959e87e Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doxygen: Consistently use '@' instead of '\' for Doxygen markup.
  Use av_printf_format to check the usage of printf style functions
  Add av_printf_format, for marking printf style format strings and their parameters
  ARM: enable thumb for Cortex-M* CPUs
  nsvdec: Propagate error values instead of returning 0 in nsv_read_header().
  build: remove SRC_PATH_BARE variable
  build: move basic rules and variables to main Makefile
  build: move special targets to end of main Makefile
  lavdev: improve feedback in case of invalid frame rate/size
  vfwcap: prefer "framerate_q" over "fps" in vfw_read_header()
  v4l2: prefer "framerate_q" over "fps" in v4l2_set_parameters()
  fbdev: prefer "framerate_q" over "fps" in device context
  bktr: prefer "framerate" over "fps" for grab_read_header()
  ALSA: implement channel layout for playback.
  alsa: support unsigned variants of already supported signed formats.
  alsa: add support for more formats.
  ARM: allow building in Thumb2 mode

Conflicts:
	common.mak
	doc/APIchanges
	libavcodec/vdpau.h
	libavdevice/alsa-audio-common.c
	libavdevice/fbdev.c
	libavdevice/libdc1394.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-24 03:07:04 +02:00
Martin Storsjö
9abbe8cc13 Use av_printf_format to check the usage of printf style functions
This helps catching cases where the format string doesn't
match what is passed in, or injection bugs where user data
is passed in as format string.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-06-23 20:17:46 +03:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Stefano Sabatini
372e288408 Move av_get_token() from libavfilter to libavutil.
Originally committed as revision 25225 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-27 16:23:43 +00:00
Måns Rullgård
f0a912d3b8 More descriptive names for av_stristr() parameters
Originally committed as revision 22349 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-08 22:16:05 +00:00
Måns Rullgård
ac6ef8682d Add av_stristr() function
This is a case-insensitive version of strstr().

Originally committed as revision 22251 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-06 19:41:22 +00:00
Stefano Sabatini
22bf4592c8 Remove duplicated word in av_strlcat() doxy.
Originally committed as revision 21549 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-30 19:03:37 +00:00
Michael Niedermayer
64b12fc317 Move #include where it belongs.
This as a sideeffect fixes the linking failure of ffplay.

Originally committed as revision 20832 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-12-13 18:42:39 +00:00
Michael Niedermayer
277c733237 Add a function to convert a number to a av_malloced string.
Originally committed as revision 20829 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-12-13 17:09:41 +00:00
Reimar Döffinger
46f3b40eb3 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
already must be properly 0-terminated strings. Unlike strncpy it
cannot be used on raw data read from a file.

Originally committed as revision 19800 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-09 21:00:51 +00:00
Diego Biurrun
7d685b486b spelling/grammar/consistency review part III
Originally committed as revision 16849 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-28 23:16:49 +00:00
Diego Biurrun
89c9ff504b spelling/grammar/consistency review part I
Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-28 00:16:05 +00:00
Stefano Sabatini
987903826b Globally rename the header inclusion guard names.
Consistently apply this rule: the guard name is obtained from the
filename by stripping the leading "lib", converting '/' and '.'  to
'_' and uppercasing the resulting name. Guard names in the root
directory have to be prefixed by "FFMPEG_".

Originally committed as revision 15120 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-31 07:39:47 +00:00