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
25a2d269
Commit
25a2d269
authored
Dec 29, 2017
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
ea3672b7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
19 deletions
+22
-19
transcode_aac.c
doc/examples/transcode_aac.c
+5
-2
ffmpeg.c
fftools/ffmpeg.c
+8
-8
ffmpeg_opt.c
fftools/ffmpeg_opt.c
+4
-4
ffplay.c
fftools/ffplay.c
+3
-3
ffprobe.c
fftools/ffprobe.c
+1
-1
uncoded_frame.c
tools/uncoded_frame.c
+1
-1
No files found.
doc/examples/transcode_aac.c
View file @
25a2d269
...
@@ -171,8 +171,11 @@ static int open_output_file(const char *filename,
...
@@ -171,8 +171,11 @@ static int open_output_file(const char *filename,
goto
cleanup
;
goto
cleanup
;
}
}
av_strlcpy
((
*
output_format_context
)
->
filename
,
filename
,
if
(
!
((
*
output_format_context
)
->
url
=
av_strdup
(
filename
)))
{
sizeof
((
*
output_format_context
)
->
filename
));
fprintf
(
stderr
,
"Could not allocate url.
\n
"
);
error
=
AVERROR
(
ENOMEM
);
goto
cleanup
;
}
/* Find the encoder to be used by its name. */
/* Find the encoder to be used by its name. */
if
(
!
(
output_codec
=
avcodec_find_encoder
(
AV_CODEC_ID_AAC
)))
{
if
(
!
(
output_codec
=
avcodec_find_encoder
(
AV_CODEC_ID_AAC
)))
{
...
...
fftools/ffmpeg.c
View file @
25a2d269
...
@@ -1563,7 +1563,7 @@ static void print_final_stats(int64_t total_size)
...
@@ -1563,7 +1563,7 @@ static void print_final_stats(int64_t total_size)
uint64_t
total_packets
=
0
,
total_size
=
0
;
uint64_t
total_packets
=
0
,
total_size
=
0
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"Input file #%d (%s):
\n
"
,
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"Input file #%d (%s):
\n
"
,
i
,
f
->
ctx
->
filename
);
i
,
f
->
ctx
->
url
);
for
(
j
=
0
;
j
<
f
->
nb_streams
;
j
++
)
{
for
(
j
=
0
;
j
<
f
->
nb_streams
;
j
++
)
{
InputStream
*
ist
=
input_streams
[
f
->
ist_index
+
j
];
InputStream
*
ist
=
input_streams
[
f
->
ist_index
+
j
];
...
@@ -1597,7 +1597,7 @@ static void print_final_stats(int64_t total_size)
...
@@ -1597,7 +1597,7 @@ static void print_final_stats(int64_t total_size)
uint64_t
total_packets
=
0
,
total_size
=
0
;
uint64_t
total_packets
=
0
,
total_size
=
0
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"Output file #%d (%s):
\n
"
,
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"Output file #%d (%s):
\n
"
,
i
,
of
->
ctx
->
filename
);
i
,
of
->
ctx
->
url
);
for
(
j
=
0
;
j
<
of
->
ctx
->
nb_streams
;
j
++
)
{
for
(
j
=
0
;
j
<
of
->
ctx
->
nb_streams
;
j
++
)
{
OutputStream
*
ost
=
output_streams
[
of
->
ost_index
+
j
];
OutputStream
*
ost
=
output_streams
[
of
->
ost_index
+
j
];
...
@@ -2105,7 +2105,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
...
@@ -2105,7 +2105,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
if
(
exit_on_error
&&
*
got_output
&&
ist
)
{
if
(
exit_on_error
&&
*
got_output
&&
ist
)
{
if
(
ist
->
decoded_frame
->
decode_error_flags
||
(
ist
->
decoded_frame
->
flags
&
AV_FRAME_FLAG_CORRUPT
))
{
if
(
ist
->
decoded_frame
->
decode_error_flags
||
(
ist
->
decoded_frame
->
flags
&
AV_FRAME_FLAG_CORRUPT
))
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"%s: corrupt decoded frame in stream %d
\n
"
,
input_files
[
ist
->
file_index
]
->
ctx
->
filename
,
ist
->
st
->
index
);
av_log
(
NULL
,
AV_LOG_FATAL
,
"%s: corrupt decoded frame in stream %d
\n
"
,
input_files
[
ist
->
file_index
]
->
ctx
->
url
,
ist
->
st
->
index
);
exit_program
(
1
);
exit_program
(
1
);
}
}
}
}
...
@@ -2989,7 +2989,7 @@ static int check_init_output_file(OutputFile *of, int file_index)
...
@@ -2989,7 +2989,7 @@ static int check_init_output_file(OutputFile *of, int file_index)
//assert_avoptions(of->opts);
//assert_avoptions(of->opts);
of
->
header_written
=
1
;
of
->
header_written
=
1
;
av_dump_format
(
of
->
ctx
,
file_index
,
of
->
ctx
->
filename
,
1
);
av_dump_format
(
of
->
ctx
,
file_index
,
of
->
ctx
->
url
,
1
);
if
(
sdp_filename
||
want_sdp
)
if
(
sdp_filename
||
want_sdp
)
print_sdp
();
print_sdp
();
...
@@ -4252,7 +4252,7 @@ static int process_input(int file_index)
...
@@ -4252,7 +4252,7 @@ static int process_input(int file_index)
}
}
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
ret
!=
AVERROR_EOF
)
{
if
(
ret
!=
AVERROR_EOF
)
{
print_error
(
is
->
filename
,
ret
);
print_error
(
is
->
url
,
ret
);
if
(
exit_on_error
)
if
(
exit_on_error
)
exit_program
(
1
);
exit_program
(
1
);
}
}
...
@@ -4301,7 +4301,7 @@ static int process_input(int file_index)
...
@@ -4301,7 +4301,7 @@ static int process_input(int file_index)
goto
discard_packet
;
goto
discard_packet
;
if
(
exit_on_error
&&
(
pkt
.
flags
&
AV_PKT_FLAG_CORRUPT
))
{
if
(
exit_on_error
&&
(
pkt
.
flags
&
AV_PKT_FLAG_CORRUPT
))
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"%s: corrupt input packet in stream %d
\n
"
,
is
->
filename
,
pkt
.
stream_index
);
av_log
(
NULL
,
AV_LOG_FATAL
,
"%s: corrupt input packet in stream %d
\n
"
,
is
->
url
,
pkt
.
stream_index
);
exit_program
(
1
);
exit_program
(
1
);
}
}
...
@@ -4668,11 +4668,11 @@ static int transcode(void)
...
@@ -4668,11 +4668,11 @@ static int transcode(void)
av_log
(
NULL
,
AV_LOG_ERROR
,
av_log
(
NULL
,
AV_LOG_ERROR
,
"Nothing was written into output file %d (%s), because "
"Nothing was written into output file %d (%s), because "
"at least one of its streams received no packets.
\n
"
,
"at least one of its streams received no packets.
\n
"
,
i
,
os
->
filename
);
i
,
os
->
url
);
continue
;
continue
;
}
}
if
((
ret
=
av_write_trailer
(
os
))
<
0
)
{
if
((
ret
=
av_write_trailer
(
os
))
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error writing trailer of %s: %s
\n
"
,
os
->
filename
,
av_err2str
(
ret
));
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error writing trailer of %s: %s
\n
"
,
os
->
url
,
av_err2str
(
ret
));
if
(
exit_on_error
)
if
(
exit_on_error
)
exit_program
(
1
);
exit_program
(
1
);
}
}
...
...
fftools/ffmpeg_opt.c
View file @
25a2d269
...
@@ -1271,7 +1271,7 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o
...
@@ -1271,7 +1271,7 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o
if
(
type
==
AVMEDIA_TYPE_VIDEO
||
type
==
AVMEDIA_TYPE_AUDIO
||
type
==
AVMEDIA_TYPE_SUBTITLE
)
{
if
(
type
==
AVMEDIA_TYPE_VIDEO
||
type
==
AVMEDIA_TYPE_AUDIO
||
type
==
AVMEDIA_TYPE_SUBTITLE
)
{
MATCH_PER_STREAM_OPT
(
codec_names
,
str
,
codec_name
,
s
,
ost
->
st
);
MATCH_PER_STREAM_OPT
(
codec_names
,
str
,
codec_name
,
s
,
ost
->
st
);
if
(
!
codec_name
)
{
if
(
!
codec_name
)
{
ost
->
st
->
codecpar
->
codec_id
=
av_guess_codec
(
s
->
oformat
,
NULL
,
s
->
filename
,
ost
->
st
->
codecpar
->
codec_id
=
av_guess_codec
(
s
->
oformat
,
NULL
,
s
->
url
,
NULL
,
ost
->
st
->
codecpar
->
codec_type
);
NULL
,
ost
->
st
->
codecpar
->
codec_type
);
ost
->
enc
=
avcodec_find_encoder
(
ost
->
st
->
codecpar
->
codec_id
);
ost
->
enc
=
avcodec_find_encoder
(
ost
->
st
->
codecpar
->
codec_id
);
if
(
!
ost
->
enc
)
{
if
(
!
ost
->
enc
)
{
...
@@ -2334,7 +2334,7 @@ loop_end:
...
@@ -2334,7 +2334,7 @@ loop_end:
#endif
#endif
if
(
!
oc
->
nb_streams
&&
!
(
oc
->
oformat
->
flags
&
AVFMT_NOSTREAMS
))
{
if
(
!
oc
->
nb_streams
&&
!
(
oc
->
oformat
->
flags
&
AVFMT_NOSTREAMS
))
{
av_dump_format
(
oc
,
nb_output_files
-
1
,
oc
->
filename
,
1
);
av_dump_format
(
oc
,
nb_output_files
-
1
,
oc
->
url
,
1
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Output file #%d does not contain any stream
\n
"
,
nb_output_files
-
1
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Output file #%d does not contain any stream
\n
"
,
nb_output_files
-
1
);
exit_program
(
1
);
exit_program
(
1
);
}
}
...
@@ -2466,8 +2466,8 @@ loop_end:
...
@@ -2466,8 +2466,8 @@ loop_end:
/* check filename in case of an image number is expected */
/* check filename in case of an image number is expected */
if
(
oc
->
oformat
->
flags
&
AVFMT_NEEDNUMBER
)
{
if
(
oc
->
oformat
->
flags
&
AVFMT_NEEDNUMBER
)
{
if
(
!
av_filename_number_test
(
oc
->
filename
))
{
if
(
!
av_filename_number_test
(
oc
->
url
))
{
print_error
(
oc
->
filename
,
AVERROR
(
EINVAL
));
print_error
(
oc
->
url
,
AVERROR
(
EINVAL
));
exit_program
(
1
);
exit_program
(
1
);
}
}
}
}
...
...
fftools/ffplay.c
View file @
25a2d269
...
@@ -2712,8 +2712,8 @@ static int is_realtime(AVFormatContext *s)
...
@@ -2712,8 +2712,8 @@ static int is_realtime(AVFormatContext *s)
)
)
return
1
;
return
1
;
if
(
s
->
pb
&&
(
!
strncmp
(
s
->
filename
,
"rtp:"
,
4
)
if
(
s
->
pb
&&
(
!
strncmp
(
s
->
url
,
"rtp:"
,
4
)
||
!
strncmp
(
s
->
filename
,
"udp:"
,
4
)
||
!
strncmp
(
s
->
url
,
"udp:"
,
4
)
)
)
)
)
return
1
;
return
1
;
...
@@ -2928,7 +2928,7 @@ static int read_thread(void *arg)
...
@@ -2928,7 +2928,7 @@ static int read_thread(void *arg)
ret
=
avformat_seek_file
(
is
->
ic
,
-
1
,
seek_min
,
seek_target
,
seek_max
,
is
->
seek_flags
);
ret
=
avformat_seek_file
(
is
->
ic
,
-
1
,
seek_min
,
seek_target
,
seek_max
,
is
->
seek_flags
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
av_log
(
NULL
,
AV_LOG_ERROR
,
"%s: error while seeking
\n
"
,
is
->
ic
->
filename
);
"%s: error while seeking
\n
"
,
is
->
ic
->
url
);
}
else
{
}
else
{
if
(
is
->
audio_stream
>=
0
)
{
if
(
is
->
audio_stream
>=
0
)
{
packet_queue_flush
(
&
is
->
audioq
);
packet_queue_flush
(
&
is
->
audioq
);
...
...
fftools/ffprobe.c
View file @
25a2d269
...
@@ -2778,7 +2778,7 @@ static int show_format(WriterContext *w, InputFile *ifile)
...
@@ -2778,7 +2778,7 @@ static int show_format(WriterContext *w, InputFile *ifile)
int
ret
=
0
;
int
ret
=
0
;
writer_print_section_header
(
w
,
SECTION_ID_FORMAT
);
writer_print_section_header
(
w
,
SECTION_ID_FORMAT
);
print_str_validate
(
"filename"
,
fmt_ctx
->
filename
);
print_str_validate
(
"filename"
,
fmt_ctx
->
url
);
print_int
(
"nb_streams"
,
fmt_ctx
->
nb_streams
);
print_int
(
"nb_streams"
,
fmt_ctx
->
nb_streams
);
print_int
(
"nb_programs"
,
fmt_ctx
->
nb_programs
);
print_int
(
"nb_programs"
,
fmt_ctx
->
nb_programs
);
print_str
(
"format_name"
,
fmt_ctx
->
iformat
->
name
);
print_str
(
"format_name"
,
fmt_ctx
->
iformat
->
name
);
...
...
tools/uncoded_frame.c
View file @
25a2d269
...
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
...
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
goto
fail
;
goto
fail
;
}
}
if
(
!
(
st
->
mux
->
oformat
->
flags
&
AVFMT_NOFILE
))
{
if
(
!
(
st
->
mux
->
oformat
->
flags
&
AVFMT_NOFILE
))
{
ret
=
avio_open2
(
&
st
->
mux
->
pb
,
st
->
mux
->
filename
,
AVIO_FLAG_WRITE
,
ret
=
avio_open2
(
&
st
->
mux
->
pb
,
st
->
mux
->
url
,
AVIO_FLAG_WRITE
,
NULL
,
NULL
);
NULL
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
st
->
mux
,
AV_LOG_ERROR
,
"Failed to init output: %s
\n
"
,
av_log
(
st
->
mux
,
AV_LOG_ERROR
,
"Failed to init output: %s
\n
"
,
...
...
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