[FFmpeg-cvslog] avformat/pcmdec: Simplify parsing MIME type
Andreas Rheinhardt
git at videolan.org
Sun Feb 28 18:43:39 EET 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Feb 24 02:45:58 2021 +0100| [5f8e01522534fa12e47a79c81be5e7fda184a591] | committer: Andreas Rheinhardt
avformat/pcmdec: Simplify parsing MIME type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f8e01522534fa12e47a79c81be5e7fda184a591
---
libavformat/pcmdec.c | 12 ++++--------
1 file 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);
More information about the ffmpeg-cvslog
mailing list