[svn r433] GMutex fixes on TVChain, added missing g_object_refs.
2 * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
3 * Rosfran Borges <rosfran.borges@indt.org.br>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 /* Element-Checklist-Version: 5 */
23 * SECTION:element-nuvdemux
27 * Demuxes an .nuv file into raw or compressed audio and/or video streams.
30 * This element currently only supports pull-based scheduling.
32 * <title>Example launch line</title>
35 * gst-launch filesrc test.nuv ! nuvdemux name=demux demux.audio_00 ! decodebin ! audioconvert ! audioresample ! autoaudiosink demux.video_00 ! queue ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink
37 * Play (parse and decode) an .nuv file and try to output it to
38 * an automatically detected soundcard and videosink. If the NUV file contains
39 * compressed audio or video data, this will only work if you have the
40 * right decoder elements/plugins installed.
51 #include <gst/gsterror.h>
52 #include <gst/gstplugin.h>
56 #include "glib/gi18n.h"
57 #include "gstnuvdemux.h"
59 #define GST_NUV_DEMUX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemuxPrivate))
61 GST_DEBUG_CATEGORY_STATIC (nuvdemux_debug);
62 #define GST_CAT_DEFAULT nuvdemux_debug
63 #define GST_FLOW_ERROR_NO_DATA -101
71 GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
73 static const GstElementDetails gst_nuv_demux_details =
74 GST_ELEMENT_DETAILS ("Nuv demuxer",
76 "Demultiplex a .nuv file into audio and video",
77 "Renato Araujo Oliveira Filho <renato.filho@indt.org.br>,"
78 "Rosfran Borges <rosfran.borges@indt.org.br>");
84 gchar id[12]; /* "NuppelVideo\0" or "MythTVVideo\0" */
85 gchar version[5]; /* "x.xx\0" */
90 gint i_height_desired;
92 gchar i_mode; /* P progressive, I interlaced */
94 gdouble d_aspect; /* 1.0 squared pixel */
100 gint i_video_blocks; /* 0 no video, -1 unknown */
104 gint i_keyframe_distance;
111 gchar i_type; /* A: audio, V: video, S: sync; T: test
112 R: Seekpoint (string:RTjjjjjjjj)
113 D: Extra data for codec */
114 gchar i_compression; /* V: 0 uncompressed
119 A: 0 uncompressed (44100 1-bits, 2ch)
125 N null frame loudless
127 S: B audio and vdeo sync point
128 A audio sync info (timecode == effective
130 V next video sync (timecode == next video
132 S audio,video,text correlation */
133 gchar i_keyframe; /* 0 keyframe, else no no key frame */
134 guint8 i_filters; /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
135 0x02: gauss 5 pixel (8,1,1,1,1)/12
136 0x04: cartoon filter */
138 gint32 i_timecode; /* ms */
140 gint i_length; /* V,A,T: length of following data
141 S: length of packet correl */
144 /* FIXME Not sure of this one */
151 gint i_audio_sample_rate;
152 gint i_audio_bits_per_sample;
153 gint i_audio_channels;
154 gint i_audio_compression_ratio;
155 gint i_audio_quality;
156 gint i_rtjpeg_quality;
157 gint i_rtjpeg_luma_filter;
158 gint i_rtjpeg_chroma_filter;
162 gint i_lavc_maxqdiff;
163 gint64 i_seekable_offset;
164 gint64 i_keyframe_adjust_offset;
166 } nuv_extended_header;
170 GST_NUV_DEMUX_HEADER_DATA,
171 GST_NUV_DEMUX_EXTRA_DATA,
172 GST_NUV_DEMUX_MPEG_DATA,
173 GST_NUV_DEMUX_EXTEND_HEADER,
174 GST_NUV_DEMUX_EXTEND_HEADER_DATA,
175 GST_NUV_DEMUX_FRAME_HEADER,
177 GST_NUV_DEMUX_INVALID_DATA
180 struct _GstNuvDemuxPrivate {
181 /* used for indicate the mode */
184 /* used on push mode */
189 GstPad *src_video_pad;
190 GstPad *src_audio_pad;
193 GstFlowReturn last_video_return;
194 GstFlowReturn last_audio_return;
197 /* NUV decoding state */
198 GstNuvDemuxState state;
202 guint64 streamer_offset;
204 /* duration information */
205 gint64 duration_bytes;
206 gint64 duration_time;
207 gint64 duration_average;
209 /* segment control info */
210 gboolean new_audio_segment;
211 gboolean new_video_segment;
214 guint64 mpeg_data_size;
215 GstBuffer *mpeg_buffer;
219 nuv_extended_header eh;
226 guint64 last_frame_time;
230 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
233 GST_STATIC_CAPS ("video/x-nuv"));
235 static GstStaticPadTemplate audio_src_template =
236 GST_STATIC_PAD_TEMPLATE ("audio_src",
239 GST_STATIC_CAPS_ANY);
241 static GstStaticPadTemplate video_src_template =
242 GST_STATIC_PAD_TEMPLATE ("video_src",
245 GST_STATIC_CAPS_ANY);
247 static void gst_nuv_demux_dispose (GObject * object);
248 static void gst_nuv_demux_finalize (GObject * object);
249 static GstStateChangeReturn gst_nuv_demux_change_state (GstElement * element,
250 GstStateChange transition);
251 static void gst_nuv_demux_loop (GstPad * pad);
252 static GstFlowReturn gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf);
253 static GstFlowReturn gst_nuv_demux_play (GstPad * pad);
254 static gboolean gst_nuv_demux_sink_activate_pull (GstPad * sinkpad,
256 static gboolean gst_nuv_demux_sink_activate_push (GstPad * pad,
258 static gboolean gst_nuv_demux_sink_activate (GstPad * sinkpad);
259 static gboolean gst_nuv_demux_sink_event (GstPad *pad, GstEvent *event);
260 static gboolean gst_nuv_demux_srcpad_event (GstPad * pad, GstEvent * event);
262 static GstFlowReturn gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size,
263 gboolean move, GstBuffer ** buffer);
264 static void gst_nuv_demux_reset (GstNuvDemux * nuv);
265 static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
266 static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
267 static void gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp);
268 static gint64 gst_nuv_demux_get_bytes_duration (GstNuvDemux *nuv);
269 static gint64 gst_nuv_demux_get_time_duration (GstNuvDemux *nuv);
271 #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6)
272 GstBuffer * gst_adapter_take_buffer (GstAdapter * adapter, guint nbytes);
276 GST_BOILERPLATE (GstNuvDemux, gst_nuv_demux, GstElement, GST_TYPE_ELEMENT);
278 /******************************************************************************
280 ******************************************************************************/
281 #if G_BYTE_ORDER == G_BIG_ENDIAN
282 static inline gdouble
283 _gdouble_swap_le_be (gdouble * d)
292 u.i = GUINT64_SWAP_LE_BE (u.i);
296 #define READ_DOUBLE_FROM_LE(d) (_gdouble_swap_le_be((gdouble* ) d))
297 #else /* G_BYTE_ORDER != G_BIG_ENDIAN */
298 #define READ_DOUBLE_FROM_LE(d) *((gdouble* ) (d))
299 #endif /* G_BYTE_ORDER != G_BIG_ENDIAN */
302 double2fraction (double in, int *num, int *denom)
307 } else if (in == 23.976) {
312 while (in - floor(in) >= 0.1) {
316 *num = (int)floor(in);
320 /* GObject Functions */
323 gst_nuv_demux_base_init (gpointer klass)
325 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
327 gst_element_class_add_pad_template (element_class,
328 gst_static_pad_template_get (&audio_src_template));
330 gst_element_class_add_pad_template (element_class,
331 gst_static_pad_template_get (&video_src_template));
333 gst_element_class_add_pad_template (element_class,
334 gst_static_pad_template_get (&sink_template));
335 gst_element_class_set_details (element_class, &gst_nuv_demux_details);
339 gst_nuv_demux_class_init (GstNuvDemuxClass * klass)
341 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
342 GObjectClass *gobject_class = (GObjectClass *) klass;
344 GST_DEBUG_CATEGORY_INIT (nuvdemux_debug, "nuvdemux",
345 0, "Demuxer for NUV streams");
347 parent_class = g_type_class_peek_parent (klass);
349 gobject_class->dispose = gst_nuv_demux_dispose;
350 gobject_class->finalize = gst_nuv_demux_finalize;
351 gstelement_class->change_state = gst_nuv_demux_change_state;
353 g_type_class_add_private (gobject_class, sizeof (GstNuvDemuxPrivate));
357 gst_nuv_demux_init (GstNuvDemux * nuv, GstNuvDemuxClass * nuv_class)
359 nuv->priv = GST_NUV_DEMUX_GET_PRIVATE (nuv);
360 nuv->priv->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
362 /* creating adapter */
363 nuv->priv->mode = NUV_PUSH_MODE;
364 nuv->priv->adapter = gst_adapter_new ();
366 g_debug ("Adapter %p", nuv->priv->adapter);
368 nuv->priv->new_audio_segment = TRUE;
369 nuv->priv->new_video_segment = TRUE;
371 gst_pad_set_activate_function (nuv->priv->sinkpad, gst_nuv_demux_sink_activate);
372 gst_pad_set_activatepull_function (nuv->priv->sinkpad,
373 gst_nuv_demux_sink_activate_pull);
374 gst_pad_set_activatepush_function (nuv->priv->sinkpad,
375 gst_nuv_demux_sink_activate_push);
376 gst_pad_set_chain_function (nuv->priv->sinkpad,
377 GST_DEBUG_FUNCPTR (gst_nuv_demux_chain));
378 gst_pad_set_event_function (nuv->priv->sinkpad,
379 gst_nuv_demux_sink_event);
381 gst_element_add_pad (GST_ELEMENT (nuv), nuv->priv->sinkpad);
386 gst_nuv_demux_dispose (GObject * object)
388 GstNuvDemux *nuv = GST_NUV_DEMUX (object);
390 g_debug ("NUV DISPOSE");
392 if (nuv->priv->mpeg_buffer != NULL) {
393 gst_buffer_unref (nuv->priv->mpeg_buffer);
396 gst_nuv_demux_reset (GST_NUV_DEMUX (object));
397 gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (object));
399 if (nuv->priv->adapter != NULL) {
400 gst_object_unref (nuv->priv->adapter);
405 gst_nuv_demux_finalize (GObject * object)
407 G_OBJECT_CLASS (parent_class)->finalize (object);
414 gst_nuv_demux_header_load (GstNuvDemux * nuv, nuv_header *h)
416 GstBuffer *buffer = NULL;
417 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 72, TRUE, &buffer);
419 if ((res != GST_FLOW_OK) || (buffer == NULL)) {
423 memcpy (h->id, buffer->data, 12);
424 memcpy (h->version, buffer->data + 12, 5);
425 h->i_width = GST_READ_UINT32_LE (&buffer->data[20]);
426 h->i_height = GST_READ_UINT32_LE (&buffer->data[24]);
427 h->i_width_desired = GST_READ_UINT32_LE (&buffer->data[28]);
428 h->i_height_desired = GST_READ_UINT32_LE (&buffer->data[32]);
429 h->i_mode = GPOINTER_TO_INT (buffer->data[36]);
430 h->d_aspect = READ_DOUBLE_FROM_LE (&buffer->data[40]);
431 h->d_fps = READ_DOUBLE_FROM_LE (&buffer->data[48]);
432 /* get the num and denom values from fps */
433 double2fraction (h->d_fps, &h->i_fpsn, &h->i_fpsd);
434 h->i_video_blocks = GST_READ_UINT32_LE (&buffer->data[56]);
435 h->i_audio_blocks = GST_READ_UINT32_LE (&buffer->data[60]);
436 h->i_text_blocks = GST_READ_UINT32_LE (&buffer->data[64]);
437 h->i_keyframe_distance = GST_READ_UINT32_LE (&buffer->data[68]);
439 GST_DEBUG_OBJECT (nuv,
440 "nuv: h=%s v=%s %dx%d a=%f fps=%f v=%d a=%d t=%d kfd=%d", h->id,
441 h->version, h->i_width, h->i_height, h->d_aspect, h->d_fps,
442 h->i_video_blocks, h->i_audio_blocks, h->i_text_blocks,
443 h->i_keyframe_distance);
446 if (buffer != NULL) {
447 gst_buffer_unref (buffer);
454 gst_nuv_demux_stream_header_data (GstNuvDemux * nuv)
458 res = gst_nuv_demux_header_load (nuv, &nuv->priv->h);
459 if (res == GST_FLOW_OK)
460 nuv->priv->state = GST_NUV_DEMUX_EXTRA_DATA;
468 gst_nuv_demux_stream_file_header (GstNuvDemux * nuv)
470 GstFlowReturn res = GST_FLOW_OK;
471 GstBuffer *file_header = NULL;
473 res = gst_nuv_demux_read_bytes (nuv, 12, FALSE, &file_header);
474 if (res == GST_FLOW_OK) {
475 if (strncmp ((gchar *) file_header->data, "MythTVVideo", 11) ||
476 strncmp ((gchar *) file_header->data, "NuppelVideo", 11)) {
477 nuv->priv->state = GST_NUV_DEMUX_HEADER_DATA;
479 GST_DEBUG_OBJECT (nuv, "error parsing file header");
480 nuv->priv->state = GST_NUV_DEMUX_INVALID_DATA;
481 res = GST_FLOW_ERROR;
485 if (file_header != NULL) {
486 gst_buffer_unref (file_header);
495 gst_nuv_demux_frame_header_load (GstNuvDemux * nuv, nuv_frame_header *h)
498 GstBuffer *buf = NULL;
500 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 12, TRUE, &buf);
502 if ((res != GST_FLOW_OK) || (buf == NULL)) {
508 h->i_type = GPOINTER_TO_INT (data[0]);
509 h->i_compression = GPOINTER_TO_INT (data[1]);
510 h->i_keyframe = GPOINTER_TO_INT (data[2]);
511 h->i_filters = GPOINTER_TO_INT (data[3]);
512 h->i_timecode = GST_READ_UINT32_LE (&data[4]);
513 h->i_length = GST_READ_UINT32_LE (&data[8]);
515 GST_DEBUG_OBJECT (nuv, "frame hdr: t=%c c=%c k=%d f=0x%x timecode=%d l=%d",
517 h->i_compression ? h->i_compression : ' ',
518 h->i_keyframe ? h->i_keyframe : ' ',
519 h->i_filters, h->i_timecode, h->i_length);
523 gst_buffer_unref (buf);
530 gst_nuv_demux_extended_header_load (GstNuvDemux * nuv,
531 nuv_extended_header * h)
534 GstBuffer *buff = NULL;
536 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 512, TRUE, &buff);
538 if ((res != GST_FLOW_OK) || (buff == NULL)) {
543 h->i_version = GST_READ_UINT32_LE (&data[0]);
544 h->i_video_fcc = GST_MAKE_FOURCC (data[4], data[5], data[6], data[7]);
545 h->i_audio_fcc = GST_MAKE_FOURCC (data[8], data[9], data[10], data[11]);
546 h->i_audio_sample_rate = GST_READ_UINT32_LE (&data[12]);
547 h->i_audio_bits_per_sample = GST_READ_UINT32_LE (&data[16]);
548 h->i_audio_channels = GST_READ_UINT32_LE (&data[20]);
549 h->i_audio_compression_ratio = GST_READ_UINT32_LE (&data[24]);
550 h->i_audio_quality = GST_READ_UINT32_LE (&data[28]);
551 h->i_rtjpeg_quality = GST_READ_UINT32_LE (&data[32]);
552 h->i_rtjpeg_luma_filter = GST_READ_UINT32_LE (&data[36]);
553 h->i_rtjpeg_chroma_filter = GST_READ_UINT32_LE (&data[40]);
554 h->i_lavc_bitrate = GST_READ_UINT32_LE (&data[44]);
555 h->i_lavc_qmin = GST_READ_UINT32_LE (&data[48]);
556 h->i_lavc_qmin = GST_READ_UINT32_LE (&data[52]);
557 h->i_lavc_maxqdiff = GST_READ_UINT32_LE (&data[56]);
558 h->i_seekable_offset = GST_READ_UINT64_LE (&data[60]);
559 h->i_keyframe_adjust_offset = GST_READ_UINT64_LE (&data[68]);
561 GST_DEBUG_OBJECT (nuv,
562 "ex hdr: v=%d vffc=%4.4s afcc=%4.4s %dHz %dbits ach=%d acr=%d aq=%d"
563 "rtjpeg q=%d lf=%d lc=%d lavc br=%d qmin=%d qmax=%d maxqdiff=%d seekableoff=%lld keyfao=%lld",
564 h->i_version, (gchar *) & h->i_video_fcc, (gchar *) & h->i_audio_fcc,
565 h->i_audio_sample_rate, h->i_audio_bits_per_sample, h->i_audio_channels,
566 h->i_audio_compression_ratio, h->i_audio_quality, h->i_rtjpeg_quality,
567 h->i_rtjpeg_luma_filter, h->i_rtjpeg_chroma_filter, h->i_lavc_bitrate,
568 h->i_lavc_qmin, h->i_lavc_qmax, h->i_lavc_maxqdiff, h->i_seekable_offset,
569 h->i_keyframe_adjust_offset);
573 gst_buffer_unref (buff);
580 /* Query Functions */
581 static const GstQueryType *
582 gst_nuv_demux_get_src_query_types (GstPad * pad)
584 static const GstQueryType src_types[] = {
594 gst_nuv_demux_handle_src_query (GstPad * pad, GstQuery * query)
596 gboolean res = FALSE;
597 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
599 switch (GST_QUERY_TYPE (query)) {
600 case GST_QUERY_POSITION:
601 if (GST_CLOCK_TIME_IS_VALID (nuv->priv->last_frame_time)) {
603 gst_query_set_position (query, GST_FORMAT_TIME, nuv->priv->last_frame_time);
607 case GST_QUERY_DURATION:
610 duration = gst_nuv_demux_get_time_duration (nuv);
611 if (duration == GST_CLOCK_TIME_NONE) {
612 duration = nuv->priv->duration_average;
614 if (duration != GST_CLOCK_TIME_NONE) {
615 gst_query_set_duration (query, GST_FORMAT_TIME, duration);
625 gst_object_unref (nuv);
631 gst_nuv_demux_create_pad (GstNuvDemux *nuv, GstCaps *caps, GstStaticPadTemplate *template, const gchar* name)
634 pad = gst_pad_new_from_static_template (template, name);
635 gst_pad_set_caps (pad, caps);
636 gst_pad_set_active (pad, TRUE);
637 gst_pad_use_fixed_caps (pad);
638 gst_element_add_pad (GST_ELEMENT (nuv), pad);
639 gst_pad_set_event_function (pad,
640 GST_DEBUG_FUNCPTR (gst_nuv_demux_srcpad_event));
646 gst_nuv_demux_create_pads (GstNuvDemux * nuv)
648 if (nuv->priv->h.i_video_blocks != 0) {
649 GstCaps *video_caps = NULL;
651 video_caps = gst_caps_new_simple ("video/x-divx",
652 "divxversion", G_TYPE_INT, 4,
653 "width", G_TYPE_INT, nuv->priv->h.i_width,
654 "height", G_TYPE_INT, nuv->priv->h.i_height,
655 "framerate", GST_TYPE_FRACTION, nuv->priv->h.i_fpsn, nuv->priv->h.i_fpsd,
656 "format", GST_TYPE_FOURCC, nuv->priv->eh.i_video_fcc,
657 "pixel-aspect-ratio", GST_TYPE_FRACTION,
658 (gint) (nuv->priv->h.d_aspect * 1000.0f), 1000, NULL);
660 nuv->priv->src_video_pad = gst_nuv_demux_create_pad (nuv, video_caps, &video_src_template, "video_src");
661 gst_caps_unref (video_caps);
664 if (nuv->priv->h.i_audio_blocks != 0) {
665 GstCaps *audio_caps = NULL;
667 audio_caps = gst_caps_new_simple ("audio/mpeg",
668 "rate", G_TYPE_INT, nuv->priv->eh.i_audio_sample_rate,
669 "format", GST_TYPE_FOURCC, nuv->priv->eh.i_audio_fcc,
670 "channels", G_TYPE_INT, nuv->priv->eh.i_audio_channels,
671 "layer", G_TYPE_INT, 3, // fixme: magic number
672 "mpegversion", G_TYPE_INT, nuv->priv->eh.i_version, NULL);
674 nuv->priv->src_audio_pad = gst_nuv_demux_create_pad (nuv, audio_caps, &audio_src_template, "audio_src");
675 gst_caps_unref (audio_caps);
678 gst_element_no_more_pads (GST_ELEMENT (nuv));
682 gst_nuv_demux_validate_header (nuv_frame_header *h)
684 gboolean valid = FALSE;
685 //g_debug ("Type %d = Compression %d", h->i_type, h->i_compression);
686 //g_usleep (1 * G_USEC_PER_SEC );
690 if (h->i_compression == 0 ||
691 h->i_compression == 1 ||
692 h->i_compression == 2 ||
693 h->i_compression == 'N' ||
694 h->i_compression == 'L') {
699 if (h->i_compression == 0 ||
700 h->i_compression == 1 ||
701 h->i_compression == 2 ||
702 h->i_compression == 3 ||
703 h->i_compression == 'F' ||
704 h->i_compression == 'S' ||
705 h->i_compression == 'N' ||
706 h->i_compression == 'L') {
711 if (h->i_compression == 'B' ||
712 h->i_compression == 'A' ||
713 h->i_compression == 'V' ||
714 h->i_compression == 'S') {
734 gst_nuv_demux_read_head_frame (GstNuvDemux * nuv)
736 GstFlowReturn ret = GST_FLOW_OK;
737 gboolean valid = FALSE;
740 ret = gst_nuv_demux_frame_header_load (nuv, &nuv->priv->fh);
741 if (ret != GST_FLOW_OK) {
742 g_debug ("FAIL TO READ HEADER");
746 if (gst_nuv_demux_validate_header (&nuv->priv->fh) == TRUE)
749 g_debug ("Invalid frame header");
751 } while (valid == FALSE);
753 // } while (gst_nuv_demux_validate_header (nuv->priv->fh));
755 nuv->priv->state = GST_NUV_DEMUX_MOVI;
760 gst_nuv_combine_flow (GstNuvDemux *nuv)
762 GstFlowReturn ret_video = nuv->priv->last_video_return;
763 GstFlowReturn ret_audio = nuv->priv->last_audio_return;
765 if ((ret_video != GST_FLOW_OK) &&
766 (ret_audio != GST_FLOW_OK))
769 if (GST_FLOW_IS_FATAL (ret_video))
772 if (GST_FLOW_IS_FATAL (ret_audio))
779 gst_nuv_demux_stream_data (GstNuvDemux * nuv)
781 GstFlowReturn ret = GST_FLOW_OK;
784 GstBuffer *buf = NULL;
792 if (h.i_length > 0) {
793 ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf);
794 if ((ret != GST_FLOW_OK) || (buf == NULL)) {
798 if ((h.i_timecode < 0)) {
803 timestamp = h.i_timecode * GST_MSECOND;
804 GST_BUFFER_TIMESTAMP (buf) = timestamp;
814 pad = nuv->priv->src_video_pad;
816 if (nuv->priv->new_video_segment) {
818 /* send new segment event*/
819 gst_pad_push_event (nuv->priv->src_video_pad,
820 gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
821 GST_CLOCK_TIME_NONE, 0));
823 if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) {
824 nuv->priv->time_start = timestamp;
826 nuv->priv->new_video_segment = FALSE;
833 pad = nuv->priv->src_audio_pad;
835 if (nuv->priv->new_audio_segment) {
836 /* send new segment event*/
837 gst_pad_push_event (nuv->priv->src_audio_pad,
838 gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
839 GST_CLOCK_TIME_NONE, 0));
841 if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) {
842 nuv->priv->time_start = timestamp;
844 nuv->priv->new_audio_segment = FALSE;
851 switch (h.i_compression) {
853 GST_DEBUG_OBJECT (nuv, "sending new video segment: %d", h.i_timecode);
854 gst_pad_push_event (nuv->priv->src_video_pad,
855 gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, h.i_timecode * GST_MSECOND,
856 GST_CLOCK_TIME_NONE, 0));
859 GST_DEBUG_OBJECT (nuv, "sending new audio segment: %d", h.i_timecode);
860 gst_pad_push_event (nuv->priv->src_audio_pad,
861 gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
862 GST_CLOCK_TIME_NONE, 0));
873 if ((buf != NULL) && (pad != NULL)) {
874 /* update average time */
875 nuv->priv->streamer_offset += h.i_length;
876 gst_segment_set_last_stop (&nuv->priv->segment, GST_FORMAT_TIME, timestamp);
877 gst_nuv_demux_update_duration (nuv, timestamp);
879 /* pushing the buffer */
880 gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
881 ret = gst_pad_push (pad, buf);
884 if (ret != GST_FLOW_OK) {
885 GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad));
887 if (pad == nuv->priv->src_video_pad) {
888 nuv->priv->last_video_return = ret;
890 else if (pad == nuv->priv->src_audio_pad) {
891 nuv->priv->last_audio_return = ret;
894 /* verify anothers flow if is necessary stop task */
895 if (gst_nuv_combine_flow (nuv) != FALSE) {
898 GST_WARNING_OBJECT (nuv, "error: on push");
906 gst_buffer_unref (buf);
909 if (ret == GST_FLOW_OK) {
910 nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
911 memset (&nuv->priv->fh, 0, sizeof (nuv->priv->fh));
917 gst_nuv_demux_stream_mpeg_data (GstNuvDemux * nuv)
919 GstFlowReturn ret = GST_FLOW_OK;
921 /* ffmpeg extra data */
922 ret = gst_nuv_demux_read_bytes (nuv, nuv->priv->mpeg_data_size, TRUE,
923 &nuv->priv->mpeg_buffer);
924 if ((ret != GST_FLOW_OK) || (nuv->priv->mpeg_buffer == NULL)) {
928 GST_BUFFER_SIZE (nuv->priv->mpeg_buffer) = nuv->priv->mpeg_data_size;
929 nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER;
934 gst_nuv_demux_stream_extra_data (GstNuvDemux * nuv)
936 GstFlowReturn ret = GST_FLOW_OK;
941 ret = gst_nuv_demux_frame_header_load (nuv, &h);
942 if (ret != GST_FLOW_OK)
945 if (h.i_type != 'D') {
946 GST_WARNING_OBJECT (nuv, "Unsuported rtjpeg");
947 return GST_FLOW_NOT_SUPPORTED;
950 if (h.i_length > 0) {
951 if (h.i_compression == 'F') {
952 nuv->priv->state = GST_NUV_DEMUX_MPEG_DATA;
954 GST_WARNING_OBJECT (nuv, "only file with extended chunk are supported");
955 return GST_FLOW_NOT_SUPPORTED;
958 nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER;
965 gst_nuv_demux_stream_extend_header_data (GstNuvDemux * nuv)
967 GstFlowReturn ret = GST_FLOW_OK;
969 ret = gst_nuv_demux_extended_header_load (nuv, &nuv->priv->eh);
970 if (ret != GST_FLOW_OK)
973 gst_nuv_demux_create_pads (nuv);
974 nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
979 gst_nuv_demux_stream_extend_header (GstNuvDemux * nuv)
981 GstBuffer *buf = NULL;
982 GstFlowReturn res = GST_FLOW_OK;
984 res = gst_nuv_demux_read_bytes (nuv, 1, FALSE, &buf);
985 if ((res != GST_FLOW_OK) || (buf == NULL)) {
987 gst_buffer_unref (buf);
992 if (buf->data[0] == 'X') {
993 gst_buffer_unref (buf);
997 res = gst_nuv_demux_frame_header_load (nuv, &h);
998 if (res != GST_FLOW_OK)
1001 if (h.i_length != 512) {
1002 return GST_FLOW_ERROR;
1004 nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER_DATA;
1006 nuv->priv->state = GST_NUV_DEMUX_INVALID_DATA;
1007 g_object_unref (buf);
1008 GST_ELEMENT_WARNING (nuv, STREAM, FAILED,
1009 (_("incomplete NUV support")), ("incomplete NUV support"));
1010 return GST_FLOW_ERROR;
1016 static GstFlowReturn
1017 gst_nuv_demux_play (GstPad * pad)
1019 GstFlowReturn res = GST_FLOW_OK;
1020 GstNuvDemux *nuv = GST_NUV_DEMUX (GST_PAD_PARENT (pad));
1022 switch (nuv->priv->state) {
1023 case GST_NUV_DEMUX_START:
1024 res = gst_nuv_demux_stream_file_header (nuv);
1025 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1030 case GST_NUV_DEMUX_HEADER_DATA:
1031 res = gst_nuv_demux_stream_header_data (nuv);
1032 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1037 case GST_NUV_DEMUX_EXTRA_DATA:
1038 res = gst_nuv_demux_stream_extra_data (nuv);
1039 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1044 case GST_NUV_DEMUX_MPEG_DATA:
1045 res = gst_nuv_demux_stream_mpeg_data (nuv);
1046 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1051 case GST_NUV_DEMUX_EXTEND_HEADER:
1052 res = gst_nuv_demux_stream_extend_header (nuv);
1053 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1058 case GST_NUV_DEMUX_EXTEND_HEADER_DATA:
1059 res = gst_nuv_demux_stream_extend_header_data (nuv);
1060 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1065 case GST_NUV_DEMUX_FRAME_HEADER:
1066 res = gst_nuv_demux_read_head_frame (nuv);
1067 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1072 case GST_NUV_DEMUX_MOVI:
1073 res = gst_nuv_demux_stream_data (nuv);
1074 if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1079 case GST_NUV_DEMUX_INVALID_DATA:
1083 g_assert_not_reached ();
1089 GST_LOG_OBJECT (nuv, "pausing task, reason %s", gst_flow_get_name (res));
1090 gst_pad_pause_task (nuv->priv->sinkpad);
1091 if (GST_FLOW_IS_FATAL (res)) {
1092 GST_ELEMENT_ERROR (nuv, STREAM, FAILED,
1093 (_("Internal data stream error.")),
1094 ("streaming stopped, reason %s", gst_flow_get_name (res)));
1096 gst_nuv_demux_send_eos (nuv);
1102 gst_nuv_demux_send_eos (GstNuvDemux * nuv)
1104 gst_element_post_message (GST_ELEMENT (nuv),
1105 gst_message_new_segment_done (GST_OBJECT (nuv), GST_FORMAT_TIME, -1));
1107 if (nuv->priv->src_video_pad)
1108 gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_eos ());
1109 if (nuv->priv->src_audio_pad)
1110 gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_eos ());
1113 static GstFlowReturn
1114 gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size, gboolean move,
1115 GstBuffer ** buffer)
1117 GstFlowReturn ret = GST_FLOW_OK;
1123 if (nuv->priv->mode == NUV_PULL_MODE) {
1124 ret = gst_pad_pull_range (nuv->priv->sinkpad, nuv->priv->offset, size, buffer);
1125 if (ret == GST_FLOW_OK) {
1127 nuv->priv->offset += size;
1130 } else if (ret == GST_FLOW_UNEXPECTED) {
1132 gst_buffer_unref (buffer);
1134 gst_nuv_demux_send_eos (nuv);
1135 return GST_FLOW_WRONG_STATE;
1138 if (gst_adapter_available (nuv->priv->adapter) < size) {
1139 nuv->priv->more_data = TRUE;
1140 return GST_FLOW_ERROR_NO_DATA;
1143 *buffer = gst_adapter_take_buffer (nuv->priv->adapter, size);
1145 guint8 *data = NULL;
1146 data = (guint8 *) gst_adapter_peek (nuv->priv->adapter, size);
1147 *buffer = gst_buffer_new ();
1148 gst_buffer_set_data (*buffer, data, size);
1155 gst_nuv_demux_sink_activate (GstPad * sinkpad)
1157 gboolean res = TRUE;
1158 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
1160 g_debug ("SINK ACTIVATE");
1162 if (gst_pad_check_pull_range (sinkpad)) {
1164 gst_adapter_clear (nuv->priv->adapter);
1165 res = gst_pad_activate_pull (sinkpad, TRUE);
1168 gst_adapter_clear (nuv->priv->adapter);
1169 res = gst_pad_activate_push (sinkpad, TRUE);
1172 g_object_unref (nuv);
1177 gst_nuv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
1179 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
1182 GST_DEBUG_OBJECT (nuv, "activating pull function");
1183 nuv->priv->mode = NUV_PULL_MODE;
1184 gst_adapter_clear (nuv->priv->adapter);
1186 gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad);
1188 GST_DEBUG_OBJECT (nuv, "deactivating pull function");
1189 g_debug ("STOP TASK");
1190 gst_pad_stop_task (sinkpad);
1192 gst_object_unref (nuv);
1198 gst_nuv_demux_sink_activate_push (GstPad * pad, gboolean active)
1200 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
1203 nuv->priv->mode = NUV_PUSH_MODE;
1204 gst_adapter_clear (nuv->priv->adapter);
1206 GST_DEBUG_OBJECT (nuv, "activating push/chain function");
1208 GST_DEBUG_OBJECT (nuv, "deactivating push/chain function");
1211 gst_object_unref (nuv);
1217 gst_nuv_demux_do_seek (GstNuvDemux *nuv, GstEvent * event)
1222 GstSeekType cur_type;
1224 GstSeekType stop_type;
1228 g_debug ("DEMUX SEEK");
1229 gst_event_parse_seek (event, &rate, &format, &flags,
1230 &cur_type, &cur, &stop_type, &stop);
1232 if (format == GST_FORMAT_BYTES &&
1233 nuv->priv->state > GST_NUV_DEMUX_EXTEND_HEADER_DATA &&
1234 gst_pad_is_linked (nuv->priv->sinkpad)) {
1236 flush = flags & GST_SEEK_FLAG_FLUSH;
1238 gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_start ());
1240 if (nuv->priv->src_video_pad != NULL) {
1241 gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_flush_start ());
1244 if (nuv->priv->src_audio_pad != NULL) {
1245 gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_flush_start ());
1249 gst_pad_pause_task (nuv->priv->sinkpad);
1252 GST_PAD_STREAM_LOCK (nuv->priv->sinkpad);
1254 g_debug ("offset %ld, cur %ld", nuv->priv->offset, cur);
1256 nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
1259 gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_stop ());
1261 if (nuv->priv->src_video_pad != NULL) {
1262 gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_flush_stop ());
1265 if (nuv->priv->src_audio_pad != NULL) {
1266 gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_flush_stop ());
1270 g_debug ("STARTING TASK AGAIN");
1271 gst_pad_start_task (nuv->priv->sinkpad, (GstTaskFunction) gst_nuv_demux_loop,
1272 nuv->priv->sinkpad);
1274 GST_PAD_STREAM_UNLOCK (nuv->priv->sinkpad);
1281 gst_nuv_demux_srcpad_event (GstPad * pad, GstEvent * event)
1283 gboolean res = FALSE;
1286 nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
1288 switch (GST_EVENT_TYPE (event)) {
1289 case GST_EVENT_SEEK:
1290 res = gst_nuv_demux_do_seek (nuv, event);
1300 gst_nuv_demux_sink_event (GstPad *pad, GstEvent *event)
1302 gboolean res = FALSE;
1305 nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
1307 switch (GST_EVENT_TYPE (event)) {
1308 case GST_EVENT_SEEK:
1313 GstSeekType cur_type;
1315 GstSeekType stop_type;
1318 gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, &stop_type, &stop);
1319 GST_DEBUG_OBJECT (nuv, "got seek, start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT, cur, stop);
1320 g_debug ("got seek, start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT, cur, stop);
1321 res = gst_pad_event_default (pad, event);
1324 case GST_EVENT_NEWSEGMENT:
1326 gint64 start, stop, time;
1331 gst_event_parse_new_segment (event, &update, &rate, &format, &start, &stop, &time);
1332 GST_DEBUG_OBJECT (nuv, "got newsegment, start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT, start, stop);
1333 g_debug ("got newsegment, start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT, start, stop);
1334 //nuv->priv->duration_bytes = stop - start;
1335 res = gst_pad_event_default (pad, event);
1340 res = gst_pad_event_default (pad, event);
1344 gst_object_unref (nuv);
1348 static GstFlowReturn
1349 gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf)
1351 GstFlowReturn ret = GST_FLOW_OK;
1352 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
1354 if (nuv->priv->mode != NUV_PUSH_MODE)
1357 g_debug ("CHAIN ADP %p", nuv->priv->adapter);
1359 gst_adapter_push (nuv->priv->adapter, buf);
1361 while ((ret == GST_FLOW_OK) && (nuv->priv->more_data == FALSE)) {
1362 ret = gst_nuv_demux_play (pad);
1365 nuv->priv->more_data = FALSE;
1366 gst_object_unref (nuv);
1368 g_debug ("CHAIN END");
1374 gst_nuv_demux_loop (GstPad * pad)
1376 gst_nuv_demux_play (pad);
1380 gst_nuv_demux_reset (GstNuvDemux * nuv)
1382 nuv->priv->more_data = FALSE;
1383 nuv->priv->state = GST_NUV_DEMUX_START;
1384 nuv->priv->mode = NUV_PUSH_MODE;
1385 nuv->priv->offset = 0;
1386 nuv->priv->streamer_offset = 0;
1387 nuv->priv->time_start = 0;
1388 nuv->priv->time_qos = GST_CLOCK_TIME_NONE;
1389 nuv->priv->duration_bytes = GST_CLOCK_TIME_NONE;
1390 nuv->priv->duration_time = GST_CLOCK_TIME_NONE;
1391 nuv->priv->duration_average = GST_CLOCK_TIME_NONE;
1392 gst_segment_init (&nuv->priv->segment, GST_FORMAT_TIME);
1394 gst_adapter_clear (nuv->priv->adapter);
1396 if (nuv->priv->mpeg_buffer != NULL) {
1397 gst_buffer_unref (nuv->priv->mpeg_buffer);
1398 nuv->priv->mpeg_buffer = NULL;
1403 gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv)
1405 if (nuv->priv->src_video_pad) {
1406 gst_element_remove_pad (GST_ELEMENT (nuv), nuv->priv->src_video_pad);
1407 nuv->priv->src_video_pad = NULL;
1410 if (nuv->priv->src_audio_pad) {
1411 gst_element_remove_pad (GST_ELEMENT (nuv), nuv->priv->src_audio_pad);
1412 nuv->priv->src_audio_pad = NULL;
1416 static GstStateChangeReturn
1417 gst_nuv_demux_change_state (GstElement * element, GstStateChange transition)
1419 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
1421 switch (transition) {
1422 case GST_STATE_CHANGE_NULL_TO_READY:
1423 g_debug ("NULL_TO_READY");
1424 gst_nuv_demux_reset (GST_NUV_DEMUX (element));
1425 gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
1431 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
1432 if (ret == GST_STATE_CHANGE_FAILURE) {
1436 switch (transition) {
1437 case GST_STATE_CHANGE_PAUSED_TO_READY:
1438 //case GST_STATE_CHANGE_READY_TO_NULL:
1439 g_debug ("PAUSED_TO_READY");
1440 gst_nuv_demux_reset (GST_NUV_DEMUX (element));
1441 gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
1452 gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp)
1454 guint64 interval = 0;
1456 if (gst_nuv_demux_get_time_duration (nuv) != GST_CLOCK_TIME_NONE)
1459 interval = current_timestamp - nuv->priv->last_update;
1461 if (interval > (10 * GST_SECOND)) {
1462 GstMessage* msg = NULL;
1464 gint64 duration_bytes = gst_nuv_demux_get_bytes_duration (nuv);
1466 if (duration_bytes == GST_CLOCK_TIME_NONE) {
1470 interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND);
1472 average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval);
1475 nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average);
1478 nuv->priv->last_update = current_timestamp;
1479 msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average);
1480 gst_element_post_message (GST_ELEMENT (nuv), msg);
1481 GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average);
1482 g_debug ("New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average);
1487 gst_nuv_demux_get_bytes_duration (GstNuvDemux *nuv)
1489 if (nuv->priv->duration_bytes == GST_CLOCK_TIME_NONE) {
1490 GstPad *peer = gst_pad_get_peer (nuv->priv->sinkpad);
1491 GstQuery *query = gst_query_new_duration (GST_FORMAT_BYTES);
1492 if (gst_pad_query (peer, query)) {
1495 gst_query_parse_duration (query, NULL, &duration);
1496 nuv->priv->duration_bytes = duration;
1498 gst_object_unref (peer);
1499 gst_query_unref (query);
1501 return nuv->priv->duration_bytes;
1505 gst_nuv_demux_get_time_duration (GstNuvDemux *nuv)
1507 if (nuv->priv->duration_time == GST_CLOCK_TIME_NONE) {
1508 GstPad *peer = gst_pad_get_peer (nuv->priv->sinkpad);
1509 GstQuery *query = gst_query_new_duration (GST_FORMAT_TIME);
1510 if (gst_pad_query (peer, query)) {
1512 gst_query_parse_duration (query, NULL, &duration);
1513 nuv->priv->duration_time = duration;
1515 gst_object_unref (peer);
1516 gst_query_unref (query);
1518 return nuv->priv->duration_time;
1521 #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6)
1523 gst_adapter_take_buffer (GstAdapter * adapter, guint nbytes)
1529 g_return_val_if_fail (GST_IS_ADAPTER (adapter), NULL);
1530 g_return_val_if_fail (nbytes > 0, NULL);
1532 GST_LOG_OBJECT (adapter, "taking buffer of %u bytes", nbytes);
1534 /* we don't have enough data, return NULL. This is unlikely
1535 * as one usually does an _available() first instead of peeking a
1537 if (G_UNLIKELY (nbytes > adapter->size))
1540 /* our head buffer has enough data left, return it */
1541 cur = adapter->buflist->data;
1542 if (GST_BUFFER_SIZE (cur) >= nbytes + adapter->skip) {
1543 GST_LOG_OBJECT (adapter, "providing buffer of %d bytes via sub-buffer",
1545 buffer = gst_buffer_create_sub (cur, adapter->skip, nbytes);
1547 gst_adapter_flush (adapter, nbytes);
1552 data = gst_adapter_take (adapter, nbytes);
1556 buffer = gst_buffer_new ();
1557 GST_BUFFER_DATA (buffer) = data;
1558 GST_BUFFER_MALLOCDATA (buffer) = data;
1559 GST_BUFFER_SIZE (buffer) = nbytes;
1567 plugin_init (GstPlugin * plugin)
1570 setlocale (LC_ALL, "");
1571 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
1572 #endif /* ENABLE_NLS */
1574 if (!gst_element_register (plugin, "nuvdemux", GST_RANK_SECONDARY,
1575 GST_TYPE_NUV_DEMUX)) {
1581 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
1584 "Demuxes and muxes audio and video",
1585 plugin_init, VERSION, "LGPL", "NuvDemux", "")