[FFmpeg-devel] [PATCH] MPEG PS consider other audio tracks when muxing

Yuriy Kaminskiy yumkam
Sat May 16 17:03:01 CEST 2009


Baptiste Coudurier wrote:
>>> -    if (s->is_vcd && only_for_stream_id==AUDIO_ID) {
>>> +    if (s->is_vcd && only_for_stream_id & 0xc000 == 0xc000) {
>> AUDIO_ID is 0xc0 not 0xc000
> 
> I must have been high :)
And still are.
> Here is a better patch.
Tiny bit at most.
>  
> -    if (s->is_vcd && only_for_stream_id==AUDIO_ID) {
> +    if (s->is_vcd && only_for_stream_id & 0xc0 == AUDIO_ID) {
(A&B==C) equal to (A&(B==C)); not ((A&B)==C) (as you expected).
I.e. this one is equal to ... && (only_for_stream_id & 1)).
[I personally never try to remember what is relative precedence between 
  normal ops vs. bitwise ops, always use parenthesis[*] and you will be 
ok, otherwise code would be hard to read and prone to errors]
FWIW, `gcc -Wall` would warn about this code.

[*] with exception of obvious cases - && vs ||, + vs *, etc;
but with bitwise ops and shift ALWAYS use parenthesis.




More information about the ffmpeg-devel mailing list