Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-19 Thread Justin Ruggles
On 12/16/2012 11:13 AM, Justin Ruggles wrote:
 Fixes Bug 402
 ---
 Forgot to set avctx-channels before calling ff_flac_set_channel_layout()
 in the parser.
 
  libavcodec/flac_parser.c |6 +-
  libavcodec/flacdec.c |3 ++-
  2 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
 index f0a37f3..003fb47 100644
 --- a/libavcodec/flac_parser.c
 +++ b/libavcodec/flac_parser.c
 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
  check_header_mismatch(fpc, header, child, 0);
  }
  
 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
  fpc-avctx-sample_rate = header-fi.samplerate;
  fpc-avctx-channels= header-fi.channels;
 -ff_flac_set_channel_layout(fpc-avctx);
  fpc-pc-duration   = header-fi.blocksize;
  *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
  fpc-wrap_buf,
 diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
 index fd47929..51fd196 100644
 --- a/libavcodec/flacdec.c
 +++ b/libavcodec/flacdec.c
 @@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
  return ret;
  }
  s-channels = s-avctx-channels = fi.channels;
 -ff_flac_set_channel_layout(s-avctx);
 +if (!s-avctx-channel_layout  s-channels = 6)
 +ff_flac_set_channel_layout(s-avctx);
  s-ch_mode = fi.ch_mode;
  
  if (!s-bps  !fi.bps) {

ping

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-19 Thread Anton Khirnov

On Sun, 16 Dec 2012 11:13:21 -0500, Justin Ruggles justin.rugg...@gmail.com 
wrote:
 Fixes Bug 402
 ---
 Forgot to set avctx-channels before calling ff_flac_set_channel_layout()
 in the parser.
 
  libavcodec/flac_parser.c |6 +-
  libavcodec/flacdec.c |3 ++-
  2 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
 index f0a37f3..003fb47 100644
 --- a/libavcodec/flac_parser.c
 +++ b/libavcodec/flac_parser.c
 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
  check_header_mismatch(fpc, header, child, 0);
  }
  
 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
  fpc-avctx-sample_rate = header-fi.samplerate;
  fpc-avctx-channels= header-fi.channels;
 -ff_flac_set_channel_layout(fpc-avctx);
  fpc-pc-duration   = header-fi.blocksize;
  *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
  fpc-wrap_buf,
 diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
 index fd47929..51fd196 100644
 --- a/libavcodec/flacdec.c
 +++ b/libavcodec/flacdec.c
 @@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
  return ret;
  }
  s-channels = s-avctx-channels = fi.channels;
 -ff_flac_set_channel_layout(s-avctx);
 +if (!s-avctx-channel_layout  s-channels = 6)
 +ff_flac_set_channel_layout(s-avctx);
  s-ch_mode = fi.ch_mode;
  
  if (!s-bps  !fi.bps) {
 -- 
 1.7.1
 

Looks fine.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
Fixes Bug 402
---
 libavcodec/flac_parser.c |5 -
 libavcodec/flacdec.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index f0a37f3..eae0d8d 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -457,9 +457,12 @@ static int get_best_header(FLACParseContext* fpc, const 
uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
+if (header-fi.channels != fpc-avctx-channels ||
+(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
+ff_flac_set_channel_layout(fpc-avctx);
+}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
-ff_flac_set_channel_layout(fpc-avctx);
 fpc-pc-duration   = header-fi.blocksize;
 *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
 fpc-wrap_buf,
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index fd47929..51fd196 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
 return ret;
 }
 s-channels = s-avctx-channels = fi.channels;
-ff_flac_set_channel_layout(s-avctx);
+if (!s-avctx-channel_layout  s-channels = 6)
+ff_flac_set_channel_layout(s-avctx);
 s-ch_mode = fi.ch_mode;
 
 if (!s-bps  !fi.bps) {
-- 
1.7.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
Fixes Bug 402
---
Forgot to set avctx-channels before calling ff_flac_set_channel_layout()
in the parser.

 libavcodec/flac_parser.c |6 +-
 libavcodec/flacdec.c |3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index f0a37f3..003fb47 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
+if (header-fi.channels != fpc-avctx-channels ||
+(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
+fpc-avctx-channels = header-fi.channels;
+ff_flac_set_channel_layout(fpc-avctx);
+}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
-ff_flac_set_channel_layout(fpc-avctx);
 fpc-pc-duration   = header-fi.blocksize;
 *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
 fpc-wrap_buf,
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index fd47929..51fd196 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
 return ret;
 }
 s-channels = s-avctx-channels = fi.channels;
-ff_flac_set_channel_layout(s-avctx);
+if (!s-avctx-channel_layout  s-channels = 6)
+ff_flac_set_channel_layout(s-avctx);
 s-ch_mode = fi.ch_mode;
 
 if (!s-bps  !fi.bps) {
-- 
1.7.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Tim W.
On Dec 16, 2012, at 5:13 PM, Justin Ruggles justin.rugg...@gmail.com wrote:

 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;



fpc-avctx-channels = header-fi.channels;

…is being called twice. The second line could be removed?

Tim
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
On 12/16/2012 11:50 AM, Tim W. wrote:
 On Dec 16, 2012, at 5:13 PM, Justin Ruggles justin.rugg...@gmail.com wrote:
 
 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }

 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
 
 
 
 fpc-avctx-channels = header-fi.channels;
 
 …is being called twice. The second line could be removed?

yeah, it can be removed without changing behavior. fixed locally.

-Justin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel