if ((int)gotframesize <= incoming_paket_libav.size) {
if (gotframesize>0) incoming_paket_libav.size=gotframesize;
- // FIXME deprecated
+
+ // FIXME
+ // avcodec_decode_audio4 is deprecated
+ // DO_NOT_USE() works, but assumes all decoded data is returned
+ // in the first call to avcodec_receive_frame which is
+ // definitely bad code.
+ // This all needs reworking to handle this properly.
+ // Leaving DO_NOT_USE in the code in case we have to switch to it
len = avcodec_decode_audio4(current_context, decode_frame_libav,
&gotta, &incoming_paket_libav);
+
+ //len = DO_NOT_USE(current_context, decode_frame_libav,
+ // &gotta, &incoming_paket_libav);
+
} else {
//LogNT::getInstance()->debug(TAG, "FRAME:E {} {}",gotframesize,incoming_paket_libav.size);
gotta=0;
vw->ResetTimeOffsets();
}
-
+// FIXME
int AudioOMX::badMinimumFunction(u4 a, int b)
{
printf("MIN: P1: %u, P2: %i\n", a, b);
if (a > b) return b;
else return a;
}
+
+int AudioOMX::DO_NOT_USE(AVCodecContext* avctx, // used - sent to avcodec_send_packet
+ AVFrame* frame, // used - object for receive to write to
+ int* got_frame_ptr, // out param
+ const AVPacket* avpkt) // used - sent to avcodec_send_packet
+{
+ // Set this to error here. Any error point returns -9999 and *got_frame_ptr = 0
+ *got_frame_ptr = 0; // Replicate old API behaviour
+
+ int sendReturn = avcodec_send_packet(avctx, avpkt);
+ if (sendReturn < 0) return -9999; // error, shouldn't happen, just crash out.
+
+ // Don't use this code
+ // avcodec_receive_frame needs to be called multiple times
+ // to ensure reception of all decoded data
+ int recReturn = avcodec_receive_frame(avctx, frame);
+ if (recReturn == 0) // success
+ {
+ // set got_frame_ptr to 1, this is the old behaviour
+ *got_frame_ptr = 1;
+ // return number of bytes consumed
+ // guessing here that the calling code only ever supplies whole packets
+ return avpkt->size;
+ }
+
+ // error
+ return -9999; // no idea. looks like calling code checks got_frame_ptr
+}