]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - ogg_afh_common.c
Prefix public functions of ogg_afh_common.c with "oac".
[paraslash.git] / ogg_afh_common.c
index e49b803b4e7a0e6492161d7be5c2b2fa21a16a09..fd0c86ccd37925f6d09942bd82a0c7c0d7ebeeed 100644 (file)
@@ -19,7 +19,7 @@
 /* Taken from decoder_example.c of libvorbis-1.2.3. */
 static int process_packets_2_and_3(ogg_sync_state *oss,
                ogg_stream_state *stream, struct afh_info *afhi,
-               struct ogg_afh_callback_info *ci)
+               struct oac_callback_info *ci)
 {
        ogg_page page;
        ogg_packet packet;
@@ -60,7 +60,7 @@ static int process_packets_2_and_3(ogg_sync_state *oss,
 }
 
 static int process_ogg_packets(ogg_sync_state *oss, struct afh_info *afhi,
-               struct ogg_afh_callback_info *ci)
+               struct oac_callback_info *ci)
 {
        ogg_packet packet;
        ogg_stream_state stream;
@@ -122,24 +122,23 @@ static void set_chunk_tv(int frames_per_chunk, int frequency,
  *
  * \return Standard.
  */
-int ogg_get_file_info(char *map, size_t numbytes, struct afh_info *afhi,
-               struct ogg_afh_callback_info *ci)
+int oac_get_file_info(char *map, size_t numbytes, struct afh_info *afhi,
+               struct oac_callback_info *ci)
 {
        ogg_sync_state oss;
        ogg_page op;
-       long len = numbytes;
        char *buf;
        int ret, i, j, frames_per_chunk, ct_size;
        long long unsigned num_frames = 0;
 
        ogg_sync_init(&oss);
        ret = -E_OGG_SYNC;
-       buf = ogg_sync_buffer(&oss, len);
+       buf = ogg_sync_buffer(&oss, numbytes);
        if (!buf)
                goto out;
-       memcpy(buf, map, len);
+       memcpy(buf, map, numbytes);
        ret = -E_OGG_SYNC;
-       if (ogg_sync_wrote(&oss, len) < 0)
+       if (ogg_sync_wrote(&oss, numbytes) < 0)
                goto out;
        ret = process_ogg_packets(&oss, afhi, ci);
        if (ret < 0)
@@ -182,6 +181,7 @@ int ogg_get_file_info(char *map, size_t numbytes, struct afh_info *afhi,
                }
        }
        afhi->chunks_total = j;
+       set_max_chunk_size(afhi);
        set_chunk_tv(frames_per_chunk, afhi->frequency, &afhi->chunk_tv);
        ret = 0;
 out:
@@ -193,7 +193,7 @@ static int write_ogg_page(int fd, const ogg_page *op)
 {
        int ret;
 
-       PARA_DEBUG_LOG("header/body: %lu/%lu\n", op->header_len, op->body_len);
+       PARA_DEBUG_LOG("header/body: %li/%li\n", op->header_len, op->body_len);
        ret = xwrite(fd, (const char *)op->header, op->header_len);
        if (ret < 0)
                return ret;
@@ -216,7 +216,7 @@ static int write_ogg_page(int fd, const ogg_page *op)
  *
  * \return Standard.
  */
-int ogg_rewrite_tags(const char *map, size_t map_sz, int fd,
+int oac_rewrite_tags(const char *map, size_t map_sz, int fd,
                char *meta_packet, size_t meta_sz)
 {
        ogg_sync_state oss_in, oss_out;
@@ -288,7 +288,7 @@ int ogg_rewrite_tags(const char *map, size_t map_sz, int fd,
                                goto out;
                        continue;
                }
-               PARA_DEBUG_LOG("packet: bytes: %d, granule: %d, packetno: %u\n",
+               PARA_DEBUG_LOG("packet: bytes: %d, granule: %d, packetno: %d\n",
                        (int)packet.bytes, (int)packet.granulepos,
                        (int)packet.packetno);
                /* ignore meta data packet which we replaced */
@@ -309,7 +309,7 @@ int ogg_rewrite_tags(const char *map, size_t map_sz, int fd,
 #endif
                        if (ret <= 0)
                                break;
-                       PARA_DEBUG_LOG("writing page (%lu bytes)\n",
+                       PARA_DEBUG_LOG("writing page (%li bytes)\n",
                                op.header_len + op.body_len);
                        ret = write_ogg_page(fd, &op);
                        if (ret < 0)