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
d7556492
Commit
d7556492
authored
Jun 28, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/mjpeg.c: handle jpeg stills.
parent
33f67758
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
10 deletions
+41
-10
modules/demux/mjpeg.c
modules/demux/mjpeg.c
+41
-10
No files found.
modules/demux/mjpeg.c
View file @
d7556492
...
@@ -63,6 +63,9 @@ struct demux_sys_t
...
@@ -63,6 +63,9 @@ struct demux_sys_t
es_format_t
fmt
;
es_format_t
fmt
;
es_out_id_t
*
p_es
;
es_out_id_t
*
p_es
;
vlc_bool_t
b_still
;
mtime_t
i_still_end
;
mtime_t
i_time
;
mtime_t
i_time
;
mtime_t
i_frame_length
;
mtime_t
i_frame_length
;
char
*
psz_separator
;
char
*
psz_separator
;
...
@@ -271,6 +274,12 @@ static int SendBlock( demux_t *p_demux, int i )
...
@@ -271,6 +274,12 @@ static int SendBlock( demux_t *p_demux, int i )
/* 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
)
{
p_sys
->
i_still_end
=
mdate
()
+
I64C
(
5000000
);
}
return
1
;
return
1
;
}
}
...
@@ -284,20 +293,13 @@ static int Open( vlc_object_t * p_this )
...
@@ -284,20 +293,13 @@ static int Open( vlc_object_t * p_this )
int
i_size
;
int
i_size
;
int
b_matched
=
VLC_FALSE
;
int
b_matched
=
VLC_FALSE
;
vlc_value_t
val
;
vlc_value_t
val
;
char
*
psz_ext
;
p_demux
->
pf_control
=
Control
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_sys
->
p_es
=
NULL
;
p_sys
->
p_es
=
NULL
;
p_sys
->
i_time
=
0
;
p_sys
->
i_time
=
0
;
var_Create
(
p_demux
,
"mjpeg-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"mjpeg-fps"
,
&
val
);
p_sys
->
i_frame_length
=
0
;
if
(
val
.
f_float
)
{
p_sys
->
i_frame_length
=
1000000
.
0
/
val
.
f_float
;
}
p_sys
->
psz_separator
=
NULL
;
p_sys
->
psz_separator
=
NULL
;
p_sys
->
i_frame_size_estimate
=
15
*
1024
;
p_sys
->
i_frame_size_estimate
=
15
*
1024
;
...
@@ -325,6 +327,24 @@ static int Open( vlc_object_t * p_this )
...
@@ -325,6 +327,24 @@ static int Open( vlc_object_t * p_this )
goto
error
;
goto
error
;
}
}
/* Check for jpeg file extension */
p_sys
->
b_still
=
VLC_FALSE
;
p_sys
->
i_still_end
=
0
;
psz_ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
);
if
(
psz_ext
&&
(
!
strcasecmp
(
psz_ext
,
".jpeg"
)
||
!
strcasecmp
(
psz_ext
,
".jpg"
)
)
)
{
p_sys
->
b_still
=
VLC_TRUE
;
}
var_Create
(
p_demux
,
"mjpeg-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"mjpeg-fps"
,
&
val
);
p_sys
->
i_frame_length
=
0
;
if
(
val
.
f_float
)
{
p_sys
->
i_frame_length
=
1000000
.
0
/
val
.
f_float
;
}
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
0
);
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
0
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'j'
,
'p'
,
'g'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'j'
,
'p'
,
'g'
);
...
@@ -332,7 +352,6 @@ static int Open( vlc_object_t * p_this )
...
@@ -332,7 +352,6 @@ static int Open( vlc_object_t * p_this )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
msg_Warn
(
p_demux
,
"JPEG camera module discarded"
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -347,6 +366,17 @@ static int MjpgDemux( demux_t *p_demux )
...
@@ -347,6 +366,17 @@ static int MjpgDemux( demux_t *p_demux )
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int
i
;
int
i
;
if
(
p_sys
->
b_still
&&
p_sys
->
i_still_end
&&
p_sys
->
i_still_end
<
mdate
()
)
{
/* Still frame, wait until the pause delay is gone */
p_sys
->
i_still_end
=
0
;
}
else
if
(
p_sys
->
b_still
&&
p_sys
->
i_still_end
)
{
msleep
(
40000
);
return
1
;
}
if
(
!
Peek
(
p_demux
,
VLC_TRUE
)
)
if
(
!
Peek
(
p_demux
,
VLC_TRUE
)
)
{
{
msg_Warn
(
p_demux
,
"cannot peek data"
);
msg_Warn
(
p_demux
,
"cannot peek data"
);
...
@@ -373,6 +403,7 @@ static int MjpgDemux( demux_t *p_demux )
...
@@ -373,6 +403,7 @@ static int MjpgDemux( demux_t *p_demux )
}
}
}
}
i
++
;
i
++
;
msg_Dbg
(
p_demux
,
"JPEG EOI detected at %d"
,
i
);
msg_Dbg
(
p_demux
,
"JPEG EOI detected at %d"
,
i
);
return
SendBlock
(
p_demux
,
i
);
return
SendBlock
(
p_demux
,
i
);
}
}
...
...
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