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
2226f517
Commit
2226f517
authored
Jan 19, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ts: fully probe TopField VDR headers and set service id (fix #11034)
parent
665b85ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
85 deletions
+109
-85
NEWS
NEWS
+1
-0
modules/demux/ts.c
modules/demux/ts.c
+108
-85
No files found.
NEWS
View file @
2226f517
...
...
@@ -38,6 +38,7 @@ Demuxers:
* Support WMV and WMAV in MP4/mov, aka Flip4Mac files
* Support bitmap audio channel reordering in MP4/mov
* Support AlbumArtist and DiscNumber metadata
* Fixed selecting recorded program from TopField TS files
Stream filter:
* Added ARIB STD-B25 TS streams decoder
...
...
modules/demux/ts.c
View file @
2226f517
...
...
@@ -436,17 +436,79 @@ static void SetPrgFilter( demux_t *, int i_prg, bool b_selected );
#define TS_PACKET_SIZE_204 204
#define TS_PACKET_SIZE_MAX 204
static
int
DetectPacketSize
(
demux_t
*
p_demux
,
int
*
pi_header_size
)
static
int
DetectPacketSize
(
demux_t
*
p_demux
,
int
*
pi_header_size
,
int
i_offset
)
{
const
uint8_t
*
p_peek
;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
TS_PACKET_SIZE_MAX
)
<
TS_PACKET_SIZE_MAX
)
&
p_peek
,
i_offset
+
TS_PACKET_SIZE_MAX
)
<
i_offset
+
TS_PACKET_SIZE_MAX
)
return
-
1
;
for
(
int
i_sync
=
0
;
i_sync
<
TS_PACKET_SIZE_MAX
;
i_sync
++
)
{
if
(
p_peek
[
i_offset
+
i_sync
]
!=
0x47
)
continue
;
/* Check next 3 sync bytes */
int
i_peek
=
i_offset
+
TS_PACKET_SIZE_MAX
*
3
+
i_sync
+
1
;
if
(
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
)
<
i_peek
)
{
msg_Err
(
p_demux
,
"cannot peek"
);
return
-
1
;
}
if
(
p_peek
[
i_offset
+
i_sync
+
1
*
TS_PACKET_SIZE_188
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
2
*
TS_PACKET_SIZE_188
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
3
*
TS_PACKET_SIZE_188
]
==
0x47
)
{
return
TS_PACKET_SIZE_188
;
}
else
if
(
p_peek
[
i_offset
+
i_sync
+
1
*
TS_PACKET_SIZE_192
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
2
*
TS_PACKET_SIZE_192
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
3
*
TS_PACKET_SIZE_192
]
==
0x47
)
{
if
(
i_sync
==
4
)
{
*
pi_header_size
=
4
;
/* BluRay TS packets have 4-byte header */
}
return
TS_PACKET_SIZE_192
;
}
else
if
(
p_peek
[
i_offset
+
i_sync
+
1
*
TS_PACKET_SIZE_204
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
2
*
TS_PACKET_SIZE_204
]
==
0x47
&&
p_peek
[
i_offset
+
i_sync
+
3
*
TS_PACKET_SIZE_204
]
==
0x47
)
{
return
TS_PACKET_SIZE_204
;
}
}
if
(
p_demux
->
b_force
)
{
msg_Warn
(
p_demux
,
"this does not look like a TS stream, continuing"
);
return
TS_PACKET_SIZE_188
;
}
msg_Dbg
(
p_demux
,
"TS module discarded (lost sync)"
);
return
-
1
;
}
#define TOPFIELD_HEADER_SIZE 3712
static
int
DetectPVRHeadersAndHeaderSize
(
demux_t
*
p_demux
,
int
*
pi_header_size
,
vdr_info_t
*
p_vdr
)
{
const
uint8_t
*
p_peek
;
*
pi_header_size
=
0
;
int
i_packet_size
=
-
1
;
if
(
memcmp
(
p_peek
,
"TFrc"
,
4
)
==
0
)
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
TS_PACKET_SIZE_MAX
)
<
TS_PACKET_SIZE_MAX
)
return
-
1
;
if
(
memcmp
(
p_peek
,
"TFrc"
,
4
)
==
0
&&
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
TOPFIELD_HEADER_SIZE
+
TS_PACKET_SIZE_MAX
)
==
TOPFIELD_HEADER_SIZE
+
TS_PACKET_SIZE_MAX
)
{
i_packet_size
=
DetectPacketSize
(
p_demux
,
pi_header_size
,
TOPFIELD_HEADER_SIZE
);
if
(
i_packet_size
!=
-
1
)
{
msg_Dbg
(
p_demux
,
"this is a topfield file"
);
#if 0
/* I used the TF5000PVR 2004 Firmware .doc header documentation,
* http://www.i-topfield.com/data/product/firmware/Structure%20of%20Recorded%20File%20in%20TF5000PVR%20(Feb%2021%202004).doc
...
...
@@ -510,53 +572,14 @@ static int DetectPacketSize( demux_t *p_demux, int *pi_header_size )
msg_Dbg( p_demux, "extended event text=%s", psz_ext_text );
// 52 bytes reserved Bslbf
#endif
msg_Dbg
(
p_demux
,
"this is a topfield file"
);
return
TS_PACKET_SIZE_188
;
}
p_vdr
->
i_service
=
GetWBE
(
&
p_peek
[
18
]);
for
(
int
i_sync
=
0
;
i_sync
<
TS_PACKET_SIZE_MAX
;
i_sync
++
)
{
if
(
p_peek
[
i_sync
]
!=
0x47
)
continue
;
/* Check next 3 sync bytes */
int
i_peek
=
TS_PACKET_SIZE_MAX
*
3
+
i_sync
+
1
;
if
(
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
)
<
i_peek
)
{
msg_Err
(
p_demux
,
"cannot peek"
);
return
-
1
;
}
if
(
p_peek
[
i_sync
+
1
*
TS_PACKET_SIZE_188
]
==
0x47
&&
p_peek
[
i_sync
+
2
*
TS_PACKET_SIZE_188
]
==
0x47
&&
p_peek
[
i_sync
+
3
*
TS_PACKET_SIZE_188
]
==
0x47
)
{
return
TS_PACKET_SIZE_188
;
}
else
if
(
p_peek
[
i_sync
+
1
*
TS_PACKET_SIZE_192
]
==
0x47
&&
p_peek
[
i_sync
+
2
*
TS_PACKET_SIZE_192
]
==
0x47
&&
p_peek
[
i_sync
+
3
*
TS_PACKET_SIZE_192
]
==
0x47
)
{
if
(
i_sync
==
4
)
{
*
pi_header_size
=
4
;
/* BluRay TS packets have 4-byte header */
}
return
TS_PACKET_SIZE_192
;
}
else
if
(
p_peek
[
i_sync
+
1
*
TS_PACKET_SIZE_204
]
==
0x47
&&
p_peek
[
i_sync
+
2
*
TS_PACKET_SIZE_204
]
==
0x47
&&
p_peek
[
i_sync
+
3
*
TS_PACKET_SIZE_204
]
==
0x47
)
{
return
TS_PACKET_SIZE_204
;
return
i_packet_size
;
//return TS_PACKET_SIZE_188;
}
}
if
(
p_demux
->
b_force
)
{
msg_Warn
(
p_demux
,
"this does not look like a TS stream, continuing"
);
return
TS_PACKET_SIZE_188
;
}
msg_Dbg
(
p_demux
,
"TS module discarded (lost sync)"
);
return
-
1
;
return
DetectPacketSize
(
p_demux
,
pi_header_size
,
0
);
}
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
...
...
@@ -617,7 +640,7 @@ static int Open( vlc_object_t *p_this )
vdr_info_t
vdr
=
{
0
};
/* Search first sync byte */
i_packet_size
=
DetectP
acketSize
(
p_demux
,
&
i_packet_header_size
);
i_packet_size
=
DetectP
VRHeadersAndHeaderSize
(
p_demux
,
&
i_packet_header_size
,
&
vdr
);
if
(
i_packet_size
<
0
)
return
VLC_EGENERIC
;
...
...
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