rb_raise (eVTError, "vcedit_new_state() failed - %s",
vcedit_error (o->state));
+ if (vcedit_open (o->state) < 0)
+ rb_raise (eVTError, "vcedit_open() failed - %s",
+ vcedit_error (o->state));
+
vc = vcedit_comments (o->state);
if (!vc)
rb_raise (eVTError, "vcedit_comments() failed - %s",
#define CHUNKSIZE 4096
-static int vcedit_open (vcedit_state *state);
-
struct vcedit_state_St {
int refcount;
snprintf (state->filename, sizeof (state->filename),
"%s", filename);
- state->in = fopen (state->filename, "rb");
-
- if (vcedit_open (state) < 0) {
- vcedit_state_free (state);
- return NULL;
- }
-
return state;
}
return _fetch_next_packet (s, p, page);
}
-static int
+int
vcedit_open (vcedit_state *state)
{
char *buffer;
ogg_packet header_main, header_comments, header_codebooks;
ogg_page og;
+ state->in = fopen (state->filename, "rb");
+ if (!state->in) {
+ state->lasterror = "Cannot open file.";
+ return -1;
+ }
+
ogg_sync_init (state->oy);
while (1) {
}
vcedit_clear_internals (state);
-
- state->in = fopen (state->filename, "rb");
vcedit_open (state);
return 0;
void vcedit_state_ref (vcedit_state *state);
void vcedit_state_unref (vcedit_state *state);
vorbis_comment *vcedit_comments (vcedit_state *state);
+int vcedit_open (vcedit_state *state);
int vcedit_write (vcedit_state *state);
const char *vcedit_error (vcedit_state *state);