Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
ff9a1541
Commit
ff9a1541
authored
Jul 30, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add int64_t probesize2 instead of int probesize to AVFormatContext.
Allows to set a probesize >2G. Tested-by: Oliver Fromme
parent
355121bc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
16 deletions
+28
-16
avformat.h
libavformat/avformat.h
+9
-3
avio_internal.h
libavformat/avio_internal.h
+1
-1
aviobuf.c
libavformat/aviobuf.c
+1
-1
mpegts.c
libavformat/mpegts.c
+6
-5
options_table.h
libavformat/options_table.h
+1
-1
utils.c
libavformat/utils.c
+9
-4
version.h
libavformat/version.h
+1
-1
No files found.
libavformat/avformat.h
View file @
ff9a1541
...
@@ -1296,9 +1296,7 @@ typedef struct AVFormatContext {
...
@@ -1296,9 +1296,7 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
/**
/**
* Maximum size of the data read from input for determining
* @deprecated deprecated in favor of probesize2
* the input container format.
* Demuxing only, set by the caller before avformat_open_input().
*/
*/
unsigned
int
probesize
;
unsigned
int
probesize
;
...
@@ -1671,6 +1669,14 @@ typedef struct AVFormatContext {
...
@@ -1671,6 +1669,14 @@ typedef struct AVFormatContext {
* Can be set to 0 to let avformat choose using a heuristic.
* Can be set to 0 to let avformat choose using a heuristic.
*/
*/
int64_t
max_analyze_duration2
;
int64_t
max_analyze_duration2
;
/**
* Maximum size of the data read from input for determining
* the input container format.
* Demuxing only, set by the caller before avformat_open_input()
* via AVOptions (NO direct access).
*/
int64_t
probesize2
;
}
AVFormatContext
;
}
AVFormatContext
;
int
av_format_get_probe_score
(
const
AVFormatContext
*
s
);
int
av_format_get_probe_score
(
const
AVFormatContext
*
s
);
...
...
libavformat/avio_internal.h
View file @
ff9a1541
...
@@ -95,7 +95,7 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size);
...
@@ -95,7 +95,7 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size);
* within the current pos and pos+buf_size is possible.
* within the current pos and pos+buf_size is possible.
* Once the stream position moves outside this window this guarantee is lost.
* Once the stream position moves outside this window this guarantee is lost.
*/
*/
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
buf_size
);
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
64_t
buf_size
);
int
ffio_limit
(
AVIOContext
*
s
,
int
size
);
int
ffio_limit
(
AVIOContext
*
s
,
int
size
);
...
...
libavformat/aviobuf.c
View file @
ff9a1541
...
@@ -767,7 +767,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
...
@@ -767,7 +767,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
return
0
;
return
0
;
}
}
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
buf_size
)
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
64_t
buf_size
)
{
{
uint8_t
*
buffer
;
uint8_t
*
buffer
;
int
max_buffer_size
=
s
->
max_packet_size
?
int
max_buffer_size
=
s
->
max_packet_size
?
...
...
libavformat/mpegts.c
View file @
ff9a1541
...
@@ -2242,12 +2242,13 @@ static void finished_reading_packet(AVFormatContext *s, int raw_packet_size)
...
@@ -2242,12 +2242,13 @@ static void finished_reading_packet(AVFormatContext *s, int raw_packet_size)
avio_skip
(
pb
,
skip
);
avio_skip
(
pb
,
skip
);
}
}
static
int
handle_packets
(
MpegTSContext
*
ts
,
int
nb_packets
)
static
int
handle_packets
(
MpegTSContext
*
ts
,
int
64_t
nb_packets
)
{
{
AVFormatContext
*
s
=
ts
->
stream
;
AVFormatContext
*
s
=
ts
->
stream
;
uint8_t
packet
[
TS_PACKET_SIZE
+
FF_INPUT_BUFFER_PADDING_SIZE
];
uint8_t
packet
[
TS_PACKET_SIZE
+
FF_INPUT_BUFFER_PADDING_SIZE
];
const
uint8_t
*
data
;
const
uint8_t
*
data
;
int
packet_num
,
ret
=
0
;
int64_t
packet_num
;
int
ret
=
0
;
if
(
avio_tell
(
s
->
pb
)
!=
ts
->
last_pos
)
{
if
(
avio_tell
(
s
->
pb
)
!=
ts
->
last_pos
)
{
int
i
;
int
i
;
...
@@ -2369,9 +2370,9 @@ static int mpegts_read_header(AVFormatContext *s)
...
@@ -2369,9 +2370,9 @@ static int mpegts_read_header(AVFormatContext *s)
AVIOContext
*
pb
=
s
->
pb
;
AVIOContext
*
pb
=
s
->
pb
;
uint8_t
buf
[
8
*
1024
]
=
{
0
};
uint8_t
buf
[
8
*
1024
]
=
{
0
};
int
len
;
int
len
;
int64_t
pos
;
int64_t
pos
,
probesize
=
s
->
probesize
?
s
->
probesize
:
s
->
probesize2
;
ffio_ensure_seekback
(
pb
,
s
->
probesize
);
ffio_ensure_seekback
(
pb
,
probesize
);
/* read the first 8192 bytes to get packet size */
/* read the first 8192 bytes to get packet size */
pos
=
avio_tell
(
pb
);
pos
=
avio_tell
(
pb
);
...
@@ -2394,7 +2395,7 @@ static int mpegts_read_header(AVFormatContext *s)
...
@@ -2394,7 +2395,7 @@ static int mpegts_read_header(AVFormatContext *s)
mpegts_open_section_filter
(
ts
,
PAT_PID
,
pat_cb
,
ts
,
1
);
mpegts_open_section_filter
(
ts
,
PAT_PID
,
pat_cb
,
ts
,
1
);
handle_packets
(
ts
,
s
->
probesize
/
ts
->
raw_packet_size
);
handle_packets
(
ts
,
probesize
/
ts
->
raw_packet_size
);
/* if could not find service, enable auto_guess */
/* if could not find service, enable auto_guess */
ts
->
auto_guess
=
1
;
ts
->
auto_guess
=
1
;
...
...
libavformat/options_table.h
View file @
ff9a1541
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
static
const
AVOption
avformat_options
[]
=
{
static
const
AVOption
avformat_options
[]
=
{
{
"avioflags"
,
NULL
,
OFFSET
(
avio_flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"avioflags"
},
{
"avioflags"
,
NULL
,
OFFSET
(
avio_flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"avioflags"
},
{
"direct"
,
"reduce buffering"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVIO_FLAG_DIRECT
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"avioflags"
},
{
"direct"
,
"reduce buffering"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVIO_FLAG_DIRECT
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"avioflags"
},
{
"probesize"
,
"set probing size"
,
OFFSET
(
probesize
),
AV_OPT_TYPE_INT
,
{.
i64
=
5000000
},
32
,
INT
_MAX
,
D
},
{
"probesize"
,
"set probing size"
,
OFFSET
(
probesize
2
),
AV_OPT_TYPE_INT64
,
{.
i64
=
5000000
},
32
,
INT64
_MAX
,
D
},
{
"formatprobesize"
,
"number of bytes to probe file format"
,
OFFSET
(
format_probesize
),
AV_OPT_TYPE_INT
,
{.
i64
=
PROBE_BUF_MAX
},
0
,
INT_MAX
-
1
,
D
},
{
"formatprobesize"
,
"number of bytes to probe file format"
,
OFFSET
(
format_probesize
),
AV_OPT_TYPE_INT
,
{.
i64
=
PROBE_BUF_MAX
},
0
,
INT_MAX
-
1
,
D
},
{
"packetsize"
,
"set packet size"
,
OFFSET
(
packet_size
),
AV_OPT_TYPE_INT
,
{.
i64
=
DEFAULT
},
0
,
INT_MAX
,
E
},
{
"packetsize"
,
"set packet size"
,
OFFSET
(
packet_size
),
AV_OPT_TYPE_INT
,
{.
i64
=
DEFAULT
},
0
,
INT_MAX
,
E
},
{
"fflags"
,
NULL
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
AVFMT_FLAG_FLUSH_PACKETS
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"fflags"
},
{
"fflags"
,
NULL
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
AVFMT_FLAG_FLUSH_PACKETS
},
INT_MIN
,
INT_MAX
,
D
|
E
,
"fflags"
},
...
...
libavformat/utils.c
View file @
ff9a1541
...
@@ -2950,10 +2950,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -2950,10 +2950,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int64_t
old_offset
=
avio_tell
(
ic
->
pb
);
int64_t
old_offset
=
avio_tell
(
ic
->
pb
);
// new streams might appear, no options for those
// new streams might appear, no options for those
int
orig_nb_streams
=
ic
->
nb_streams
;
int
orig_nb_streams
=
ic
->
nb_streams
;
int
flush_codecs
=
ic
->
probesize
>
0
;
int
flush_codecs
;
int64_t
max_analyze_duration
=
ic
->
max_analyze_duration2
;
int64_t
max_analyze_duration
=
ic
->
max_analyze_duration2
;
int64_t
probesize
=
ic
->
probesize2
;
if
(
!
max_analyze_duration
)
if
(
!
max_analyze_duration
)
max_analyze_duration
=
ic
->
max_analyze_duration
;
max_analyze_duration
=
ic
->
max_analyze_duration
;
if
(
ic
->
probesize
)
probesize
=
ic
->
probesize
;
flush_codecs
=
probesize
>
0
;
av_opt_set
(
ic
,
"skip_clear"
,
"1"
,
AV_OPT_SEARCH_CHILDREN
);
av_opt_set
(
ic
,
"skip_clear"
,
"1"
,
AV_OPT_SEARCH_CHILDREN
);
...
@@ -3081,10 +3086,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -3081,10 +3086,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
}
}
}
/* We did not get all the codec info, but we read too much data. */
/* We did not get all the codec info, but we read too much data. */
if
(
read_size
>=
ic
->
probesize
)
{
if
(
read_size
>=
probesize
)
{
ret
=
count
;
ret
=
count
;
av_log
(
ic
,
AV_LOG_DEBUG
,
av_log
(
ic
,
AV_LOG_DEBUG
,
"Probe buffer size limit of %
d bytes reached
\n
"
,
ic
->
probesize
);
"Probe buffer size limit of %
"
PRId64
" bytes reached
\n
"
,
probesize
);
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
if
(
!
ic
->
streams
[
i
]
->
r_frame_rate
.
num
&&
if
(
!
ic
->
streams
[
i
]
->
r_frame_rate
.
num
&&
ic
->
streams
[
i
]
->
info
->
duration_count
<=
1
&&
ic
->
streams
[
i
]
->
info
->
duration_count
<=
1
&&
...
@@ -3328,7 +3333,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -3328,7 +3333,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
}
}
}
if
(
ic
->
probesize
)
if
(
probesize
)
estimate_timings
(
ic
,
old_offset
);
estimate_timings
(
ic
,
old_offset
);
if
(
ret
>=
0
&&
ic
->
nb_streams
)
if
(
ret
>=
0
&&
ic
->
nb_streams
)
...
...
libavformat/version.h
View file @
ff9a1541
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR
49
#define LIBAVFORMAT_VERSION_MINOR
50
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment