• Home
  • Raw
  • Download

Lines Matching refs:demux

124 static void gst_ffmpegdemux_init (GstFFMpegDemux * demux);
132 static void gst_ffmpegdemux_loop (GstFFMpegDemux * demux);
253 gst_ffmpegdemux_init (GstFFMpegDemux * demux) in gst_ffmpegdemux_init() argument
256 (GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux)); in gst_ffmpegdemux_init()
259 demux->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink"); in gst_ffmpegdemux_init()
260 gst_pad_set_activate_function (demux->sinkpad, in gst_ffmpegdemux_init()
262 gst_pad_set_activatemode_function (demux->sinkpad, in gst_ffmpegdemux_init()
264 gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad); in gst_ffmpegdemux_init()
268 gst_pad_set_event_function (demux->sinkpad, in gst_ffmpegdemux_init()
270 gst_pad_set_chain_function (demux->sinkpad, in gst_ffmpegdemux_init()
273 demux->task = in gst_ffmpegdemux_init()
274 gst_task_new ((GstTaskFunction) gst_ffmpegdemux_loop, demux, NULL); in gst_ffmpegdemux_init()
275 g_rec_mutex_init (&demux->task_lock); in gst_ffmpegdemux_init()
276 gst_task_set_lock (demux->task, &demux->task_lock); in gst_ffmpegdemux_init()
278 demux->have_group_id = FALSE; in gst_ffmpegdemux_init()
279 demux->group_id = G_MAXUINT; in gst_ffmpegdemux_init()
281 demux->opened = FALSE; in gst_ffmpegdemux_init()
282 demux->context = NULL; in gst_ffmpegdemux_init()
285 demux->streams[n] = NULL; in gst_ffmpegdemux_init()
287 demux->videopads = 0; in gst_ffmpegdemux_init()
288 demux->audiopads = 0; in gst_ffmpegdemux_init()
290 demux->seek_event = NULL; in gst_ffmpegdemux_init()
291 gst_segment_init (&demux->segment, GST_FORMAT_TIME); in gst_ffmpegdemux_init()
293 demux->flowcombiner = gst_flow_combiner_new (); in gst_ffmpegdemux_init()
296 g_mutex_init (&demux->ffpipe.tlock); in gst_ffmpegdemux_init()
297 g_cond_init (&demux->ffpipe.cond); in gst_ffmpegdemux_init()
298 demux->ffpipe.adapter = gst_adapter_new (); in gst_ffmpegdemux_init()
302 demux->can_push = TRUE; in gst_ffmpegdemux_init()
304 demux->can_push = FALSE; in gst_ffmpegdemux_init()
310 GstFFMpegDemux *demux; in gst_ffmpegdemux_finalize() local
312 demux = (GstFFMpegDemux *) object; in gst_ffmpegdemux_finalize()
314 gst_flow_combiner_free (demux->flowcombiner); in gst_ffmpegdemux_finalize()
316 g_mutex_clear (&demux->ffpipe.tlock); in gst_ffmpegdemux_finalize()
317 g_cond_clear (&demux->ffpipe.cond); in gst_ffmpegdemux_finalize()
318 gst_object_unref (demux->ffpipe.adapter); in gst_ffmpegdemux_finalize()
320 gst_object_unref (demux->task); in gst_ffmpegdemux_finalize()
321 g_rec_mutex_clear (&demux->task_lock); in gst_ffmpegdemux_finalize()
327 gst_ffmpegdemux_close (GstFFMpegDemux * demux) in gst_ffmpegdemux_close() argument
332 if (!demux->opened) in gst_ffmpegdemux_close()
339 stream = demux->streams[n]; in gst_ffmpegdemux_close()
342 gst_flow_combiner_remove_pad (demux->flowcombiner, stream->pad); in gst_ffmpegdemux_close()
343 gst_element_remove_pad (GST_ELEMENT (demux), stream->pad); in gst_ffmpegdemux_close()
349 demux->streams[n] = NULL; in gst_ffmpegdemux_close()
351 demux->videopads = 0; in gst_ffmpegdemux_close()
352 demux->audiopads = 0; in gst_ffmpegdemux_close()
355 if (demux->seekable) in gst_ffmpegdemux_close()
356 gst_ffmpegdata_close (demux->context->pb); in gst_ffmpegdemux_close()
358 gst_ffmpeg_pipe_close (demux->context->pb); in gst_ffmpegdemux_close()
359 demux->context->pb = NULL; in gst_ffmpegdemux_close()
360 avformat_close_input (&demux->context); in gst_ffmpegdemux_close()
361 if (demux->context) in gst_ffmpegdemux_close()
362 avformat_free_context (demux->context); in gst_ffmpegdemux_close()
363 demux->context = NULL; in gst_ffmpegdemux_close()
365 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_close()
366 demux->opened = FALSE; in gst_ffmpegdemux_close()
367 event_p = &demux->seek_event; in gst_ffmpegdemux_close()
369 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_close()
371 gst_segment_init (&demux->segment, GST_FORMAT_TIME); in gst_ffmpegdemux_close()
380 gst_ffmpegdemux_push_event (GstFFMpegDemux * demux, GstEvent * event) in gst_ffmpegdemux_push_event() argument
388 GstFFStream *s = demux->streams[n]; in gst_ffmpegdemux_push_event()
402 gst_ffmpegdemux_set_flags (GstFFMpegDemux * demux, gboolean discont, in gst_ffmpegdemux_set_flags() argument
409 if ((s = demux->streams[n])) { in gst_ffmpegdemux_set_flags()
418 gst_ffmpegdemux_is_eos (GstFFMpegDemux * demux) in gst_ffmpegdemux_is_eos() argument
424 if ((s = demux->streams[n])) { in gst_ffmpegdemux_is_eos()
435 gst_ffmpegdemux_has_outputted (GstFFMpegDemux * demux) in gst_ffmpegdemux_has_outputted() argument
441 if ((s = demux->streams[n])) { in gst_ffmpegdemux_has_outputted()
450 gst_ffmpegdemux_do_seek (GstFFMpegDemux * demux, GstSegment * segment) in gst_ffmpegdemux_do_seek() argument
460 index = av_find_default_stream_index (demux->context); in gst_ffmpegdemux_do_seek()
461 GST_LOG_OBJECT (demux, "default stream index %d", index); in gst_ffmpegdemux_do_seek()
468 stream = demux->context->streams[index]; in gst_ffmpegdemux_do_seek()
470 target = segment->position + demux->start_time; in gst_ffmpegdemux_do_seek()
474 GST_LOG_OBJECT (demux, "do seek to time %" GST_TIME_FORMAT, in gst_ffmpegdemux_do_seek()
482 GST_LOG_OBJECT (demux, "looking for keyframe in ffmpeg for time %" in gst_ffmpegdemux_do_seek()
489 GST_LOG_OBJECT (demux, "keyframeidx: %d", keyframeidx); in gst_ffmpegdemux_do_seek()
499 GST_LOG_OBJECT (demux, in gst_ffmpegdemux_do_seek()
505 GST_DEBUG_OBJECT (demux, in gst_ffmpegdemux_do_seek()
511 av_seek_frame (demux->context, index, fftarget, in gst_ffmpegdemux_do_seek()
515 GST_DEBUG_OBJECT (demux, "seek success, returned %d", seekret); in gst_ffmpegdemux_do_seek()
517 if (target > demux->start_time) in gst_ffmpegdemux_do_seek()
518 target -= demux->start_time; in gst_ffmpegdemux_do_seek()
531 GST_WARNING_OBJECT (demux, "Call to av_seek_frame failed : %d", seekret); in gst_ffmpegdemux_do_seek()
537 gst_ffmpegdemux_perform_seek (GstFFMpegDemux * demux, GstEvent * event) in gst_ffmpegdemux_perform_seek() argument
549 if (!demux->seekable) { in gst_ffmpegdemux_perform_seek()
550 GST_DEBUG_OBJECT (demux, "in push mode; ignoring seek"); in gst_ffmpegdemux_perform_seek()
554 GST_DEBUG_OBJECT (demux, "starting seek"); in gst_ffmpegdemux_perform_seek()
562 if (demux->segment.format != format) { in gst_ffmpegdemux_perform_seek()
565 fmt = demux->segment.format; in gst_ffmpegdemux_perform_seek()
569 res = gst_pad_query_convert (demux->sinkpad, format, cur, fmt, &cur); in gst_ffmpegdemux_perform_seek()
571 res = gst_pad_query_convert (demux->sinkpad, format, stop, fmt, &stop); in gst_ffmpegdemux_perform_seek()
590 gst_ffmpegdemux_push_event (demux, gst_event_new_flush_start ()); in gst_ffmpegdemux_perform_seek()
593 GST_INFO_OBJECT (demux, "will pause demux sinkpad task"); in gst_ffmpegdemux_perform_seek()
594 gst_pad_pause_task (demux->sinkpad); in gst_ffmpegdemux_perform_seek()
595 GST_INFO_OBJECT (demux, "demux sinkpad task paused"); in gst_ffmpegdemux_perform_seek()
599 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_perform_seek()
600 demux->flushing = TRUE; in gst_ffmpegdemux_perform_seek()
601 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_perform_seek()
606 GST_INFO_OBJECT (demux, "send flush start to upstream."); in gst_ffmpegdemux_perform_seek()
607 gst_pad_push_event (demux->sinkpad, gst_event_new_flush_start ()); in gst_ffmpegdemux_perform_seek()
610 GST_INFO_OBJECT (demux, "GST_PAD_STREAM_LOCK"); in gst_ffmpegdemux_perform_seek()
615 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_perform_seek()
616 demux->flushing = TRUE; in gst_ffmpegdemux_perform_seek()
617 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_perform_seek()
618 gst_pad_push_event (demux->sinkpad, gst_event_new_flush_start ()); in gst_ffmpegdemux_perform_seek()
619 gst_ffmpegdemux_push_event (demux, gst_event_new_flush_start ()); in gst_ffmpegdemux_perform_seek()
621 gst_pad_pause_task (demux->sinkpad); in gst_ffmpegdemux_perform_seek()
628 GST_PAD_STREAM_LOCK (demux->sinkpad); in gst_ffmpegdemux_perform_seek()
632 memcpy (&seeksegment, &demux->segment, sizeof (GstSegment)); in gst_ffmpegdemux_perform_seek()
640 GST_DEBUG_OBJECT (demux, "segment configured from %" G_GINT64_FORMAT in gst_ffmpegdemux_perform_seek()
647 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_perform_seek()
648 demux->flushing = FALSE; in gst_ffmpegdemux_perform_seek()
649 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_perform_seek()
650 gst_pad_push_event (demux->sinkpad, gst_event_new_flush_stop (TRUE)); in gst_ffmpegdemux_perform_seek()
654 res = gst_ffmpegdemux_do_seek (demux, &seeksegment); in gst_ffmpegdemux_perform_seek()
660 gst_ffmpegdemux_push_event (demux, gst_event_new_flush_stop (TRUE)); in gst_ffmpegdemux_perform_seek()
665 memcpy (&demux->segment, &seeksegment, sizeof (GstSegment)); in gst_ffmpegdemux_perform_seek()
667 if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) { in gst_ffmpegdemux_perform_seek()
668 gst_element_post_message (GST_ELEMENT (demux), in gst_ffmpegdemux_perform_seek()
669 gst_message_new_segment_start (GST_OBJECT (demux), in gst_ffmpegdemux_perform_seek()
670 demux->segment.format, demux->segment.position)); in gst_ffmpegdemux_perform_seek()
674 GST_DEBUG_OBJECT (demux, "Sending newsegment %" GST_SEGMENT_FORMAT, in gst_ffmpegdemux_perform_seek()
675 &demux->segment); in gst_ffmpegdemux_perform_seek()
677 gst_ffmpegdemux_push_event (demux, gst_event_new_segment (&demux->segment)); in gst_ffmpegdemux_perform_seek()
681 gst_ffmpegdemux_set_flags (demux, TRUE, FALSE); in gst_ffmpegdemux_perform_seek()
682 gst_flow_combiner_reset (demux->flowcombiner); in gst_ffmpegdemux_perform_seek()
686 gst_pad_start_task (demux->sinkpad, (GstTaskFunction) gst_ffmpegdemux_loop, in gst_ffmpegdemux_perform_seek()
687 demux->sinkpad, NULL); in gst_ffmpegdemux_perform_seek()
690 GST_PAD_STREAM_UNLOCK (demux->sinkpad); in gst_ffmpegdemux_perform_seek()
697 GST_DEBUG_OBJECT (demux, "undefined format given, seek aborted."); in gst_ffmpegdemux_perform_seek()
705 GstFFMpegDemux *demux; in gst_ffmpegdemux_src_event() local
708 demux = (GstFFMpegDemux *) parent; in gst_ffmpegdemux_src_event()
712 res = gst_ffmpegdemux_perform_seek (demux, event); in gst_ffmpegdemux_src_event()
716 res = gst_pad_push_event (demux->sinkpad, event); in gst_ffmpegdemux_src_event()
732 GstFFMpegDemux *demux = (GstFFMpegDemux *) (element); in gst_ffmpegdemux_send_event() local
737 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_send_event()
738 if (!demux->opened) { in gst_ffmpegdemux_send_event()
741 GST_DEBUG_OBJECT (demux, "caching seek event"); in gst_ffmpegdemux_send_event()
742 event_p = &demux->seek_event; in gst_ffmpegdemux_send_event()
744 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_send_event()
748 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_send_event()
749 res = gst_ffmpegdemux_perform_seek (demux, event); in gst_ffmpegdemux_send_event()
764 GstFFMpegDemux *demux; in gst_ffmpegdemux_src_query() local
774 demux = (GstFFMpegDemux *) parent; in gst_ffmpegdemux_src_query()
800 if (demux->videopads + demux->audiopads == 1 && in gst_ffmpegdemux_src_query()
801 GST_PAD_PEER (demux->sinkpad) != NULL) in gst_ffmpegdemux_src_query()
820 timeduration = demux->duration; in gst_ffmpegdemux_src_query()
837 if (demux->videopads + demux->audiopads == 1 && in gst_ffmpegdemux_src_query()
838 GST_PAD_PEER (demux->sinkpad) != NULL) in gst_ffmpegdemux_src_query()
852 seekable = demux->seekable; in gst_ffmpegdemux_src_query()
866 format = demux->segment.format; in gst_ffmpegdemux_src_query()
869 gst_segment_to_stream_time (&demux->segment, format, in gst_ffmpegdemux_src_query()
870 demux->segment.start); in gst_ffmpegdemux_src_query()
871 if ((stop = demux->segment.stop) == -1) in gst_ffmpegdemux_src_query()
872 stop = demux->segment.duration; in gst_ffmpegdemux_src_query()
874 stop = gst_segment_to_stream_time (&demux->segment, format, stop); in gst_ffmpegdemux_src_query()
876 gst_query_set_segment (query, demux->segment.rate, format, start, stop); in gst_ffmpegdemux_src_query()
963 gst_ffmpegdemux_add_image_tag (GstFFMpegDemux * demux, GstTagList * taglist) in gst_ffmpegdemux_add_image_tag() argument
968 GST_WARNING_OBJECT(demux, "create taglist failed"); in gst_ffmpegdemux_add_image_tag()
977 stream = demux->streams[i]; in gst_ffmpegdemux_add_image_tag()
991 GST_INFO_OBJECT (demux, "stream %d has attached pic, size: %d", in gst_ffmpegdemux_add_image_tag()
1001 GST_INFO_OBJECT (demux, "stream %d has Cover (front) image", avstream->index); in gst_ffmpegdemux_add_image_tag()
1011 …GST_WARNING_OBJECT (demux, "stream %d convert image data to image sample failed", avstream->index); in gst_ffmpegdemux_add_image_tag()
1024 gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream) in gst_ffmpegdemux_get_stream() argument
1038 oclass = (GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux); in gst_ffmpegdemux_get_stream()
1040 if (demux->streams[avstream->index] != NULL) in gst_ffmpegdemux_get_stream()
1048 demux->streams[avstream->index] = stream; in gst_ffmpegdemux_get_stream()
1060 num = demux->videopads++; in gst_ffmpegdemux_get_stream()
1068 num = demux->audiopads++; in gst_ffmpegdemux_get_stream()
1105 GST_DEBUG_OBJECT (demux, "stream %d: start time: %" GST_TIME_FORMAT, in gst_ffmpegdemux_get_stream()
1109 GST_DEBUG_OBJECT (demux, "stream %d: duration: %" GST_TIME_FORMAT, in gst_ffmpegdemux_get_stream()
1113 demux->streams[avstream->index] = stream; in gst_ffmpegdemux_get_stream()
1117 gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (demux), "%03u", in gst_ffmpegdemux_get_stream()
1120 event = gst_pad_get_sticky_event (demux->sinkpad, GST_EVENT_STREAM_START, 0); in gst_ffmpegdemux_get_stream()
1122 if (gst_event_parse_group_id (event, &demux->group_id)) in gst_ffmpegdemux_get_stream()
1123 demux->have_group_id = TRUE; in gst_ffmpegdemux_get_stream()
1125 demux->have_group_id = FALSE; in gst_ffmpegdemux_get_stream()
1127 } else if (!demux->have_group_id) { in gst_ffmpegdemux_get_stream()
1128 demux->have_group_id = TRUE; in gst_ffmpegdemux_get_stream()
1129 demux->group_id = gst_util_group_id_next (); in gst_ffmpegdemux_get_stream()
1132 if (demux->have_group_id) in gst_ffmpegdemux_get_stream()
1133 gst_event_set_group_id (event, demux->group_id); in gst_ffmpegdemux_get_stream()
1143 gst_element_add_pad (GST_ELEMENT (demux), pad); in gst_ffmpegdemux_get_stream()
1144 gst_flow_combiner_add_pad (demux->flowcombiner, pad); in gst_ffmpegdemux_get_stream()
1166 GST_DEBUG_OBJECT (demux, "Pad existed (stream %d)", avstream->index); in gst_ffmpegdemux_get_stream()
1167 stream = demux->streams[avstream->index]; in gst_ffmpegdemux_get_stream()
1172 GST_WARNING_OBJECT (demux, "Unknown pad type %d", ctx->codec_type); in gst_ffmpegdemux_get_stream()
1177 GST_WARNING_OBJECT (demux, "Unknown caps for codec %d", ctx->codec_id); in gst_ffmpegdemux_get_stream()
1352 gst_ffmpegdemux_open (GstFFMpegDemux * demux) in gst_ffmpegdemux_open() argument
1356 (GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux); in gst_ffmpegdemux_open()
1372 gst_ffmpegdemux_close (demux); in gst_ffmpegdemux_open()
1375 if (demux->seekable) in gst_ffmpegdemux_open()
1376 res = gst_ffmpegdata_open (demux->sinkpad, AVIO_FLAG_READ, &iocontext); in gst_ffmpegdemux_open()
1378 res = gst_ffmpeg_pipe_open (&demux->ffpipe, AVIO_FLAG_READ, &iocontext); in gst_ffmpegdemux_open()
1388 if (gst_pad_peer_query (demux->sinkpad, query)) { in gst_ffmpegdemux_open()
1406 GST_DEBUG_OBJECT (demux, "Opening context with URI %s", GST_STR_NULL (uri)); in gst_ffmpegdemux_open()
1409 demux->context = avformat_alloc_context (); in gst_ffmpegdemux_open()
1410 demux->context->pb = iocontext; in gst_ffmpegdemux_open()
1414 res = avformat_open_input (&demux->context, NULL, oclass->in_plugin, NULL); in gst_ffmpegdemux_open()
1416 res = avformat_open_input (&demux->context, uri, oclass->in_plugin, NULL); in gst_ffmpegdemux_open()
1421 GST_DEBUG_OBJECT (demux, "av_open_input returned %d", res); in gst_ffmpegdemux_open()
1425 res = gst_ffmpeg_av_find_stream_info (demux->context); in gst_ffmpegdemux_open()
1426 GST_DEBUG_OBJECT (demux, "av_find_stream_info returned %d", res); in gst_ffmpegdemux_open()
1430 n_streams = demux->context->nb_streams; in gst_ffmpegdemux_open()
1431 GST_DEBUG_OBJECT (demux, "we have %d streams", n_streams); in gst_ffmpegdemux_open()
1436 gst_ffmpegdemux_get_stream (demux, demux->context->streams[i]); in gst_ffmpegdemux_open()
1439 gst_element_no_more_pads (GST_ELEMENT (demux)); in gst_ffmpegdemux_open()
1442 demux->start_time = gst_util_uint64_scale_int (demux->context->start_time, in gst_ffmpegdemux_open()
1444 GST_DEBUG_OBJECT (demux, "start time: %" GST_TIME_FORMAT, in gst_ffmpegdemux_open()
1445 GST_TIME_ARGS (demux->start_time)); in gst_ffmpegdemux_open()
1446 if (demux->context->duration > 0) in gst_ffmpegdemux_open()
1447 demux->duration = gst_util_uint64_scale_int (demux->context->duration, in gst_ffmpegdemux_open()
1450 demux->duration = GST_CLOCK_TIME_NONE; in gst_ffmpegdemux_open()
1452 GST_DEBUG_OBJECT (demux, "duration: %" GST_TIME_FORMAT, in gst_ffmpegdemux_open()
1453 GST_TIME_ARGS (demux->duration)); in gst_ffmpegdemux_open()
1456 demux->segment.duration = demux->duration; in gst_ffmpegdemux_open()
1458 GST_OBJECT_LOCK (demux); in gst_ffmpegdemux_open()
1459 demux->opened = TRUE; in gst_ffmpegdemux_open()
1460 event = demux->seek_event; in gst_ffmpegdemux_open()
1461 demux->seek_event = NULL; in gst_ffmpegdemux_open()
1462 cached_events = demux->cached_events; in gst_ffmpegdemux_open()
1463 demux->cached_events = NULL; in gst_ffmpegdemux_open()
1464 GST_OBJECT_UNLOCK (demux); in gst_ffmpegdemux_open()
1467 gst_ffmpegdemux_perform_seek (demux, event); in gst_ffmpegdemux_open()
1470 GST_DEBUG_OBJECT (demux, "Sending segment %" GST_SEGMENT_FORMAT, in gst_ffmpegdemux_open()
1471 &demux->segment); in gst_ffmpegdemux_open()
1472 gst_ffmpegdemux_push_event (demux, gst_event_new_segment (&demux->segment)); in gst_ffmpegdemux_open()
1477 GST_INFO_OBJECT (demux, "pushing cached event: %" GST_PTR_FORMAT, event); in gst_ffmpegdemux_open()
1478 gst_ffmpegdemux_push_event (demux, event); in gst_ffmpegdemux_open()
1483 tags = gst_ffmpeg_metadata_to_tag_list (demux->context->metadata); in gst_ffmpegdemux_open()
1485 GST_INFO_OBJECT (demux, "global tags: %" GST_PTR_FORMAT, tags); in gst_ffmpegdemux_open()
1497 tags = gst_ffmpegdemux_add_image_tag(demux, tags); in gst_ffmpegdemux_open()
1505 stream = gst_ffmpegdemux_get_stream (demux, demux->context->streams[i]); in gst_ffmpegdemux_open()
1529 GST_ELEMENT_ERROR (demux, LIBRARY, FAILED, (NULL), in gst_ffmpegdemux_open()
1635 gst_ffmpegdemux_loop (GstFFMpegDemux * demux) argument
1651 if (!demux->opened)
1652 if (!gst_ffmpegdemux_open (demux))
1655 GST_DEBUG_OBJECT (demux, "about to read a frame");
1658 res = av_read_frame (demux->context, &pkt);
1664 gst_ffmpegdemux_get_stream (demux,
1665 demux->context->streams[pkt.stream_index]);
1686 GST_WARNING_OBJECT (demux,
1696 GST_WARNING_OBJECT (demux, "invalid buffer duration, setting to NONE");
1701 GST_DEBUG_OBJECT (demux,
1709 if (demux->start_time != -1 && demux->start_time > timestamp)
1719 if (!(GST_CLOCK_TIME_IS_VALID (demux->start_time)) &&
1720 demux->start_time == -1) {
1721 demux->start_time = timestamp;
1726 if (demux->start_time >= timestamp)
1729 timestamp -= demux->start_time;
1733 if (demux->segment.stop != -1 && timestamp > demux->segment.stop)
1755 ((GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux)))->in_plugin->name;
1786 GST_DEBUG_OBJECT (demux, "marking DISCONT");
1791 GST_DEBUG_OBJECT (demux,
1798 if (((ret = gst_flow_combiner_update_flow (demux->flowcombiner,
1800 GST_WARNING_OBJECT (demux, "stream_movi flow: %s / %s",
1816 GST_LOG_OBJECT (demux, "pausing task, reason %d (%s)", ret,
1818 if (demux->seekable)
1819 gst_pad_pause_task (demux->sinkpad);
1821 GstFFMpegPipe *ffpipe = &demux->ffpipe;
1825 gst_task_pause (demux->task);
1826 g_rec_mutex_lock (&demux->task_lock);
1827 g_rec_mutex_unlock (&demux->task_lock);
1828 demux->ffpipe.srcresult = ret;
1833 if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
1836 if ((stop = demux->segment.stop) == -1)
1837 stop = demux->segment.duration;
1839 GST_LOG_OBJECT (demux, "posting segment done");
1840 gst_element_post_message (GST_ELEMENT (demux),
1841 gst_message_new_segment_done (GST_OBJECT (demux),
1842 demux->segment.format, stop));
1843 gst_ffmpegdemux_push_event (demux,
1844 gst_event_new_segment_done (demux->segment.format, stop));
1846 GST_LOG_OBJECT (demux, "pushing eos");
1847 gst_ffmpegdemux_push_event (demux, gst_event_new_eos ());
1850 GST_ELEMENT_FLOW_ERROR (demux, ret);
1851 gst_ffmpegdemux_push_event (demux, gst_event_new_eos ());
1863 GST_WARNING_OBJECT (demux, "av_read_frame returned %d", res);
1865 GST_OBJECT_LOCK (demux);
1867 if (demux->flushing)
1869 else if (gst_ffmpegdemux_has_outputted (demux)
1870 || gst_ffmpegdemux_is_eos (demux)) {
1871 GST_DEBUG_OBJECT (demux, "We are EOS");
1875 GST_OBJECT_UNLOCK (demux);
1881 GST_DEBUG_OBJECT (demux, "dropping buffer out of segment, stream eos");
1883 if (gst_ffmpegdemux_is_eos (demux)) {
1885 GST_DEBUG_OBJECT (demux, "we are eos");
1889 GST_DEBUG_OBJECT (demux, "some streams are not yet eos");
1918 GstFFMpegDemux *demux; local
1922 demux = (GstFFMpegDemux *) parent;
1923 ffpipe = &(demux->ffpipe);
1925 GST_LOG_OBJECT (demux, "event: %" GST_PTR_FORMAT, event);
1947 GST_OBJECT_LOCK (demux);
1948 g_list_foreach (demux->cached_events, (GFunc) gst_mini_object_unref,
1950 g_list_free (demux->cached_events);
1951 GST_OBJECT_UNLOCK (demux);
1956 gst_task_start (demux->task);
1957 demux->flushing = FALSE;
1958 GST_LOG_OBJECT (demux, "loop started");
1973 GST_LOG_OBJECT (demux, "dropping %s event", GST_EVENT_TYPE_NAME (event));
1983 if (demux->opened) {
1992 GST_DEBUG_OBJECT (demux, "drop segment event: %" GST_PTR_FORMAT, event);
1998 GST_OBJECT_LOCK (demux);
1999 demux->cached_events = g_list_append (demux->cached_events, event);
2000 GST_OBJECT_UNLOCK (demux);
2017 GstFFMpegDemux *demux; local
2020 demux = (GstFFMpegDemux *) parent;
2021 ffpipe = &demux->ffpipe;
2052 GST_DEBUG_OBJECT (demux, "ignoring buffer at end-of-stream");
2060 GST_DEBUG_OBJECT (demux, "ignoring buffer because src task encountered %s",
2121 GstFFMpegDemux *demux; local
2124 demux = (GstFFMpegDemux *) (parent);
2127 if (demux->can_push == FALSE) {
2128 GST_WARNING_OBJECT (demux, "Demuxer can't reliably operate in push-mode");
2131 demux->ffpipe.eos = FALSE;
2132 demux->ffpipe.srcresult = GST_FLOW_OK;
2133 demux->ffpipe.needed = 0;
2134 demux->seekable = FALSE;
2135 res = gst_task_start (demux->task);
2137 GstFFMpegPipe *ffpipe = &demux->ffpipe;
2141 demux->ffpipe.srcresult = GST_FLOW_FLUSHING;
2143 demux->ffpipe.eos = TRUE;
2148 gst_task_stop (demux->task);
2149 g_rec_mutex_lock (&demux->task_lock);
2150 g_rec_mutex_unlock (&demux->task_lock);
2151 res = gst_task_join (demux->task);
2152 demux->seekable = FALSE;
2168 GstFFMpegDemux *demux; local
2171 demux = (GstFFMpegDemux *) parent;
2174 demux->seekable = TRUE;
2176 demux, NULL);
2179 demux->seekable = FALSE;
2208 GstFFMpegDemux *demux = (GstFFMpegDemux *) (element); local
2229 gst_ffmpegdemux_close (demux);
2230 gst_adapter_clear (demux->ffpipe.adapter);
2231 g_list_foreach (demux->cached_events, (GFunc) gst_mini_object_unref,
2233 g_list_free (demux->cached_events);
2234 demux->cached_events = NULL;
2235 demux->have_group_id = FALSE;
2236 demux->group_id = G_MAXUINT;