[gst-devel] Framestepping backwards doesn't work with MPEG2 PS files.

wl2776 wl2776 at gmail.com
Wed May 19 14:40:05 CEST 2010


The playbin2 doesn't react on the new_step events when paused.
Current playing position, reported by _query_position doesn't change. The
displayed picture doesn't change also.

Framestepping forward is OK.

0. GStreamer is initialized with the keys --gst-debug=player:5,mpegpsdemux:3
where player is my private debug category.

1. My application creates the playbin2 instance to play the file.
It successfully opens and plays.

2. I pause the playbin2.

3. I position a playbin2 somewhere in the movie by clicking on a movie
progress bar on my form. 
This issues the call 

r=gst_element_seek_simple(GST_ELEMENT(m_player),
        GST_FORMAT_TIME,
        (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_KEY_UNIT),
        pos*GST_MSECOND);

where pos is the seek position.

GST_DEBUG rigth after this shows that r=1 (seek is successful), I also
observe the changing picture.

Debug shows the following.

0:00:11.316272000  3952   003D9118 INFO             mpegpsdemux
gstmpegdemux.c:1060:gst_flups_demux_do_seek:<mpegpsdemux0> sink segment
configured 0409D880, trying to go at SCR: 5535000
0:00:11.326286000  3952   003D9118 INFO             mpegpsdemux
gstmpegdemux.c:1082:gst_flups_demux_do_seek:<mpegpsdemux0> doing seek at
offset 42065920 SCR: 5534990 0:01:01.499888888
0:00:11.346315000  3952   003D9118 DEBUG                 player
gst_player.cpp:911:gst_player::set_position: direction=1, seek to 61500
msec, r=1
0:00:11.356329000  3952   040A06C0 INFO             mpegpsdemux
gstmpegdemux.c:533:gst_flups_demux_send_data:<mpegpsdemux0> sending new
segment: rate 1 applied_rate 1 start: 0:01:01.500011111, stop:
99:99:99.999999999, time: 0:01:01.500000000 to pad 0401E668
0:00:11.356329000  3952   040A06C0 INFO             mpegpsdemux
gstmpegdemux.c:533:gst_flups_demux_send_data:<mpegpsdemux0> sending new
segment: rate 1 applied_rate 1 start: 0:01:01.500011111, stop:
99:99:99.999999999, time: 0:01:01.500000000 to pad 0401EA50
0:00:11.486517000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:00:11.486517000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:00:11.526574000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate 1.000000 fmt
3 start 61500011111 stop -1 direction 1


4. I press "step left" button on my player's window.
This issues the call to my step_left() function

void gst_player::step_left(void)
{GstFormat fmt=GST_FORMAT_TIME;
 gboolean rb;

   if(m_player){
     if(m_current_position>=40*GST_MSECOND){
       if(m_direction>0) {
        m_direction=-1;
        flag_set(FLAG_STEP_LEFT1);
        rb=gst_element_seek(m_player,-1.0,GST_FORMAT_TIME,
                       
(GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
                       
GST_SEEK_TYPE_SET,0,GST_SEEK_TYPE_SET,m_current_position);
        GST_DEBUG("seek backwards: %d",rb);
       }else{
        rb=gst_element_send_event (m_player, 
                                 gst_event_new_step (GST_FORMAT_BUFFERS, 1,
1.0, TRUE, FALSE));
        GST_DEBUG("send step event: %d",rb);
       }
     }
   }
}


This function tracks current playback direction, if it doesn't match, it
sends the seek event to turn the player to backwards playback. 
The bus_watch watches for the async-done messages, checks the application's
internal flags and basing on them decides what caused the async-done message
and what to do next.

Here is the relevant code from my bus-watch.

case GST_MESSAGE_ASYNC_DONE:{
    GST_DEBUG("message %s(%d) from %s",
       
GST_MESSAGE_TYPE_NAME(msg),GST_MESSAGE_TYPE(msg),GST_MESSAGE_SRC_NAME(msg));
    GstFormat fmt=GST_FORMAT_TIME;

    gst_element_query_position(m_player,&fmt,&m_current_position);
    GST_DEBUG("current player position
%dms",GST_TIME_AS_MSECONDS(m_current_position));

    GstQuery *query=gst_query_new_segment(GST_FORMAT_TIME);
    gst_element_query(GST_ELEMENT(m_player),query);
    gdouble rate;
    gint64 start=-1,stop=-1;
    gst_query_parse_segment(query,&rate,&fmt,&start,&stop);
    GST_DEBUG("current segment: rate %lf fmt %d start %"G_GINT64_FORMAT
                       " stop %"G_GINT64_FORMAT" direction
%d",rate,fmt,start,stop,m_direction);
    gst_query_unref(query);

    if(m_flags & FLAG_GO_END){
      flag_unset(FLAG_GO_END);
     /* ... */
    }else if(m_flags & FLAG_STEP_LEFT1){
      flag_unset(FLAG_STEP_LEFT1);
      GST_DEBUG("flag_unset(FLAG_STEP_LEFT1);");
      rb=gst_element_send_event (m_player,
                  gst_event_new_step (GST_FORMAT_BUFFERS, 1, 1.0, TRUE,
FALSE));
      GST_DEBUG("send step event: %d",rb);
    }
}


Here is the debug output, resulted by several presses of the step_left
button

0:10:32.509504000  3952   003D9118 INFO             mpegpsdemux
gstmpegdemux.c:1060:gst_flups_demux_do_seek:<mpegpsdemux0> sink segment
configured 0409D880, trying to go at SCR: 5535000
0:10:32.519518000  3952   003D9118 INFO             mpegpsdemux
gstmpegdemux.c:1082:gst_flups_demux_do_seek:<mpegpsdemux0> doing seek at
offset 42065920 SCR: 5534990 0:01:01.499888888
0:10:32.519518000  3952   003D9118 DEBUG                 player
gst_player.cpp:940:gst_player::step_left: seek backwards: 1
0:10:32.519518000  3952   040A06C0 INFO             mpegpsdemux
gstmpegdemux.c:533:gst_flups_demux_send_data:<mpegpsdemux0> sending new
segment: rate -1 applied_rate 1 start: 0:00:00.000011111, stop:
0:01:01.500011111, time: 0:00:00.000000000 to pad 0401E668
0:10:32.990195000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:10:32.990195000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:10:32.990195000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate -1.000000
fmt 3 start 11111 stop 61500011111 direction -1
0:10:32.990195000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:354:gst_player::bus_watch: flag_unset(FLAG_STEP_LEFT1);
0:10:32.990195000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:356:gst_player::bus_watch: send step event: 1
0:10:33.000209000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:10:33.000209000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:10:33.000209000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate -1.000000
fmt 3 start 11111 stop 61500011111 direction -1
0:14:59.793840000  3952   003D9118 DEBUG                 player
gst_player.cpp:943:gst_player::step_left: send step event: 1
0:14:59.803854000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:14:59.803854000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:14:59.803854000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate -1.000000
fmt 3 start 11111 stop 61500011111 direction -1
0:15:02.467685000  3952   003D9118 DEBUG                 player
gst_player.cpp:943:gst_player::step_left: send step event: 1
0:15:02.467685000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:15:02.467685000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:15:02.467685000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate -1.000000
fmt 3 start 11111 stop 61500011111 direction -1
0:15:05.191601000  3952   003D9118 DEBUG                 player
gst_player.cpp:943:gst_player::step_left: send step event: 1
0:15:05.191601000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:330:gst_player::bus_watch: message async-done(2097152) from
playbin0
0:15:05.191601000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:334:gst_player::bus_watch: current player position 61500ms
0:15:05.191601000  3952   0404AEE0 DEBUG                 player
gst_player.cpp:341:gst_player::bus_watch: current segment: rate -1.000000
fmt 3 start 11111 stop 61500011111 direction -1


As can be seen, current position remains at 61500ms, the displayed picture
doesn't change. I repeat, m_player is the playbin2, and is paused.

-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Framestepping-backwards-doesn-t-work-with-MPEG2-PS-files-tp2222757p2222757.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list