Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gst-plugins-base
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sebastian Dröge
gst-plugins-base
Commits
0ba57f58
Commit
0ba57f58
authored
May 09, 2005
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port to new query API.
Original commit message from CVS: Port to new query API. Updated seek. Cleanups in x[v]imagesink
parent
276f6fe5
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
534 additions
and
425 deletions
+534
-425
ChangeLog
ChangeLog
+51
-0
examples/seeking/seek.c
examples/seeking/seek.c
+36
-94
ext/ogg/gstoggdemux.c
ext/ogg/gstoggdemux.c
+36
-45
ext/ogg/gstoggmux.c
ext/ogg/gstoggmux.c
+2
-1
ext/ogg/gstogmparse.c
ext/ogg/gstogmparse.c
+46
-17
ext/theora/theoradec.c
ext/theora/theoradec.c
+109
-33
ext/vorbis/vorbisdec.c
ext/vorbis/vorbisdec.c
+99
-24
ext/vorbis/vorbisenc.c
ext/vorbis/vorbisenc.c
+58
-25
gst/playback/gstplaybin.c
gst/playback/gstplaybin.c
+7
-38
gst/playback/test3.c
gst/playback/test3.c
+1
-2
gst/sine/gstsinesrc.c
gst/sine/gstsinesrc.c
+18
-9
gst/subparse/gstsubparse.c
gst/subparse/gstsubparse.c
+4
-3
gst/videotestsrc/gstvideotestsrc.c
gst/videotestsrc/gstvideotestsrc.c
+21
-10
gst/videotestsrc/videotestsrc.c
gst/videotestsrc/videotestsrc.c
+10
-0
sys/ximage/ximagesink.c
sys/ximage/ximagesink.c
+0
-30
tests/examples/seek/seek.c
tests/examples/seek/seek.c
+36
-94
No files found.
ChangeLog
View file @
0ba57f58
2005-05-09 Wim Taymans <wim@fluendo.com>
* examples/seeking/seek.c: (make_theora_pipeline),
(make_vorbis_theora_pipeline), (make_avi_msmpeg4v3_mp3_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (play_cb), (pause_cb), (stop_cb), (main):
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_pad_query_types), (gst_ogg_pad_src_query),
(gst_ogg_pad_typefind), (gst_ogg_demux_init),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_sink_activate):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_init),
(gst_ogg_mux_request_new_pad), (gst_ogg_mux_next_buffer),
(gst_ogg_mux_push_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_get_headers), (gst_ogg_mux_send_headers),
(gst_ogg_mux_collected), (gst_ogg_mux_change_state):
* ext/ogg/gstogmparse.c: (gst_ogm_audio_parse_init),
(gst_ogm_video_parse_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (gst_theora_dec_init), (_inc_granulepos),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_sink_query),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_src_query),
(gst_vorbisenc_sink_query), (gst_vorbisenc_init),
(gst_vorbisenc_sink_event), (gst_vorbisenc_chain):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init),
(gst_play_bin_query):
* gst/playback/test3.c: (update_scale):
* gst/sine/gstsinesrc.c: (gst_sinesrc_setcaps),
(gst_sinesrc_src_query), (gst_sinesrc_create), (gst_sinesrc_start):
* gst/subparse/gstsubparse.c: (gst_subparse_init):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_init),
(gst_videotestsrc_src_query):
* gst/videotestsrc/videotestsrc.c: (paint_hline_I420),
(paint_hline_Y41B), (paint_hline_Y42B), (paint_hline_Y800),
(paint_hline_YUV9):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame):
Port to new query API.
Updated seek.
Cleanups in x[v]imagesink
2005-05-09 Andy Wingo <wingo@pobox.com>
* ext/alsa/gstalsasink.h:
...
...
examples/seeking/seek.c
View file @
0ba57f58
...
...
@@ -9,7 +9,8 @@ static GList *rate_pads = NULL;
static
GList
*
seekable_elements
=
NULL
;
static
GstElement
*
pipeline
;
static
guint64
duration
;
static
gint64
position
;
static
gint64
duration
;
static
GtkAdjustment
*
adjustment
;
static
GtkWidget
*
hscale
;
static
gboolean
stats
=
FALSE
;
...
...
@@ -24,6 +25,9 @@ static gulong changed_id;
#define SOURCE "gnomevfssrc"
#define ASINK "alsasink"
//#define ASINK "osssink"
#define VSINK "xvimagesink"
//#define VSINK "ximagesink"
//#define VSINK "aasink"
#define UPDATE_INTERVAL 500
...
...
@@ -334,7 +338,7 @@ make_theora_pipeline (const gchar * location)
queue
=
gst_element_factory_make_or_warn
(
"queue"
,
"queue"
);
decoder
=
gst_element_factory_make_or_warn
(
"theoradec"
,
"decoder"
);
convert
=
gst_element_factory_make_or_warn
(
"ffmpegcolorspace"
,
"convert"
);
videosink
=
gst_element_factory_make_or_warn
(
"xvimagesink"
,
"sink"
);
videosink
=
gst_element_factory_make_or_warn
(
VSINK
,
"sink"
);
g_object_set
(
G_OBJECT
(
src
),
"location"
,
location
,
NULL
);
...
...
@@ -407,7 +411,7 @@ make_vorbis_theora_pipeline (const gchar * location)
v_decoder
=
gst_element_factory_make_or_warn
(
"theoradec"
,
"v_dec"
);
v_convert
=
gst_element_factory_make_or_warn
(
"ffmpegcolorspace"
,
"v_convert"
);
videosink
=
gst_element_factory_make_or_warn
(
"xvimagesink"
,
"v_sink"
);
videosink
=
gst_element_factory_make_or_warn
(
VSINK
,
"v_sink"
);
gst_element_link_many
(
v_queue
,
v_decoder
,
v_convert
,
videosink
,
NULL
);
gst_bin_add
(
GST_BIN
(
video_bin
),
v_queue
);
...
...
@@ -472,7 +476,7 @@ make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
v_decoder
=
gst_element_factory_make_or_warn
(
"ffdec_msmpeg4"
,
"v_dec"
);
v_convert
=
gst_element_factory_make_or_warn
(
"ffmpegcolorspace"
,
"v_convert"
);
videosink
=
gst_element_factory_make_or_warn
(
"xvimagesink"
,
"v_sink"
);
videosink
=
gst_element_factory_make_or_warn
(
VSINK
,
"v_sink"
);
gst_element_link_many
(
v_queue
,
v_decoder
,
v_convert
,
videosink
,
NULL
);
gst_bin_add
(
GST_BIN
(
video_bin
),
v_queue
);
...
...
@@ -794,7 +798,8 @@ query_rates (void)
format
=
seek_formats
[
i
].
format
;
if
(
gst_pad_convert
(
pad
,
GST_FORMAT_TIME
,
GST_SECOND
,
&
format
,
&
value
))
{
if
(
gst_pad_query_convert
(
pad
,
GST_FORMAT_TIME
,
GST_SECOND
,
&
format
,
&
value
))
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
value
);
}
else
{
g_print
(
"%s %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
);
...
...
@@ -808,66 +813,6 @@ query_rates (void)
}
}
G_GNUC_UNUSED
static
void
query_durations_elems
()
{
GList
*
walk
=
seekable_elements
;
while
(
walk
)
{
GstElement
*
element
=
GST_ELEMENT
(
walk
->
data
);
gint
i
=
0
;
g_print
(
"durations %8.8s: "
,
GST_ELEMENT_NAME
(
element
));
while
(
seek_formats
[
i
].
name
)
{
gboolean
res
;
gint64
value
;
GstFormat
format
;
format
=
seek_formats
[
i
].
format
;
res
=
gst_element_query
(
element
,
GST_QUERY_TOTAL
,
&
format
,
&
value
);
if
(
res
)
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
value
);
}
else
{
g_print
(
"%s %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
);
}
i
++
;
}
g_print
(
" %s
\n
"
,
GST_ELEMENT_NAME
(
element
));
walk
=
g_list_next
(
walk
);
}
}
G_GNUC_UNUSED
static
void
query_durations_pads
()
{
GList
*
walk
=
seekable_pads
;
while
(
walk
)
{
GstPad
*
pad
=
GST_PAD
(
walk
->
data
);
gint
i
=
0
;
g_print
(
"durations %8.8s: "
,
GST_PAD_NAME
(
pad
));
while
(
seek_formats
[
i
].
name
)
{
gboolean
res
;
gint64
value
;
GstFormat
format
;
format
=
seek_formats
[
i
].
format
;
res
=
gst_pad_query
(
pad
,
GST_QUERY_TOTAL
,
&
format
,
&
value
);
if
(
res
)
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
value
);
}
else
{
g_print
(
"%s %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
);
}
i
++
;
}
g_print
(
" %s:%s
\n
"
,
GST_DEBUG_PAD_NAME
(
pad
));
walk
=
g_list_next
(
walk
);
}
}
G_GNUC_UNUSED
static
void
query_positions_elems
()
{
...
...
@@ -879,16 +824,17 @@ query_positions_elems ()
g_print
(
"positions %8.8s: "
,
GST_ELEMENT_NAME
(
element
));
while
(
seek_formats
[
i
].
name
)
{
gboolean
res
;
gint64
value
;
gint64
position
,
total
;
GstFormat
format
;
format
=
seek_formats
[
i
].
format
;
res
=
gst_element_query
(
element
,
GST_QUERY_POSITION
,
&
format
,
&
value
);
if
(
res
)
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
value
);
if
(
gst_element_query_position
(
element
,
&
format
,
&
position
,
&
total
))
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" / %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
position
,
total
);
}
else
{
g_print
(
"%s %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
);
g_print
(
"%s %13.13s / %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
,
"*NA*"
);
}
i
++
;
}
...
...
@@ -909,17 +855,19 @@ query_positions_pads ()
g_print
(
"positions %8.8s: "
,
GST_PAD_NAME
(
pad
));
while
(
seek_formats
[
i
].
name
)
{
gboolean
res
;
gint64
value
;
GstFormat
format
;
gint64
position
,
total
;
format
=
seek_formats
[
i
].
format
;
res
=
gst_pad_query
(
pad
,
GST_QUERY_POSITION
,
&
format
,
&
value
);
if
(
res
)
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
value
);
if
(
gst_pad_query_position
(
pad
,
&
format
,
&
position
,
&
total
))
{
g_print
(
"%s %13"
G_GINT64_FORMAT
" / %13"
G_GINT64_FORMAT
" | "
,
seek_formats
[
i
].
name
,
position
,
total
);
}
else
{
g_print
(
"%s %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
);
g_print
(
"%s %13.13s / %13.13s | "
,
seek_formats
[
i
].
name
,
"*NA*"
,
"*NA*"
);
}
i
++
;
}
g_print
(
" %s:%s
\n
"
,
GST_DEBUG_PAD_NAME
(
pad
));
...
...
@@ -932,34 +880,25 @@ static gboolean
update_scale
(
gpointer
data
)
{
GstClock
*
clock
;
guint64
position
;
GstFormat
format
=
GST_FORMAT_TIME
;
gboolean
res
;
GstFormat
format
;
position
=
0
;
duration
=
0
;
clock
=
gst_pipeline_get_clock
(
GST_PIPELINE
(
pipeline
));
format
=
GST_FORMAT_TIME
;
if
(
elem_seek
)
{
if
(
seekable_elements
)
{
GstElement
*
element
=
GST_ELEMENT
(
seekable_elements
->
data
);
res
=
gst_element_query
(
element
,
GST_QUERY_TOTAL
,
&
format
,
&
duration
);
if
(
!
res
)
duration
=
0
;
res
=
gst_element_query
(
element
,
GST_QUERY_POSITION
,
&
format
,
&
position
);
if
(
!
res
)
position
=
0
;
gst_element_query_position
(
element
,
&
format
,
&
position
,
&
duration
);
}
}
else
{
if
(
seekable_pads
)
{
GstPad
*
pad
=
GST_PAD
(
seekable_pads
->
data
);
res
=
gst_pad_query
(
pad
,
GST_QUERY_TOTAL
,
&
format
,
&
duration
);
if
(
!
res
)
duration
=
0
;
res
=
gst_pad_query
(
pad
,
GST_QUERY_POSITION
,
&
format
,
&
position
);
if
(
!
res
)
position
=
0
;
gst_pad_query_position
(
pad
,
&
format
,
&
position
,
&
duration
);
}
}
...
...
@@ -970,10 +909,8 @@ update_scale (gpointer data)
}
if
(
elem_seek
)
{
query_durations_elems
();
query_positions_elems
();
}
else
{
query_durations_pads
();
query_positions_pads
();
}
query_rates
();
...
...
@@ -1107,6 +1044,7 @@ play_cb (GtkButton * button, gpointer data)
gst_element_get_state
(
pipeline
,
&
state
,
NULL
,
NULL
);
if
(
state
!=
GST_STATE_PLAYING
)
{
g_print
(
"PLAY pipeline
\n
"
);
gst_element_set_state
(
pipeline
,
GST_STATE_PLAYING
);
update_id
=
gtk_timeout_add
(
UPDATE_INTERVAL
,
(
GtkFunction
)
update_scale
,
pipeline
);
...
...
@@ -1120,6 +1058,7 @@ pause_cb (GtkButton * button, gpointer data)
gst_element_get_state
(
pipeline
,
&
state
,
NULL
,
NULL
);
if
(
state
!=
GST_STATE_PAUSED
)
{
g_print
(
"PAUSE pipeline
\n
"
);
gst_element_set_state
(
pipeline
,
GST_STATE_PAUSED
);
gtk_timeout_remove
(
update_id
);
}
...
...
@@ -1132,6 +1071,7 @@ stop_cb (GtkButton * button, gpointer data)
gst_element_get_state
(
pipeline
,
&
state
,
NULL
,
NULL
);
if
(
state
!=
GST_STATE_READY
)
{
g_print
(
"READY pipeline
\n
"
);
gst_element_set_state
(
pipeline
,
GST_STATE_READY
);
gtk_adjustment_set_value
(
adjustment
,
0
.
0
);
gtk_timeout_remove
(
update_id
);
...
...
@@ -1260,8 +1200,10 @@ main (int argc, char **argv)
}
gtk_main
();
g_print
(
"NULL pipeline
\n
"
);
gst_element_set_state
(
pipeline
,
GST_STATE_NULL
);
g_print
(
"free pipeline
\n
"
);
gst_object_unref
(
GST_OBJECT
(
pipeline
));
return
0
;
...
...
ext/ogg/gstoggdemux.c
View file @
0ba57f58
...
...
@@ -186,14 +186,13 @@ static void gst_ogg_pad_class_init (GstOggPadClass * klass);
static
void
gst_ogg_pad_init
(
GstOggPad
*
pad
);
static
void
gst_ogg_pad_dispose
(
GObject
*
object
);
static
void
gst_ogg_pad_finalize
(
GObject
*
object
);
#if 0
static const GstFormat *gst_ogg_pad_formats (GstPad * pad);
static const GstEventMask *gst_ogg_pad_event_masks (GstPad * pad);
#endif
static
const
GstQueryType
*
gst_ogg_pad_query_types
(
GstPad
*
pad
);
static
gboolean
gst_ogg_pad_src_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_value
,
GstFormat
*
dest_format
,
gint64
*
dest_value
);
static
gboolean
gst_ogg_pad_src_query
(
GstPad
*
pad
,
GstQueryType
type
,
GstFormat
*
format
,
gint64
*
value
);
static
gboolean
gst_ogg_pad_src_query
(
GstPad
*
pad
,
GstQuery
*
query
);
static
gboolean
gst_ogg_pad_event
(
GstPad
*
pad
,
GstEvent
*
event
);
static
GstCaps
*
gst_ogg_pad_getcaps
(
GstPad
*
pad
);
static
GstCaps
*
gst_ogg_type_find
(
ogg_packet
*
packet
);
...
...
@@ -243,16 +242,10 @@ gst_ogg_pad_init (GstOggPad * pad)
{
gst_pad_set_event_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_event
));
gst_pad_set_event_mask_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_event_masks
));
gst_pad_set_getcaps_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_getcaps
));
gst_pad_set_query_type_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_query_types
));
gst_pad_set_formats_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_formats
));
gst_pad_set_convert_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_src_convert
));
gst_pad_set_query_function
(
GST_PAD
(
pad
),
GST_DEBUG_FUNCPTR
(
gst_ogg_pad_src_query
));
...
...
@@ -304,6 +297,7 @@ gst_ogg_pad_finalize (GObject * object)
G_OBJECT_CLASS
(
ogg_pad_parent_class
)
->
finalize
(
object
);
}
#if 0
static const GstFormat *
gst_ogg_pad_formats (GstPad * pad)
{
...
...
@@ -320,7 +314,9 @@ gst_ogg_pad_formats (GstPad * pad)
return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
}
#endif
#if 0
static const GstEventMask *
gst_ogg_pad_event_masks (GstPad * pad)
{
...
...
@@ -331,13 +327,13 @@ gst_ogg_pad_event_masks (GstPad * pad)
return src_event_masks;
}
#endif
static
const
GstQueryType
*
gst_ogg_pad_query_types
(
GstPad
*
pad
)
{
static
const
GstQueryType
query_types
[]
=
{
GST_QUERY_POSITION
,
GST_QUERY_TOTAL
,
0
};
...
...
@@ -351,23 +347,7 @@ gst_ogg_pad_getcaps (GstPad * pad)
}
static
gboolean
gst_ogg_pad_src_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_value
,
GstFormat
*
dest_format
,
gint64
*
dest_value
)
{
gboolean
res
=
FALSE
;
GstOggDemux
*
ogg
;
ogg
=
GST_OGG_DEMUX
(
GST_PAD_PARENT
(
pad
));
/* fill me, not sure with what... */
return
res
;
}
static
gboolean
gst_ogg_pad_src_query
(
GstPad
*
pad
,
GstQueryType
type
,
GstFormat
*
format
,
gint64
*
value
)
gst_ogg_pad_src_query
(
GstPad
*
pad
,
GstQuery
*
query
)
{
gboolean
res
=
TRUE
;
GstOggDemux
*
ogg
;
...
...
@@ -376,12 +356,13 @@ gst_ogg_pad_src_query (GstPad * pad, GstQueryType type,
ogg
=
GST_OGG_DEMUX
(
GST_PAD_PARENT
(
pad
));
cur
=
GST_OGG_PAD
(
pad
);
switch
(
type
)
{
switch
(
GST_QUERY_TYPE
(
query
)
)
{
case
GST_QUERY_POSITION
:
*
value
=
cur
->
current_granule
;
gst_query_set_position
(
query
,
GST_FORMAT_TIME
,
-
1
,
ogg
->
total_time
)
;
break
;
case
GST_QUERY_TOTAL
:
*
value
=
ogg
->
total_time
;
case
GST_QUERY_CONVERT
:
/* hmm .. */
res
=
FALSE
;
break
;
default:
res
=
FALSE
;
...
...
@@ -940,7 +921,6 @@ gst_ogg_demux_init (GstOggDemux * ogg)
ogg
->
sinkpad
=
gst_pad_new_from_template
(
gst_static_pad_template_get
(
&
ogg_demux_sink_template_factory
),
"sink"
);
gst_pad_set_formats_function
(
ogg
->
sinkpad
,
gst_ogg_pad_formats
);
gst_pad_set_loop_function
(
ogg
->
sinkpad
,
(
GstPadLoopFunction
)
gst_ogg_demux_loop
);
gst_pad_set_event_function
(
ogg
->
sinkpad
,
gst_ogg_demux_handle_event
);
...
...
@@ -1327,7 +1307,7 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gint64 pos)
}
else
{
gint64
granulepos
;
GstClockTime
granuletime
;
GstFormat
format
=
GST_FORMAT_TIME
;
GstFormat
format
;
GstOggPad
*
pad
;
granulepos
=
ogg_page_granulepos
(
&
og
);
...
...
@@ -1338,8 +1318,13 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gint64 pos)
if
(
pad
==
NULL
)
continue
;
gst_pad_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
granulepos
,
&
format
,
(
gint64
*
)
&
granuletime
);
format
=
GST_FORMAT_TIME
;
if
(
!
gst_pad_query_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
granulepos
,
&
format
,
(
gint64
*
)
&
granuletime
))
{
g_warning
(
"could not convert granulepos to time"
);
granuletime
=
target
;
}
GST_DEBUG_OBJECT
(
ogg
,
"found page with granule %"
G_GINT64_FORMAT
" and time %"
...
...
@@ -1575,11 +1560,14 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg)
/* now we can fill in the missing info using queries */
for
(
i
=
0
;
i
<
chain
->
streams
->
len
;
i
++
)
{
GstOggPad
*
pad
=
g_array_index
(
chain
->
streams
,
GstOggPad
*
,
i
);
GstFormat
target
=
GST_FORMAT_TIME
;
GstFormat
target
;
gst_pad_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
pad
->
first_granule
,
&
target
,
(
gint64
*
)
&
pad
->
first_time
);
target
=
GST_FORMAT_TIME
;
if
(
!
gst_pad_query_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
pad
->
first_granule
,
&
target
,
(
gint64
*
)
&
pad
->
first_time
))
{
g_warning
(
"could not convert granule to time"
);
}
pad
->
mode
=
GST_OGG_PAD_MODE_STREAMING
;
pad
->
packetno
=
0
;
...
...
@@ -1637,11 +1625,14 @@ gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain)
/* now we can fill in the missing info using queries */
for
(
i
=
0
;
i
<
chain
->
streams
->
len
;
i
++
)
{
GstOggPad
*
pad
=
g_array_index
(
chain
->
streams
,
GstOggPad
*
,
i
);
GstFormat
target
=
GST_FORMAT_TIME
;
GstFormat
target
;
gst_pad_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
pad
->
last_granule
,
&
target
,
(
gint64
*
)
&
pad
->
last_time
);
target
=
GST_FORMAT_TIME
;
if
(
!
gst_pad_query_convert
(
pad
->
elem_pad
,
GST_FORMAT_DEFAULT
,
pad
->
last_granule
,
&
target
,
(
gint64
*
)
&
pad
->
last_time
))
{
g_warning
(
"could not convert granule to time"
);
}
}
return
0
;
}
...
...
ext/ogg/gstoggmux.c
View file @
0ba57f58
...
...
@@ -240,6 +240,7 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
}
#if 0
static const GstEventMask *
gst_ogg_mux_get_sink_event_masks (GstPad * pad)
{
...
...
@@ -251,6 +252,7 @@ gst_ogg_mux_get_sink_event_masks (GstPad * pad)
return gst_ogg_mux_sink_event_masks;
}
#endif
static
void
gst_ogg_mux_init
(
GstOggMux
*
ogg_mux
)
...
...
@@ -353,7 +355,6 @@ gst_ogg_mux_request_new_pad (GstElement * element,
/* setup some pad functions */
gst_pad_set_link_function
(
newpad
,
gst_ogg_mux_sinkconnect
);
gst_pad_set_event_mask_function
(
newpad
,
gst_ogg_mux_get_sink_event_masks
);
/* dd the pad to the element */
gst_element_add_pad
(
element
,
newpad
);
...
...
ext/ogg/gstogmparse.c
View file @
0ba57f58
...
...
@@ -140,12 +140,14 @@ static void gst_ogm_video_parse_init (GstOgmParse * ogm);
static
void
gst_ogm_audio_parse_init
(
GstOgmParse
*
ogm
);
static
void
gst_ogm_text_parse_init
(
GstOgmParse
*
ogm
);
#if 0
static const GstFormat *gst_ogm_parse_get_sink_formats (GstPad * pad);
#endif
static
const
GstQueryType
*
gst_ogm_parse_get_sink_querytypes
(
GstPad
*
pad
);
static
gboolean
gst_ogm_parse_sink_query
(
GstPad
*
pad
,
GstQuery
*
query
);
static
gboolean
gst_ogm_parse_sink_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_value
,
GstFormat
*
dest_format
,
gint64
*
dest_value
);
static
gboolean
gst_ogm_parse_sink_query
(
GstPad
*
pad
,
GstQueryType
type
,
GstFormat
*
fmt
,
gint64
*
val
);
static
GstFlowReturn
gst_ogm_parse_chain
(
GstPad
*
pad
,
GstBuffer
*
buffer
);
...
...
@@ -343,8 +345,7 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm)
/* create the pads */
templ
=
gst_static_pad_template_get
(
&
ogm_audio_parse_sink_template_factory
);
ogm
->
sinkpad
=
gst_pad_new_from_template
(
templ
,
"sink"
);
gst_pad_set_convert_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_convert
);
gst_pad_set_formats_function
(
ogm
->
sinkpad
,
gst_ogm_parse_get_sink_formats
);
gst_pad_set_query_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_query
);
gst_pad_set_chain_function
(
ogm
->
sinkpad
,
gst_ogm_parse_chain
);
gst_element_add_pad
(
GST_ELEMENT
(
ogm
),
ogm
->
sinkpad
);
...
...
@@ -364,8 +365,7 @@ gst_ogm_video_parse_init (GstOgmParse * ogm)
/* create the pads */
templ
=
gst_static_pad_template_get
(
&
ogm_video_parse_sink_template_factory
);
ogm
->
sinkpad
=
gst_pad_new_from_template
(
templ
,
"sink"
);
gst_pad_set_convert_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_convert
);
gst_pad_set_formats_function
(
ogm
->
sinkpad
,
gst_ogm_parse_get_sink_formats
);
gst_pad_set_query_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_query
);
gst_pad_set_chain_function
(
ogm
->
sinkpad
,
gst_ogm_parse_chain
);
gst_element_add_pad
(
GST_ELEMENT
(
ogm
),
ogm
->
sinkpad
);
...
...
@@ -385,8 +385,6 @@ gst_ogm_text_parse_init (GstOgmParse * ogm)
/* create the pads */
templ
=
gst_static_pad_template_get
(
&
ogm_text_parse_sink_template_factory
);
ogm
->
sinkpad
=
gst_pad_new_from_template
(
templ
,
"sink"
);
gst_pad_set_convert_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_convert
);
gst_pad_set_formats_function
(
ogm
->
sinkpad
,
gst_ogm_parse_get_sink_formats
);
gst_pad_set_query_type_function
(
ogm
->
sinkpad
,
gst_ogm_parse_get_sink_querytypes
);
gst_pad_set_query_function
(
ogm
->
sinkpad
,
gst_ogm_parse_sink_query
);
...
...
@@ -401,6 +399,7 @@ gst_ogm_text_parse_init (GstOgmParse * ogm)
ogm
->
srcpadtempl
=
text_src_templ
;
}
#if 0
static const GstFormat *
gst_ogm_parse_get_sink_formats (GstPad * pad)
{
...
...
@@ -412,6 +411,7 @@ gst_ogm_parse_get_sink_formats (GstPad * pad)
return formats;
}
#endif
static
const
GstQueryType
*
gst_ogm_parse_get_sink_querytypes
(
GstPad
*
pad
)
...
...
@@ -485,18 +485,47 @@ gst_ogm_parse_sink_convert (GstPad * pad,
}
static
gboolean
gst_ogm_parse_sink_query
(
GstPad
*
pad
,
GstQueryType
type
,
GstFormat
*
fmt
,
gint64
*
val
)
gst_ogm_parse_sink_query
(
GstPad
*
pad
,
GstQuery
*
query
)
{
GstOgmParse
*
ogm
=
GST_OGM_PARSE
(
gst_pad_get_parent
(
pad
));
GstOgmParse
*
ogm
=
GST_OGM_PARSE
(
GST_PAD_PARENT
(
pad
));
GstFormat
format
;
gboolean
res
;
switch
(
GST_QUERY_TYPE
(
query
))
{
case
GST_QUERY_POSITION
:
{
gint64
val
;
gst_query_parse_position
(
query
,
&
format
,
NULL
,
NULL
);
if
(
type
!=
GST_QUERY_POSITION
)
return
FALSE
;
if
(
*
fmt
!=
GST_FORMAT_DEFAULT
&&
*
fmt
!=
GST_FORMAT_TIME
)
return
FALSE
;
if
(
format
!=
GST_FORMAT_DEFAULT
&&
format
!=
GST_FORMAT_TIME
)
return
FALSE
;
return
gst_pad_convert
(
pad
,
GST_FORMAT_DEFAULT
,
ogm
->
next_granulepos
,
fmt
,
val
);
if
((
res
=
gst_ogm_parse_sink_convert
(
pad
,
GST_FORMAT_DEFAULT
,
ogm
->
next_granulepos
,
&
format
,
&
val
)))
{
/* don't know the total length here.. */
gst_query_set_position
(
query
,
format
,
val
,
-
1
);
}
break
;
}
case
GST_QUERY_CONVERT
:
{
GstFormat
src_fmt
,
dest_fmt
;
gint64
src_val
,
dest_val
;
/* peel off input */
gst_query_parse_convert
(
query
,
&
src_fmt
,
&
src_val
,
NULL
,
NULL
);
if
((
res
=
gst_ogm_parse_sink_convert
(
pad
,
src_fmt
,
src_val
,
&
dest_fmt
,
&
dest_val
)))
{
gst_query_set_convert
(
query
,
src_fmt
,
src_val
,
dest_fmt
,
dest_val
);
}
break
;
}
default:
res
=
FALSE
;
break
;
}
return
res
;
}
static
GstFlowReturn
...
...
ext/theora/theoradec.c
View file @
0ba57f58
...
...
@@ -115,16 +115,21 @@ static gboolean theora_dec_sink_event (GstPad * pad, GstEvent * event);
static
GstFlowReturn
theora_dec_chain
(
GstPad
*
pad
,
GstBuffer
*
buffer
);
static
GstElementStateReturn
theora_dec_change_state
(
GstElement
*
element
);
static
gboolean
theora_dec_src_event
(
GstPad
*
pad
,
GstEvent
*
event
);
static
gboolean
theora_dec_src_query
(
GstPad
*
pad
,
GstQueryType
query
,
GstFormat
*
format
,
gint64
*
value
);
static
gboolean
theora_dec_src_query
(
GstPad
*
pad
,
GstQuery
*
query
);
static
gboolean
theora_dec_src_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_value
,
GstFormat
*
dest_format
,
gint64
*
dest_value
);
static
gboolean
theora_dec_sink_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_value
,
GstFormat
*
dest_format
,
gint64
*
dest_value
);
static
gboolean
theora_dec_sink_query
(
GstPad
*
pad
,
GstQuery
*
query
);
#if 0
static const GstFormat *theora_get_formats (GstPad * pad);
#endif
#if 0
static const GstEventMask *theora_get_event_masks (GstPad * pad);
#endif