Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
aaf6cc92
Commit
aaf6cc92
authored
10 years ago
by
Lukasz Marek
Browse files
Options
Downloads
Patches
Plain Diff
ffserver: allow skip setting defaults
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
6c2ed67c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/ffserver.texi
+11
-0
11 additions, 0 deletions
doc/ffserver.texi
ffserver.c
+1
-0
1 addition, 0 deletions
ffserver.c
ffserver_config.c
+35
-0
35 additions, 0 deletions
ffserver_config.c
ffserver_config.h
+2
-0
2 additions, 0 deletions
ffserver_config.h
with
49 additions
and
0 deletions
doc/ffserver.texi
+
11
−
0
View file @
aaf6cc92
...
...
@@ -408,6 +408,12 @@ ignored, and the log is written to standard output.
Set no-daemon mode. This option is currently ignored since now
@command
{
ffserver
}
will always work in no-daemon mode, and is
deprecated.
@item UseDefaults
@item NoDefaults
Control whether default codec options are used for the all streams or not.
Each stream may overwrite this setting for its own. Default is @var
{
UseDefaults
}
.
The lastest occurrence overrides previous if multiple definitions.
@end table
@section Feed section
...
...
@@ -571,6 +577,11 @@ deprecated in favor of @option{Metadata}.
@item Metadata @var
{
key
}
@var
{
value
}
Set metadata value on the output stream.
@item UseDefaults
@item NoDefaults
Control whether default codec options are used for the stream or not.
Default is @var
{
UseDefaults
}
unless disabled globally.
@item NoAudio
@item NoVideo
Suppress audio/video.
...
...
This diff is collapsed.
Click to expand it.
ffserver.c
+
1
−
0
View file @
aaf6cc92
...
...
@@ -201,6 +201,7 @@ static FFServerConfig config = {
.
nb_max_http_connections
=
2000
,
.
nb_max_connections
=
5
,
.
max_bandwidth
=
1000
,
.
use_defaults
=
1
,
};
static
void
new_connection
(
int
server_fd
,
int
is_rtsp
);
...
...
This diff is collapsed.
Click to expand it.
ffserver_config.c
+
35
−
0
View file @
aaf6cc92
...
...
@@ -191,6 +191,8 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av,
av_log
(
NULL
,
AV_LOG_WARNING
,
"Something is wrong, %d options are not set!
\n
"
,
av_dict_count
(
*
opts
));
if
(
config
->
stream_use_defaults
)
{
//TODO: reident
/* compute default parameters */
switch
(
av
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
...
...
@@ -255,6 +257,25 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av,
default:
abort
();
}
}
else
{
switch
(
av
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
if
(
av
->
bit_rate
==
0
)
report_config_error
(
config
->
filename
,
config
->
line_num
,
AV_LOG_ERROR
,
&
config
->
errors
,
"audio bit rate is not set
\n
"
);
if
(
av
->
sample_rate
==
0
)
report_config_error
(
config
->
filename
,
config
->
line_num
,
AV_LOG_ERROR
,
&
config
->
errors
,
"audio sample rate is not set
\n
"
);
break
;
case
AVMEDIA_TYPE_VIDEO
:
if
(
av
->
width
==
0
||
av
->
height
==
0
)
report_config_error
(
config
->
filename
,
config
->
line_num
,
AV_LOG_ERROR
,
&
config
->
errors
,
"video size is not set
\n
"
);
break
;
default:
av_assert0
(
0
);
}
}
st
=
av_mallocz
(
sizeof
(
AVStream
));
if
(
!
st
)
...
...
@@ -583,6 +604,10 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd,
ffserver_get_arg
(
config
->
logfilename
,
sizeof
(
config
->
logfilename
),
p
);
}
else
if
(
!
av_strcasecmp
(
cmd
,
"LoadModule"
))
{
ERROR
(
"Loadable modules are no longer supported
\n
"
);
}
else
if
(
!
av_strcasecmp
(
cmd
,
"NoDefaults"
))
{
config
->
use_defaults
=
0
;
}
else
if
(
!
av_strcasecmp
(
cmd
,
"UseDefaults"
))
{
config
->
use_defaults
=
1
;
}
else
ERROR
(
"Incorrect keyword: '%s'
\n
"
,
cmd
);
return
0
;
...
...
@@ -738,6 +763,7 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
config
->
guessed_audio_codec_id
=
AV_CODEC_ID_NONE
;
config
->
guessed_video_codec_id
=
AV_CODEC_ID_NONE
;
}
config
->
stream_use_defaults
=
config
->
use_defaults
;
*
pstream
=
stream
;
return
0
;
}
...
...
@@ -1010,6 +1036,7 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
}
else
if
(
!
av_strcasecmp
(
cmd
,
"NoLoop"
))
{
stream
->
loop
=
0
;
}
else
if
(
!
av_strcasecmp
(
cmd
,
"</Stream>"
))
{
config
->
stream_use_defaults
&=
1
;
if
(
stream
->
feed
&&
stream
->
fmt
&&
strcmp
(
stream
->
fmt
->
name
,
"ffm"
))
{
if
(
config
->
dummy_actx
->
codec_id
==
AV_CODEC_ID_NONE
)
config
->
dummy_actx
->
codec_id
=
config
->
guessed_audio_codec_id
;
...
...
@@ -1032,6 +1059,14 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
}
else
if
(
!
av_strcasecmp
(
cmd
,
"File"
)
||
!
av_strcasecmp
(
cmd
,
"ReadOnlyFile"
))
{
ffserver_get_arg
(
stream
->
feed_filename
,
sizeof
(
stream
->
feed_filename
),
p
);
}
else
if
(
!
av_strcasecmp
(
cmd
,
"UseDefaults"
))
{
if
(
config
->
stream_use_defaults
>
1
)
WARNING
(
"Multiple UseDefaults/NoDefaults entries.
\n
"
);
config
->
stream_use_defaults
=
3
;
}
else
if
(
!
av_strcasecmp
(
cmd
,
"NoDefaults"
))
{
if
(
config
->
stream_use_defaults
>
1
)
WARNING
(
"Multiple UseDefaults/NoDefaults entries.
\n
"
);
config
->
stream_use_defaults
=
2
;
}
else
{
ERROR
(
"Invalid entry '%s' inside <Stream></Stream>
\n
"
,
cmd
);
}
...
...
This diff is collapsed.
Click to expand it.
ffserver_config.h
+
2
−
0
View file @
aaf6cc92
...
...
@@ -106,6 +106,7 @@ typedef struct FFServerConfig {
struct
sockaddr_in
rtsp_addr
;
int
errors
;
int
warnings
;
int
use_defaults
;
// Following variables MUST NOT be used outside configuration parsing code.
enum
AVCodecID
guessed_audio_codec_id
;
enum
AVCodecID
guessed_video_codec_id
;
...
...
@@ -116,6 +117,7 @@ typedef struct FFServerConfig {
int
no_audio
;
int
no_video
;
int
line_num
;
int
stream_use_defaults
;
}
FFServerConfig
;
void
ffserver_get_arg
(
char
*
buf
,
int
buf_size
,
const
char
**
pp
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment