2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:26:48 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __MPEG_DEMUX_H__
|
|
|
|
#define __MPEG_DEMUX_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include "gstmpegparse.h"
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +00:00
|
|
|
G_BEGIN_DECLS
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
#define GST_TYPE_MPEG_DEMUX \
|
2004-03-27 22:45:41 +00:00
|
|
|
(gst_mpeg_demux_get_type())
|
2001-12-22 23:26:48 +00:00
|
|
|
#define GST_MPEG_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEG_DEMUX,GstMPEGDemux))
|
|
|
|
#define GST_MPEG_DEMUX_CLASS(klass) \
|
2004-03-27 22:45:41 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEG_DEMUX,GstMPEGDemuxClass))
|
2001-12-22 23:26:48 +00:00
|
|
|
#define GST_IS_MPEG_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEG_DEMUX))
|
2006-06-01 21:11:41 +00:00
|
|
|
#define GST_IS_MPEG_DEMUX_CLASS(klass) \
|
2001-12-22 23:26:48 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG_DEMUX))
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
/* Supported kinds of streams. */
|
|
|
|
enum {
|
|
|
|
GST_MPEG_DEMUX_STREAM_VIDEO = 1,
|
|
|
|
GST_MPEG_DEMUX_STREAM_AUDIO,
|
|
|
|
GST_MPEG_DEMUX_STREAM_PRIVATE,
|
2004-05-21 22:39:29 +00:00
|
|
|
GST_MPEG_DEMUX_STREAM_LAST
|
2004-03-27 22:45:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Supported number of streams. */
|
2005-12-06 19:48:07 +00:00
|
|
|
#define GST_MPEG_DEMUX_NUM_VIDEO_STREAMS 16
|
|
|
|
#define GST_MPEG_DEMUX_NUM_AUDIO_STREAMS 32
|
|
|
|
#define GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS 2
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
/* How to make stream type values. */
|
|
|
|
#define GST_MPEG_DEMUX_STREAM_TYPE(kind, serial) \
|
|
|
|
(((kind) << 16) + (serial))
|
|
|
|
|
|
|
|
/* How to retrieve the stream kind back from a type. */
|
|
|
|
#define GST_MPEG_DEMUX_STREAM_KIND(type) ((type) >> 16)
|
|
|
|
|
|
|
|
/* The recognized video types. */
|
|
|
|
enum {
|
|
|
|
GST_MPEG_DEMUX_VIDEO_UNKNOWN =
|
|
|
|
GST_MPEG_DEMUX_STREAM_TYPE (GST_MPEG_DEMUX_STREAM_VIDEO, 1),
|
|
|
|
GST_MPEG_DEMUX_VIDEO_MPEG,
|
2004-05-21 22:39:29 +00:00
|
|
|
GST_MPEG_DEMUX_VIDEO_LAST
|
2004-03-27 22:45:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The recognized audio types. */
|
|
|
|
enum {
|
|
|
|
GST_MPEG_DEMUX_AUDIO_UNKNOWN =
|
|
|
|
GST_MPEG_DEMUX_STREAM_TYPE (GST_MPEG_DEMUX_STREAM_AUDIO, 1),
|
|
|
|
GST_MPEG_DEMUX_AUDIO_MPEG,
|
2004-05-21 22:39:29 +00:00
|
|
|
GST_MPEG_DEMUX_AUDIO_LAST
|
2004-03-27 22:45:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The recognized private stream types. */
|
|
|
|
enum {
|
|
|
|
GST_MPEG_DEMUX_PRIVATE_UNKNOWN =
|
|
|
|
GST_MPEG_DEMUX_STREAM_TYPE (GST_MPEG_DEMUX_STREAM_PRIVATE, 1),
|
2004-05-21 22:39:29 +00:00
|
|
|
GST_MPEG_DEMUX_PRIVATE_LAST
|
2004-03-27 22:45:41 +00:00
|
|
|
};
|
2004-03-15 16:32:53 +00:00
|
|
|
|
|
|
|
typedef struct _GstMPEGStream GstMPEGStream;
|
2004-03-27 22:45:41 +00:00
|
|
|
typedef struct _GstMPEGVideoStream GstMPEGVideoStream;
|
|
|
|
typedef struct _GstMPEGDemux GstMPEGDemux;
|
|
|
|
typedef struct _GstMPEGDemuxClass GstMPEGDemuxClass;
|
2004-03-15 16:32:53 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
/* Information associated to a single MPEG stream. */
|
2004-03-15 16:32:53 +00:00
|
|
|
struct _GstMPEGStream {
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
gint type;
|
|
|
|
gint number;
|
|
|
|
GstPad *pad;
|
|
|
|
GstCaps *caps;
|
|
|
|
gint index_id;
|
|
|
|
gint size_bound;
|
|
|
|
GstClockTime cur_ts;
|
|
|
|
GstClockTimeDiff scr_offs;
|
|
|
|
GstFlowReturn last_flow;
|
|
|
|
guint buffers_sent;
|
2004-03-27 22:45:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Extended structure to hold additional information for video
|
|
|
|
streams. */
|
|
|
|
struct _GstMPEGVideoStream {
|
2005-12-06 19:48:07 +00:00
|
|
|
GstMPEGStream parent;
|
|
|
|
gint mpeg_version;
|
2004-03-15 16:32:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstMPEGDemux {
|
2005-12-06 19:48:07 +00:00
|
|
|
GstMPEGParse parent;
|
2004-03-15 16:32:53 +00:00
|
|
|
|
|
|
|
/* previous partial chunk and bytes remaining in it */
|
2005-12-06 19:48:07 +00:00
|
|
|
gboolean in_flush;
|
2004-03-15 16:32:53 +00:00
|
|
|
|
|
|
|
/* program stream header values */
|
2005-12-06 19:48:07 +00:00
|
|
|
guint16 header_length;
|
|
|
|
guint32 rate_bound;
|
|
|
|
guint8 audio_bound;
|
|
|
|
gboolean fixed;
|
|
|
|
gboolean constrained;
|
|
|
|
gboolean audio_lock;
|
|
|
|
gboolean video_lock;
|
|
|
|
guint8 video_bound;
|
|
|
|
gboolean packet_rate_restriction;
|
|
|
|
gint64 total_size_bound;
|
|
|
|
|
2006-03-23 18:17:34 +00:00
|
|
|
gint64 last_pts;
|
2005-12-06 19:48:07 +00:00
|
|
|
GstIndex *index;
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
/* stream output */
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *video_stream[GST_MPEG_DEMUX_NUM_VIDEO_STREAMS];
|
|
|
|
GstMPEGStream *audio_stream[GST_MPEG_DEMUX_NUM_AUDIO_STREAMS];
|
|
|
|
GstMPEGStream *private_stream[GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS];
|
2003-05-14 21:54:41 +00:00
|
|
|
|
2005-12-19 17:26:47 +00:00
|
|
|
GstClockTime max_gap; /* Maximum timestamp difference to
|
|
|
|
allow between pads before using a
|
|
|
|
filler to catch up. */
|
|
|
|
GstClockTime max_gap_tolerance;
|
|
|
|
/* When catching a pad up, how far
|
|
|
|
behind to make it. */
|
|
|
|
|
|
|
|
GstClockTime max_ts; /* Highest timestamp of all pads. */
|
|
|
|
GstPad *max_pad; /* Pad with highest timestamp. */
|
2004-03-15 16:32:53 +00:00
|
|
|
};
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
struct _GstMPEGDemuxClass {
|
|
|
|
GstMPEGParseClass parent_class;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
GstPadTemplate *video_template;
|
|
|
|
GstPadTemplate *audio_template;
|
|
|
|
GstPadTemplate *private_template;
|
|
|
|
|
2005-12-06 19:48:07 +00:00
|
|
|
GstPad * (*new_output_pad) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
const gchar *name,
|
|
|
|
GstPadTemplate *temp);
|
2005-12-06 19:48:07 +00:00
|
|
|
void (*init_stream) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
gint type,
|
|
|
|
GstMPEGStream *str,
|
|
|
|
gint number,
|
|
|
|
const gchar *name,
|
|
|
|
GstPadTemplate *temp);
|
|
|
|
|
|
|
|
GstMPEGStream *
|
2005-12-06 19:48:07 +00:00
|
|
|
(*get_video_stream) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
guint8 stream_nr,
|
|
|
|
gint type,
|
|
|
|
const gpointer info);
|
|
|
|
GstMPEGStream *
|
2005-12-06 19:48:07 +00:00
|
|
|
(*get_audio_stream) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
guint8 stream_nr,
|
|
|
|
gint type,
|
|
|
|
const gpointer info);
|
|
|
|
GstMPEGStream *
|
2005-12-06 19:48:07 +00:00
|
|
|
(*get_private_stream) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
guint8 stream_nr,
|
|
|
|
gint type,
|
|
|
|
const gpointer info);
|
|
|
|
|
2005-12-06 19:48:07 +00:00
|
|
|
GstFlowReturn (*send_subbuffer) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *outstream,
|
|
|
|
GstBuffer *buffer,
|
|
|
|
GstClockTime timestamp,
|
|
|
|
guint offset,
|
|
|
|
guint size);
|
|
|
|
|
|
|
|
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
GstFlowReturn (*combine_flows) (GstMPEGDemux *mpeg_demux,
|
|
|
|
GstMPEGStream *stream,
|
|
|
|
GstFlowReturn flow);
|
|
|
|
|
2005-12-06 19:48:07 +00:00
|
|
|
GstFlowReturn (*process_private) (GstMPEGDemux *mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
GstBuffer *buffer,
|
|
|
|
guint stream_nr,
|
|
|
|
GstClockTime timestamp,
|
|
|
|
guint headerlen, guint datalen);
|
2005-11-14 21:20:21 +00:00
|
|
|
|
2005-12-06 19:48:07 +00:00
|
|
|
void (*synchronise_pads) (GstMPEGDemux *mpeg_demux,
|
2005-11-14 21:20:21 +00:00
|
|
|
GstClockTime threshold,
|
2005-12-06 19:48:07 +00:00
|
|
|
GstClockTime new_ts);
|
2005-11-14 21:20:21 +00:00
|
|
|
|
2005-12-06 19:48:07 +00:00
|
|
|
void (*sync_stream_to_time) (GstMPEGDemux *mpeg_demux,
|
|
|
|
GstMPEGStream *stream,
|
|
|
|
GstClockTime last_ts);
|
2004-03-15 16:32:53 +00:00
|
|
|
};
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
void gst_mpeg_streams_reset_last_flow (GstMPEGStream *streams[],
|
|
|
|
guint num);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
GType gst_mpeg_demux_get_type (void);
|
|
|
|
|
|
|
|
gboolean gst_mpeg_demux_plugin_init (GstPlugin *plugin);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +00:00
|
|
|
G_END_DECLS
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
#endif /* __MPEG_DEMUX_H__ */
|