From 745730c9c208c40f800d5d71ffa39aceab6ce044 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Tue, 11 Nov 2014 08:20:02 +0100 Subject: lavf/ffm: use AVOption API to store/restore stream properties This is a generic solution that will not reqiore modifications when new options are added. This also fixes problem with current implementation when qmin or qmax=-1. Only 8 bits was sent and read back as 255. Fixes #1275 Fixes #1461 Signed-off-by: Lukasz Marek --- libavformat/ffmdec.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'libavformat/ffmdec.c') diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 1c848b9ee7..f66f8aaa87 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -240,6 +240,7 @@ static int ffm2_read_header(AVFormatContext *s) int ret; int f_main = 0, f_cprv, f_stvi, f_stau; AVCodec *enc; + char *buffer; ffm->packet_size = avio_rb32(pb); if (ffm->packet_size != FFM_PACKET_SIZE) { @@ -375,6 +376,34 @@ static int ffm2_read_header(AVFormatContext *s) avio_get_str(pb, size, st->recommended_encoder_configuration, size + 1); } break; + case MKBETAG('S', '2', 'V', 'I'): + if (f_stvi++) { + ret = AVERROR(EINVAL); + goto fail; + } + buffer = av_malloc(size); + if (!buffer) { + ret = AVERROR(ENOMEM); + goto fail; + } + avio_get_str(pb, INT_MAX, buffer, size); + av_set_options_string(codec, buffer, "=", ","); + av_freep(&buffer); + break; + case MKBETAG('S', '2', 'A', 'U'): + if (f_stau++) { + ret = AVERROR(EINVAL); + goto fail; + } + buffer = av_malloc(size); + if (!buffer) { + ret = AVERROR(ENOMEM); + goto fail; + } + avio_get_str(pb, INT_MAX, buffer, size); + av_set_options_string(codec, buffer, "=", ","); + av_freep(&buffer); + break; } avio_seek(pb, next, SEEK_SET); } -- cgit v1.2.3