| OLD | NEW |
| 1 /* | 1 /* |
| 2 * "NUT" Container Format demuxer | 2 * "NUT" Container Format demuxer |
| 3 * Copyright (c) 2004-2006 Michael Niedermayer | 3 * Copyright (c) 2004-2006 Michael Niedermayer |
| 4 * Copyright (c) 2003 Alex Beregszaszi | 4 * Copyright (c) 2003 Alex Beregszaszi |
| 5 * | 5 * |
| 6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
| 7 * | 7 * |
| 8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include <strings.h> | 23 #include <strings.h> |
| 24 #include "libavutil/avstring.h" | 24 #include "libavutil/avstring.h" |
| 25 #include "libavutil/bswap.h" | 25 #include "libavutil/bswap.h" |
| 26 #include "libavutil/tree.h" | 26 #include "libavutil/tree.h" |
| 27 #include "nut.h" | 27 #include "nut.h" |
| 28 | 28 |
| 29 #undef NDEBUG | 29 #undef NDEBUG |
| 30 #include <assert.h> | 30 #include <assert.h> |
| 31 | 31 |
| 32 #if FF_API_MAX_STREAMS |
| 33 #define NUT_MAX_STREAMS MAX_STREAMS |
| 34 #else |
| 35 #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ |
| 36 #endif |
| 37 |
| 32 static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ | 38 static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ |
| 33 unsigned int len= ff_get_v(bc); | 39 unsigned int len= ff_get_v(bc); |
| 34 | 40 |
| 35 if(len && maxlen) | 41 if(len && maxlen) |
| 36 get_buffer(bc, string, FFMIN(len, maxlen)); | 42 get_buffer(bc, string, FFMIN(len, maxlen)); |
| 37 while(len > maxlen){ | 43 while(len > maxlen){ |
| 38 get_byte(bc); | 44 get_byte(bc); |
| 39 len--; | 45 len--; |
| 40 } | 46 } |
| 41 | 47 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ByteIOContext *bc = s->pb; | 192 ByteIOContext *bc = s->pb; |
| 187 uint64_t tmp, end; | 193 uint64_t tmp, end; |
| 188 unsigned int stream_count; | 194 unsigned int stream_count; |
| 189 int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_i
dx; | 195 int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_i
dx; |
| 190 int64_t tmp_match; | 196 int64_t tmp_match; |
| 191 | 197 |
| 192 end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); | 198 end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); |
| 193 end += url_ftell(bc); | 199 end += url_ftell(bc); |
| 194 | 200 |
| 195 GET_V(tmp , tmp >=2 && tmp <= 3) | 201 GET_V(tmp , tmp >=2 && tmp <= 3) |
| 196 GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) | 202 GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) |
| 197 | 203 |
| 198 nut->max_distance = ff_get_v(bc); | 204 nut->max_distance = ff_get_v(bc); |
| 199 if(nut->max_distance > 65536){ | 205 if(nut->max_distance > 65536){ |
| 200 av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); | 206 av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); |
| 201 nut->max_distance= 65536; | 207 nut->max_distance= 65536; |
| 202 } | 208 } |
| 203 | 209 |
| 204 GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) | 210 GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) |
| 205 nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational)); | 211 nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational)); |
| 206 | 212 |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 nut_probe, | 928 nut_probe, |
| 923 nut_read_header, | 929 nut_read_header, |
| 924 nut_read_packet, | 930 nut_read_packet, |
| 925 nut_read_close, | 931 nut_read_close, |
| 926 read_seek, | 932 read_seek, |
| 927 .extensions = "nut", | 933 .extensions = "nut", |
| 928 .metadata_conv = ff_nut_metadata_conv, | 934 .metadata_conv = ff_nut_metadata_conv, |
| 929 .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_nut_video
_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 }, | 935 .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_nut_video
_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 }, |
| 930 }; | 936 }; |
| 931 #endif | 937 #endif |
| OLD | NEW |