2002-10-17 21:41:47 +00:00
/* GStreamer
* 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 .
*/
2003-06-29 19:46:09 +00:00
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
2004-05-02 18:07:39 +00:00
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
# include <gst/gstutils.h>
2004-10-01 10:50:57 +00:00
# include <gst/riff/riff-media.h>
2004-05-11 16:25:04 +00:00
# include <string.h>
2004-05-02 18:07:39 +00:00
2006-01-20 14:18:20 +00:00
# include <gst/gst-i18n-plugin.h>
2002-10-17 21:41:47 +00:00
# include "gstasfdemux.h"
2003-01-31 21:41:07 +00:00
# include "asfheaders.h"
2002-10-17 21:41:47 +00:00
2003-12-22 01:47:08 +00:00
static GstStaticPadTemplate gst_asf_demux_sink_template =
2004-03-14 22:34:30 +00:00
GST_STATIC_PAD_TEMPLATE ( " sink " ,
GST_PAD_SINK ,
GST_PAD_ALWAYS ,
GST_STATIC_CAPS ( " video/x-ms-asf " )
) ;
2004-01-27 01:27:04 +00:00
GST_DEBUG_CATEGORY_STATIC ( asf_debug ) ;
# define GST_CAT_DEFAULT asf_debug
2004-03-14 22:34:30 +00:00
static void gst_asf_demux_base_init ( gpointer g_class ) ;
static void gst_asf_demux_class_init ( GstASFDemuxClass * klass ) ;
static void gst_asf_demux_init ( GstASFDemux * asf_demux ) ;
static gboolean gst_asf_demux_send_event ( GstElement * element ,
GstEvent * event ) ;
static void gst_asf_demux_loop ( GstElement * element ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
static gboolean gst_asf_demux_handle_data ( GstASFDemux * asf_demux ) ;
2004-03-14 22:34:30 +00:00
static gboolean gst_asf_demux_process_object ( GstASFDemux * asf_demux ) ;
static void gst_asf_demux_get_property ( GObject * object ,
guint prop_id , GValue * value , GParamSpec * pspec ) ;
static guint32 gst_asf_demux_identify_guid ( GstASFDemux * asf_demux ,
ASFGuidHash * guids , ASFGuid * guid_raw ) ;
static gboolean gst_asf_demux_process_chunk ( GstASFDemux * asf_demux ,
asf_packet_info * packet_info , asf_segment_info * segment_info ) ;
static const GstEventMask * gst_asf_demux_get_src_event_mask ( GstPad * pad ) ;
static gboolean gst_asf_demux_handle_sink_event ( GstASFDemux * asf_demux ,
GstEvent * event , guint32 remaining ) ;
static gboolean gst_asf_demux_handle_src_event ( GstPad * pad , GstEvent * event ) ;
static const GstFormat * gst_asf_demux_get_src_formats ( GstPad * pad ) ;
static const GstQueryType * gst_asf_demux_get_src_query_types ( GstPad * pad ) ;
static gboolean gst_asf_demux_handle_src_query ( GstPad * pad ,
GstQueryType type , GstFormat * format , gint64 * value ) ;
static gboolean gst_asf_demux_add_video_stream ( GstASFDemux * asf_demux ,
asf_stream_video_format * video_format , guint16 id ) ;
static gboolean gst_asf_demux_add_audio_stream ( GstASFDemux * asf_demux ,
asf_stream_audio * audio , guint16 id ) ;
static gboolean gst_asf_demux_setup_pad ( GstASFDemux * asf_demux ,
GstPad * src_pad , GstCaps * caps , guint16 id ) ;
2005-09-02 15:43:54 +00:00
static GstStateChangeReturn gst_asf_demux_change_state ( GstElement * element ,
GstStateChange transition ) ;
2002-10-17 21:41:47 +00:00
2003-07-06 20:49:50 +00:00
static GstPadTemplate * videosrctempl , * audiosrctempl ;
2002-10-17 21:41:47 +00:00
static GstElementClass * parent_class = NULL ;
GType
2004-05-02 18:07:39 +00:00
gst_asf_demux_get_type ( void )
2002-10-17 21:41:47 +00:00
{
static GType asf_demux_type = 0 ;
if ( ! asf_demux_type ) {
static const GTypeInfo asf_demux_info = {
2004-03-14 22:34:30 +00:00
sizeof ( GstASFDemuxClass ) ,
2003-11-01 11:28:53 +00:00
gst_asf_demux_base_init ,
2002-10-17 21:41:47 +00:00
NULL ,
2004-03-14 22:34:30 +00:00
( GClassInitFunc ) gst_asf_demux_class_init ,
2002-10-17 21:41:47 +00:00
NULL ,
NULL ,
2004-03-14 22:34:30 +00:00
sizeof ( GstASFDemux ) ,
2002-10-17 21:41:47 +00:00
0 ,
2004-03-14 22:34:30 +00:00
( GInstanceInitFunc ) gst_asf_demux_init ,
2002-10-17 21:41:47 +00:00
} ;
2004-03-15 19:32:25 +00:00
2004-03-14 22:34:30 +00:00
asf_demux_type =
2004-03-15 19:32:25 +00:00
g_type_register_static ( GST_TYPE_ELEMENT , " GstASFDemux " ,
& asf_demux_info , 0 ) ;
2004-05-02 18:07:39 +00:00
GST_DEBUG_CATEGORY_INIT ( asf_debug , " asfdemux " , 0 , " asf demuxer element " ) ;
2002-10-17 21:41:47 +00:00
}
return asf_demux_type ;
}
2003-11-01 11:28:53 +00:00
static void
gst_asf_demux_base_init ( gpointer g_class )
{
GstElementClass * element_class = GST_ELEMENT_CLASS ( g_class ) ;
2004-05-02 18:07:39 +00:00
static GstElementDetails gst_asf_demux_details = {
" ASF Demuxer " ,
" Codec/Demuxer " ,
" Demultiplexes ASF Streams " ,
" Owen Fraser-Green <owen@discobabe.net> "
} ;
2004-10-01 10:50:57 +00:00
GstCaps * audcaps = gst_riff_create_audio_template_caps ( ) ,
* vidcaps = gst_riff_create_video_template_caps ( ) ;
2003-11-01 11:28:53 +00:00
audiosrctempl = gst_pad_template_new ( " audio_%02d " ,
2004-03-14 22:34:30 +00:00
GST_PAD_SRC , GST_PAD_SOMETIMES , audcaps ) ;
2003-11-01 11:28:53 +00:00
videosrctempl = gst_pad_template_new ( " video_%02d " ,
2004-03-14 22:34:30 +00:00
GST_PAD_SRC , GST_PAD_SOMETIMES , vidcaps ) ;
2004-10-01 10:50:57 +00:00
2003-11-01 11:28:53 +00:00
gst_element_class_add_pad_template ( element_class , audiosrctempl ) ;
gst_element_class_add_pad_template ( element_class , videosrctempl ) ;
2004-03-14 22:34:30 +00:00
gst_element_class_add_pad_template ( element_class ,
2003-12-22 01:47:08 +00:00
gst_static_pad_template_get ( & gst_asf_demux_sink_template ) ) ;
2003-11-01 11:28:53 +00:00
gst_element_class_set_details ( element_class , & gst_asf_demux_details ) ;
}
2002-10-17 21:41:47 +00:00
static void
2004-03-14 22:34:30 +00:00
gst_asf_demux_class_init ( GstASFDemuxClass * klass )
2002-10-17 21:41:47 +00:00
{
GObjectClass * gobject_class ;
GstElementClass * gstelement_class ;
2004-03-14 22:34:30 +00:00
gobject_class = ( GObjectClass * ) klass ;
gstelement_class = ( GstElementClass * ) klass ;
2002-10-17 21:41:47 +00:00
parent_class = g_type_class_ref ( GST_TYPE_ELEMENT ) ;
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
gobject_class - > get_property = gst_asf_demux_get_property ;
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
gstelement_class - > change_state = gst_asf_demux_change_state ;
gstelement_class - > send_event = gst_asf_demux_send_event ;
}
static void
2004-03-14 22:34:30 +00:00
gst_asf_demux_init ( GstASFDemux * asf_demux )
2002-10-17 21:41:47 +00:00
{
2003-01-31 18:23:38 +00:00
guint i ;
2002-10-17 21:41:47 +00:00
2004-03-14 22:34:30 +00:00
asf_demux - > sinkpad =
gst_pad_new_from_template ( gst_static_pad_template_get
( & gst_asf_demux_sink_template ) , " sink " ) ;
2002-10-17 21:41:47 +00:00
gst_element_add_pad ( GST_ELEMENT ( asf_demux ) , asf_demux - > sinkpad ) ;
gst_element_set_loop_function ( GST_ELEMENT ( asf_demux ) , gst_asf_demux_loop ) ;
2003-01-31 18:23:38 +00:00
/* We should zero everything to be on the safe side */
for ( i = 0 ; i < GST_ASF_DEMUX_NUM_VIDEO_PADS ; i + + ) {
2002-10-17 21:41:47 +00:00
asf_demux - > video_pad [ i ] = NULL ;
asf_demux - > video_PTS [ i ] = 0 ;
}
2003-01-31 18:23:38 +00:00
for ( i = 0 ; i < GST_ASF_DEMUX_NUM_AUDIO_PADS ; i + + ) {
2002-10-17 21:41:47 +00:00
asf_demux - > audio_pad [ i ] = NULL ;
asf_demux - > audio_PTS [ i ] = 0 ;
}
asf_demux - > num_audio_streams = 0 ;
asf_demux - > num_video_streams = 0 ;
asf_demux - > num_streams = 0 ;
2004-03-14 22:34:30 +00:00
2005-01-27 00:56:11 +00:00
asf_demux - > taglist = NULL ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
asf_demux - > state = GST_ASF_DEMUX_STATE_HEADER ;
asf_demux - > seek_pending = GST_CLOCK_TIME_NONE ;
asf_demux - > seek_discont = FALSE ;
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/a52dec/gsta52dec.c: (gst_a52dec_init):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_is_open),
(dvdnavsrc_set_property), (dvdnavsrc_open), (dvdnavsrc_close),
(dvdnavsrc_event), (dvdnavsrc_convert), (dvdnavsrc_query):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_set_property),
(dvdreadsrc_srcpad_query), (dvdreadsrc_get),
(dvdreadsrc_open_file), (dvdreadsrc_close_file):
* ext/dvdread/dvdreadsrc.h:
* ext/lame/gstlame.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init):
* gst/asfdemux/gstasfmux.c: (gst_asfmux_init):
* gst/iec958/ac3iec.h:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init):
* gst/mpegstream/gstrfc2250enc.c: (gst_rfc2250_enc_init):
* gst/synaesthesia/gstsynaesthesia.c: (gst_synaesthesia_init):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:30:36 +00:00
GST_OBJECT_FLAG_SET ( asf_demux , GST_ELEMENT_EVENT_AWARE ) ;
2002-10-17 21:41:47 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_send_event ( GstElement * element , GstEvent * event )
2002-10-17 21:41:47 +00:00
{
const GList * pads ;
pads = gst_element_get_pad_list ( element ) ;
2003-01-31 18:23:38 +00:00
while ( pads ) {
2002-10-17 21:41:47 +00:00
GstPad * pad = GST_PAD ( pads - > data ) ;
if ( GST_PAD_DIRECTION ( pad ) = = GST_PAD_SRC ) {
/* we ref the event here as we might have to try again if the event
* failed on this pad */
gst_event_ref ( event ) ;
if ( gst_asf_demux_handle_src_event ( pad , event ) ) {
2004-03-15 19:32:25 +00:00
gst_event_unref ( event ) ;
return TRUE ;
2002-10-17 21:41:47 +00:00
}
}
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
pads = g_list_next ( pads ) ;
}
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
gst_event_unref ( event ) ;
return FALSE ;
}
static void
2004-03-14 22:34:30 +00:00
gst_asf_demux_loop ( GstElement * element )
2002-10-17 21:41:47 +00:00
{
GstASFDemux * asf_demux ;
g_return_if_fail ( element ! = NULL ) ;
g_return_if_fail ( GST_IS_ASF_DEMUX ( element ) ) ;
asf_demux = GST_ASF_DEMUX ( element ) ;
/* this is basically an infinite loop */
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
switch ( asf_demux - > state ) {
case GST_ASF_DEMUX_STATE_HEADER :
gst_asf_demux_process_object ( asf_demux ) ;
break ;
2004-12-10 21:11:33 +00:00
case GST_ASF_DEMUX_STATE_DATA : {
guint64 start_off = gst_bytestream_tell ( asf_demux - > bs ) , end_off ;
/* make sure a full packet is actually available */
if ( asf_demux - > packet_size ! = ( guint32 ) - 1 )
do {
guint32 remaining ;
GstEvent * event ;
guint got_bytes ;
guint8 * data ;
if ( ( got_bytes = gst_bytestream_peek_bytes ( asf_demux - > bs , & data ,
asf_demux - > packet_size ) ) = = asf_demux - > packet_size )
break ;
gst_bytestream_get_status ( asf_demux - > bs , & remaining , & event ) ;
if ( ! gst_asf_demux_handle_sink_event ( asf_demux , event , remaining ) )
return ;
} while ( 1 ) ;
/* now handle data */
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
gst_asf_demux_handle_data ( asf_demux ) ;
2004-12-10 21:11:33 +00:00
/* align by packet size */
end_off = gst_bytestream_tell ( asf_demux - > bs ) ;
if ( asf_demux - > packet_size ! = ( guint32 ) - 1 & &
end_off - start_off < asf_demux - > packet_size ) {
gst_bytestream_flush_fast ( asf_demux - > bs ,
asf_demux - > packet_size - ( end_off - start_off ) ) ;
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
break ;
2004-12-10 21:11:33 +00:00
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
case GST_ASF_DEMUX_STATE_EOS :
gst_pad_event_default ( asf_demux - > sinkpad , gst_event_new ( GST_EVENT_EOS ) ) ;
break ;
default :
g_assert_not_reached ( ) ;
break ;
}
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
static guint32
_read_var_length ( GstASFDemux * asf_demux , guint8 type , guint32 * rsize )
2002-10-17 21:41:47 +00:00
{
guint32 got_bytes ;
2003-06-30 06:45:29 +00:00
guint8 * var ;
2002-10-17 21:41:47 +00:00
guint32 ret = 0 ;
GstByteStream * bs = asf_demux - > bs ;
if ( type = = 0 ) {
return 0 ;
}
2004-03-14 22:34:30 +00:00
2003-06-30 06:45:29 +00:00
got_bytes = gst_bytestream_peek_bytes ( bs , & var , 4 ) ;
2002-10-17 21:41:47 +00:00
2004-09-22 07:55:36 +00:00
do {
2002-10-17 21:41:47 +00:00
guint32 remaining ;
GstEvent * event ;
2004-03-14 22:34:30 +00:00
2004-09-22 07:55:36 +00:00
if ( ( got_bytes = gst_bytestream_peek_bytes ( bs , & var , 4 ) ) = = 4 )
break ;
2002-10-17 21:41:47 +00:00
gst_bytestream_get_status ( bs , & remaining , & event ) ;
2004-09-22 07:55:36 +00:00
if ( ! gst_asf_demux_handle_sink_event ( asf_demux , event , remaining ) )
return FALSE ;
} while ( 1 ) ;
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
switch ( type ) {
2004-03-14 22:34:30 +00:00
case 1 :
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
ret = ( GST_READ_UINT32_LE ( var ) ) & 0xff ;
2004-03-14 22:34:30 +00:00
gst_bytestream_flush ( bs , 1 ) ;
* rsize + = 1 ;
break ;
case 2 :
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
ret = ( GST_READ_UINT32_LE ( var ) ) & 0xffff ;
2004-03-14 22:34:30 +00:00
gst_bytestream_flush ( bs , 2 ) ;
* rsize + = 2 ;
break ;
case 3 :
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
ret = GST_READ_UINT32_LE ( var ) ;
2004-03-14 22:34:30 +00:00
gst_bytestream_flush ( bs , 4 ) ;
* rsize + = 4 ;
break ;
2002-10-17 21:41:47 +00:00
}
return ret ;
}
2005-12-06 19:48:07 +00:00
# define READ_UINT_BITS_FUNCTION(bits) \
static gboolean \
_read_uint # # bits ( GstASFDemux * asf_demux , guint # # bits * ret ) \
{ \
GstEvent * event ; \
guint32 remaining ; \
guint8 * data ; \
\
g_return_val_if_fail ( ret ! = NULL , FALSE ) ; \
\
do { \
2004-01-27 01:27:04 +00:00
if ( gst_bytestream_peek_bytes ( asf_demux - > bs , & data , bits / 8 ) = = bits / 8 ) { \
2005-12-06 19:48:07 +00:00
* ret = GST_READ_UINT # # bits # # _LE ( data ) ; \
gst_bytestream_flush ( asf_demux - > bs , bits / 8 ) ; \
return TRUE ; \
} \
gst_bytestream_get_status ( asf_demux - > bs , & remaining , & event ) ; \
} while ( gst_asf_demux_handle_sink_event ( asf_demux , event , remaining ) ) ; \
\
return FALSE ; \
2004-01-27 01:27:04 +00:00
}
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
# define GST_READ_UINT8_LE(x) GST_READ_UINT8(x)
2004-09-22 07:55:36 +00:00
READ_UINT_BITS_FUNCTION ( 8 ) ;
READ_UINT_BITS_FUNCTION ( 16 ) ;
READ_UINT_BITS_FUNCTION ( 32 ) ;
READ_UINT_BITS_FUNCTION ( 64 ) ;
static gboolean
_read_guid ( GstASFDemux * asf_demux , ASFGuid * guid )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint32 ( asf_demux , & guid - > v1 ) & &
2004-03-14 22:34:30 +00:00
_read_uint32 ( asf_demux , & guid - > v2 ) & &
_read_uint32 ( asf_demux , & guid - > v3 ) & &
_read_uint32 ( asf_demux , & guid - > v4 ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_file ( GstASFDemux * asf_demux , asf_obj_file * object )
2004-01-27 01:27:04 +00:00
{
return ( _read_guid ( asf_demux , & object - > file_id ) & &
2004-03-14 22:34:30 +00:00
_read_uint64 ( asf_demux , & object - > file_size ) & &
_read_uint64 ( asf_demux , & object - > creation_time ) & &
_read_uint64 ( asf_demux , & object - > packets_count ) & &
_read_uint64 ( asf_demux , & object - > play_time ) & &
_read_uint64 ( asf_demux , & object - > send_time ) & &
_read_uint64 ( asf_demux , & object - > preroll ) & &
_read_uint32 ( asf_demux , & object - > flags ) & &
_read_uint32 ( asf_demux , & object - > min_pktsize ) & &
_read_uint32 ( asf_demux , & object - > max_pktsize ) & &
_read_uint32 ( asf_demux , & object - > min_bitrate ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_bitrate_record ( GstASFDemux * asf_demux , asf_bitrate_record * record )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint16 ( asf_demux , & record - > stream_id ) & &
2004-03-14 22:34:30 +00:00
_read_uint32 ( asf_demux , & record - > bitrate ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_comment ( GstASFDemux * asf_demux , asf_obj_comment * comment )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint16 ( asf_demux , & comment - > title_length ) & &
2004-03-14 22:34:30 +00:00
_read_uint16 ( asf_demux , & comment - > author_length ) & &
_read_uint16 ( asf_demux , & comment - > copyright_length ) & &
_read_uint16 ( asf_demux , & comment - > description_length ) & &
_read_uint16 ( asf_demux , & comment - > rating_length ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_header ( GstASFDemux * asf_demux , asf_obj_header * header )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint32 ( asf_demux , & header - > num_objects ) & &
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & header - > unknown1 ) & &
_read_uint8 ( asf_demux , & header - > unknown2 ) ) ;
2004-01-27 01:27:04 +00:00
}
2004-05-18 01:38:49 +00:00
static gboolean
_read_obj_header_ext ( GstASFDemux * asf_demux , asf_obj_header_ext * header_ext )
{
return ( _read_guid ( asf_demux , & header_ext - > reserved1 ) & &
_read_uint16 ( asf_demux , & header_ext - > reserved2 ) & &
_read_uint32 ( asf_demux , & header_ext - > data_size ) ) ;
}
2004-01-27 01:27:04 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_stream ( GstASFDemux * asf_demux , asf_obj_stream * stream )
2004-01-27 01:27:04 +00:00
{
return ( _read_guid ( asf_demux , & stream - > type ) & &
2004-03-14 22:34:30 +00:00
_read_guid ( asf_demux , & stream - > correction ) & &
_read_uint64 ( asf_demux , & stream - > unknown1 ) & &
_read_uint32 ( asf_demux , & stream - > type_specific_size ) & &
_read_uint32 ( asf_demux , & stream - > stream_specific_size ) & &
_read_uint16 ( asf_demux , & stream - > id ) & &
_read_uint32 ( asf_demux , & stream - > unknown2 ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_replicated_data ( GstASFDemux * asf_demux , asf_replicated_data * rep )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint32 ( asf_demux , & rep - > object_size ) & &
2004-03-14 22:34:30 +00:00
_read_uint32 ( asf_demux , & rep - > frag_timestamp ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_data ( GstASFDemux * asf_demux , asf_obj_data * object )
2004-01-27 01:27:04 +00:00
{
return ( _read_guid ( asf_demux , & object - > file_id ) & &
2004-03-14 22:34:30 +00:00
_read_uint64 ( asf_demux , & object - > packets ) & &
_read_uint8 ( asf_demux , & object - > unknown1 ) & &
2004-03-15 19:32:25 +00:00
/*_read_uint8 (asf_demux, &object->unknown2) && */
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & object - > correction ) ) ;
2002-10-17 21:41:47 +00:00
}
2004-01-27 01:27:04 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_data_correction ( GstASFDemux * asf_demux ,
asf_obj_data_correction * object )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint8 ( asf_demux , & object - > type ) & &
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & object - > cycle ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_obj_data_packet ( GstASFDemux * asf_demux , asf_obj_data_packet * object )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint8 ( asf_demux , & object - > flags ) & &
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & object - > property ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_stream_audio ( GstASFDemux * asf_demux , asf_stream_audio * audio )
2004-01-27 01:27:04 +00:00
{
2004-05-16 22:18:11 +00:00
/* WAVEFORMATEX Structure */
return ( _read_uint16 ( asf_demux , & audio - > codec_tag ) & & _read_uint16 ( asf_demux , & audio - > channels ) & & _read_uint32 ( asf_demux , & audio - > sample_rate ) & & _read_uint32 ( asf_demux , & audio - > byte_rate ) & & _read_uint16 ( asf_demux , & audio - > block_align ) & & _read_uint16 ( asf_demux , & audio - > word_size ) & & _read_uint16 ( asf_demux , & audio - > size ) ) ; /* Codec specific data size */
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_stream_correction ( GstASFDemux * asf_demux ,
asf_stream_correction * object )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint8 ( asf_demux , & object - > span ) & &
2004-03-14 22:34:30 +00:00
_read_uint16 ( asf_demux , & object - > packet_size ) & &
_read_uint16 ( asf_demux , & object - > chunk_size ) & &
_read_uint16 ( asf_demux , & object - > data_size ) & &
_read_uint8 ( asf_demux , & object - > silence_data ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_stream_video ( GstASFDemux * asf_demux , asf_stream_video * video )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint32 ( asf_demux , & video - > width ) & &
2004-03-14 22:34:30 +00:00
_read_uint32 ( asf_demux , & video - > height ) & &
_read_uint8 ( asf_demux , & video - > unknown ) & &
_read_uint16 ( asf_demux , & video - > size ) ) ;
2004-01-27 01:27:04 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
_read_stream_video_format ( GstASFDemux * asf_demux ,
asf_stream_video_format * fmt )
2004-01-27 01:27:04 +00:00
{
return ( _read_uint32 ( asf_demux , & fmt - > size ) & &
2004-03-14 22:34:30 +00:00
_read_uint32 ( asf_demux , & fmt - > width ) & &
_read_uint32 ( asf_demux , & fmt - > height ) & &
_read_uint16 ( asf_demux , & fmt - > planes ) & &
_read_uint16 ( asf_demux , & fmt - > depth ) & &
_read_uint32 ( asf_demux , & fmt - > tag ) & &
_read_uint32 ( asf_demux , & fmt - > image_size ) & &
_read_uint32 ( asf_demux , & fmt - > xpels_meter ) & &
_read_uint32 ( asf_demux , & fmt - > ypels_meter ) & &
_read_uint32 ( asf_demux , & fmt - > num_colors ) & &
_read_uint32 ( asf_demux , & fmt - > imp_colors ) ) ;
2004-01-27 01:27:04 +00:00
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_file ( GstASFDemux * asf_demux , guint64 * obj_size )
2002-10-17 21:41:47 +00:00
{
2004-01-27 01:27:04 +00:00
asf_obj_file object ;
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
/* Get the rest of the header's header */
2004-01-27 01:27:04 +00:00
_read_obj_file ( asf_demux , & object ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( object . min_pktsize = = object . max_pktsize )
asf_demux - > packet_size = object . max_pktsize ;
else {
asf_demux - > packet_size = ( guint32 ) - 1 ;
GST_WARNING_OBJECT ( asf_demux , " Non-const packet size, seeking disabled " ) ;
}
asf_demux - > play_time = ( guint64 ) object . play_time * ( GST_SECOND / 10000000 ) ;
2004-01-27 01:27:04 +00:00
asf_demux - > preroll = object . preroll ;
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is a file with % " G_GUINT64_FORMAT " data packets " ,
object . packets_count ) ;
2002-10-17 21:41:47 +00:00
return TRUE ;
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_bitrate_props_object ( GstASFDemux * asf_demux ,
guint64 * obj_size )
2003-01-31 21:10:00 +00:00
{
2004-03-14 22:34:30 +00:00
guint16 num_streams ;
guint8 stream_id ;
guint16 i ;
2004-01-27 01:27:04 +00:00
asf_bitrate_record bitrate_record ;
2002-10-17 21:41:47 +00:00
2004-01-27 01:27:04 +00:00
if ( ! _read_uint16 ( asf_demux , & num_streams ) )
return FALSE ;
2003-01-31 21:10:00 +00:00
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is a bitrate properties object with %u streams. " ,
num_streams ) ;
2003-01-31 21:10:00 +00:00
for ( i = 0 ; i < num_streams ; i + + ) {
2004-01-27 01:27:04 +00:00
_read_bitrate_record ( asf_demux , & bitrate_record ) ;
stream_id = bitrate_record . stream_id & 0x7f ;
asf_demux - > bitrate [ stream_id ] = bitrate_record . bitrate ;
2003-01-31 21:10:00 +00:00
}
return TRUE ;
}
2005-01-27 00:56:11 +00:00
static void
gst_asf_demux_commit_taglist ( GstASFDemux * asf_demux , GstTagList * taglist )
{
GstElement * element = GST_ELEMENT ( asf_demux ) ;
GstEvent * event ;
const GList * padlist ;
/* emit signal */
gst_element_found_tags ( element , taglist ) ;
/* save internally */
if ( ! asf_demux - > taglist )
asf_demux - > taglist = gst_tag_list_copy ( taglist ) ;
else {
GstTagList * t ;
t = gst_tag_list_merge ( asf_demux - > taglist , taglist , GST_TAG_MERGE_APPEND ) ;
gst_tag_list_free ( asf_demux - > taglist ) ;
asf_demux - > taglist = t ;
}
/* pads */
event = gst_event_new_tag ( taglist ) ;
for ( padlist = gst_element_get_pad_list ( element ) ;
padlist ! = NULL ; padlist = padlist - > next ) {
if ( GST_PAD_IS_SRC ( padlist - > data ) & & GST_PAD_IS_USABLE ( padlist - > data ) ) {
gst_event_ref ( event ) ;
gst_pad_push ( GST_PAD ( padlist - > data ) , GST_DATA ( event ) ) ;
}
}
gst_event_unref ( event ) ;
}
2005-01-05 21:46:19 +00:00
/* Content Description Object */
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_comment ( GstASFDemux * asf_demux , guint64 * obj_size )
2003-01-31 21:10:00 +00:00
{
2004-01-27 01:27:04 +00:00
asf_obj_comment object ;
2003-01-31 21:10:00 +00:00
GstByteStream * bs = asf_demux - > bs ;
2004-05-02 18:07:39 +00:00
gchar * utf8_comments [ 5 ] = { NULL , NULL , NULL , NULL , NULL } ;
guchar * data ;
const gchar * tags [ 5 ] = { GST_TAG_TITLE , GST_TAG_ARTIST , GST_TAG_COPYRIGHT ,
2004-05-05 11:29:48 +00:00
GST_TAG_COMMENT , NULL /* ? */
2004-05-02 18:07:39 +00:00
} ;
guint16 * lengths = ( guint16 * ) & object ;
2004-05-16 16:22:42 +00:00
gint i ;
2004-05-02 18:07:39 +00:00
gsize in , out ;
GstTagList * taglist ;
GValue value = { 0 } ;
2004-05-16 19:59:48 +00:00
gboolean have_tags = FALSE ;
2003-01-31 21:10:00 +00:00
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is a comment. " ) ;
2003-01-31 21:10:00 +00:00
/* Get the rest of the comment's header */
2004-01-27 01:27:04 +00:00
_read_obj_comment ( asf_demux , & object ) ;
2004-03-14 22:34:30 +00:00
GST_DEBUG
( " Comment lengths: title=%d author=%d copyright=%d description=%d rating=%d " ,
object . title_length , object . author_length , object . copyright_length ,
object . description_length , object . rating_length ) ;
2004-05-02 18:07:39 +00:00
for ( i = 0 ; i < 5 ; i + + ) {
/* might be just '/0', '/0'... */
if ( lengths [ i ] > 2 & & lengths [ i ] % 2 = = 0 ) {
if ( gst_bytestream_peek_bytes ( bs , & data , lengths [ i ] ) ! = lengths [ i ] )
goto fail ;
/* convert to UTF-8 */
utf8_comments [ i ] = g_convert ( data , lengths [ i ] ,
2004-05-16 16:22:42 +00:00
" UTF-8 " , " UTF-16LE " , & in , & out , NULL ) ;
gst_bytestream_flush_fast ( bs , lengths [ i ] ) ;
2004-05-11 04:33:48 +00:00
} else {
if ( lengths [ i ] > 0 & & ! gst_bytestream_flush ( bs , lengths [ i ] ) )
goto fail ;
2004-05-02 18:07:39 +00:00
}
}
2003-01-31 21:10:00 +00:00
2004-05-02 18:07:39 +00:00
/* parse metadata into taglist */
taglist = gst_tag_list_new ( ) ;
g_value_init ( & value , G_TYPE_STRING ) ;
for ( i = 0 ; i < 5 ; i + + ) {
if ( utf8_comments [ i ] & & tags [ i ] ) {
2004-05-16 19:59:48 +00:00
have_tags = TRUE ;
2004-05-02 18:07:39 +00:00
g_value_set_string ( & value , utf8_comments [ i ] ) ;
gst_tag_list_add_values ( taglist , GST_TAG_MERGE_APPEND ,
tags [ i ] , & value , NULL ) ;
g_free ( utf8_comments [ i ] ) ;
}
}
g_value_unset ( & value ) ;
2004-05-16 19:59:48 +00:00
if ( have_tags ) {
2005-01-27 00:56:11 +00:00
gst_asf_demux_commit_taglist ( asf_demux , taglist ) ;
2004-05-16 19:59:48 +00:00
} else {
gst_tag_list_free ( taglist ) ;
2004-05-02 18:07:39 +00:00
}
2003-01-31 21:10:00 +00:00
return TRUE ;
2004-05-02 18:07:39 +00:00
fail :
for ( i = 0 ; i < 5 ; i + + )
g_free ( utf8_comments [ i ] ) ;
return FALSE ;
2003-01-31 21:10:00 +00:00
}
2005-01-05 21:46:19 +00:00
/* Extended Content Description Object */
static gboolean
gst_asf_demux_process_ext_content_desc ( GstASFDemux * asf_demux ,
guint64 * obj_size )
{
GstByteStream * bs = asf_demux - > bs ;
guint16 blockcount , i ;
/*
Other known ( and unused ) ' text / unicode ' metadata available :
WM / Lyrics =
WM / MediaPrimaryClassID = { D1607DBC - E323 - 4 BE2 - 86 A1 - 48 A42A28441E }
WMFSDKVersion = 9.00 .00 .2980
WMFSDKNeeded = 0.0 .0 .0000
WM / UniqueFileIdentifier = AMGa_id = R 15334 ; AMGp_id = P 5149 ; AMGt_id = T 2324984
WM / Publisher = 4 AD
WM / Provider = AMG
WM / ProviderRating = 8
2005-01-07 22:42:32 +00:00
WM / ProviderStyle = Rock ( similar to WM / Genre )
WM / GenreID ( similar to WM / Genre )
2005-01-05 21:46:19 +00:00
Other known ( and unused ) ' non - text ' metadata available :
2005-01-06 12:41:13 +00:00
WM / Track ( same as WM / TrackNumber but starts at 0 )
2005-01-05 21:46:19 +00:00
WM / EncodingTime
WM / MCDI
2005-01-06 12:41:13 +00:00
IsVBR
2005-01-05 21:46:19 +00:00
*/
2005-01-07 22:42:32 +00:00
const guchar * tags [ ] = { GST_TAG_GENRE , GST_TAG_ALBUM , GST_TAG_ARTIST , GST_TAG_TRACK_NUMBER , GST_TAG_DATE , NULL } ; // GST_TAG_COMPOSER
const guchar * tags_label [ ] = { " WM/Genre " , " WM/AlbumTitle " , " WM/AlbumArtist " , " WM/TrackNumber " , " WM/Year " , NULL } ; // "WM/Composer"
2005-01-05 21:46:19 +00:00
GstTagList * taglist ;
GValue tag_value = { 0 } ;
gboolean have_tags = FALSE ;
2005-01-08 12:25:26 +00:00
guint8 * name = NULL ;
2005-01-05 21:46:19 +00:00
GST_INFO ( " Object is an extended content description. " ) ;
taglist = gst_tag_list_new ( ) ;
/* Content Descriptors Count */
if ( ! _read_uint16 ( asf_demux , & blockcount ) )
goto fail ;
for ( i = 1 ; i < = blockcount ; i + + ) {
guint16 name_length ;
guint16 datatype ;
guint16 value_length ;
2005-01-08 12:25:26 +00:00
guint8 * tmpname ;
2005-01-05 21:46:19 +00:00
guint8 * tmpvalue , * value ;
/* Descriptor Name Length */
if ( ! _read_uint16 ( asf_demux , & name_length ) )
goto fail ;
/* Descriptor Name */
name = g_malloc ( name_length ) ;
if ( gst_bytestream_peek_bytes ( bs , & tmpname , name_length ) ! = name_length )
goto fail ;
name = g_memdup ( tmpname , name_length ) ;
gst_bytestream_flush_fast ( bs , name_length ) ;
/* Descriptor Value Data Type */
if ( ! _read_uint16 ( asf_demux , & datatype ) )
goto fail ;
/* Descriptor Value Length */
if ( ! _read_uint16 ( asf_demux , & value_length ) )
goto fail ;
/* Descriptor Value */
if ( gst_bytestream_peek_bytes ( bs , & tmpvalue , value_length ) ! = value_length )
goto fail ;
value = g_memdup ( tmpvalue , value_length ) ;
gst_bytestream_flush_fast ( bs , value_length ) ;
2005-01-06 12:41:13 +00:00
/* 0000 = Unicode String OR 0003 = DWORD */
if ( ( datatype = = 0 ) | | ( datatype = = 3 ) ) {
2005-01-05 21:46:19 +00:00
gsize in , out ;
2005-01-06 12:41:13 +00:00
guchar tag ;
2005-01-05 21:46:19 +00:00
guint16 j = 0 ;
/* convert to UTF-8 */
name =
g_convert ( name , name_length , " UTF-8 " , " UTF-16LE " , & in , & out , NULL ) ;
name [ out ] = 0 ;
while ( tags_label [ j ] ! = NULL ) {
2005-01-06 12:41:13 +00:00
if ( ! strcmp ( name , tags_label [ j ] ) ) {
2005-01-05 21:46:19 +00:00
tag = j ;
2005-01-06 12:41:13 +00:00
/* 0000 = UTF-16 String */
if ( datatype = = 0 ) {
/* convert to UTF-8 */
value =
g_convert ( value , value_length , " UTF-8 " , " UTF-16LE " , & in , & out ,
NULL ) ;
value [ out ] = 0 ;
2005-01-08 12:25:26 +00:00
/* get rid of tags with empty value */
if ( strlen ( value ) ) {
g_value_init ( & tag_value , G_TYPE_STRING ) ;
g_value_set_string ( & tag_value , value ) ;
}
2005-01-06 12:41:13 +00:00
}
/* 0003 = DWORD */
if ( datatype = = 3 ) {
g_value_init ( & tag_value , G_TYPE_INT ) ;
g_value_set_int ( & tag_value , GUINT32_FROM_LE ( ( guint32 ) * value ) ) ;
}
2005-01-08 15:30:33 +00:00
if ( G_IS_VALUE ( & tag_value ) ) {
gst_tag_list_add_values ( taglist , GST_TAG_MERGE_APPEND , tags [ tag ] ,
& tag_value , NULL ) ;
g_value_unset ( & tag_value ) ;
2005-01-06 12:41:13 +00:00
2005-01-08 15:30:33 +00:00
have_tags = TRUE ;
}
}
2005-01-05 21:46:19 +00:00
j + + ;
}
}
g_free ( name ) ;
g_free ( value ) ;
}
if ( have_tags ) {
2005-01-27 00:56:11 +00:00
gst_asf_demux_commit_taglist ( asf_demux , taglist ) ;
2005-01-05 21:46:19 +00:00
} else {
gst_tag_list_free ( taglist ) ;
}
return TRUE ;
fail :
2005-01-08 12:25:26 +00:00
if ( name ) {
g_free ( name ) ;
} ;
2005-01-05 21:46:19 +00:00
return FALSE ;
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_header ( GstASFDemux * asf_demux , guint64 * obj_size )
2002-10-17 21:41:47 +00:00
{
2004-01-27 01:27:04 +00:00
asf_obj_header object ;
2002-10-17 21:41:47 +00:00
guint32 i ;
/* Get the rest of the header's header */
2004-01-27 01:27:04 +00:00
_read_obj_header ( asf_demux , & object ) ;
2002-10-17 21:41:47 +00:00
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is a header with %u parts " , object . num_objects ) ;
2002-10-17 21:41:47 +00:00
2004-03-14 22:34:30 +00:00
/* Loop through the header's objects, processing those */
2004-01-27 01:27:04 +00:00
for ( i = 0 ; i < object . num_objects ; i + + ) {
2003-10-09 09:06:04 +00:00
if ( ! gst_asf_demux_process_object ( asf_demux ) ) {
2002-10-17 21:41:47 +00:00
return FALSE ;
}
}
return TRUE ;
}
2004-05-18 01:38:49 +00:00
static gboolean
gst_asf_demux_process_header_ext ( GstASFDemux * asf_demux , guint64 * obj_size )
{
asf_obj_header_ext object ;
guint64 original_offset ;
/* Get the rest of the header's header */
_read_obj_header_ext ( asf_demux , & object ) ;
GST_INFO ( " Object is an extended header with a size of %u bytes " ,
object . data_size ) ;
original_offset = asf_demux - > bs - > offset ;
while ( ( asf_demux - > bs - > offset - original_offset ) < object . data_size ) {
if ( ! gst_asf_demux_process_object ( asf_demux ) )
return FALSE ;
}
return TRUE ;
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_segment ( GstASFDemux * asf_demux ,
asf_packet_info * packet_info )
2002-10-17 21:41:47 +00:00
{
2004-03-14 22:34:30 +00:00
guint8 byte ;
2002-10-17 21:41:47 +00:00
gboolean key_frame ;
2004-03-14 22:34:30 +00:00
guint32 replic_size ;
guint8 time_delta ;
guint32 time_start ;
guint32 frag_size ;
guint32 rsize ;
2002-10-17 21:41:47 +00:00
asf_segment_info segment_info ;
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & byte ) ;
rsize = 1 ;
2004-01-27 01:27:04 +00:00
segment_info . stream_number = byte & 0x7f ;
key_frame = ( byte & 0x80 ) > > 7 ;
2004-03-14 22:34:30 +00:00
GST_INFO ( " Processing segment for stream %u " , segment_info . stream_number ) ;
segment_info . sequence =
_read_var_length ( asf_demux , packet_info - > seqtype , & rsize ) ;
segment_info . frag_offset =
_read_var_length ( asf_demux , packet_info - > fragoffsettype , & rsize ) ;
replic_size =
_read_var_length ( asf_demux , packet_info - > replicsizetype , & rsize ) ;
GST_DEBUG ( " sequence = %x, frag_offset = %x, replic_size = %x " ,
segment_info . sequence , segment_info . frag_offset , replic_size ) ;
2002-10-17 21:41:47 +00:00
if ( replic_size > 1 ) {
2004-01-27 01:27:04 +00:00
asf_replicated_data replicated_data_header ;
2002-10-17 21:41:47 +00:00
segment_info . compressed = FALSE ;
2004-03-14 22:34:30 +00:00
/* It's uncompressed with replic data */
2002-10-17 21:41:47 +00:00
if ( replic_size < 8 ) {
2004-03-14 22:34:30 +00:00
GST_ELEMENT_ERROR ( asf_demux , STREAM , DEMUX , ( NULL ) ,
2004-03-15 19:32:25 +00:00
( " The payload has replicated data but the size is less than 8 " ) ) ;
2002-10-17 21:41:47 +00:00
return FALSE ;
}
2004-01-27 01:27:04 +00:00
_read_replicated_data ( asf_demux , & replicated_data_header ) ;
segment_info . frag_timestamp = replicated_data_header . frag_timestamp ;
segment_info . segment_size = replicated_data_header . object_size ;
2002-10-17 21:41:47 +00:00
if ( replic_size > 8 ) {
2004-01-27 01:27:04 +00:00
gst_bytestream_flush ( asf_demux - > bs , replic_size - 8 ) ;
2002-10-17 21:41:47 +00:00
}
rsize + = replic_size ;
} else {
if ( replic_size = = 1 ) {
/* It's compressed */
segment_info . compressed = TRUE ;
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & time_delta ) ;
rsize + + ;
2003-06-29 19:46:09 +00:00
GST_DEBUG ( " time_delta %u " , time_delta ) ;
2002-10-17 21:41:47 +00:00
} else {
segment_info . compressed = FALSE ;
}
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
time_start = segment_info . frag_offset ;
segment_info . frag_offset = 0 ;
2003-01-23 11:15:49 +00:00
segment_info . frag_timestamp = asf_demux - > timestamp ;
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " multiple = %u compressed = %u " , packet_info - > multiple ,
segment_info . compressed ) ;
2002-10-17 21:41:47 +00:00
if ( packet_info - > multiple ) {
2004-01-27 01:27:04 +00:00
frag_size = _read_var_length ( asf_demux , packet_info - > segsizetype , & rsize ) ;
2002-10-17 21:41:47 +00:00
} else {
frag_size = packet_info - > size_left - rsize ;
}
packet_info - > size_left - = rsize ;
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " size left = %u frag size = %u rsize = %u " , packet_info - > size_left ,
frag_size , rsize ) ;
2002-10-17 21:41:47 +00:00
if ( segment_info . compressed ) {
while ( frag_size > 0 ) {
2004-03-14 22:34:30 +00:00
_read_uint8 ( asf_demux , & byte ) ;
2002-10-17 21:41:47 +00:00
packet_info - > size_left - - ;
2004-01-27 01:27:04 +00:00
segment_info . chunk_size = byte ;
2003-01-31 18:23:38 +00:00
segment_info . segment_size = segment_info . chunk_size ;
2002-10-17 21:41:47 +00:00
if ( segment_info . chunk_size > packet_info - > size_left ) {
2004-03-15 19:32:25 +00:00
GST_ELEMENT_ERROR ( asf_demux , STREAM , DEMUX , ( NULL ) ,
( " Payload chunk overruns packet size. " ) ) ;
return FALSE ;
2002-10-17 21:41:47 +00:00
}
2004-05-13 00:59:20 +00:00
if ( ! gst_asf_demux_process_chunk ( asf_demux , packet_info , & segment_info ) )
2004-05-16 16:22:42 +00:00
return FALSE ;
2002-10-17 21:41:47 +00:00
2004-09-22 07:55:36 +00:00
if ( segment_info . chunk_size < frag_size )
frag_size - = segment_info . chunk_size + 1 ;
else {
2006-01-20 14:18:20 +00:00
GST_ELEMENT_ERROR ( asf_demux , STREAM , DEMUX ,
( _ ( " Invalid data in stream " ) ) ,
2004-09-22 07:55:36 +00:00
( " Invalid fragment size indicator in segment " ) ) ;
return FALSE ;
}
2002-10-17 21:41:47 +00:00
}
} else {
segment_info . chunk_size = frag_size ;
2004-05-13 00:59:20 +00:00
if ( ! gst_asf_demux_process_chunk ( asf_demux , packet_info , & segment_info ) )
return FALSE ;
2002-10-17 21:41:47 +00:00
}
return TRUE ;
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_data ( GstASFDemux * asf_demux , guint64 * obj_size )
2002-10-17 21:41:47 +00:00
{
2004-03-14 22:34:30 +00:00
asf_obj_data object ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
/* Get the rest of the header */
_read_obj_data ( asf_demux , & object ) ;
GST_INFO ( " Object is data with % " G_GUINT64_FORMAT " packets " ,
object . packets ) ;
gst_element_no_more_pads ( GST_ELEMENT ( asf_demux ) ) ;
asf_demux - > state = GST_ASF_DEMUX_STATE_DATA ;
asf_demux - > packet = 0 ;
asf_demux - > num_packets = object . packets ;
asf_demux - > data_size = * obj_size ;
asf_demux - > data_offset = gst_bytestream_tell ( asf_demux - > bs ) ;
return TRUE ;
}
static gboolean
gst_asf_demux_handle_data ( GstASFDemux * asf_demux )
{
2004-01-27 01:27:04 +00:00
asf_obj_data_packet packet_properties_object ;
2004-03-14 22:34:30 +00:00
gboolean correction ;
guint8 buf ;
guint32 sequence ;
guint32 packet_length ;
guint16 duration ;
guint8 segment ;
guint8 segments ;
guint8 flags ;
guint8 property ;
asf_packet_info packet_info ;
guint32 rsize ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
gint n ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
/* handle seek, if any */
if ( GST_CLOCK_TIME_IS_VALID ( asf_demux - > seek_pending ) & &
asf_demux - > packet_size ! = 0 ) {
guint64 packet_seek = asf_demux - > num_packets *
asf_demux - > seek_pending / asf_demux - > play_time ;
2002-10-17 21:41:47 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( packet_seek > asf_demux - > num_packets )
packet_seek = asf_demux - > num_packets ;
2002-10-17 21:41:47 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( gst_bytestream_seek ( asf_demux - > bs , packet_seek *
asf_demux - > packet_size + asf_demux - > data_offset ,
GST_SEEK_METHOD_SET ) ) {
asf_demux - > packet = packet_seek ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
for ( n = 0 ; n < asf_demux - > num_streams ; n + + ) {
if ( asf_demux - > stream [ n ] . frag_offset > 0 ) {
gst_buffer_unref ( asf_demux - > stream [ n ] . payload ) ;
asf_demux - > stream [ n ] . frag_offset = 0 ;
}
}
asf_demux - > seek_discont = TRUE ;
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
asf_demux - > seek_pending = GST_CLOCK_TIME_NONE ;
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
GST_INFO ( " Process packet " ) ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( asf_demux - > packet + + > = asf_demux - > num_packets ) {
GstEvent * event ;
guint32 remaining ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
gst_bytestream_flush ( asf_demux - > bs , 0xFFFFFF ) ;
gst_bytestream_get_status ( asf_demux - > bs , & remaining , & event ) ;
if ( ! event | | GST_EVENT_TYPE ( event ) ! = GST_EVENT_EOS )
g_warning ( " No EOS " ) ;
if ( event )
gst_event_unref ( event ) ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
return gst_asf_demux_handle_sink_event ( asf_demux ,
gst_event_new ( GST_EVENT_EOS ) , 0 ) ;
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
_read_uint8 ( asf_demux , & buf ) ;
rsize = 1 ;
if ( buf & 0x80 ) {
asf_obj_data_correction correction_object ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
/* Uses error correction */
correction = TRUE ;
GST_DEBUG ( " Data has error correction (%x) " , buf ) ;
_read_obj_data_correction ( asf_demux , & correction_object ) ;
rsize + = 2 ;
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
/* Read the packet flags */
_read_obj_data_packet ( asf_demux , & packet_properties_object ) ;
rsize + = 2 ;
flags = packet_properties_object . flags ;
property = packet_properties_object . property ;
2004-03-14 22:34:30 +00:00
2005-02-08 13:38:11 +00:00
packet_length = _read_var_length ( asf_demux , ( flags > > 5 ) & 0x03 , & rsize ) ;
if ( packet_length = = 0 )
packet_length = asf_demux - > packet_size ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
packet_info . multiple = flags & 0x01 ;
sequence = _read_var_length ( asf_demux , ( flags > > 1 ) & 0x03 , & rsize ) ;
packet_info . padsize =
_read_var_length ( asf_demux , ( flags > > 3 ) & 0x03 , & rsize ) ;
2002-10-17 21:41:47 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
GST_DEBUG ( " Multiple = %u, Sequence = %u, Padsize = %u, Packet length = %u " ,
packet_info . multiple , sequence , packet_info . padsize , packet_length ) ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
/* Read the property flags */
packet_info . replicsizetype = property & 0x03 ;
packet_info . fragoffsettype = ( property > > 2 ) & 0x03 ;
packet_info . seqtype = ( property > > 4 ) & 0x03 ;
2002-10-17 21:41:47 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
_read_uint32 ( asf_demux , & asf_demux - > timestamp ) ;
_read_uint16 ( asf_demux , & duration ) ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
rsize + = 6 ;
2002-10-17 21:41:47 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
GST_DEBUG ( " Timestamp = %x, Duration = %x " , asf_demux - > timestamp , duration ) ;
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( packet_info . multiple ) {
/* There are multiple payloads */
_read_uint8 ( asf_demux , & buf ) ;
rsize + + ;
packet_info . segsizetype = ( buf > > 6 ) & 0x03 ;
segments = buf & 0x3f ;
} else {
packet_info . segsizetype = 2 ;
segments = 1 ;
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
packet_info . size_left = packet_length - packet_info . padsize - rsize ;
GST_DEBUG ( " rsize: %u size left: %u " , rsize , packet_info . size_left ) ;
for ( segment = 0 ; segment < segments ; segment + + ) {
if ( ! gst_asf_demux_process_segment ( asf_demux , & packet_info ) )
return FALSE ;
}
/* Skip the padding */
if ( packet_info . padsize > 0 )
gst_bytestream_flush ( asf_demux - > bs , packet_info . padsize ) ;
GST_DEBUG ( " Remaining size left: %u " , packet_info . size_left ) ;
if ( packet_info . size_left > 0 )
gst_bytestream_flush ( asf_demux - > bs , packet_info . size_left ) ;
2002-10-17 21:41:47 +00:00
return TRUE ;
}
2003-01-31 21:10:00 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_stream ( GstASFDemux * asf_demux , guint64 * obj_size )
2002-10-17 21:41:47 +00:00
{
2004-03-14 22:34:30 +00:00
asf_obj_stream object ;
guint32 stream_id ;
guint32 correction ;
asf_stream_audio audio_object ;
asf_stream_correction correction_object ;
asf_stream_video video_object ;
2004-01-27 01:27:04 +00:00
asf_stream_video_format video_format_object ;
2004-03-14 22:34:30 +00:00
guint16 size ;
guint16 id ;
2002-10-17 21:41:47 +00:00
/* Get the rest of the header's header */
2004-01-27 01:27:04 +00:00
_read_obj_stream ( asf_demux , & object ) ;
2002-10-17 21:41:47 +00:00
/* Identify the stream type */
2004-03-14 22:34:30 +00:00
stream_id =
gst_asf_demux_identify_guid ( asf_demux , asf_stream_guids , & ( object . type ) ) ;
correction =
gst_asf_demux_identify_guid ( asf_demux , asf_correction_guids ,
& ( object . correction ) ) ;
2004-01-27 01:27:04 +00:00
id = object . id ;
2002-10-17 21:41:47 +00:00
switch ( stream_id ) {
2004-03-14 22:34:30 +00:00
case ASF_STREAM_AUDIO :
_read_stream_audio ( asf_demux , & audio_object ) ;
size = audio_object . size ;
2002-10-17 21:41:47 +00:00
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is an audio stream with %u bytes of additional data. " ,
2004-03-15 19:32:25 +00:00
size ) ;
2003-01-31 18:23:38 +00:00
2004-03-14 22:34:30 +00:00
if ( ! gst_asf_demux_add_audio_stream ( asf_demux , & audio_object , id ) )
2004-03-15 19:32:25 +00:00
return FALSE ;
2003-01-31 18:23:38 +00:00
2004-03-14 22:34:30 +00:00
switch ( correction ) {
2004-03-15 19:32:25 +00:00
case ASF_CORRECTION_ON :
GST_INFO ( " Using error correction " ) ;
_read_stream_correction ( asf_demux , & correction_object ) ;
asf_demux - > span = correction_object . span ;
GST_DEBUG ( " Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d " ,
correction_object . packet_size , correction_object . chunk_size ,
correction_object . data_size , ( guint ) correction_object . span ,
( guint ) correction_object . silence_data ) ;
if ( asf_demux - > span > 1 ) {
if ( ! correction_object . chunk_size
| | ( ( correction_object . packet_size /
correction_object . chunk_size ) < = 1 ) )
/* Disable descrambling */
asf_demux - > span = 0 ;
} else {
/* Descambling is enabled */
asf_demux - > ds_packet_size = correction_object . packet_size ;
asf_demux - > ds_chunk_size = correction_object . chunk_size ;
}
/* Now skip the rest of the silence data */
if ( correction_object . data_size > 1 )
gst_bytestream_flush ( asf_demux - > bs ,
correction_object . data_size - 1 ) ;
break ;
case ASF_CORRECTION_OFF :
GST_INFO ( " Error correction off " ) ;
gst_bytestream_flush ( asf_demux - > bs , object . stream_specific_size ) ;
break ;
default :
GST_ELEMENT_ERROR ( asf_demux , STREAM , DEMUX , ( NULL ) ,
( " Audio stream using unknown error correction " ) ) ;
return FALSE ;
2003-01-31 18:23:38 +00:00
}
2002-10-17 21:41:47 +00:00
break ;
2004-03-14 22:34:30 +00:00
case ASF_STREAM_VIDEO :
_read_stream_video ( asf_demux , & video_object ) ;
2004-03-15 19:32:25 +00:00
size = video_object . size - 40 ; /* Byte order gets offset by single byte */
2004-03-14 22:34:30 +00:00
GST_INFO ( " Object is a video stream with %u bytes of additional data. " ,
2004-03-15 19:32:25 +00:00
size ) ;
2004-03-14 22:34:30 +00:00
_read_stream_video_format ( asf_demux , & video_format_object ) ;
if ( ! gst_asf_demux_add_video_stream ( asf_demux , & video_format_object , id ) )
2004-03-15 19:32:25 +00:00
return FALSE ;
2004-03-14 22:34:30 +00:00
break ;
default :
GST_ELEMENT_ERROR ( asf_demux , STREAM , WRONG_TYPE , ( NULL ) ,
2004-03-15 19:32:25 +00:00
( " unknown asf stream (id %08x) " , ( guint ) stream_id ) ) ;
2004-03-14 22:34:30 +00:00
return FALSE ;
2002-10-17 21:41:47 +00:00
}
return TRUE ;
}
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_skip_object ( GstASFDemux * asf_demux , guint64 * obj_size )
2002-10-17 21:41:47 +00:00
{
GstByteStream * bs = asf_demux - > bs ;
2004-03-14 22:34:30 +00:00
GST_INFO ( " Skipping object... " ) ;
2002-10-17 21:41:47 +00:00
gst_bytestream_flush ( bs , * obj_size - 24 ) ;
return TRUE ;
}
2003-01-31 21:10:00 +00:00
static inline gboolean
2004-03-14 22:34:30 +00:00
_read_object_header ( GstASFDemux * asf_demux , guint32 * obj_id ,
guint64 * obj_size )
2003-01-31 21:10:00 +00:00
{
2004-03-14 22:34:30 +00:00
ASFGuid guid ;
2003-01-31 21:10:00 +00:00
/* First get the GUID */
2004-01-27 01:27:04 +00:00
if ( ! _read_guid ( asf_demux , & guid ) )
2003-01-31 21:10:00 +00:00
return FALSE ;
2004-01-27 01:27:04 +00:00
* obj_id = gst_asf_demux_identify_guid ( asf_demux , asf_object_guids , & guid ) ;
2003-01-31 21:10:00 +00:00
2004-01-27 01:27:04 +00:00
if ( ! _read_uint64 ( asf_demux , obj_size ) )
2003-01-31 21:10:00 +00:00
return FALSE ;
2003-10-09 09:06:04 +00:00
if ( * obj_id = = ASF_OBJ_UNDEFINED ) {
2004-03-14 22:34:30 +00:00
GST_WARNING_OBJECT ( asf_demux ,
2004-03-15 19:32:25 +00:00
" Could not identify object (0x%08x/0x%08x/0x%08x/0x%08x) with size=%llu " ,
guid . v1 , guid . v2 , guid . v3 , guid . v4 , * obj_size ) ;
2003-10-09 09:06:04 +00:00
return TRUE ;
}
2004-03-14 22:34:30 +00:00
2003-01-31 21:10:00 +00:00
return TRUE ;
}
2002-10-17 21:41:47 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_process_object ( GstASFDemux * asf_demux )
{
2002-10-17 21:41:47 +00:00
guint32 obj_id ;
guint64 obj_size ;
2004-01-27 01:27:04 +00:00
if ( ! _read_object_header ( asf_demux , & obj_id , & obj_size ) ) {
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " ***** Error reading object at filepos % " G_GUINT64_FORMAT
2004-03-15 19:32:25 +00:00
" (EOS?) \n " , /**filepos*/ gst_bytestream_tell ( asf_demux - > bs ) ) ;
2004-03-14 22:34:30 +00:00
gst_asf_demux_handle_sink_event ( asf_demux , gst_event_new ( GST_EVENT_EOS ) ,
2004-03-15 19:32:25 +00:00
0 ) ;
2002-10-17 21:41:47 +00:00
return FALSE ;
}
2004-03-14 22:34:30 +00:00
GST_INFO ( " Found object %u with size % " G_GUINT64_FORMAT , obj_id , obj_size ) ;
2002-10-17 21:41:47 +00:00
2003-01-31 21:41:07 +00:00
switch ( obj_id ) {
2004-03-14 22:34:30 +00:00
case ASF_OBJ_STREAM :
return gst_asf_demux_process_stream ( asf_demux , & obj_size ) ;
case ASF_OBJ_DATA :
gst_asf_demux_process_data ( asf_demux , & obj_size ) ;
/* This is the last object */
return FALSE ;
case ASF_OBJ_FILE :
return gst_asf_demux_process_file ( asf_demux , & obj_size ) ;
case ASF_OBJ_HEADER :
return gst_asf_demux_process_header ( asf_demux , & obj_size ) ;
case ASF_OBJ_COMMENT :
return gst_asf_demux_process_comment ( asf_demux , & obj_size ) ;
case ASF_OBJ_HEAD1 :
2004-05-18 01:38:49 +00:00
return gst_asf_demux_process_header_ext ( asf_demux , & obj_size ) ;
2004-03-14 22:34:30 +00:00
case ASF_OBJ_BITRATE_PROPS :
return gst_asf_demux_process_bitrate_props_object ( asf_demux , & obj_size ) ;
2005-01-05 21:46:19 +00:00
case ASF_OBJ_EXT_CONTENT_DESC :
return gst_asf_demux_process_ext_content_desc ( asf_demux , & obj_size ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
case ASF_OBJ_CONCEAL_NONE :
case ASF_OBJ_HEAD2 :
2004-03-14 22:34:30 +00:00
case ASF_OBJ_UNDEFINED :
2004-05-18 01:38:49 +00:00
case ASF_OBJ_CODEC_COMMENT :
case ASF_OBJ_INDEX :
case ASF_OBJ_PADDING :
case ASF_OBJ_BITRATE_MUTEX :
case ASF_OBJ_LANGUAGE_LIST :
case ASF_OBJ_METADATA_OBJECT :
case ASF_OBJ_EXTENDED_STREAM_PROPS :
2004-03-14 22:34:30 +00:00
default :
2004-05-18 01:38:49 +00:00
/* unknown/unhandled object read, just ignore it, we hate fatal errors */
2004-03-14 22:34:30 +00:00
return gst_asf_demux_skip_object ( asf_demux , & obj_size ) ;
2002-10-17 21:41:47 +00:00
}
2003-01-23 11:15:49 +00:00
2002-10-17 21:41:47 +00:00
return TRUE ;
}
2003-01-31 18:23:38 +00:00
static asf_stream_context *
2004-03-14 22:34:30 +00:00
gst_asf_demux_get_stream ( GstASFDemux * asf_demux , guint16 id )
2003-01-31 18:23:38 +00:00
{
guint8 i ;
asf_stream_context * stream ;
for ( i = 0 ; i < asf_demux - > num_streams ; i + + ) {
stream = & asf_demux - > stream [ i ] ;
if ( stream - > id = = id ) {
/* We've found the one with the matching id */
return & asf_demux - > stream [ i ] ;
}
}
/* Base case if we haven't found one at all */
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
GST_WARNING_OBJECT ( asf_demux ,
" Segment found for undefined stream: (%d) " , id ) ;
2003-11-06 13:16:24 +00:00
2003-01-31 18:23:38 +00:00
return NULL ;
}
static inline void
2004-03-14 22:34:30 +00:00
gst_asf_demux_descramble_segment ( GstASFDemux * asf_demux ,
asf_segment_info * segment_info , asf_stream_context * stream )
{
2003-01-31 18:23:38 +00:00
GstBuffer * scrambled_buffer ;
GstBuffer * descrambled_buffer ;
GstBuffer * sub_buffer ;
2004-03-14 22:34:30 +00:00
guint offset ;
guint off ;
guint row ;
guint col ;
guint idx ;
2003-01-31 18:23:38 +00:00
/* descrambled_buffer is initialised in the first iteration */
descrambled_buffer = NULL ;
scrambled_buffer = stream - > payload ;
offset = 0 ;
2004-03-14 22:34:30 +00:00
for ( offset = 0 ; offset < segment_info - > segment_size ;
offset + = asf_demux - > ds_chunk_size ) {
2003-01-31 18:23:38 +00:00
off = offset / asf_demux - > ds_chunk_size ;
row = off / asf_demux - > span ;
col = off % asf_demux - > span ;
idx = row + col * asf_demux - > ds_packet_size / asf_demux - > ds_chunk_size ;
2004-03-14 22:34:30 +00:00
sub_buffer =
2004-03-15 19:32:25 +00:00
gst_buffer_create_sub ( scrambled_buffer , idx * asf_demux - > ds_chunk_size ,
asf_demux - > ds_chunk_size ) ;
2003-01-31 18:23:38 +00:00
if ( ! offset ) {
descrambled_buffer = sub_buffer ;
} else {
2004-03-06 01:25:57 +00:00
GstBuffer * newbuf ;
newbuf = gst_buffer_merge ( descrambled_buffer , sub_buffer ) ;
2003-01-31 18:23:38 +00:00
gst_buffer_unref ( sub_buffer ) ;
2004-03-06 01:25:57 +00:00
gst_buffer_unref ( descrambled_buffer ) ;
descrambled_buffer = newbuf ;
2003-01-31 18:23:38 +00:00
}
}
stream - > payload = descrambled_buffer ;
gst_buffer_unref ( scrambled_buffer ) ;
}
2004-03-14 22:34:30 +00:00
static gboolean
gst_asf_demux_process_chunk ( GstASFDemux * asf_demux ,
asf_packet_info * packet_info , asf_segment_info * segment_info )
2002-10-17 21:41:47 +00:00
{
asf_stream_context * stream ;
2004-03-14 22:34:30 +00:00
guint32 got_bytes ;
GstByteStream * bs = asf_demux - > bs ;
GstBuffer * buffer ;
2002-10-17 21:41:47 +00:00
2004-03-14 22:34:30 +00:00
if ( ! ( stream =
2004-03-15 19:32:25 +00:00
gst_asf_demux_get_stream ( asf_demux , segment_info - > stream_number ) ) )
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
goto done ;
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " Processing chunk of size %u (fo = %d) " , segment_info - > chunk_size ,
stream - > frag_offset ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( segment_info - > frag_offset = = 0 ) {
2002-10-17 21:41:47 +00:00
/* new packet */
stream - > sequence = segment_info - > sequence ;
2003-01-23 11:15:49 +00:00
asf_demux - > pts = segment_info - > frag_timestamp - asf_demux - > preroll ;
got_bytes = gst_bytestream_peek ( bs , & buffer , segment_info - > chunk_size ) ;
2004-10-29 17:27:43 +00:00
if ( got_bytes = = 0 )
goto done ;
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " BUFFER: Copied stream to buffer (%p - %d) " , buffer ,
2004-03-15 19:32:25 +00:00
GST_BUFFER_REFCOUNT_VALUE ( buffer ) ) ;
2003-01-23 11:15:49 +00:00
stream - > payload = buffer ;
2002-10-17 21:41:47 +00:00
} else {
2004-03-14 22:34:30 +00:00
GST_DEBUG
2004-03-15 19:32:25 +00:00
( " segment_info->sequence = %d, stream->sequence = %d, segment_info->frag_offset = %d, stream->frag_offset = %d " ,
segment_info - > sequence , stream - > sequence , segment_info - > frag_offset ,
stream - > frag_offset ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( segment_info - > sequence = = stream - > sequence & &
segment_info - > frag_offset = = stream - > frag_offset ) {
2003-01-23 11:15:49 +00:00
GstBuffer * new_buffer ;
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
/* continuing packet */
2004-03-14 22:34:30 +00:00
GST_INFO ( " A continuation packet " ) ;
2003-01-23 11:15:49 +00:00
got_bytes = gst_bytestream_peek ( bs , & buffer , segment_info - > chunk_size ) ;
2004-10-29 17:27:43 +00:00
if ( got_bytes = = 0 )
goto done ;
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " Copied stream to buffer (%p - %d) " , buffer ,
2004-03-15 19:32:25 +00:00
GST_BUFFER_REFCOUNT_VALUE ( buffer ) ) ;
2003-01-23 11:15:49 +00:00
new_buffer = gst_buffer_merge ( stream - > payload , buffer ) ;
2004-03-14 22:34:30 +00:00
GST_DEBUG
2004-03-15 19:32:25 +00:00
( " BUFFER: Merged new_buffer (%p - %d) from stream->payload(%p - %d) and buffer (%p - %d) " ,
new_buffer , GST_BUFFER_REFCOUNT_VALUE ( new_buffer ) , stream - > payload ,
GST_BUFFER_REFCOUNT_VALUE ( stream - > payload ) , buffer ,
GST_BUFFER_REFCOUNT_VALUE ( buffer ) ) ;
2003-01-31 18:23:38 +00:00
gst_buffer_unref ( stream - > payload ) ;
gst_buffer_unref ( buffer ) ;
2003-01-23 11:15:49 +00:00
stream - > payload = new_buffer ;
2002-10-17 21:41:47 +00:00
} else {
/* cannot continue current packet: free it */
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( stream - > frag_offset ! = 0 ) {
2004-03-15 19:32:25 +00:00
/* cannot create new packet */
GST_DEBUG ( " BUFFER: Freeing stream->payload (%p) " , stream - > payload ) ;
gst_buffer_unref ( stream - > payload ) ;
gst_bytestream_flush ( bs , segment_info - > chunk_size ) ;
packet_info - > size_left - = segment_info - > chunk_size ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
stream - > frag_offset = 0 ;
2002-10-17 21:41:47 +00:00
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
asf_demux - > pts = segment_info - > frag_timestamp - asf_demux - > preroll ;
goto done ;
//return TRUE;
//} else {
/* create new packet */
//stream->sequence = segment_info->sequence;
//}
2002-10-17 21:41:47 +00:00
}
}
2004-03-14 22:34:30 +00:00
stream - > frag_offset + = segment_info - > chunk_size ;
2003-01-31 18:23:38 +00:00
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " frag_offset = %d segment_size = %d " , stream - > frag_offset ,
segment_info - > segment_size ) ;
2003-01-31 18:23:38 +00:00
if ( stream - > frag_offset < segment_info - > segment_size ) {
2003-01-23 11:15:49 +00:00
/* We don't have the whole packet yet */
2004-10-25 09:01:43 +00:00
} else if ( got_bytes < segment_info - > chunk_size ) {
/* We didn't get the entire chunk, so don't push it down the pipeline. */
gst_buffer_unref ( stream - > payload ) ;
stream - > payload = NULL ;
stream - > frag_offset = 0 ;
2003-01-31 18:23:38 +00:00
} else {
/* We have the whole packet now so we should push the packet to
the src pad now . First though we should check if we need to do
descrambling */
if ( asf_demux - > span > 1 ) {
gst_asf_demux_descramble_segment ( asf_demux , segment_info , stream ) ;
}
2003-01-23 11:15:49 +00:00
if ( GST_PAD_IS_USABLE ( stream - > pad ) ) {
2004-03-14 22:34:30 +00:00
GST_DEBUG ( " New buffer is at: %p size: %u " ,
2004-03-15 19:32:25 +00:00
GST_BUFFER_DATA ( stream - > payload ) , GST_BUFFER_SIZE ( stream - > payload ) ) ;
2004-03-14 22:34:30 +00:00
GST_BUFFER_TIMESTAMP ( stream - > payload ) =
2004-03-15 19:32:25 +00:00
( GST_SECOND / 1000 ) * asf_demux - > pts ;
2003-01-23 11:15:49 +00:00
/*!!! Should handle flush events here? */
2004-05-18 01:38:49 +00:00
GST_DEBUG ( " Sending stream %d of size %d " , stream - > id ,
2004-03-15 19:32:25 +00:00
segment_info - > chunk_size ) ;
2004-03-14 22:34:30 +00:00
GST_INFO ( " Pushing pad " ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( asf_demux - > seek_discont ) {
if ( asf_demux - > seek_flush ) {
gst_pad_event_default ( asf_demux - > sinkpad ,
gst_event_new ( GST_EVENT_FLUSH ) ) ;
}
gst_pad_event_default ( asf_demux - > sinkpad ,
gst_event_new_discontinuous ( FALSE , GST_FORMAT_TIME ,
GST_BUFFER_TIMESTAMP ( stream - > payload ) , GST_FORMAT_UNDEFINED ) ) ;
asf_demux - > seek_discont = FALSE ;
}
2003-10-08 16:08:10 +00:00
gst_pad_push ( stream - > pad , GST_DATA ( stream - > payload ) ) ;
2004-09-22 07:55:36 +00:00
} else {
gst_buffer_unref ( stream - > payload ) ;
stream - > payload = NULL ;
2003-01-23 11:15:49 +00:00
}
2003-01-31 18:23:38 +00:00
stream - > frag_offset = 0 ;
2002-10-17 21:41:47 +00:00
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
done :
2004-03-14 22:34:30 +00:00
gst_bytestream_flush ( bs , segment_info - > chunk_size ) ;
2002-10-17 21:41:47 +00:00
packet_info - > size_left - = segment_info - > chunk_size ;
return TRUE ;
}
2003-01-23 11:15:49 +00:00
/*
* Event stuff
*/
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_handle_sink_event ( GstASFDemux * asf_demux ,
GstEvent * event , guint32 remaining )
2003-01-23 11:15:49 +00:00
{
2004-01-27 01:53:27 +00:00
gboolean ret = TRUE ;
2003-11-05 23:14:52 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
if ( ! event ) {
GST_ELEMENT_ERROR ( asf_demux , RESOURCE , READ , ( NULL ) , ( NULL ) ) ;
return FALSE ;
}
2004-03-14 22:34:30 +00:00
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
switch ( GST_EVENT_TYPE ( event ) ) {
case GST_EVENT_EOS :
gst_pad_event_default ( asf_demux - > sinkpad , event ) ;
return FALSE ;
2003-01-23 11:15:49 +00:00
case GST_EVENT_DISCONTINUOUS :
{
gint i ;
GstEvent * discont ;
for ( i = 0 ; i < asf_demux - > num_streams ; i + + ) {
2004-03-15 19:32:25 +00:00
asf_stream_context * stream = & asf_demux - > stream [ i ] ;
if ( GST_PAD_IS_USABLE ( stream - > pad ) ) {
2004-05-05 11:29:48 +00:00
GST_DEBUG ( " sending discont on stream %d with % " GST_TIME_FORMAT
" + % " GST_TIME_FORMAT " = % " GST_TIME_FORMAT ,
i , GST_TIME_ARGS ( asf_demux - > last_seek ) ,
GST_TIME_ARGS ( stream - > delay ) ,
GST_TIME_ARGS ( asf_demux - > last_seek + stream - > delay ) ) ;
2004-03-15 19:32:25 +00:00
discont =
gst_event_new_discontinuous ( FALSE , GST_FORMAT_TIME ,
asf_demux - > last_seek + stream - > delay , NULL ) ;
gst_pad_push ( stream - > pad , GST_DATA ( discont ) ) ;
}
2003-01-23 11:15:49 +00:00
}
break ;
}
2004-01-15 02:14:54 +00:00
case GST_EVENT_FLUSH :
GST_WARNING_OBJECT ( asf_demux , " flush event " ) ;
break ;
2003-01-23 11:15:49 +00:00
default :
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
GST_WARNING_OBJECT ( asf_demux , " unhandled event %d " ,
GST_EVENT_TYPE ( event ) ) ;
2004-09-22 07:55:36 +00:00
ret = FALSE ;
2003-01-23 11:15:49 +00:00
break ;
}
gst_event_unref ( event ) ;
2004-01-27 01:53:27 +00:00
return ret ;
2003-01-23 11:15:49 +00:00
}
2002-10-17 21:41:47 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_handle_src_event ( GstPad * pad , GstEvent * event )
2002-10-17 21:41:47 +00:00
{
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
gboolean res = TRUE ;
GstASFDemux * asf_demux = GST_ASF_DEMUX ( gst_pad_get_parent ( pad ) ) ;
2003-06-29 19:46:09 +00:00
GST_DEBUG ( " asfdemux: handle_src_event " ) ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
switch ( GST_EVENT_TYPE ( event ) ) {
case GST_EVENT_SEEK :
switch ( GST_EVENT_SEEK_FORMAT ( event ) ) {
case GST_FORMAT_BYTES :
case GST_FORMAT_DEFAULT :
res = FALSE ;
break ;
case GST_FORMAT_TIME :
asf_demux - > seek_pending = GST_EVENT_SEEK_OFFSET ( event ) ;
asf_demux - > seek_flush = ( GST_EVENT_SEEK_FLAGS ( event ) &
GST_SEEK_FLAG_FLUSH ) ? TRUE : FALSE ;
break ;
default :
res = FALSE ;
break ;
}
break ;
default :
res = FALSE ;
break ;
}
return res ;
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
static const GstEventMask *
gst_asf_demux_get_src_event_mask ( GstPad * pad )
{
2002-10-17 21:41:47 +00:00
static const GstEventMask masks [ ] = {
2004-03-14 22:34:30 +00:00
{ GST_EVENT_SEEK , GST_SEEK_METHOD_SET | GST_SEEK_FLAG_KEY_UNIT } ,
{ 0 , }
2002-10-17 21:41:47 +00:00
} ;
return masks ;
}
2004-03-14 22:34:30 +00:00
static const GstFormat *
gst_asf_demux_get_src_formats ( GstPad * pad )
{
2002-10-17 21:41:47 +00:00
static const GstFormat formats [ ] = {
GST_FORMAT_TIME ,
0
} ;
2004-03-15 19:32:25 +00:00
2002-10-17 21:41:47 +00:00
return formats ;
}
2004-03-14 22:34:30 +00:00
static const GstQueryType *
gst_asf_demux_get_src_query_types ( GstPad * pad )
{
2002-12-30 17:53:18 +00:00
static const GstQueryType types [ ] = {
GST_QUERY_TOTAL ,
GST_QUERY_POSITION ,
2002-10-17 21:41:47 +00:00
0
} ;
return types ;
}
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_handle_src_query ( GstPad * pad ,
GstQueryType type , GstFormat * format , gint64 * value )
2002-10-17 21:41:47 +00:00
{
GstASFDemux * asf_demux ;
gboolean res = TRUE ;
asf_demux = GST_ASF_DEMUX ( gst_pad_get_parent ( pad ) ) ;
switch ( type ) {
2004-03-14 22:34:30 +00:00
case GST_QUERY_TOTAL :
switch ( * format ) {
2004-03-15 19:32:25 +00:00
case GST_FORMAT_DEFAULT :
* format = GST_FORMAT_TIME ;
/* fall through */
case GST_FORMAT_TIME :
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
* value = asf_demux - > play_time ;
2004-03-15 19:32:25 +00:00
break ;
default :
res = FALSE ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
break ;
2004-03-14 22:34:30 +00:00
}
2002-10-17 21:41:47 +00:00
break ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
2004-03-14 22:34:30 +00:00
case GST_QUERY_POSITION :
switch ( * format ) {
2004-03-15 19:32:25 +00:00
case GST_FORMAT_DEFAULT :
* format = GST_FORMAT_TIME ;
/* fall through */
case GST_FORMAT_TIME :
* value = ( GST_SECOND / 1000 ) * asf_demux - > timestamp ;
break ;
default :
res = FALSE ;
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
break ;
2004-03-14 22:34:30 +00:00
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
break ;
2002-10-17 21:41:47 +00:00
default :
res = FALSE ;
break ;
}
return res ;
}
static void
2004-03-14 22:34:30 +00:00
gst_asf_demux_get_property ( GObject * object ,
guint prop_id , GValue * value , GParamSpec * pspec )
2002-10-17 21:41:47 +00:00
{
GstASFDemux * src ;
g_return_if_fail ( GST_IS_ASF_DEMUX ( object ) ) ;
src = GST_ASF_DEMUX ( object ) ;
switch ( prop_id ) {
default :
break ;
}
}
2005-09-02 15:43:54 +00:00
static GstStateChangeReturn
gst_asf_demux_change_state ( GstElement * element , GstStateChange transition )
2004-03-14 22:34:30 +00:00
{
2002-10-17 21:41:47 +00:00
GstASFDemux * asf_demux = GST_ASF_DEMUX ( element ) ;
gint i ;
2004-03-14 22:34:30 +00:00
2005-09-02 15:43:54 +00:00
switch ( transition ) {
case GST_STATE_CHANGE_READY_TO_PAUSED :
2002-10-17 21:41:47 +00:00
asf_demux - > bs = gst_bytestream_new ( asf_demux - > sinkpad ) ;
2003-01-23 11:15:49 +00:00
asf_demux - > last_seek = 0 ;
2002-10-17 21:41:47 +00:00
break ;
2005-09-02 15:43:54 +00:00
case GST_STATE_CHANGE_PAUSED_TO_READY :
2002-10-17 21:41:47 +00:00
gst_bytestream_destroy ( asf_demux - > bs ) ;
2004-03-14 22:34:30 +00:00
for ( i = 0 ; i < GST_ASF_DEMUX_NUM_VIDEO_PADS ; i + + ) {
2004-03-15 19:32:25 +00:00
asf_demux - > video_PTS [ i ] = 0 ;
2002-10-17 21:41:47 +00:00
}
2004-03-14 22:34:30 +00:00
for ( i = 0 ; i < GST_ASF_DEMUX_NUM_AUDIO_PADS ; i + + ) {
2004-03-15 19:32:25 +00:00
asf_demux - > audio_PTS [ i ] = 0 ;
2002-10-17 21:41:47 +00:00
}
2005-01-27 00:56:11 +00:00
if ( asf_demux - > taglist ) {
gst_tag_list_free ( asf_demux - > taglist ) ;
asf_demux - > taglist = NULL ;
}
gst/asfdemux/gstasfdemux.*: You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this feels like. I think we...
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),
(gst_asf_demux_loop), (gst_asf_demux_process_file),
(gst_asf_demux_process_data), (gst_asf_demux_handle_data),
(gst_asf_demux_process_object), (gst_asf_demux_get_stream),
(gst_asf_demux_process_chunk), (gst_asf_demux_handle_sink_event),
(gst_asf_demux_handle_src_event), (gst_asf_demux_handle_src_query),
(gst_asf_demux_change_state):
* gst/asfdemux/gstasfdemux.h:
You know Chimaira? "I - HATE - EVERYTHING". Yeah, that's what this
feels like. I think we should set a new requirement for demuxers
from now on to implement sane loop functions, data loops, query
and seek functions before first commit into CVS. And this commit
fixes all of the above.
2004-06-10 04:23:03 +00:00
asf_demux - > state = GST_ASF_DEMUX_STATE_HEADER ;
asf_demux - > seek_pending = GST_CLOCK_TIME_NONE ;
asf_demux - > seek_discont = FALSE ;
2002-10-17 21:41:47 +00:00
break ;
2005-09-02 15:43:54 +00:00
case GST_STATE_CHANGE_READY_TO_NULL :
2002-10-17 21:41:47 +00:00
break ;
default :
break ;
}
2005-09-02 15:43:54 +00:00
return GST_ELEMENT_CLASS ( parent_class ) - > change_state ( element , transition ) ;
2002-10-17 21:41:47 +00:00
}
static guint32
2004-03-14 22:34:30 +00:00
gst_asf_demux_identify_guid ( GstASFDemux * asf_demux ,
ASFGuidHash * guids , ASFGuid * guid )
2002-10-17 21:41:47 +00:00
{
guint32 i ;
2004-03-14 22:34:30 +00:00
GST_LOG_OBJECT ( asf_demux , " identifying 0x%08x/0x%08x/0x%08x/0x%08x " ,
guid - > v1 , guid - > v2 , guid - > v3 , guid - > v4 ) ;
2002-10-17 21:41:47 +00:00
i = 0 ;
while ( guids [ i ] . obj_id ! = ASF_OBJ_UNDEFINED ) {
2004-01-27 01:27:04 +00:00
if ( guids [ i ] . guid . v1 = = guid - > v1 & &
2004-03-15 19:32:25 +00:00
guids [ i ] . guid . v2 = = guid - > v2 & &
guids [ i ] . guid . v3 = = guid - > v3 & & guids [ i ] . guid . v4 = = guid - > v4 ) {
2002-10-17 21:41:47 +00:00
return guids [ i ] . obj_id ;
}
i + + ;
}
2004-03-14 22:34:30 +00:00
2002-10-17 21:41:47 +00:00
/* The base case if none is found */
return ASF_OBJ_UNDEFINED ;
}
2004-03-14 22:34:30 +00:00
static gboolean
gst_asf_demux_add_audio_stream ( GstASFDemux * asf_demux ,
asf_stream_audio * audio , guint16 id )
2003-01-23 11:15:49 +00:00
{
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
GstPad * src_pad ;
GstCaps * caps ;
gchar * name = NULL ;
guint16 size_left = 0 ;
char * codec_name = NULL ;
GstTagList * list = gst_tag_list_new ( ) ;
2004-10-01 10:50:57 +00:00
GstBuffer * extradata = NULL ;
2004-03-14 22:34:30 +00:00
2004-01-27 01:27:04 +00:00
size_left = audio - > size ;
2003-01-23 11:15:49 +00:00
/* Create the audio pad */
name = g_strdup_printf ( " audio_%02d " , asf_demux - > num_audio_streams ) ;
2003-11-05 23:14:52 +00:00
2003-07-06 20:49:50 +00:00
src_pad = gst_pad_new_from_template ( audiosrctempl , name ) ;
g_free ( name ) ;
2003-01-23 11:15:49 +00:00
2004-01-02 07:09:23 +00:00
gst_pad_use_explicit_caps ( src_pad ) ;
2004-05-16 22:18:11 +00:00
/* Swallow up any left over data and set up the standard properties from the header info */
2003-11-05 23:14:52 +00:00
if ( size_left ) {
2004-03-14 22:34:30 +00:00
GST_WARNING_OBJECT ( asf_demux ,
2004-05-16 22:18:11 +00:00
" asfdemux: Audio header contains %d bytes of codec specific data " ,
size_left ) ;
2004-10-01 10:50:57 +00:00
gst_bytestream_peek ( asf_demux - > bs , & extradata , size_left ) ;
2004-01-27 01:27:04 +00:00
gst_bytestream_flush ( asf_demux - > bs , size_left ) ;
2003-11-05 23:14:52 +00:00
}
2004-10-01 10:50:57 +00:00
/* asf_stream_audio is the same as gst_riff_strf_auds, but with an
* additional two bytes indicating extradata . */
caps = gst_riff_create_audio_caps_with_data ( audio - > codec_tag ,
NULL , ( gst_riff_strf_auds * ) audio , extradata , NULL , & codec_name ) ;
2004-03-14 22:34:30 +00:00
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
/* Informing about that audio format we just added */
gst_tag_list_add ( list , GST_TAG_MERGE_APPEND , GST_TAG_AUDIO_CODEC ,
2004-03-14 22:34:30 +00:00
codec_name , NULL ) ;
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
gst_element_found_tags ( GST_ELEMENT ( asf_demux ) , list ) ;
2004-10-01 10:50:57 +00:00
g_free ( codec_name ) ;
if ( extradata )
gst_buffer_unref ( extradata ) ;
2004-03-14 22:34:30 +00:00
2003-07-06 20:49:50 +00:00
GST_INFO ( " Adding audio stream %u codec %u (0x%x) " ,
2004-03-14 22:34:30 +00:00
asf_demux - > num_video_streams , audio - > codec_tag , audio - > codec_tag ) ;
2003-01-23 11:15:49 +00:00
2003-11-05 23:14:52 +00:00
asf_demux - > num_audio_streams + + ;
2003-01-31 18:23:38 +00:00
2005-01-27 00:56:11 +00:00
if ( ! gst_asf_demux_setup_pad ( asf_demux , src_pad , caps , id ) )
return FALSE ;
gst_pad_push ( src_pad , GST_DATA ( gst_event_new_tag ( list ) ) ) ;
return TRUE ;
2003-07-06 20:49:50 +00:00
}
2003-01-23 11:15:49 +00:00
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_add_video_stream ( GstASFDemux * asf_demux ,
asf_stream_video_format * video , guint16 id )
{
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
GstPad * src_pad ;
GstCaps * caps ;
gchar * name = NULL ;
char * codec_name = NULL ;
GstTagList * list = gst_tag_list_new ( ) ;
ext/mad/gstmad.c: Allow for mp3 rate/channels changes. However, only very conservatively. Reason that we *have* to en...
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_check_caps_reset),
(gst_mad_change_state):
Allow for mp3 rate/channels changes. However, only very
conservatively. Reason that we *have* to enable this is smiply
because the mad find_sync() function is not good enough, it will
regularly sync on random data as valid frames and therefore make
us provide random caps as *final* caps of the stream. The best fix
I could think of is to simply require several of the same stream
changes in a row before we change caps.
The actual testcase that works now is #
* ext/ogg/Makefile.am:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstogmparse.c:
OGM support (video only for now; I need an audio sample file).
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_process_stream), (gst_asf_demux_video_caps),
(gst_asf_demux_add_video_stream):
WMV extradata.
* gst/playback/gstplaybasebin.c: (unknown_type):
Don't error out on single unknown-types after all. It's wrong.
If we found type of video and audio but not of a subtitle stream,
it will still error out (which is unwanted). Will find a better fix
later on.
* gst/typefind/gsttypefindfunctions.c: (ogmvideo_type_find),
(ogmaudio_type_find), (plugin_init):
OGM support.
2004-09-20 12:40:40 +00:00
gint size_left = video - > size - 40 ;
2004-10-01 10:50:57 +00:00
GstBuffer * extradata = NULL ;
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
2003-01-23 11:15:49 +00:00
/* Create the audio pad */
name = g_strdup_printf ( " video_%02d " , asf_demux - > num_video_streams ) ;
2003-07-06 20:49:50 +00:00
src_pad = gst_pad_new_from_template ( videosrctempl , name ) ;
g_free ( name ) ;
2003-01-23 11:15:49 +00:00
/* Now try some gstreamer formatted MIME types (from gst_avi_demux_strf_vids) */
ext/mad/gstmad.c: Allow for mp3 rate/channels changes. However, only very conservatively. Reason that we *have* to en...
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_check_caps_reset),
(gst_mad_change_state):
Allow for mp3 rate/channels changes. However, only very
conservatively. Reason that we *have* to enable this is smiply
because the mad find_sync() function is not good enough, it will
regularly sync on random data as valid frames and therefore make
us provide random caps as *final* caps of the stream. The best fix
I could think of is to simply require several of the same stream
changes in a row before we change caps.
The actual testcase that works now is #
* ext/ogg/Makefile.am:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstogmparse.c:
OGM support (video only for now; I need an audio sample file).
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_process_stream), (gst_asf_demux_video_caps),
(gst_asf_demux_add_video_stream):
WMV extradata.
* gst/playback/gstplaybasebin.c: (unknown_type):
Don't error out on single unknown-types after all. It's wrong.
If we found type of video and audio but not of a subtitle stream,
it will still error out (which is unwanted). Will find a better fix
later on.
* gst/typefind/gsttypefindfunctions.c: (ogmvideo_type_find),
(ogmaudio_type_find), (plugin_init):
OGM support.
2004-09-20 12:40:40 +00:00
if ( size_left ) {
2004-10-01 10:50:57 +00:00
GST_LOG_OBJECT ( asf_demux ,
ext/mad/gstmad.c: Allow for mp3 rate/channels changes. However, only very conservatively. Reason that we *have* to en...
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_check_caps_reset),
(gst_mad_change_state):
Allow for mp3 rate/channels changes. However, only very
conservatively. Reason that we *have* to enable this is smiply
because the mad find_sync() function is not good enough, it will
regularly sync on random data as valid frames and therefore make
us provide random caps as *final* caps of the stream. The best fix
I could think of is to simply require several of the same stream
changes in a row before we change caps.
The actual testcase that works now is #
* ext/ogg/Makefile.am:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstogmparse.c:
OGM support (video only for now; I need an audio sample file).
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_process_stream), (gst_asf_demux_video_caps),
(gst_asf_demux_add_video_stream):
WMV extradata.
* gst/playback/gstplaybasebin.c: (unknown_type):
Don't error out on single unknown-types after all. It's wrong.
If we found type of video and audio but not of a subtitle stream,
it will still error out (which is unwanted). Will find a better fix
later on.
* gst/typefind/gsttypefindfunctions.c: (ogmvideo_type_find),
(ogmaudio_type_find), (plugin_init):
OGM support.
2004-09-20 12:40:40 +00:00
" asfdemux: Video header contains %d bytes of codec specific data " ,
size_left ) ;
2004-10-01 10:50:57 +00:00
gst_bytestream_peek ( asf_demux - > bs , & extradata , size_left ) ;
ext/mad/gstmad.c: Allow for mp3 rate/channels changes. However, only very conservatively. Reason that we *have* to en...
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_check_caps_reset),
(gst_mad_change_state):
Allow for mp3 rate/channels changes. However, only very
conservatively. Reason that we *have* to enable this is smiply
because the mad find_sync() function is not good enough, it will
regularly sync on random data as valid frames and therefore make
us provide random caps as *final* caps of the stream. The best fix
I could think of is to simply require several of the same stream
changes in a row before we change caps.
The actual testcase that works now is #
* ext/ogg/Makefile.am:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstogmparse.c:
OGM support (video only for now; I need an audio sample file).
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_process_stream), (gst_asf_demux_video_caps),
(gst_asf_demux_add_video_stream):
WMV extradata.
* gst/playback/gstplaybasebin.c: (unknown_type):
Don't error out on single unknown-types after all. It's wrong.
If we found type of video and audio but not of a subtitle stream,
it will still error out (which is unwanted). Will find a better fix
later on.
* gst/typefind/gsttypefindfunctions.c: (ogmvideo_type_find),
(ogmaudio_type_find), (plugin_init):
OGM support.
2004-09-20 12:40:40 +00:00
gst_bytestream_flush ( asf_demux - > bs , size_left ) ;
}
2004-10-01 10:50:57 +00:00
/* yes, asf_stream_video_format and gst_riff_strf_vids are the same */
caps = gst_riff_create_video_caps_with_data ( video - > tag , NULL ,
( gst_riff_strf_vids * ) video , extradata , NULL , & codec_name ) ;
gst_caps_set_simple ( caps , " framerate " , G_TYPE_DOUBLE , 25.0 , NULL ) ;
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
gst_tag_list_add ( list , GST_TAG_MERGE_APPEND , GST_TAG_VIDEO_CODEC ,
2004-03-14 22:34:30 +00:00
codec_name , NULL ) ;
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
gst_element_found_tags ( GST_ELEMENT ( asf_demux ) , list ) ;
2004-10-01 10:50:57 +00:00
g_free ( codec_name ) ;
if ( extradata )
gst_buffer_unref ( extradata ) ;
2005-11-21 14:08:45 +00:00
GST_INFO ( " Adding video stream %u codec % " GST_FOURCC_FORMAT " (0x%08x) " ,
2004-03-14 22:34:30 +00:00
asf_demux - > num_video_streams , GST_FOURCC_ARGS ( video - > tag ) , video - > tag ) ;
2003-01-23 11:15:49 +00:00
asf_demux - > num_video_streams + + ;
2003-11-05 23:14:52 +00:00
2005-01-27 00:56:11 +00:00
if ( ! gst_asf_demux_setup_pad ( asf_demux , src_pad , caps , id ) )
return FALSE ;
gst_pad_push ( src_pad , GST_DATA ( gst_event_new_tag ( list ) ) ) ;
return TRUE ;
2003-01-23 11:15:49 +00:00
}
static gboolean
2004-03-14 22:34:30 +00:00
gst_asf_demux_setup_pad ( GstASFDemux * asf_demux ,
GstPad * src_pad , GstCaps * caps , guint16 id )
2003-01-23 11:15:49 +00:00
{
asf_stream_context * stream ;
2003-11-05 23:14:52 +00:00
2004-03-14 03:31:51 +00:00
gst_pad_use_explicit_caps ( src_pad ) ;
2004-01-02 07:09:23 +00:00
gst_pad_set_explicit_caps ( src_pad , caps ) ;
2003-01-23 11:15:49 +00:00
gst_pad_set_formats_function ( src_pad , gst_asf_demux_get_src_formats ) ;
gst_pad_set_event_mask_function ( src_pad , gst_asf_demux_get_src_event_mask ) ;
gst_pad_set_event_function ( src_pad , gst_asf_demux_handle_src_event ) ;
gst_pad_set_query_type_function ( src_pad , gst_asf_demux_get_src_query_types ) ;
gst_pad_set_query_function ( src_pad , gst_asf_demux_handle_src_query ) ;
2004-03-14 22:34:30 +00:00
2003-01-23 11:15:49 +00:00
stream = & asf_demux - > stream [ asf_demux - > num_streams ] ;
stream - > pad = src_pad ;
2003-01-31 18:23:38 +00:00
stream - > id = id ;
2003-01-23 11:15:49 +00:00
stream - > frag_offset = 0 ;
stream - > sequence = 0 ;
stream - > delay = 0LL ;
gst_pad_set_element_private ( src_pad , stream ) ;
2004-03-14 22:34:30 +00:00
GST_INFO ( " Adding pad for stream %u " , asf_demux - > num_streams ) ;
2003-01-23 11:15:49 +00:00
asf_demux - > num_streams + + ;
2004-03-14 22:34:30 +00:00
2003-01-23 11:15:49 +00:00
gst_element_add_pad ( GST_ELEMENT ( asf_demux ) , src_pad ) ;
2004-03-14 22:34:30 +00:00
2005-01-27 00:56:11 +00:00
if ( asf_demux - > taglist ) {
gst_pad_push ( src_pad ,
GST_DATA ( gst_event_new_tag ( gst_tag_list_copy ( asf_demux - > taglist ) ) ) ) ;
}
2003-01-23 11:15:49 +00:00
return TRUE ;
}