@christophecvr, below is the schwerkraft (aka dreambox) gst_dvbaudiosink_set_caps:
995 else if (!strcmp(type, "audio/x-raw-int")) { 996 GST_INFO_OBJECT (self, "MIMETYPE %s",type); 997 bypass = 0xf; 998 gint block_align, width, rate, depth, channels, bitrate; 999 gst_structure_get_int (structure, "channels", &channels); 1000 gst_structure_get_int (structure, "rate", &rate); 1001 gst_structure_get_int (structure, "width", &width); 1002 gst_structure_get_int (structure, "depth", &depth); 1003 // calc size of pcm data for 30ms 1004 self->block_align = rate * 30 / 1000; 1005 self->block_align *= channels * depth / 8; 1006 block_align = channels * width / 8; 1007 bitrate = channels * rate * width; 1008 self->temp_offset = 18+8; 1009 self->temp_buffer = gst_buffer_new_and_alloc(self->temp_offset+self->block_align); 1010 guint8 *d = GST_BUFFER_DATA(self->temp_buffer); 1011 memcpy(d, "BCMA", 4); 1012 d[4] = (self->block_align & 0xFF000000) >> 24; 1013 d[5] = (self->block_align & 0xFF0000) >> 16; 1014 d[6] = (self->block_align & 0xFF00) >> 8; 1015 d[7] = (self->block_align & 0xFF); 1016 // rebuild WAVFORMAT 1017 d[8] = 0x01; // format tag 1018 d[9] = 0x00; 1019 d[10] = channels & 0xFF; 1020 d[11] = (channels >> 8) & 0xFF; 1021 d[12] = rate & 0xFF; // sample rate 1022 d[13] = (rate & 0xFF00) >> 8; 1023 d[14] = (rate & 0xFF0000) >> 16; 1024 d[15] = (rate & 0xFF000000) >> 24; 1025 d[16] = (bitrate >> 3) & 0xFF; // byte rate 1026 d[17] = (bitrate >> 11) & 0xFF; 1027 d[18] = (bitrate >> 19) & 0xFF; 1028 d[19] = (bitrate >> 27) & 0xFF; 1029 d[20] = block_align & 0xFF; // block align 1030 d[21] = (block_align >> 8) & 0xFF; 1031 d[22] = depth & 0xFF; // word size 1032 d[23] = (depth >> 8) & 0xFF; 1033 d[24] = 0; // codec data len 1034 d[25] = 0; 1035 }Below is the your version of gst_dvbaudiosink_set_caps:
666 else if (!strcmp(type, XRAW)) 667 { 668 guint8 *data; 669 gint size; 670 gint format = 0x01; 671 #if GST_VERSION_MAJOR >= 1 672 const gchar *formatstring = NULL; 673 #endif 674 gint width = 0, depth = 0, rate = 0, channels, block_align, byterate; 675 self->codec_data = gst_buffer_new_and_alloc(18); 676 #if GST_VERSION_MAJOR < 1 677 data = GST_BUFFER_DATA(self->codec_data); 678 size = GST_BUFFER_SIZE(self->codec_data); 679 #else 680 GstMapInfo map; 681 gst_buffer_map(self->codec_data, &map, GST_MAP_WRITE); 682 data = map.data; 683 size = map.size; 684 #endif 685 #if GST_VERSION_MAJOR < 1 686 gst_structure_get_int(structure, "width", &width); 687 gst_structure_get_int(structure, "depth", &depth); 688 #else 689 formatstring = gst_structure_get_string(structure, "format"); 690 if (formatstring) 691 { 692 if (!strncmp(&formatstring[1], "32", 2)) 693 { 694 width = depth = 32; 695 } 696 else if (!strncmp(&formatstring[1], "24", 2)) 697 { 698 width = depth = 24; 699 } 700 else if (!strncmp(&formatstring[1], "16", 2)) 701 { 702 width = depth = 16; 703 } 704 else if (!strncmp(&formatstring[1], "8", 1)) 705 { 706 width = depth = 8; 707 } 708 } 709 #endif 710 gst_structure_get_int(structure, "rate", &rate); 711 gst_structure_get_int(structure, "channels", &channels); 712 byterate = channels * rate * width / 8; 713 block_align = channels * width / 8; 714 memset(data, 0, size); 715 /* format tag */ 716 *(data++) = format & 0xff; 717 *(data++) = (format >> 8) & 0xff; 718 /* channels */ 719 *(data++) = channels & 0xff; 720 *(data++) = (channels >> 8) & 0xff; 721 /* sample rate */ 722 *(data++) = rate & 0xff; 723 *(data++) = (rate >> 8) & 0xff; 724 *(data++) = (rate >> 16) & 0xff; 725 *(data++) = (rate >> 24) & 0xff; 726 /* byte rate */ 727 *(data++) = byterate & 0xff; 728 *(data++) = (byterate >> 8) & 0xff; 729 *(data++) = (byterate >> 16) & 0xff; 730 *(data++) = (byterate >> 24) & 0xff; 731 /* block align */ 732 *(data++) = block_align & 0xff; 733 *(data++) = (block_align >> 8) & 0xff; 734 /* word size */ 735 *(data++) = depth & 0xff; 736 *(data++) = (depth >> 8) & 0xff; 737 self->fixed_buffersize = rate * 30 / 1000; 738 self->fixed_buffersize *= channels * depth / 8; 739 self->fixed_buffertimestamp = GST_CLOCK_TIME_NONE; 740 self->fixed_bufferduration = GST_SECOND * (GstClockTime)self->fixed_buffersize / (GstClockTime)byterate; 741 GST_INFO_OBJECT(self, "MIMETYPE %s", type); 742 bypass = AUDIOTYPE_RAW; 743 #if GST_VERSION_MAJOR >= 1 744 gst_buffer_unmap(self->codec_data, &map); 745 #endif 746 }I have the impression that produced data for "RAW" are not the same.
WAVFORMAT (d[8] to d[23]) seems same for both dvbmediasinks.
But schwerkraft starts with BCMA (d[0] to d[3]), then size of pcm data for 30ms is stored (d[4] to d[7]), finaly codec data len is added (d[24] to d[25]).
Did you compare produced data produced with OpenPLi dvbmediasink patched for dreambox?
PS. Regarding codec data len, I guess OpenPLi version silently does the same with memset(data, 0, size);
Edited by athoik, 20 March 2015 - 20:08.