diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-11-11 10:20:02 +0300 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-11-16 03:13:38 +0300 |
commit | 745730c9c208c40f800d5d71ffa39aceab6ce044 (patch) | |
tree | 485d03c81d0d5529fd0c96fa60169fa289edab6a /libavformat/ffmdec.c | |
parent | a38e06c1aaac3002838e19612df375d42cc28a76 (diff) |
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 <lukasz.m.luki2@gmail.com>
Diffstat (limited to 'libavformat/ffmdec.c')
-rw-r--r-- | libavformat/ffmdec.c | 29 |
1 files changed, 29 insertions, 0 deletions
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); } |