Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b8df153b
Commit
b8df153b
authored
Aug 30, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mjpeg: deduplicate frame length variable
parent
c3693789
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
29 deletions
+16
-29
modules/demux/mjpeg.c
modules/demux/mjpeg.c
+16
-29
No files found.
modules/demux/mjpeg.c
View file @
b8df153b
...
@@ -70,10 +70,8 @@ struct demux_sys_t
...
@@ -70,10 +70,8 @@ struct demux_sys_t
es_format_t
fmt
;
es_format_t
fmt
;
es_out_id_t
*
p_es
;
es_out_id_t
*
p_es
;
bool
b_still
;
bool
b_still
;
mtime_t
i_still_end
;
mtime_t
i_still_end
;
mtime_t
i_still_length
;
mtime_t
i_time
;
mtime_t
i_time
;
mtime_t
i_frame_length
;
mtime_t
i_frame_length
;
char
*
psz_separator
;
char
*
psz_separator
;
...
@@ -299,24 +297,23 @@ static int SendBlock( demux_t *p_demux, int i )
...
@@ -299,24 +297,23 @@ static int SendBlock( demux_t *p_demux, int i )
return
0
;
return
0
;
}
}
if
(
!
p_sys
->
i_frame_length
||
!
p_sys
->
i_time
)
if
(
p_sys
->
i_frame_length
)
{
{
p_sys
->
i_time
=
p_block
->
i_dts
=
p_block
->
i_pts
=
mdate
();
p_block
->
i_pts
=
p_sys
->
i_time
;
p_sys
->
i_time
+=
p_sys
->
i_frame_length
;
}
}
else
else
{
{
p_block
->
i_dts
=
p_block
->
i_pts
=
VLC_TS_0
+
p_sys
->
i_time
;
p_block
->
i_pts
=
mdate
();
p_sys
->
i_time
+=
p_sys
->
i_frame_length
;
}
}
p_block
->
i_dts
=
p_block
->
i_pts
;
/* set PCR */
/* set PCR */
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_block
->
i_pts
);
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_block
->
i_pts
);
es_out_Send
(
p_demux
->
out
,
p_sys
->
p_es
,
p_block
);
es_out_Send
(
p_demux
->
out
,
p_sys
->
p_es
,
p_block
);
if
(
p_sys
->
b_still
)
if
(
p_sys
->
b_still
)
{
p_sys
->
i_still_end
=
mdate
()
+
p_sys
->
i_frame_length
;
p_sys
->
i_still_end
=
mdate
()
+
p_sys
->
i_still_length
;
}
return
1
;
return
1
;
}
}
...
@@ -330,7 +327,6 @@ static int Open( vlc_object_t * p_this )
...
@@ -330,7 +327,6 @@ static int Open( vlc_object_t * p_this )
demux_sys_t
*
p_sys
;
demux_sys_t
*
p_sys
;
int
i_size
;
int
i_size
;
bool
b_matched
=
false
;
bool
b_matched
=
false
;
float
f_fps
;
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
if
(
unlikely
(
p_sys
==
NULL
)
)
if
(
unlikely
(
p_sys
==
NULL
)
)
...
@@ -339,7 +335,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -339,7 +335,7 @@ static int Open( vlc_object_t * p_this )
p_demux
->
pf_control
=
Control
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
;
p_demux
->
p_sys
=
p_sys
;
p_sys
->
p_es
=
NULL
;
p_sys
->
p_es
=
NULL
;
p_sys
->
i_time
=
0
;
p_sys
->
i_time
=
VLC_TS_
0
;
p_sys
->
i_level
=
0
;
p_sys
->
i_level
=
0
;
p_sys
->
psz_separator
=
NULL
;
p_sys
->
psz_separator
=
NULL
;
...
@@ -376,31 +372,22 @@ static int Open( vlc_object_t * p_this )
...
@@ -376,31 +372,22 @@ static int Open( vlc_object_t * p_this )
goto
error
;
goto
error
;
}
}
/* Frame rate */
float
f_fps
=
var_InheritFloat
(
p_demux
,
"mjpeg-fps"
);
f_fps
=
var_CreateGetFloat
(
p_demux
,
"mjpeg-fps"
);
p_sys
->
i_frame_length
=
0
;
/* Check for jpeg file extension */
p_sys
->
b_still
=
false
;
p_sys
->
i_still_end
=
0
;
p_sys
->
i_still_end
=
0
;
if
(
demux_IsPathExtension
(
p_demux
,
".jpeg"
)
||
if
(
demux_IsPathExtension
(
p_demux
,
".jpeg"
)
||
demux_IsPathExtension
(
p_demux
,
".jpg"
)
)
demux_IsPathExtension
(
p_demux
,
".jpg"
)
)
{
{
/* Plain JPEG file = single still picture */
p_sys
->
b_still
=
true
;
p_sys
->
b_still
=
true
;
if
(
f_fps
)
if
(
f_fps
==
0
.
f
)
{
p_sys
->
i_still_length
=
1000000
.
0
/
f_fps
;
}
else
{
/* Defaults to 1fps */
/* Defaults to 1fps */
p_sys
->
i_still_length
=
1000000
;
f_fps
=
1
.
f
;
}
}
else
if
(
f_fps
)
{
p_sys
->
i_frame_length
=
1000000
.
0
/
f_fps
;
}
}
else
p_sys
->
b_still
=
false
;
p_sys
->
i_frame_length
=
f_fps
?
(
CLOCK_FREQ
/
f_fps
)
:
0
;
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
0
);
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
0
);
p_sys
->
fmt
.
i_codec
=
VLC_CODEC_MJPG
;
p_sys
->
fmt
.
i_codec
=
VLC_CODEC_MJPG
;
...
...
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