mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
ext/dv/gstdvdec.c: Fix caps negotiation.
Original commit message from CVS: * ext/dv/gstdvdec.c: (gst_dvdec_loop): Fix caps negotiation. * ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init), (dvdnavsrc_update_buttoninfo), (dvdnavsrc_get), (dvdnavsrc_get_event_mask), (dvdnav_handle_navigation_event), (dvdnavsrc_event): * ext/mpeg2dec/gstmpeg2dec.c: * gst-libs/gst/navigation/navigation.c: (gst_navigation_send_key_event), (gst_navigation_send_mouse_event): * gst-libs/gst/navigation/navigation.h: * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_handle_src_event): * sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_handle_xevents): Super-simple first version of mouse and keyboard events. Clicking on a DVD menu now works, although it may not take you where you expected. * gst/sine/gstsinesrc.c: (gst_sinesrc_src_fixate): * gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_src_fixate): These fixate functions were broken - they never actually fixated :)
This commit is contained in:
parent
9c5fc629c8
commit
afa4e0fc85
6 changed files with 131 additions and 19 deletions
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2004-01-07 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* ext/dv/gstdvdec.c: (gst_dvdec_loop):
|
||||
Fix caps negotiation.
|
||||
|
||||
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
|
||||
(dvdnavsrc_update_buttoninfo), (dvdnavsrc_get),
|
||||
(dvdnavsrc_get_event_mask), (dvdnav_handle_navigation_event),
|
||||
(dvdnavsrc_event):
|
||||
* ext/mpeg2dec/gstmpeg2dec.c:
|
||||
* gst-libs/gst/navigation/navigation.c:
|
||||
(gst_navigation_send_key_event), (gst_navigation_send_mouse_event):
|
||||
* gst-libs/gst/navigation/navigation.h:
|
||||
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_handle_src_event):
|
||||
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents):
|
||||
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_handle_xevents):
|
||||
Super-simple first version of mouse and keyboard events. Clicking
|
||||
on a DVD menu now works, although it may not take you where you
|
||||
expected.
|
||||
|
||||
* gst/sine/gstsinesrc.c: (gst_sinesrc_src_fixate):
|
||||
* gst/videotestsrc/gstvideotestsrc.c:
|
||||
(gst_videotestsrc_src_fixate):
|
||||
These fixate functions were broken - they never actually
|
||||
fixated :)
|
||||
|
||||
2004-01-06 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/shout/gstshout.c: (gst_icecastsend_base_init),
|
||||
|
|
|
@ -260,7 +260,7 @@ dvdnavsrc_class_init (DVDNavSrcClass *klass)
|
|||
0,99,1,G_PARAM_READWRITE));
|
||||
g_object_class_install_property(gobject_class, ARG_CHAPTER,
|
||||
g_param_spec_int("chapter", "chapter", "chapter",
|
||||
1,99,1,G_PARAM_READWRITE));
|
||||
0,99,1,G_PARAM_READWRITE));
|
||||
g_object_class_install_property(gobject_class, ARG_ANGLE,
|
||||
g_param_spec_int("angle", "angle", "angle",
|
||||
1,9,1,G_PARAM_READWRITE));
|
||||
|
@ -546,14 +546,27 @@ dvdnavsrc_update_buttoninfo (DVDNavSrc *src)
|
|||
pci_t *pci;
|
||||
|
||||
pci = dvdnav_get_current_nav_pci(src->dvdnav);
|
||||
fprintf(stderr, "update button info total:%d\n", pci->hli.hl_gi.btn_ns);
|
||||
|
||||
caps = gst_caps_new_simple ("dvdnavsrc_buttoninfo",
|
||||
"application/x-gst-dvdnavsrc-buttoninfo",
|
||||
"total", G_TYPE_INT, pci->hli.hl_gi.btn_ns, NULL);
|
||||
if (src->buttoninfo) {
|
||||
gst_caps_free (src->buttoninfo);
|
||||
gint btn_ns;
|
||||
|
||||
/* Don't notify if there is no actual change */
|
||||
if (gst_structure_get_int (gst_caps_get_structure (src->buttoninfo, 0),
|
||||
"total", &btn_ns)
|
||||
&& (btn_ns == pci->hli.hl_gi.btn_ns))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
caps = gst_caps_new_simple (
|
||||
"application/x-gst-dvdnavsrc-buttoninfo",
|
||||
"total", G_TYPE_INT, (gint) pci->hli.hl_gi.btn_ns,
|
||||
NULL);
|
||||
|
||||
if (src->buttoninfo)
|
||||
gst_caps_free (src->buttoninfo);
|
||||
|
||||
src->buttoninfo = caps;
|
||||
g_object_notify (G_OBJECT (src), "buttoninfo");
|
||||
}
|
||||
|
@ -879,19 +892,38 @@ dvdnavsrc_get (GstPad *pad)
|
|||
dvdnavsrc_update_streaminfo (src);
|
||||
break;
|
||||
case DVDNAV_NAV_PACKET:
|
||||
if (0) dvdnavsrc_update_buttoninfo (src);
|
||||
dvdnavsrc_update_buttoninfo (src);
|
||||
break;
|
||||
case DVDNAV_WAIT:
|
||||
/* FIXME: supposed to make sure all the data has made
|
||||
* it to the sinks before skipping the wait
|
||||
*/
|
||||
dvdnavsrc_print_event (src, data, event, len);
|
||||
dvdnav_wait_skip(src->dvdnav);
|
||||
case DVDNAV_VTS_CHANGE:
|
||||
case DVDNAV_SPU_STREAM_CHANGE:
|
||||
case DVDNAV_AUDIO_STREAM_CHANGE:
|
||||
case DVDNAV_HIGHLIGHT:
|
||||
case DVDNAV_SPU_CLUT_CHANGE:
|
||||
break;
|
||||
case DVDNAV_HOP_CHANNEL:
|
||||
/* Indicates a time discontinuity, and the downstream should
|
||||
* flush
|
||||
*/
|
||||
dvdnavsrc_print_event (src, data, event, len);
|
||||
buf = GST_BUFFER (gst_event_new (GST_EVENT_DISCONTINUOUS));
|
||||
have_buf = TRUE;
|
||||
break;
|
||||
case DVDNAV_HIGHLIGHT:
|
||||
dvdnavsrc_print_event (src, data, event, len);
|
||||
break;
|
||||
|
||||
/* SPU_STREAM_CHANGE provides MPEG stream numbers for different
|
||||
* formats of the video, eg letterbox/pan&scan
|
||||
*/
|
||||
case DVDNAV_SPU_STREAM_CHANGE:
|
||||
/* AUDIO_STREAM_CHANGE indicates that the user selected an alternate
|
||||
* audio stream (from a menu)
|
||||
*/
|
||||
case DVDNAV_AUDIO_STREAM_CHANGE:
|
||||
/* VTS_CHANGE Indicates a change in VTS (Video Title Set) */
|
||||
case DVDNAV_VTS_CHANGE:
|
||||
case DVDNAV_SPU_CLUT_CHANGE:
|
||||
default:
|
||||
dvdnavsrc_print_event (src, data, event, len);
|
||||
break;
|
||||
|
@ -1036,12 +1068,50 @@ dvdnavsrc_get_event_mask (GstPad *pad)
|
|||
GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH },
|
||||
*/
|
||||
{GST_EVENT_NAVIGATION, GST_EVENT_FLAG_NONE },
|
||||
{0,}
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dvdnav_handle_navigation_event (DVDNavSrc *src, GstEvent *event)
|
||||
{
|
||||
GstStructure *structure = event->event_data.structure.structure;
|
||||
const char *event_type = gst_structure_get_string (structure, "event");
|
||||
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (strcmp (event_type, "key-press") == 0)
|
||||
{
|
||||
const char *key = gst_structure_get_string(structure, "key");
|
||||
|
||||
g_assert (key != NULL);
|
||||
g_print ("dvdnavsrc got a keypress: %s\n", key);
|
||||
}
|
||||
else if (strcmp (event_type, "mouse-move") == 0)
|
||||
{
|
||||
double x, y;
|
||||
|
||||
gst_structure_get_double(structure, "pointer_x", &x);
|
||||
gst_structure_get_double(structure, "pointer_y", &y);
|
||||
|
||||
dvdnavsrc_pointer_select (src, (int) x, (int) y);
|
||||
}
|
||||
else if (strcmp (event_type, "mouse-button-release") == 0)
|
||||
{
|
||||
double x, y;
|
||||
|
||||
gst_structure_get_double(structure, "pointer_x", &x);
|
||||
gst_structure_get_double(structure, "pointer_y", &y);
|
||||
|
||||
dvdnavsrc_pointer_activate (src, (int) x, (int) y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dvdnavsrc_event (GstPad *pad, GstEvent *event)
|
||||
{
|
||||
|
@ -1169,6 +1239,8 @@ dvdnavsrc_event (GstPad *pad, GstEvent *event)
|
|||
src->need_flush = GST_EVENT_SEEK_FLAGS(event) & GST_SEEK_FLAG_FLUSH;
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_NAVIGATION:
|
||||
res = dvdnav_handle_navigation_event (src, event);
|
||||
case GST_EVENT_FLUSH:
|
||||
src->need_flush = TRUE;
|
||||
break;
|
||||
|
|
|
@ -862,6 +862,7 @@ gst_mpeg2dec_get_src_event_masks (GstPad *pad)
|
|||
{
|
||||
static const GstEventMask masks[] = {
|
||||
{ GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH },
|
||||
{ GST_EVENT_NAVIGATION, GST_EVENT_FLAG_NONE },
|
||||
{ 0, }
|
||||
};
|
||||
return masks;
|
||||
|
@ -1012,6 +1013,9 @@ gst_mpeg2dec_src_event (GstPad *pad, GstEvent *event)
|
|||
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_NAVIGATION:
|
||||
/* Forward a navigation event unchanged */
|
||||
return gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), event);
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
|
|
|
@ -71,19 +71,23 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
|
|||
}
|
||||
|
||||
void
|
||||
gst_navigation_send_key_event (GstNavigation *navigation, const char *key)
|
||||
gst_navigation_send_key_event (GstNavigation *navigation, const char *event,
|
||||
const char *key)
|
||||
{
|
||||
gst_navigation_send_event (navigation, gst_structure_new (
|
||||
"application/x-gst-navigation",
|
||||
"event", G_TYPE_STRING, event,
|
||||
"key", G_TYPE_STRING, key, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
|
||||
double y)
|
||||
gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event,
|
||||
int button, double x, double y)
|
||||
{
|
||||
gst_navigation_send_event (navigation, gst_structure_new (
|
||||
"application/x-gst-navigation",
|
||||
"event", G_TYPE_STRING, event,
|
||||
"button", G_TYPE_INT, button,
|
||||
"pointer_x", G_TYPE_DOUBLE, x,
|
||||
"pointer_y", G_TYPE_DOUBLE, y, NULL));
|
||||
}
|
||||
|
|
|
@ -52,9 +52,10 @@ GType gst_navigation_get_type (void);
|
|||
/* virtual class function wrappers */
|
||||
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
|
||||
|
||||
void gst_navigation_send_key_event (GstNavigation *navigation, const char *key);
|
||||
void gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
|
||||
double y);
|
||||
void gst_navigation_send_key_event (GstNavigation *navigation,
|
||||
const char *event, const char *key);
|
||||
void gst_navigation_send_mouse_event (GstNavigation *navigation,
|
||||
const char *event, int button, double x, double y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1141,12 +1141,17 @@ gst_mpeg_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
|||
GstEvent *new_event;
|
||||
|
||||
new_event = gst_event_new_seek (GST_EVENT_SEEK_TYPE (event), desired_offset);
|
||||
gst_event_unref (event);
|
||||
res = gst_mpeg_parse_handle_src_event (pad, new_event);
|
||||
}
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_NAVIGATION:
|
||||
return gst_pad_send_event (GST_PAD_PEER (GST_MPEG_PARSE (mpeg_demux)->sinkpad),
|
||||
event);
|
||||
break;
|
||||
default:
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue