libmpdemux: add back demux_ts

Someone wanted this. Apparently both libavformat's TS demuxer and
demux_ts are crap, and work/fail in different cases.

This demuxer has been removed in 1fde09db6f. All code added comes
from the revision before that. Some required bits have been added in
the commit before this one (re-adding demux_mpg), in particular the
changes to video.c.

stream_dvb will use this demuxer by default, otherwise demux_lavf is
preferred (as it has been before).

Some TS related command line options are not re-added.

Closed captions might not work.
This commit is contained in:
wm4 2012-09-07 14:42:25 +02:00
parent c323592c3a
commit ae9c3d530c
5 changed files with 3574 additions and 1 deletions

View File

@ -235,6 +235,7 @@ SRCS_COMMON = asxparser.c \
libmpdemux/demux_mf.c \
libmpdemux/demux_mkv.c \
libmpdemux/demux_mpg.c \
libmpdemux/demux_ts.c \
libmpdemux/mp3_hdr.c \
libmpdemux/parse_es.c \
libmpdemux/mpeg_hdr.c \

3533
libmpdemux/demux_ts.c Normal file

File diff suppressed because it is too large Load Diff

24
libmpdemux/demux_ts.h Normal file
View File

@ -0,0 +1,24 @@
/*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_DEMUX_TS_H
#define MPLAYER_DEMUX_TS_H
#define TS_MAX_PROBE_SIZE 2000000
#endif /* MPLAYER_DEMUX_TS_H */

View File

@ -69,6 +69,7 @@ extern const demuxer_desc_t demuxer_desc_mpeg_gxf;
extern const demuxer_desc_t demuxer_desc_mpeg_es;
extern const demuxer_desc_t demuxer_desc_mpeg4_es;
extern const demuxer_desc_t demuxer_desc_h264_es;
extern const demuxer_desc_t demuxer_desc_mpeg_ts;
/* Please do not add any new demuxers here. If you want to implement a new
* demuxer, add it to libavformat, except for wrappers around external
@ -100,6 +101,7 @@ const demuxer_desc_t *const demuxer_list[] = {
&demuxer_desc_mpeg_es,
&demuxer_desc_mpeg4_es,
&demuxer_desc_h264_es,
&demuxer_desc_mpeg_ts,
/* Please do not add any new demuxers here. If you want to implement a new
* demuxer, add it to libavformat, except for wrappers around external
* libraries and demuxers requiring binary support. */
@ -361,6 +363,17 @@ sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
return demuxer->s_streams[id];
}
struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid,
const char *lang)
{
struct sh_sub *sh = new_sh_sub_sid(demuxer, id, sid);
if (lang && lang[0] && strcmp(lang, "und")) {
sh->lang = talloc_strdup(sh, lang);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, lang);
}
return sh;
}
static void free_sh_sub(sh_sub_t *sh)
{
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);
@ -988,7 +1001,7 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
// correctly.
switch (file_format) {
//case DEMUXER_TYPE_MPEG_PS:
case DEMUXER_TYPE_MPEG_TS:
//case DEMUXER_TYPE_MPEG_TS:
case DEMUXER_TYPE_Y4M:
case DEMUXER_TYPE_NSV:
case DEMUXER_TYPE_AAC:

View File

@ -179,6 +179,8 @@ struct sh_audio *new_sh_audio_aid(struct demuxer *demuxer, int id, int aid);
struct sh_video *new_sh_video_vid(struct demuxer *demuxer, int id, int vid);
#define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
struct sh_sub *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid,
const char *lang);
void free_sh_audio(struct demuxer *demuxer, int id);
void free_sh_video(struct sh_video *sh);