aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-24 02:45:58 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-28 17:14:21 +0100
commit5f8e01522534fa12e47a79c81be5e7fda184a591 (patch)
treed0bbaf768800cbc5336ece6f94fab124d3827c20
parentb9b0c96db7aa272163c1e819553a3a508f029649 (diff)
downloadffmpeg-5f8e01522534fa12e47a79c81be5e7fda184a591.tar.gz
avformat/pcmdec: Simplify parsing MIME type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavformat/pcmdec.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 395d9ecf92..cd3e7b2e8f 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "pcm.h"
@@ -51,14 +52,9 @@ static int pcm_read_header(AVFormatContext *s)
av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type);
if (mime_type && s->iformat->mime_type) {
int rate = 0, channels = 0, little_endian = 0;
- size_t len = strlen(s->iformat->mime_type);
- if (!av_strncasecmp(s->iformat->mime_type, mime_type, len)) { /* audio/L16 */
- uint8_t *options = mime_type + len;
- len = strlen(mime_type);
- while (options < mime_type + len) {
- options = strstr(options, ";");
- if (!options)
- break;
+ const char *options;
+ if (av_stristart(mime_type, s->iformat->mime_type, &options)) { /* audio/L16 */
+ while (options = strchr(options, ';')) {
options++;
if (!rate)
sscanf(options, " rate=%d", &rate);