summaryrefslogtreecommitdiffstats
path: root/sys/dxr3
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dxr3')
-rw-r--r--sys/dxr3/ac3_padder.c178
-rw-r--r--sys/dxr3/dxr3audiosink.c135
-rw-r--r--sys/dxr3/dxr3init.c6
-rw-r--r--sys/dxr3/dxr3spusink.c53
-rw-r--r--sys/dxr3/dxr3videosink.c187
5 files changed, 281 insertions, 278 deletions
diff --git a/sys/dxr3/ac3_padder.c b/sys/dxr3/ac3_padder.c
index 606923a7..9e778bac 100644
--- a/sys/dxr3/ac3_padder.c
+++ b/sys/dxr3/ac3_padder.c
@@ -152,101 +152,101 @@ ac3p_parse (ac3_padder * padder)
while (padder->remaining > 0) {
switch (padder->state) {
case AC3P_STATE_SYNC1:
- if (*(padder->in_ptr) == 0x0b) {
- /* The first sync byte was found. Go to the next state. */
- padder->frame.sync_byte1 = 0x0b;
- padder->state = AC3P_STATE_SYNC2;
- }
- ac3p_in_fw (padder);
- break;
+ if (*(padder->in_ptr) == 0x0b) {
+ /* The first sync byte was found. Go to the next state. */
+ padder->frame.sync_byte1 = 0x0b;
+ padder->state = AC3P_STATE_SYNC2;
+ }
+ ac3p_in_fw (padder);
+ break;
case AC3P_STATE_SYNC2:
- if (*(padder->in_ptr) == 0x77) {
- /* The second sync byte was seen right after the first. Go to
- the next state. */
- padder->frame.sync_byte2 = 0x77;
- padder->state = AC3P_STATE_HEADER;
-
- /* Skip one byte. */
- ac3p_in_fw (padder);
-
- /* Prepare for reading the header. */
- padder->out_ptr = (guchar *) & (padder->frame.crc1);
- /* Discount the 2 sync bytes from the header size. */
- padder->bytes_to_copy = AC3P_AC3_HEADER_SIZE - 2;
- } else {
- /* The second sync byte was not seen. Go back to the
- first state. */
- padder->state = AC3P_STATE_SYNC1;
- }
- break;
+ if (*(padder->in_ptr) == 0x77) {
+ /* The second sync byte was seen right after the first. Go to
+ the next state. */
+ padder->frame.sync_byte2 = 0x77;
+ padder->state = AC3P_STATE_HEADER;
+
+ /* Skip one byte. */
+ ac3p_in_fw (padder);
+
+ /* Prepare for reading the header. */
+ padder->out_ptr = (guchar *) & (padder->frame.crc1);
+ /* Discount the 2 sync bytes from the header size. */
+ padder->bytes_to_copy = AC3P_AC3_HEADER_SIZE - 2;
+ } else {
+ /* The second sync byte was not seen. Go back to the
+ first state. */
+ padder->state = AC3P_STATE_SYNC1;
+ }
+ break;
case AC3P_STATE_HEADER:
- if (padder->bytes_to_copy > 0) {
- /* Copy one byte. */
- *(padder->out_ptr) = *(padder->in_ptr);
- ac3p_in_fw (padder);
- ac3p_out_fw (padder);
- } else {
- int fscod;
-
- /* The header is ready: */
-
- fscod = (padder->frame.code >> 6) & 0x03;
-
- /* Calculate the frame size. */
- padder->ac3_frame_size =
- 2 * frmsizecod_tbl[padder->frame.code & 0x3f].frm_size[fscod];
-
- /* Set up the IEC header. */
- if (padder->ac3_frame_size > 0) {
- padder->frame.header[4] = IEC61937_DATA_TYPE_AC3;
- } else {
- /* Don't know what it is, better be careful. */
- padder->state = AC3P_STATE_SYNC1;
- break;
- }
- padder->frame.header[5] = 0x00;
- padder->frame.header[6] = (padder->ac3_frame_size * 8) & 0xFF;
- padder->frame.header[7] = ((padder->ac3_frame_size * 8) >> 8) & 0xFF;
-
- /* Prepare for reading the body. */
- padder->bytes_to_copy = padder->ac3_frame_size - AC3P_AC3_HEADER_SIZE;
- padder->state = AC3P_STATE_CONTENT;
- }
- break;
+ if (padder->bytes_to_copy > 0) {
+ /* Copy one byte. */
+ *(padder->out_ptr) = *(padder->in_ptr);
+ ac3p_in_fw (padder);
+ ac3p_out_fw (padder);
+ } else {
+ int fscod;
+
+ /* The header is ready: */
+
+ fscod = (padder->frame.code >> 6) & 0x03;
+
+ /* Calculate the frame size. */
+ padder->ac3_frame_size =
+ 2 * frmsizecod_tbl[padder->frame.code & 0x3f].frm_size[fscod];
+
+ /* Set up the IEC header. */
+ if (padder->ac3_frame_size > 0) {
+ padder->frame.header[4] = IEC61937_DATA_TYPE_AC3;
+ } else {
+ /* Don't know what it is, better be careful. */
+ padder->state = AC3P_STATE_SYNC1;
+ break;
+ }
+ padder->frame.header[5] = 0x00;
+ padder->frame.header[6] = (padder->ac3_frame_size * 8) & 0xFF;
+ padder->frame.header[7] = ((padder->ac3_frame_size * 8) >> 8) & 0xFF;
+
+ /* Prepare for reading the body. */
+ padder->bytes_to_copy = padder->ac3_frame_size - AC3P_AC3_HEADER_SIZE;
+ padder->state = AC3P_STATE_CONTENT;
+ }
+ break;
case AC3P_STATE_CONTENT:
- if (padder->bytes_to_copy > 0) {
- /* Copy one byte. */
- *(padder->out_ptr) = *(padder->in_ptr);
- ac3p_in_fw (padder);
- ac3p_out_fw (padder);
- } else {
- guint16 *ptr, i;
-
- /* Frame ready. Prepare for output: */
-
- /* Zero the non AC3 portion of the padded frame. */
- memset (&(padder->frame.sync_byte1) + padder->ac3_frame_size, 0,
- AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE -
- padder->ac3_frame_size);
-
- /* Fix the byte order in the AC3 portion: */
- ptr = (guint16 *) & (padder->frame.sync_byte1);
- i = padder->ac3_frame_size / 2;
- while (i > 0) {
- *ptr = GUINT16_TO_BE (*ptr);
- ptr++;
- i--;
- }
-
- /* Start over again. */
- padder->state = AC3P_STATE_SYNC1;
-
- return AC3P_EVENT_FRAME;
- }
- break;
+ if (padder->bytes_to_copy > 0) {
+ /* Copy one byte. */
+ *(padder->out_ptr) = *(padder->in_ptr);
+ ac3p_in_fw (padder);
+ ac3p_out_fw (padder);
+ } else {
+ guint16 *ptr, i;
+
+ /* Frame ready. Prepare for output: */
+
+ /* Zero the non AC3 portion of the padded frame. */
+ memset (&(padder->frame.sync_byte1) + padder->ac3_frame_size, 0,
+ AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE -
+ padder->ac3_frame_size);
+
+ /* Fix the byte order in the AC3 portion: */
+ ptr = (guint16 *) & (padder->frame.sync_byte1);
+ i = padder->ac3_frame_size / 2;
+ while (i > 0) {
+ *ptr = GUINT16_TO_BE (*ptr);
+ ptr++;
+ i--;
+ }
+
+ /* Start over again. */
+ padder->state = AC3P_STATE_SYNC1;
+
+ return AC3P_EVENT_FRAME;
+ }
+ break;
}
}
diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c
index a1a7b8e6..558dcb0c 100644
--- a/sys/dxr3/dxr3audiosink.c
+++ b/sys/dxr3/dxr3audiosink.c
@@ -73,11 +73,11 @@ GST_STATIC_PAD_TEMPLATE ("pcm_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) { 32000, 44100, 48000, 66000 }, " "channels = (int) 2")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) { 32000, 44100, 48000, 66000 }, " "channels = (int) 2")
);
static GstStaticPadTemplate dxr3audiosink_ac3_sink_factory =
@@ -85,7 +85,7 @@ GST_STATIC_PAD_TEMPLATE ("ac3_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-ac3"
- /* no parameters needed, we don't need a parsed stream */
+ /* no parameters needed, we don't need a parsed stream */
)
);
@@ -143,8 +143,9 @@ dxr3audiosink_get_type (void)
0,
(GInstanceInitFunc) dxr3audiosink_init,
};
+
dxr3audiosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3AudioSink", &dxr3audiosink_info, 0);
+ "Dxr3AudioSink", &dxr3audiosink_info, 0);
}
return dxr3audiosink_type;
@@ -184,7 +185,7 @@ dxr3audiosink_class_init (Dxr3AudioSinkClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DIGITAL_PCM,
g_param_spec_boolean ("digital-pcm", "Digital PCM",
- "Use the digital output for PCM sound", FALSE, G_PARAM_READWRITE));
+ "Use the digital output for PCM sound", FALSE, G_PARAM_READWRITE));
gobject_class->set_property = dxr3audiosink_set_property;
gobject_class->get_property = dxr3audiosink_get_property;
@@ -249,7 +250,7 @@ dxr3audiosink_set_property (GObject * object, guint prop_id,
sink->digital_pcm = g_value_get_boolean (value);
/* Refresh the setup of the device. */
if (sink->mode == DXR3AUDIOSINK_MODE_PCM) {
- dxr3audiosink_set_mode_pcm (sink);
+ dxr3audiosink_set_mode_pcm (sink);
}
g_object_notify (G_OBJECT (sink), "digital-pcm");
break;
@@ -294,8 +295,8 @@ dxr3audiosink_open (Dxr3AudioSink * sink)
sink->audio_fd = open (sink->audio_filename, O_WRONLY);
if (sink->audio_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open audio device \"%s\" for writing."),
- sink->audio_filename), GST_ERROR_SYSTEM);
+ (_("Could not open audio device \"%s\" for writing."),
+ sink->audio_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -306,8 +307,8 @@ dxr3audiosink_open (Dxr3AudioSink * sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
+ (_("Could not open control device \"%s\" for writing."),
+ sink->control_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -339,8 +340,8 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink)
tmp = oss_mode;
if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != oss_mode) {
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not configure audio device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not configure audio device \"%s\"."), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return FALSE;
}
@@ -353,8 +354,8 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink)
tmp = sink->rate;
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
- sink->rate), GST_ERROR_SYSTEM);
+ (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
+ sink->rate), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -390,8 +391,8 @@ dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink)
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 ||
tmp != AC3_BYTE_RATE) {
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
- AC3_BYTE_RATE), GST_ERROR_SYSTEM);
+ (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
+ AC3_BYTE_RATE), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -418,15 +419,15 @@ dxr3audiosink_close (Dxr3AudioSink * sink)
if (close (sink->audio_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close audio device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close audio device \"%s\"."), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close control device \"%s\"."), sink->audio_filename),
+ GST_ERROR_SYSTEM);
return;
}
@@ -495,18 +496,18 @@ dxr3audiosink_handle_event (GstPad * pad, GstEvent * event)
switch (type) {
case GST_EVENT_FLUSH:
if (sink->control_fd >= 0) {
- unsigned audiomode;
-
- if (sink->mode == DXR3AUDIOSINK_MODE_AC3) {
- audiomode = EM8300_AUDIOMODE_DIGITALPCM;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
- audiomode = EM8300_AUDIOMODE_DIGITALAC3;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
- }
-
- /* Report the flush operation. */
- g_signal_emit (G_OBJECT (sink),
- dxr3audiosink_signals[SIGNAL_FLUSHED], 0);
+ unsigned audiomode;
+
+ if (sink->mode == DXR3AUDIOSINK_MODE_AC3) {
+ audiomode = EM8300_AUDIOMODE_DIGITALPCM;
+ ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
+ audiomode = EM8300_AUDIOMODE_DIGITALAC3;
+ ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
+ }
+
+ /* Report the flush operation. */
+ g_signal_emit (G_OBJECT (sink),
+ dxr3audiosink_signals[SIGNAL_FLUSHED], 0);
}
break;
default:
@@ -561,21 +562,21 @@ dxr3audiosink_chain_pcm (GstPad * pad, GstData * _data)
in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
diff = in > out ? in - out : out - in;
if (diff > 1800) {
- dxr3audiosink_set_scr (sink, in);
+ dxr3audiosink_set_scr (sink, in);
}
}
/* Update our SCR value. */
sink->scr += (unsigned) (GST_BUFFER_SIZE (buf) *
- (90000.0 / ((float) sink->rate * 4)));
+ (90000.0 / ((float) sink->rate * 4)));
/* Write the buffer to the sound device. */
bytes_written = write (sink->audio_fd, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ GST_BUFFER_SIZE (buf));
if (bytes_written < GST_BUFFER_SIZE (buf)) {
fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
- "written, only %d bytes written\n",
- GST_BUFFER_SIZE (buf), bytes_written);
+ "written, only %d bytes written\n",
+ GST_BUFFER_SIZE (buf), bytes_written);
}
}
@@ -627,40 +628,40 @@ dxr3audiosink_chain_ac3 (GstPad * pad, GstData * _data)
event = ac3p_parse (sink->padder);
while (event != AC3P_EVENT_PUSH) {
switch (event) {
- case AC3P_EVENT_FRAME:
- /* We have a new frame: */
+ case AC3P_EVENT_FRAME:
+ /* We have a new frame: */
- /* Update the system reference clock (SCR) in the card. */
- {
- unsigned in, out, odelay;
- unsigned diff;
+ /* Update the system reference clock (SCR) in the card. */
+ {
+ unsigned in, out, odelay;
+ unsigned diff;
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
+ ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
- ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
- /* 192000 bytes/sec */
+ ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
+ /* 192000 bytes/sec */
- in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
- diff = in > out ? in - out : out - in;
- if (diff > 1800) {
- dxr3audiosink_set_scr (sink, in);
- }
- }
+ in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
+ diff = in > out ? in - out : out - in;
+ if (diff > 1800) {
+ dxr3audiosink_set_scr (sink, in);
+ }
+ }
- /* Update our SCR value. */
- sink->scr += TIME_FOR_BYTES (ac3p_frame_size (sink->padder));
+ /* Update our SCR value. */
+ sink->scr += TIME_FOR_BYTES (ac3p_frame_size (sink->padder));
- /* Write the frame to the sound device. */
- bytes_written = write (sink->audio_fd, ac3p_frame (sink->padder),
- AC3P_IEC_FRAME_SIZE);
+ /* Write the frame to the sound device. */
+ bytes_written = write (sink->audio_fd, ac3p_frame (sink->padder),
+ AC3P_IEC_FRAME_SIZE);
- if (bytes_written < AC3P_IEC_FRAME_SIZE) {
- fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
- "written, only %d bytes written\n",
- AC3P_IEC_FRAME_SIZE, bytes_written);
- }
+ if (bytes_written < AC3P_IEC_FRAME_SIZE) {
+ fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
+ "written, only %d bytes written\n",
+ AC3P_IEC_FRAME_SIZE, bytes_written);
+ }
- break;
+ break;
}
event = ac3p_parse (sink->padder);
@@ -714,7 +715,7 @@ dxr3audiosink_change_state (GstElement * element)
} else {
if (!GST_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) {
if (!dxr3audiosink_open (DXR3AUDIOSINK (element))) {
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
}
diff --git a/sys/dxr3/dxr3init.c b/sys/dxr3/dxr3init.c
index d5bbd0f2..921d4f89 100644
--- a/sys/dxr3/dxr3init.c
+++ b/sys/dxr3/dxr3init.c
@@ -34,11 +34,11 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "dxr3videosink",
- GST_RANK_NONE, GST_TYPE_DXR3VIDEOSINK) ||
+ GST_RANK_NONE, GST_TYPE_DXR3VIDEOSINK) ||
!gst_element_register (plugin, "dxr3audiosink",
- GST_RANK_NONE, GST_TYPE_DXR3AUDIOSINK) ||
+ GST_RANK_NONE, GST_TYPE_DXR3AUDIOSINK) ||
!gst_element_register (plugin, "dxr3spusink",
- GST_RANK_NONE, GST_TYPE_DXR3SPUSINK))
+ GST_RANK_NONE, GST_TYPE_DXR3SPUSINK))
return FALSE;
#ifdef ENABLE_NLS
diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c
index 1652cdc6..0d7e6457 100644
--- a/sys/dxr3/dxr3spusink.c
+++ b/sys/dxr3/dxr3spusink.c
@@ -122,8 +122,9 @@ dxr3spusink_get_type (void)
0,
(GInstanceInitFunc) dxr3spusink_init,
};
+
dxr3spusink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3SpuSink", &dxr3spusink_info, 0);
+ "Dxr3SpuSink", &dxr3spusink_info, 0);
}
return dxr3spusink_type;
}
@@ -264,8 +265,8 @@ dxr3spusink_open (Dxr3SpuSink * sink)
sink->spu_fd = open (sink->spu_filename, O_WRONLY);
if (sink->spu_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open spu device \"%s\" for writing."),
- sink->spu_filename), GST_ERROR_SYSTEM);
+ (_("Could not open spu device \"%s\" for writing."),
+ sink->spu_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -276,8 +277,8 @@ dxr3spusink_open (Dxr3SpuSink * sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
+ (_("Could not open control device \"%s\" for writing."),
+ sink->control_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -294,15 +295,15 @@ dxr3spusink_close (Dxr3SpuSink * sink)
if (close (sink->spu_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close spu device \"%s\"."), sink->spu_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close spu device \"%s\"."), sink->spu_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->control_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close control device \"%s\"."), sink->control_filename),
+ GST_ERROR_SYSTEM);
return;
}
@@ -335,19 +336,19 @@ dxr3spusink_handle_event (GstPad * pad, GstEvent * event)
switch (type) {
case GST_EVENT_FLUSH:
if (sink->control_fd >= 0) {
- int subdevice;
+ int subdevice;
- subdevice = EM8300_SUBDEVICE_SUBPICTURE;
- ioctl (sink->control_fd, EM8300_IOCTL_FLUSH, &subdevice);
+ subdevice = EM8300_SUBDEVICE_SUBPICTURE;
+ ioctl (sink->control_fd, EM8300_IOCTL_FLUSH, &subdevice);
- /* FIXME: There should be a nicer way to do this, but I tried
- everything and nothing else seems to really reset the video
- fifo. */
+ /* FIXME: There should be a nicer way to do this, but I tried
+ everything and nothing else seems to really reset the video
+ fifo. */
/* dxr3spusink_close (sink); */
/* dxr3spusink_open (sink); */
- /* Report the flush operation. */
- g_signal_emit (G_OBJECT (sink), dxr3spusink_signals[SIGNAL_FLUSHED], 0);
+ /* Report the flush operation. */
+ g_signal_emit (G_OBJECT (sink), dxr3spusink_signals[SIGNAL_FLUSHED], 0);
}
break;
default:
@@ -387,10 +388,10 @@ dxr3spusink_chain (GstPad * pad, GstData * _data)
}
bytes_written = write (sink->spu_fd, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ GST_BUFFER_SIZE (buf));
if (bytes_written < GST_BUFFER_SIZE (buf)) {
fprintf (stderr, "dxr3spusink: Warning: %d bytes should be written,"
- " only %d bytes written\n", GST_BUFFER_SIZE (buf), bytes_written);
+ " only %d bytes written\n", GST_BUFFER_SIZE (buf), bytes_written);
}
}
@@ -406,9 +407,9 @@ dxr3spusink_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!GST_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) {
- if (!dxr3spusink_open (DXR3SPUSINK (element))) {
- return GST_STATE_FAILURE;
- }
+ if (!dxr3spusink_open (DXR3SPUSINK (element))) {
+ return GST_STATE_FAILURE;
+ }
}
break;
case GST_STATE_READY_TO_PAUSED:
@@ -421,7 +422,7 @@ dxr3spusink_change_state (GstElement * element)
break;
case GST_STATE_READY_TO_NULL:
if (GST_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) {
- dxr3spusink_close (DXR3SPUSINK (element));
+ dxr3spusink_close (DXR3SPUSINK (element));
}
break;
}
@@ -470,7 +471,7 @@ dxr3spusink_set_clut (Dxr3SpuSink * sink, const guint32 * clut)
if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_SETPALETTE, clut_fixed))
fprintf (stderr, "dxr3spusink: failed to set CLUT (%s)\n",
- strerror (errno));
+ strerror (errno));
}
@@ -489,7 +490,7 @@ dxr3spusink_highlight_on (Dxr3SpuSink * sink, unsigned palette,
if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, &btn)) {
fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n",
- strerror (errno));
+ strerror (errno));
}
}
@@ -499,7 +500,7 @@ dxr3spusink_highlight_off (Dxr3SpuSink * sink)
{
if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, NULL)) {
fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n",
- strerror (errno));
+ strerror (errno));
}
}
diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c
index 616c12f3..80805913 100644
--- a/sys/dxr3/dxr3videosink.c
+++ b/sys/dxr3/dxr3videosink.c
@@ -63,18 +63,18 @@ enum
/* Possible states for the MPEG start code scanner. */
enum
{
- SCAN_STATE_WAITING, /* Waiting for a code. */
- SCAN_STATE_0, /* 0 seen. */
- SCAN_STATE_00, /* 00 seen. */
- SCAN_STATE_001 /* 001 seen. */
+ SCAN_STATE_WAITING, /* Waiting for a code. */
+ SCAN_STATE_0, /* 0 seen. */
+ SCAN_STATE_00, /* 00 seen. */
+ SCAN_STATE_001 /* 001 seen. */
};
/* Possible states for the MPEG sequence parser. */
enum
{
- PARSE_STATE_WAITING, /* Waiting for the start of a sequence. */
- PARSE_STATE_START, /* Start of sequence seen. */
- PARSE_STATE_PICTURE, /* Picture start seen. */
+ PARSE_STATE_WAITING, /* Waiting for the start of a sequence. */
+ PARSE_STATE_START, /* Start of sequence seen. */
+ PARSE_STATE_PICTURE, /* Picture start seen. */
};
@@ -88,9 +88,9 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) FALSE"
- /* width/height/framerate omitted, we don't
- * need a parsed stream */
+ "mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) FALSE"
+ /* width/height/framerate omitted, we don't
+ * need a parsed stream */
)
);
@@ -146,8 +146,9 @@ dxr3videosink_get_type (void)
0,
(GInstanceInitFunc) dxr3videosink_init,
};
+
dxr3videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3VideoSink", &dxr3videosink_info, 0);
+ "Dxr3VideoSink", &dxr3videosink_info, 0);
}
return dxr3videosink_type;
@@ -267,8 +268,8 @@ dxr3videosink_open (Dxr3VideoSink * sink)
sink->video_fd = open (sink->video_filename, O_WRONLY);
if (sink->video_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open video device \"%s\" for writing."),
- sink->video_filename), GST_ERROR_SYSTEM);
+ (_("Could not open video device \"%s\" for writing."),
+ sink->video_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -279,8 +280,8 @@ dxr3videosink_open (Dxr3VideoSink * sink)
sink->control_fd = open (sink->control_filename, O_WRONLY);
if (sink->control_fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
+ (_("Could not open control device \"%s\" for writing."),
+ sink->control_filename), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -297,15 +298,15 @@ dxr3videosink_close (Dxr3VideoSink * sink)
if (close (sink->video_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close video device \"%s\"."), sink->video_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close video device \"%s\"."), sink->video_filename),
+ GST_ERROR_SYSTEM);
return;
}
if (close (sink->control_fd) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->control_filename),
- GST_ERROR_SYSTEM);
+ (_("Could not close control device \"%s\"."), sink->control_filename),
+ GST_ERROR_SYSTEM);
return;
}
@@ -353,28 +354,28 @@ dxr3videosink_next_start_code (Dxr3VideoSink * sink)
switch (sink->scan_state) {
case SCAN_STATE_WAITING:
- if (c == 0x00) {
- sink->scan_state = SCAN_STATE_0;
- }
- break;
+ if (c == 0x00) {
+ sink->scan_state = SCAN_STATE_0;
+ }
+ break;
case SCAN_STATE_0:
- if (c == 0x00) {
- sink->scan_state = SCAN_STATE_00;
- } else {
- sink->scan_state = SCAN_STATE_WAITING;
- }
- break;
+ if (c == 0x00) {
+ sink->scan_state = SCAN_STATE_00;
+ } else {
+ sink->scan_state = SCAN_STATE_WAITING;
+ }
+ break;
case SCAN_STATE_00:
- if (c == 0x01) {
- sink->scan_state = SCAN_STATE_001;
- } else if (c != 0x00) {
- sink->scan_state = SCAN_STATE_WAITING;
- }
- break;
+ if (c == 0x01) {
+ sink->scan_state = SCAN_STATE_001;
+ } else if (c != 0x00) {
+ sink->scan_state = SCAN_STATE_WAITING;
+ }
+ break;
case SCAN_STATE_001:
- sink->scan_pos++;
- sink->scan_state = SCAN_STATE_WAITING;
- return c;
+ sink->scan_pos++;
+ sink->scan_state = SCAN_STATE_WAITING;
+ return c;
}
sink->scan_pos++;
@@ -402,8 +403,8 @@ dxr3videosink_discard_data (Dxr3VideoSink * sink, guint cut)
sink->cur_buf = NULL;
} else {
sub = gst_buffer_create_sub (sink->cur_buf, size,
- GST_BUFFER_SIZE (sink->cur_buf)
- - size);
+ GST_BUFFER_SIZE (sink->cur_buf)
+ - size);
gst_buffer_unref (sink->cur_buf);
sink->cur_buf = sub;
}
@@ -448,10 +449,10 @@ dxr3videosink_write_data (Dxr3VideoSink * sink, guint cut)
while (size > 0) {
written = write (sink->video_fd, data, size);
if (written < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
- (_("Could not write to device \"%s\"."), sink->video_filename),
- GST_ERROR_SYSTEM);
- break;
+ GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
+ (_("Could not write to device \"%s\"."), sink->video_filename),
+ GST_ERROR_SYSTEM);
+ break;
}
size = size - written;
data = data + written;
@@ -476,45 +477,45 @@ dxr3videosink_parse_data (Dxr3VideoSink * sink)
switch (sink->parse_state) {
case PARSE_STATE_WAITING:
- if (code == START_CODE_SEQUENCE_HEADER) {
- dxr3videosink_discard_data (sink, 4);
- sink->parse_state = PARSE_STATE_START;
- sink->cur_ts = sink->last_ts;
- }
- break;
+ if (code == START_CODE_SEQUENCE_HEADER) {
+ dxr3videosink_discard_data (sink, 4);
+ sink->parse_state = PARSE_STATE_START;
+ sink->cur_ts = sink->last_ts;
+ }
+ break;
case PARSE_STATE_START:
- switch (code) {
- case START_CODE_SEQUENCE_HEADER:
- dxr3videosink_discard_data (sink, 4);
- sink->cur_ts = sink->last_ts;
- break;
- case START_CODE_SEQUENCE_END:
- dxr3videosink_discard_data (sink, 0);
- sink->parse_state = PARSE_STATE_WAITING;
- break;
- case START_CODE_PICTURE:
- sink->parse_state = PARSE_STATE_PICTURE;
- break;
- }
- break;
+ switch (code) {
+ case START_CODE_SEQUENCE_HEADER:
+ dxr3videosink_discard_data (sink, 4);
+ sink->cur_ts = sink->last_ts;
+ break;
+ case START_CODE_SEQUENCE_END:
+ dxr3videosink_discard_data (sink, 0);
+ sink->parse_state = PARSE_STATE_WAITING;
+ break;
+ case START_CODE_PICTURE:
+ sink->parse_state = PARSE_STATE_PICTURE;
+ break;
+ }
+ break;
case PARSE_STATE_PICTURE:
- switch (code) {
- case START_CODE_SEQUENCE_HEADER:
- dxr3videosink_write_data (sink, 4);
- sink->parse_state = PARSE_STATE_START;
- sink->cur_ts = sink->last_ts;
- break;
- case START_CODE_SEQUENCE_END:
- dxr3videosink_write_data (sink, 0);
- sink->parse_state = PARSE_STATE_WAITING;
- break;
- case START_CODE_PICTURE:
- dxr3videosink_write_data (sink, 4);
- break;
- }
- break;
+ switch (code) {
+ case START_CODE_SEQUENCE_HEADER:
+ dxr3videosink_write_data (sink, 4);
+ sink->parse_state = PARSE_STATE_START;
+ sink->cur_ts = sink->last_ts;
+ break;
+ case START_CODE_SEQUENCE_END:
+ dxr3videosink_write_data (sink, 0);
+ sink->parse_state = PARSE_STATE_WAITING;
+ break;
+ case START_CODE_PICTURE:
+ dxr3videosink_write_data (sink, 4);
+ break;
+ }
+ break;
}
@@ -548,7 +549,7 @@ dxr3videosink_handle_event (GstPad * pad, GstEvent * event)
static guint8 sec[4] = { 0x00, 0x00, 0x01, 0xb7 };
if (sink->cur_buf != NULL) {
- dxr3videosink_write_data (sink, 0);
+ dxr3videosink_write_data (sink, 0);
}
write (sink->video_fd, &sec, 4);
@@ -567,19 +568,19 @@ dxr3videosink_handle_event (GstPad * pad, GstEvent * event)
/* fprintf (stderr, "^^^^^^ Discontinuous event has time %.4f\n", */
/* (double) time / GST_SECOND); */
- /* If the SCR in the card is way off, fix it. */
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &cur_scr);
- mpeg_scr = MPEGTIME_TO_DXRTIME (GSTTIME_TO_MPEGTIME (time));
+ /* If the SCR in the card is way off, fix it. */
+ ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &cur_scr);
+ mpeg_scr = MPEGTIME_TO_DXRTIME (GSTTIME_TO_MPEGTIME (time));
- diff = cur_scr > mpeg_scr ? cur_scr - mpeg_scr : mpeg_scr - cur_scr;
- if (diff > 1800) {
- unsigned zero = 0;
+ diff = cur_scr > mpeg_scr ? cur_scr - mpeg_scr : mpeg_scr - cur_scr;
+ if (diff > 1800) {
+ unsigned zero = 0;
/* fprintf (stderr, "====== Adjusting SCR from video\n"); */
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero);
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &mpeg_scr);
- }
+ ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero);
+ ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &mpeg_scr);
+ }
} else {
/* fprintf (stderr, "^^^^^^ Discontinuous event has no time\n"); */
}
@@ -642,9 +643,9 @@ dxr3videosink_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!GST_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) {
- if (!dxr3videosink_open (DXR3VIDEOSINK (element))) {
- return GST_STATE_FAILURE;
- }
+ if (!dxr3videosink_open (DXR3VIDEOSINK (element))) {
+ return GST_STATE_FAILURE;
+ }
}
break;
case GST_STATE_READY_TO_PAUSED:
@@ -661,7 +662,7 @@ dxr3videosink_change_state (GstElement * element)
break;
case GST_STATE_READY_TO_NULL:
if (GST_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) {
- dxr3videosink_close (DXR3VIDEOSINK (element));
+ dxr3videosink_close (DXR3VIDEOSINK (element));
}
break;
}