summaryrefslogtreecommitdiffstats
path: root/gst/mpeg1sys
diff options
context:
space:
mode:
Diffstat (limited to 'gst/mpeg1sys')
-rw-r--r--gst/mpeg1sys/buffer.c58
-rw-r--r--gst/mpeg1sys/gstmpeg1systemencode.c27
2 files changed, 44 insertions, 41 deletions
diff --git a/gst/mpeg1sys/buffer.c b/gst/mpeg1sys/buffer.c
index 677c398b..53104a31 100644
--- a/gst/mpeg1sys/buffer.c
+++ b/gst/mpeg1sys/buffer.c
@@ -71,7 +71,7 @@ static double ratio [16] = { 0., 1., 0.6735, 0.7031, 0.7615, 0.8055,
1.2015, 0.};
*/
-#ifdef GST_DEBUG_ENABLED
+#ifndef GST_DISABLE_GST_DEBUG
static char picture_types [4][3] =
{ "I", "P", "B", "D" };
#endif
@@ -136,7 +136,7 @@ void mpeg1mux_buffer_queue(Mpeg1MuxBuffer *mb, GstBuffer *buf) {
mb->length += GST_BUFFER_SIZE(buf);
}
- GST_DEBUG (0,"queuing buffer %lu", mb->length);
+ GST_DEBUG ("queuing buffer %lu", mb->length);
if (mb->buffer_type == BUFFER_TYPE_VIDEO) {
mpeg1mux_buffer_update_video_info(mb);
}
@@ -150,7 +150,7 @@ gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr) {
Mpeg1MuxTimecode *tc;
gulong total_queued = 0;
- GST_DEBUG (0,"queued in buffer on SCR=%" G_GUINT64_FORMAT, scr);
+ GST_DEBUG ("queued in buffer on SCR=%" G_GUINT64_FORMAT, scr);
queued_list = g_list_first(mb->queued_list);
while (queued_list) {
@@ -161,12 +161,12 @@ gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr) {
queued_list = g_list_first(mb->queued_list);
}
else {
- GST_DEBUG (0,"queued in buffer %ld, %" G_GUINT64_FORMAT, tc->original_length, tc->DTS);
+ GST_DEBUG ("queued in buffer %ld, %" G_GUINT64_FORMAT, tc->original_length, tc->DTS);
total_queued += tc->original_length;
queued_list = g_list_next(queued_list);
}
}
- GST_DEBUG (0,"queued in buffer %lu", total_queued);
+ GST_DEBUG ("queued in buffer %lu", total_queued);
return total_queued;
}
@@ -177,7 +177,7 @@ void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
gulong consumed = 0;
gulong count;
- GST_DEBUG (0,"shrinking buffer %lu", size);
+ GST_DEBUG ("shrinking buffer %lu", size);
g_assert(mb->length >= size);
@@ -198,16 +198,16 @@ void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
else {
consumed += tc->length;
while (size >= consumed) {
- GST_DEBUG (0,"removing timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
+ GST_DEBUG ("removing timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
mb->timecode_list = g_list_remove_link(mb->timecode_list, timecode_list);
mb->queued_list = g_list_append(mb->queued_list, tc);
timecode_list = g_list_first(mb->timecode_list);
tc = (Mpeg1MuxTimecode *) timecode_list->data;
consumed += tc->length;
- GST_DEBUG (0,"next timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
+ GST_DEBUG ("next timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
}
mb->new_frame = TRUE;
- GST_DEBUG (0,"leftover frame size from %lu to %lu ", tc->length, consumed-size);
+ GST_DEBUG ("leftover frame size from %lu to %lu ", tc->length, consumed-size);
tc->length = consumed - size;
}
@@ -220,7 +220,7 @@ void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
mb->info.audio.PTS = tc->PTS;
mb->next_frame_time = tc->PTS;
}
- GST_DEBUG (0,"next frame time timecode: %" G_GUINT64_FORMAT " %lu", mb->next_frame_time, tc->length);
+ GST_DEBUG ("next frame time timecode: %" G_GUINT64_FORMAT " %lu", mb->next_frame_time, tc->length);
/* check buffer consistency */
timecode_list = g_list_first(mb->timecode_list);
@@ -248,7 +248,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
gst_getbits_t gb;
- GST_DEBUG (0,"mpeg1mux::update_video_info %lu %lu", mb->base, mb->scan_pos);
+ GST_DEBUG ("mpeg1mux::update_video_info %lu %lu", mb->base, mb->scan_pos);
if (mb->base == 0 && mb->scan_pos == 0) {
if ((SYNCWORD_START<<8)+*(mb->buffer+3) == SEQUENCE_HEADER) {
@@ -268,7 +268,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
mb->info.video.secs_per_frame = 1. / picture_rates[mb->info.video.picture_rate];
mb->info.video.decoding_order=0;
mb->info.video.group_order=0;
- GST_DEBUG (0,"mpeg1mux::update_video_info: secs per frame %g", mb->info.video.secs_per_frame);
+ GST_DEBUG ("mpeg1mux::update_video_info: secs per frame %g", mb->info.video.secs_per_frame);
}
else {
g_print("mpeg1mux::update_video_info: Invalid MPEG Video header\n");
@@ -277,16 +277,16 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
while (offset < mb->length-6) {
if (!have_sync) {
guchar byte = *(data+offset);
- /*GST_DEBUG (0,"mpeg1mux::update_video_info: found #%d at %lu",byte,offset); */
+ /*GST_DEBUG ("mpeg1mux::update_video_info: found #%d at %lu",byte,offset); */
offset++;
/* if it's zero, increment the zero count */
if (byte == 0) {
sync_zeros++;
- /*GST_DEBUG (0,"mpeg1mux::update_video_info: found zero #%d at %lu",sync_zeros,offset-1); */
+ /*GST_DEBUG ("mpeg1mux::update_video_info: found zero #%d at %lu",sync_zeros,offset-1); */
}
/* if it's a one and we have two previous zeros, we have sync */
else if ((byte == 1) && (sync_zeros >= 2)) {
- GST_DEBUG (0,"mpeg1mux::update_video_info: synced at %lu",offset-1);
+ GST_DEBUG ("mpeg1mux::update_video_info: synced at %lu",offset-1);
have_sync = TRUE;
sync_zeros = 0;
}
@@ -295,21 +295,21 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
/* then snag the chunk ID */
} else if (id == 0) {
id = *(data+offset);
- GST_DEBUG (0,"mpeg1mux::update_video_info: got id 0x%02lX",id);
+ GST_DEBUG ("mpeg1mux::update_video_info: got id 0x%02lX",id);
id = (SYNCWORD_START<<8)+id;
switch (id) {
case SEQUENCE_HEADER:
- GST_DEBUG (0,"mpeg1mux::update_video_info: sequence header");
+ GST_DEBUG ("mpeg1mux::update_video_info: sequence header");
break;
case GROUP_START:
- GST_DEBUG (0,"mpeg1mux::update_video_info: group start");
+ GST_DEBUG ("mpeg1mux::update_video_info: group start");
mb->info.video.group_order=0;
break;
case PICTURE_START:
/* skip the first access unit */
if (mb->info.video.decoding_order != 0) {
Mpeg1MuxTimecode *tc;
- GST_DEBUG (0,"mpeg1mux::update_video_info: PTS %" G_GUINT64_FORMAT ", DTS %" G_GUINT64_FORMAT ", length %lu", mb->info.video.current_PTS,
+ GST_DEBUG ("mpeg1mux::update_video_info: PTS %" G_GUINT64_FORMAT ", DTS %" G_GUINT64_FORMAT ", length %lu", mb->info.video.current_PTS,
mb->info.video.current_DTS, offset - mb->current_start-3);
tc = (Mpeg1MuxTimecode *) g_malloc(sizeof(Mpeg1MuxTimecode));
@@ -331,7 +331,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
temp= (*(data+offset+1)<<8)+*(data+offset+2);
temporal_reference = (temp & 0xffc0) >> 6;
mb->info.video.current_type = (temp & 0x0038) >> 3;
- GST_DEBUG (0,"mpeg1mux::update_video_info: picture start temporal_ref:%d type:%s Frame", temporal_reference,
+ GST_DEBUG ("mpeg1mux::update_video_info: picture start temporal_ref:%d type:%s Frame", temporal_reference,
picture_types[mb->info.video.current_type-1]);
mb->info.video.current_DTS = mb->info.video.decoding_order * mb->info.video.secs_per_frame * CLOCKS;
@@ -345,7 +345,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
offset++;
break;
case SEQUENCE_END:
- GST_DEBUG (0,"mpeg1mux::update_video_info: sequence end");
+ GST_DEBUG ("mpeg1mux::update_video_info: sequence end");
break;
}
/* prepare for next sync */
@@ -370,7 +370,7 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
Mpeg1MuxTimecode *tc;
- GST_DEBUG (0,"mpeg1mux::update_audio_info %lu %lu", mb->base, mb->scan_pos);
+ GST_DEBUG ("mpeg1mux::update_audio_info %lu %lu", mb->base, mb->scan_pos);
if (mb->base == 0 && mb->scan_pos == 0) {
id = GUINT32_FROM_BE(*((guint32 *)(data)));
@@ -396,7 +396,7 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
}
mb->info.audio.framesize = bpf;
- GST_DEBUG (0,"mpeg1mux::update_audio_info: samples per second %d", samplerate_index);
+ GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %d", samplerate_index);
gst_getbits_init(&gb, NULL, NULL);
gst_getbits_newbuf(&gb, data, mb->length);
@@ -417,13 +417,13 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
mb->info.audio.original_copy = gst_getbits1(&gb);
mb->info.audio.emphasis = gst_getbits2(&gb);
- GST_DEBUG (0,"mpeg1mux::update_audio_info: layer %d", mb->info.audio.layer);
- GST_DEBUG (0,"mpeg1mux::update_audio_info: bit_rate %d", mb->info.audio.bit_rate);
- GST_DEBUG (0,"mpeg1mux::update_audio_info: frequency %d", mb->info.audio.frequency);
+ GST_DEBUG ("mpeg1mux::update_audio_info: layer %d", mb->info.audio.layer);
+ GST_DEBUG ("mpeg1mux::update_audio_info: bit_rate %d", mb->info.audio.bit_rate);
+ GST_DEBUG ("mpeg1mux::update_audio_info: frequency %d", mb->info.audio.frequency);
mb->info.audio.samples_per_second = (double)dfrequency [mb->info.audio.frequency];
- GST_DEBUG (0,"mpeg1mux::update_audio_info: samples per second %g", mb->info.audio.samples_per_second);
+ GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %g", mb->info.audio.samples_per_second);
mb->info.audio.decoding_order=0;
@@ -435,7 +435,7 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
mb->info.audio.current_PTS = mb->info.audio.decoding_order * samples [mb->info.audio.layer] /
mb->info.audio.samples_per_second * 90. + startup_delay;
- GST_DEBUG (0,"mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", length %u", mb->info.audio.current_PTS, mb->info.audio.framesize);
+ GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", length %u", mb->info.audio.current_PTS, mb->info.audio.framesize);
tc->PTS = mb->info.audio.current_PTS;
tc->DTS = mb->info.audio.current_PTS;
mb->timecode_list = g_list_append(mb->timecode_list, tc);
@@ -482,7 +482,7 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
mb->info.audio.samples_per_second * 90. ;
tc->DTS = tc->PTS = mb->info.audio.current_PTS;
- GST_DEBUG (0,"mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT " length %lu", mb->info.audio.current_PTS, tc->PTS, tc->length);
+ GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT " length %lu", mb->info.audio.current_PTS, tc->PTS, tc->length);
mb->timecode_list = g_list_append(mb->timecode_list, tc);
mb->info.audio.decoding_order++;
diff --git a/gst/mpeg1sys/gstmpeg1systemencode.c b/gst/mpeg1sys/gstmpeg1systemencode.c
index 01f32198..7e18121a 100644
--- a/gst/mpeg1sys/gstmpeg1systemencode.c
+++ b/gst/mpeg1sys/gstmpeg1systemencode.c
@@ -17,6 +17,9 @@
* Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -25,7 +28,7 @@
#include "gstmpeg1systemencode.h"
#include "main.h"
-/*#define GST_DEBUG(a, b...) g_print (##b) */
+/*#define GST_DEBUG (b...) g_print (##b) */
/* elementfactory information */
static GstElementDetails system_encode_details = {
@@ -217,7 +220,7 @@ gst_system_encode_pick_streams (GList *mta, GstMPEG1SystemEncode *system_encode)
{
guint64 lowest = ~1;
- GST_DEBUG (0, "pick_streams: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT, system_encode->video_buffer->next_frame_time,
+ GST_DEBUG ("pick_streams: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT, system_encode->video_buffer->next_frame_time,
system_encode->audio_buffer->next_frame_time);
if (system_encode->which_streams & STREAMS_VIDEO) {
@@ -278,7 +281,7 @@ gst_system_encode_update_mta (GstMPEG1SystemEncode *system_encode, GList *mta, g
GList *streams = g_list_first(mta);
Mpeg1MuxBuffer *mb = (Mpeg1MuxBuffer *)streams->data;
- GST_DEBUG (0,"system_encode::multiplex: update mta");
+ GST_DEBUG ("system_encode::multiplex: update mta");
mpeg1mux_buffer_shrink(mb, size);
@@ -315,7 +318,7 @@ gst_system_setup_multiplex (GstMPEG1SystemEncode *system_encode)
(double)(system_encode->packets_per_pack-1.))) / (double)(system_encode->packets_per_pack) );
system_encode->data_rate = ceil(system_encode->dmux_rate/50.)*50;
- GST_DEBUG (0,"system_encode::multiplex: data_rate %u, video_rate: %u, audio_rate: %u", system_encode->data_rate,
+ GST_DEBUG ("system_encode::multiplex: data_rate %u, video_rate: %u, audio_rate: %u", system_encode->data_rate,
system_encode->video_rate, system_encode->audio_rate);
system_encode->video_delay = (double)system_encode->video_delay_ms*(double)(CLOCKS/1000);
@@ -327,7 +330,7 @@ gst_system_setup_multiplex (GstMPEG1SystemEncode *system_encode)
video_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(system_encode->video_buffer);
audio_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(system_encode->audio_buffer);
- GST_DEBUG (0,"system_encode::video tc %" G_GINT64_FORMAT ", audio tc %" G_GINT64_FORMAT ":", video_tc->DTS, audio_tc->DTS);
+ GST_DEBUG ("system_encode::video tc %" G_GINT64_FORMAT ", audio tc %" G_GINT64_FORMAT ":", video_tc->DTS, audio_tc->DTS);
system_encode->delay = ((double)system_encode->sectors_delay +
ceil((double)video_tc->length/(double)system_encode->min_packet_data) +
@@ -341,7 +344,7 @@ gst_system_setup_multiplex (GstMPEG1SystemEncode *system_encode)
system_encode->video_delay = 0;
system_encode->delay = 0;
- GST_DEBUG (0,"system_encode::multiplex: delay %g, mux_rate: %lu", system_encode->delay, system_encode->mux_rate);
+ GST_DEBUG ("system_encode::multiplex: delay %g, mux_rate: %lu", system_encode->delay, system_encode->mux_rate);
}
static void
@@ -361,7 +364,7 @@ gst_system_encode_multiplex(GstMPEG1SystemEncode *system_encode)
g_mutex_lock(system_encode->lock);
while (gst_system_encode_have_data(system_encode)) {
- GST_DEBUG (0,"system_encode::multiplex: multiplexing");
+ GST_DEBUG ("system_encode::multiplex: multiplexing");
if (!system_encode->have_setup) {
gst_system_setup_multiplex(system_encode);
@@ -397,7 +400,7 @@ gst_system_encode_multiplex(GstMPEG1SystemEncode *system_encode)
tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(mb);
if (mb->new_frame) {
- GST_DEBUG (0,"system_encode::multiplex: new frame");
+ GST_DEBUG ("system_encode::multiplex: new frame");
if (tc->frame_type == FRAME_TYPE_AUDIO || tc->frame_type == FRAME_TYPE_IFRAME || tc->frame_type == FRAME_TYPE_PFRAME) {
timestamps = TIMESTAMPS_PTS;
}
@@ -458,7 +461,7 @@ gst_system_encode_multiplex(GstMPEG1SystemEncode *system_encode)
system_encode->bytes_output += GST_BUFFER_SIZE(outbuf);
gst_pad_push(system_encode->srcpad,outbuf);
- GST_DEBUG (0,"system_encode::multiplex: writing %02x", mb->stream_id);
+ GST_DEBUG ("system_encode::multiplex: writing %02x", mb->stream_id);
}
gst_info("system_encode::multiplex: data left in video buffer %lu\n", MPEG1MUX_BUFFER_SPACE(system_encode->video_buffer));
@@ -484,18 +487,18 @@ gst_system_encode_chain (GstPad *pad, GstBuffer *buf)
data = GST_BUFFER_DATA(buf);
size = GST_BUFFER_SIZE(buf);
- GST_DEBUG (0,"system_encode::chain: system_encode: have buffer of size %lu",size);
+ GST_DEBUG ("system_encode::chain: system_encode: have buffer of size %lu",size);
padname = GST_OBJECT_NAME (pad);
if (strncmp(padname, "audio_", 6) == 0) {
channel = atoi(&padname[6]);
- GST_DEBUG (0,"gst_system_encode_chain: got audio buffer in from audio channel %02d", channel);
+ GST_DEBUG ("gst_system_encode_chain: got audio buffer in from audio channel %02d", channel);
mpeg1mux_buffer_queue(system_encode->audio_buffer, buf);
}
else if (strncmp(padname, "video_", 6) == 0) {
channel = atoi(&padname[6]);
- GST_DEBUG (0,"gst_system_encode_chain: got video buffer in from video channel %02d", channel);
+ GST_DEBUG ("gst_system_encode_chain: got video buffer in from video channel %02d", channel);
mpeg1mux_buffer_queue(system_encode->video_buffer, buf);