Re: vdr xine-lib eac3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Miércoles, 24 de Marzo de 2010, zaverel escribió:
> hello
> 
> i try the patch from Jose Alberto to use ffmpeg eac3 with xine
> http://www.linuxtv.org/pipermail/vdr/2010-March/022687.html
> 
> The good things is that eac3 sound is now decoded with xine-lib
> 
> But it's not stable at all when zapping frhom HD to HD channel or SD
> channel
> 
> vdr-sxfe doesn't work anymore with --video=xv on HD channels but only
> with --video=vdpau
> 
> vdr-sxfe --tcp --video=xv --verbose
> 
> 
> [29976] [input_vdr] fifo_buffer_new...
> [29976] [input_vdr] fifo_buffer_new done.
> [29977] [demux_vdr] PMT changed
> [29977] [demux_vdr] audio stream changed: 00000000 -> 03000000
> ffmpeg_audio_dec: increasing buffer to 98304 to avoid overflow.
> Erreur de segmentation
> 
> and dmesg said
> 
> vdr-sxfe[29973] general protection ip:b06757c5 sp:b442a020 error:0 in
> libavcodec.so.52.60.0[b01d7000+6e3000]
> 
> with xine-ui it's almost the same
> 
> xine "xvdr+tcp://miniq#nocache" --verbose --video=xv
> 
> 
> 
> [1723] [input_vdr] wait_stream_sync: discard_index 5465954112 != curpos
> 5471218488 ! (diff -5264376)
> prebuffer=14400 pts
> prebuffer=2000 pts
> prebuffer=14400 pts
> prebuffer=14400 pts
> [1723] [demux_vdr] PMT changed
> ffmpeg_audio_dec: augmentation du buffer à 98304 pour éviter sa saturation.
>     Last message repeated 3 times
> [h264 @ 0x8fb2640]non-existing SPS 0 referenced in buffering period
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]non-existing PPS 0 referenced
> [h264 @ 0x8fb2640]decode_slice_header error
> [h264 @ 0x8fb2640]no frame!
> xiTK received SIGSEGV signal, RIP.
> Abandon
> 
> but dmesg said nothing.
> 
> 
> I do my test with vdr-1.7.12 , ffmpeg  , xine-lib-1.2 , all patched for
> eac3 and xineliboutput.
> All are latest cvs
> 
> 
> So what can i do ?
> 
> thanks.
> 
> 

I make some changes based on the patches posted by Petri Hintukainen yesterday 
in the xine-devel mailing list. Attached is a new version of the patch. I can 
not probe it now with tdt eac3 channel. You can try it.

Jose Alberto
diff -r a6a25ea3e2c8 include/xine/buffer.h
--- a/include/xine/buffer.h	Sun Mar 14 15:12:25 2010 +0000
+++ b/include/xine/buffer.h	Wed Mar 24 17:24:12 2010 +0100
@@ -266,6 +266,7 @@
 #define BUF_AUDIO_MP3ADU	0x033E0000
 #define BUF_AUDIO_AMR_NB	0x033F0000
 #define BUF_AUDIO_AMR_WB	0x03400000
+#define BUF_AUDIO_EAC3		0x03410000
 /*@}*/
 
 /**
diff -r a6a25ea3e2c8 src/combined/ffmpeg/ff_audio_decoder.c
--- a/src/combined/ffmpeg/ff_audio_decoder.c	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/combined/ffmpeg/ff_audio_decoder.c	Wed Mar 24 17:24:12 2010 +0100
@@ -257,10 +257,44 @@
 
     if( !this->decoder_ok ) {
       if ( ! this->context || ! this->codec ) {
-        xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
-		_("ffmpeg_audio_dec: trying to open null codec\n"));
-	_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0);
-	return;
+	if ( (buf->type & 0xFFFF0000) == BUF_AUDIO_EAC3 ) { 
+	pthread_mutex_lock (&ffmpeg_lock);
+        this->codec = avcodec_find_decoder(CODEC_ID_EAC3);
+	pthread_mutex_unlock (&ffmpeg_lock);
+        _x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC,
+                           "AC3 coque (ffmpeg)");
+
+        if (!this->codec) {
+          xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+                   _("ffmpeg_audio_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"),
+                   buf->type);
+          _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0);
+          return;
+        }
+
+        this->context = avcodec_alloc_context();
+
+        this->audio_bits = 16;
+//	this->audio_sample_rate = 48000;
+//	this->audio_channels = 6;	
+        this->context->request_channels = 2;
+
+        this->context->bits_per_sample = this->audio_bits;
+        this->context->sample_rate = this->audio_sample_rate;
+        this->context->channels    = this->audio_channels;
+        this->context->codec_id    = this->codec->id;
+        this->context->codec_type  = this->codec->type;
+        this->context->codec_tag   = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC);
+
+        this->size = 0;
+
+        this->decode_buffer = calloc(1, AVCODEC_MAX_AUDIO_FRAME_SIZE);
+	} else {
+       	  xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+		  _("ffmpeg_audio_dec: trying to open null codec\n"));
+	  _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0);
+	  return;
+	}
       }
 
       pthread_mutex_lock (&ffmpeg_lock);
@@ -284,11 +318,14 @@
 
     if (!this->output_open) {
       if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) {
-        avcodec_decode_audio2 (this->context,
+        decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+        bytes_consumed = avcodec_decode_audio2 (this->context,
                               (int16_t *)this->decode_buffer,
                               &decode_buffer_size,
                               &this->buf[0],
                               this->size);
+	this->size -= bytes_consumed;
+	memmove(this->buf, &this->buf[bytes_consumed], this->size);
 	this->audio_bits = this->context->bits_per_sample;
 	this->audio_sample_rate = this->context->sample_rate;
 	this->audio_channels = this->context->channels;
diff -r a6a25ea3e2c8 src/combined/ffmpeg/xine_audio.list
--- a/src/combined/ffmpeg/xine_audio.list	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/combined/ffmpeg/xine_audio.list	Wed Mar 24 17:24:12 2010 +0100
@@ -40,6 +40,7 @@
 WAVPACK			WAVPACK			WavPack
 AMR_NB			AMR_NB			AMR narrow band
 AMR_WB			AMR_WB			AMR wide band
+EAC3			EAC3			E-AC-3
 
 # disabled codecs (ref. configure.ac)
 !			AAC
diff -r a6a25ea3e2c8 src/demuxers/demux_matroska.c
--- a/src/demuxers/demux_matroska.c	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/demuxers/demux_matroska.c	Wed Mar 24 17:24:12 2010 +0100
@@ -1352,6 +1352,11 @@
       track->buf_type = BUF_AUDIO_A52;
       init_codec = init_codec_audio;
 
+    } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_EAC3)) {
+      lprintf("MATROSKA_CODEC_ID_A_EAC3\n");
+      track->buf_type = BUF_AUDIO_EAC3;
+      init_codec = init_codec_audio;
+
     } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_DTS)) {
       lprintf("MATROSKA_CODEC_ID_A_DTS\n");
       track->buf_type = BUF_AUDIO_DTS;
diff -r a6a25ea3e2c8 src/demuxers/demux_ts.c
--- a/src/demuxers/demux_ts.c	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/demuxers/demux_ts.c	Wed Mar 24 17:24:12 2010 +0100
@@ -790,7 +790,13 @@
      * these "raw" streams may begin with a byte that looks like a stream type.
      * For audio streams, m->type already contains the stream no.
      */
-    if((m->descriptor_tag == STREAM_AUDIO_AC3) ||    /* ac3 - raw */
+    if(m->descriptor_tag == HDMV_AUDIO_84_EAC3) {
+      m->content   = p;
+      m->size = packet_len;
+      m->type |= BUF_AUDIO_EAC3;
+      return 1;
+
+    } else if((m->descriptor_tag == STREAM_AUDIO_AC3) ||    /* ac3 - raw */
        (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */
       m->content   = p;
       m->size = packet_len;
@@ -1415,9 +1421,9 @@
       break;
     case ISO_13818_PES_PRIVATE:
       for (i = 5; i < coded_length; i += stream[i+1] + 2) {
-          if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) {
-          int i, found = 0;
-          for(i = 0; i < this->audio_tracks_count; i++) {
+          if (((stream[i] == 0x6a) || (stream[i] == 0x7a)) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) {
+          int j, found = 0;
+          for(j = 0; j < this->audio_tracks_count; j++) {
             if(this->audio_tracks[i].pid == pid) {
               found = 1;
               break;
@@ -1427,8 +1433,12 @@
 #ifdef TS_PMT_LOG
             printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
 #endif
-          demux_ts_pes_new(this, this->media_num, pid,
-                           this->audio_fifo, STREAM_AUDIO_AC3);
+          if (stream[i] == 0x6a)
+            demux_ts_pes_new(this, this->media_num, pid,
+                             this->audio_fifo, STREAM_AUDIO_AC3);
+          else
+            demux_ts_pes_new(this, this->media_num, pid,
+                             this->audio_fifo, HDMV_AUDIO_84_EAC3);
 
           this->audio_tracks[this->audio_tracks_count].pid = pid;
           this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
diff -r a6a25ea3e2c8 src/demuxers/matroska.h
--- a/src/demuxers/matroska.h	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/demuxers/matroska.h	Wed Mar 24 17:24:12 2010 +0100
@@ -320,6 +320,7 @@
 #define MATROSKA_CODEC_ID_A_PCM_INT_LE   "A_PCM/INT/LIT"
 #define MATROSKA_CODEC_ID_A_PCM_FLOAT    "A_PCM/FLOAT/IEEE"
 #define MATROSKA_CODEC_ID_A_AC3          "A_AC3"
+#define MATROSKA_CODEC_ID_A_EAC3         "A_EAC3"
 #define MATROSKA_CODEC_ID_A_DTS          "A_DTS"
 #define MATROSKA_CODEC_ID_A_VORBIS       "A_VORBIS"
 #define MATROSKA_CODEC_ID_A_ACM          "A_MS/ACM"
diff -r a6a25ea3e2c8 src/xine-engine/buffer_types.c
--- a/src/xine-engine/buffer_types.c	Sun Mar 14 15:12:25 2010 +0000
+++ b/src/xine-engine/buffer_types.c	Wed Mar 24 17:24:12 2010 +0100
@@ -1178,6 +1178,13 @@
   BUF_AUDIO_TTA,
   "True Audio Lossless"
 },
+{
+  {
+    0
+  },
+  BUF_AUDIO_EAC3,
+  "E-AC-3"
+},
 { { 0 }, 0, "last entry" }
 };
 
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux