[MPlayer-cvslog] r36429 - trunk/libaf/af_lavcac3enc.c
reimar
subversion at mplayerhq.hu
Sun Aug 25 13:30:42 CEST 2013
Author: reimar
Date: Sun Aug 25 13:30:42 2013
New Revision: 36429
Log:
lavcac3enc: avoid code duplication.
Modified:
trunk/libaf/af_lavcac3enc.c
Modified: trunk/libaf/af_lavcac3enc.c
==============================================================================
--- trunk/libaf/af_lavcac3enc.c Wed Aug 21 20:08:37 2013 (r36428)
+++ trunk/libaf/af_lavcac3enc.c Sun Aug 25 13:30:42 2013 (r36429)
@@ -202,6 +202,7 @@ static af_data_t* play(struct af_instanc
while (left > 0) {
+ void *in = NULL;
if (left + s->pending_len < s->expect_len) {
memcpy(s->pending_data + s->pending_len, src, left);
src += left;
@@ -220,29 +221,21 @@ static af_data_t* play(struct af_instanc
src += needs;
left -= needs;
}
-
- if (c->nch >= 5)
- reorder_channel_nch(s->pending_data,
- AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
- AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
- c->nch,
- s->expect_len / 2, 2);
-
- len = avcodec_encode_audio(s->lavc_actx, dest, destsize,
- (void *)s->pending_data);
+ in = s->pending_data;
s->pending_len = 0;
}
else {
- if (c->nch >= 5)
- reorder_channel_nch(src,
- AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
- AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
- c->nch,
- s->expect_len / 2, 2);
- len = avcodec_encode_audio(s->lavc_actx,dest,destsize,(void *)src);
+ in = src;
src += s->expect_len;
left -= s->expect_len;
}
+ if (c->nch >= 5)
+ reorder_channel_nch(in,
+ AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
+ AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
+ c->nch,
+ s->expect_len / 2, 2);
+ len = avcodec_encode_audio(s->lavc_actx, dest, destsize, in);
mp_msg(MSGT_AFILTER, MSGL_DBG2, "avcodec_encode_audio got %d, pending %d.\n",
len, s->pending_len);
More information about the MPlayer-cvslog
mailing list