changeset 3135:41a01cea8885 libavcodec

explain extradata and pass avctx to av_log's
author alex
date Tue, 21 Feb 2006 00:03:10 +0000
parents 03af25454cc3
children ddf6d81a6369
files alac.c
diffstat 1 files changed, 29 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/alac.c	Mon Feb 20 23:22:02 2006 +0000
+++ b/alac.c	Tue Feb 21 00:03:10 2006 +0000
@@ -32,6 +32,22 @@
  *  bytes 0-3   atom size (0x24), big-endian
  *  bytes 4-7   atom type ('alac', not the 'alac' tag from start of stsd)
  *  bytes 8-35  data bytes needed by decoder
+ *
+ * Extradata:
+ * 32bit  size
+ * 32bit  tag (=alac)
+ * 32bit  zero?
+ * 32bit  max sample per frame
+ *  8bit  ?? (zero?)
+ *  8bit  sample size
+ *  8bit  history mult
+ *  8bit  initial history
+ *  8bit  kmodifier
+ *  8bit  channels?
+ * 16bit  ??
+ * 32bit  max coded frame size
+ * 32bit  bitrate?
+ * 32bit  samplerate
  */
 
 
@@ -99,14 +115,14 @@
     alac->setinfo_rice_historymult = *ptr++;
     alac->setinfo_rice_initialhistory = *ptr++;
     alac->setinfo_rice_kmodifier = *ptr++;
-    alac->setinfo_7f = *ptr++;
+    alac->setinfo_7f = *ptr++; // channels?
     alac->setinfo_80 = BE_16(ptr);
     ptr += 2;
-    alac->setinfo_82 = BE_32(ptr);
+    alac->setinfo_82 = BE_32(ptr); // max coded frame size
     ptr += 4;
-    alac->setinfo_86 = BE_32(ptr);
+    alac->setinfo_86 = BE_32(ptr); // bitrate ?
     ptr += 4;
-    alac->setinfo_8a_rate = BE_32(ptr);
+    alac->setinfo_8a_rate = BE_32(ptr); // samplerate
     ptr += 4;
 
     allocate_buffers(alac);
@@ -444,7 +460,7 @@
     /* initialize from the extradata */
     if (!alac->context_initialized) {
         if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
-            av_log(NULL, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
+            av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
                 ALAC_EXTRADATA_SIZE);
             return input_buffer_size;
         }
@@ -500,7 +516,7 @@
             int prediction_quantitization;
             int i;
 
-            /* skip 16 bits, not sure what they are. seem to be used in
+            /* FIXME: skip 16 bits, not sure what they are. seem to be used in
              * two channel case */
             get_bits(&alac->gb, 8);
             get_bits(&alac->gb, 8);
@@ -520,7 +536,7 @@
                 /* these bytes seem to have something to do with
                  * > 2 channel files.
                  */
-                av_log(NULL, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
+                av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
             }
 
             bastardized_rice_decompress(alac,
@@ -542,7 +558,7 @@
                                                predictor_coef_num,
                                                prediction_quantitization);
             } else {
-                av_log(NULL, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type);
+                av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type);
                 /* i think the only other prediction type (or perhaps this is just a
                  * boolean?) runs adaptive fir twice.. like:
                  * predictor_decompress_fir_adapt(predictor_error, tempout, ...)
@@ -594,7 +610,7 @@
         case 20:
         case 24:
         case 32:
-            av_log(NULL, AV_LOG_ERROR, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
+            av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
             break;
         default:
             break;
@@ -679,7 +695,7 @@
             /*********************/
             if (wasted_bytes) {
               /* see mono case */
-                av_log(NULL, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
+                av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
             }
 
             /* channel 1 */
@@ -703,7 +719,7 @@
                                                prediction_quantitization_a);
             } else {
               /* see mono case */
-                av_log(NULL, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type_a);
+                av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type_a);
             }
 
             /* channel 2 */
@@ -726,7 +742,7 @@
                                                predictor_coef_num_b,
                                                prediction_quantitization_b);
             } else {
-                av_log(NULL, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type_b);
+                av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type_b);
             }
         } else {
          /* not compressed, easy case */
@@ -782,7 +798,7 @@
         case 20:
         case 24:
         case 32:
-            av_log(NULL, AV_LOG_ERROR, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
+            av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
             break;
         default:
             break;